From 53ffb2c13f78379e1c27d599485539ab07ed3661 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Tue, 16 Apr 2024 04:29:17 +0100 Subject: [PATCH 001/136] feat(test): setup jest testing environment --- e2e-tests/bun-e2e.test.ts | 18 + e2e-tests/jest-e2e.test.ts | 23 + e2e-tests/jest.config.ts | 11 + e2e-tests/setup/env-setup.ts | 64 + e2e-tests/setup/networkContext.example.json | 11268 ++++++++++++++++++ e2e-tests/tsconfig.json | 12 + package.json | 2 +- 7 files changed, 11397 insertions(+), 1 deletion(-) create mode 100644 e2e-tests/bun-e2e.test.ts create mode 100644 e2e-tests/jest-e2e.test.ts create mode 100644 e2e-tests/jest.config.ts create mode 100644 e2e-tests/setup/env-setup.ts create mode 100644 e2e-tests/setup/networkContext.example.json create mode 100644 e2e-tests/tsconfig.json diff --git a/e2e-tests/bun-e2e.test.ts b/e2e-tests/bun-e2e.test.ts new file mode 100644 index 0000000000..e5d05389a1 --- /dev/null +++ b/e2e-tests/bun-e2e.test.ts @@ -0,0 +1,18 @@ +// Test command: +// DEBUG=true bun test bun-e2e.test.ts --timeout 20000 + +import { expect, test } from 'bun:test'; +import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; + +// Test command +// DEBUG=true bun test bun-e2e.test.ts --timeout 20000 +test('test multiple networks', async () => { + for (let network of ['habanero', 'manzano', 'cayenne']) { + console.log(`Testing network: ${network}`); + const litDev: DevEnv = await devEnv({ + network: network as TESTABLE_NETWORK_TYPE, + }); + expect(litDev.litNodeClient.ready).toBe(true); + expect(litDev.litNodeClient.config.litNetwork).toBe(network); + } +}); diff --git a/e2e-tests/jest-e2e.test.ts b/e2e-tests/jest-e2e.test.ts new file mode 100644 index 0000000000..96c734b506 --- /dev/null +++ b/e2e-tests/jest-e2e.test.ts @@ -0,0 +1,23 @@ +// Test command +// yarn jest:e2e + +import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('connections', () => { + test('test multiple networks', async () => { + for (let network of ['habanero', 'manzano', 'cayenne']) { + console.log(`Testing network: ${network}`); + const litDev: DevEnv = await devEnv({ + network: network as TESTABLE_NETWORK_TYPE, + }); + expect(litDev.litNodeClient.ready).toBe(true); + expect(litDev.litNodeClient.config.litNetwork).toBe(network); + } + }); +}); diff --git a/e2e-tests/jest.config.ts b/e2e-tests/jest.config.ts new file mode 100644 index 0000000000..a9fe13eb3b --- /dev/null +++ b/e2e-tests/jest.config.ts @@ -0,0 +1,11 @@ +// import { getJestProjects } from '@nx/jest'; + +export default { + roots: [''], + transform: { + '^.+\\.tsx?$': 'ts-jest', + }, + testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + // maxWorkers: 1, +}; diff --git a/e2e-tests/setup/env-setup.ts b/e2e-tests/setup/env-setup.ts new file mode 100644 index 0000000000..0d7e6c53a9 --- /dev/null +++ b/e2e-tests/setup/env-setup.ts @@ -0,0 +1,64 @@ +import { log } from '@lit-protocol/misc'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import * as networkContextData from './networkContext.json'; + +let litNetwork = process.env.NETWORK as any; +const debug = process.env.DEBUG === 'true' ? true : false; + +export type TESTABLE_NETWORK_TYPE = + | 'habanero' + | 'manzano' + | 'cayenne' + | 'custom'; + +export interface DevEnv { + network: TESTABLE_NETWORK_TYPE; + litNodeClient: LitNodeClient; +} + +export const devEnv = async (params?: { + network?: TESTABLE_NETWORK_TYPE; +}): Promise => { + /** + * ==================================== + * Setting up Lit Node Client + * ==================================== + */ + log('πŸ§ͺ [env-setup.ts] Starting devEnv'); + let litNodeClient: LitNodeClient; + + litNetwork = params?.network || litNetwork; + + if (litNetwork === 'custom') { + litNodeClient = new LitNodeClient({ + litNetwork: 'custom', + bootstrapUrls: [ + 'http://127.0.0.1:7470', + 'http://127.0.0.1:7471', + 'http://127.0.0.1:7472', + ], + debug, + checkNodeAttestation: false, + networkContext: networkContextData, + }); + } else if (litNetwork === 'manzano' || litNetwork === 'habanero') { + litNodeClient = new LitNodeClient({ + litNetwork, + debug, + checkNodeAttestation: true, + }); + } else { + litNodeClient = new LitNodeClient({ + litNetwork: 'cayenne', + debug, + checkNodeAttestation: false, + }); + } + + await litNodeClient.connect(); + + return { + network: litNetwork, + litNodeClient, + }; +}; diff --git a/e2e-tests/setup/networkContext.example.json b/e2e-tests/setup/networkContext.example.json new file mode 100644 index 0000000000..307fd9f508 --- /dev/null +++ b/e2e-tests/setup/networkContext.example.json @@ -0,0 +1,11268 @@ +{ + "Allowlist": { + "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Allowlist" + }, + "LITToken": { + "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "LITToken" + }, + "Multisender": { + "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Multisender" + }, + "PKPHelper": { + "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPHelper" + }, + "PKPNFT": { + "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPNFT" + }, + "PKPNFTMetadata": { + "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPNFTMetadata" + }, + "PKPPermissions": { + "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPPermissions" + }, + "PubkeyRouter": { + "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PubkeyRouter" + }, + "RateLimitNFT": { + "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "RateLimitNFT" + }, + "Staking": { + "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newComplaintTolerance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newComplaintIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newComplaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newComplaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "Staking" + }, + "StakingBalances": { + "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "StakingBalances" + }, + "ContractResolver": { + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "abi": [ + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AdminRoleRequired", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "SetContract", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ALLOWLIST_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BACKUP_RECOVERY_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_WALLET_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HD_KEY_DERIVER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIT_TOKEN_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTI_SENDER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAYMENT_DELEGATION_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_HELPER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_METADATA_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_PERMISSIONS_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PUB_KEY_ROUTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_LIMIT_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELEASE_REGISTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_BALANCES_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "addAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "adminBeingRemoved", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "removeAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "name": "typeAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "ContractResolver" + } +} diff --git a/e2e-tests/tsconfig.json b/e2e-tests/tsconfig.json new file mode 100644 index 0000000000..1633228da3 --- /dev/null +++ b/e2e-tests/tsconfig.json @@ -0,0 +1,12 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": ["es6", "dom"], + "types": ["jest"], + "strict": true, + "resolveJsonModule": true, + "esModuleInterop": true + }, + "include": ["./**/*"] +} diff --git a/package.json b/package.json index 9da634f9a2..4160b85e69 100644 --- a/package.json +++ b/package.json @@ -121,7 +121,7 @@ "express": "^4.18.2", "ipfs-unixfs-importer": "12.0.1", "inquirer": "^9.2.21", - "jest": "27.5.1", + "jest": "29.7.0", "lerna": "^5.4.3", "live-server": "^1.2.2", "node-fetch": "^2.6.1", From 471b167aa0f6d8ed7932ab4c8521bbcfa2289e87 Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Tue, 16 Apr 2024 04:35:08 +0100 Subject: [PATCH 002/136] chore: update test command --- e2e-tests/jest-e2e.test.ts | 2 +- e2e-tests/setup/env-setup.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e-tests/jest-e2e.test.ts b/e2e-tests/jest-e2e.test.ts index 96c734b506..f897a793a2 100644 --- a/e2e-tests/jest-e2e.test.ts +++ b/e2e-tests/jest-e2e.test.ts @@ -1,5 +1,5 @@ // Test command -// yarn jest:e2e +// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; diff --git a/e2e-tests/setup/env-setup.ts b/e2e-tests/setup/env-setup.ts index 0d7e6c53a9..10c46df9f5 100644 --- a/e2e-tests/setup/env-setup.ts +++ b/e2e-tests/setup/env-setup.ts @@ -1,6 +1,6 @@ import { log } from '@lit-protocol/misc'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import * as networkContextData from './networkContext.json'; +import * as networkContextData from './networkContext.example.json'; let litNetwork = process.env.NETWORK as any; const debug = process.env.DEBUG === 'true' ? true : false; From 40b54bb75aaca488bdecf75abd550cf2602670ba Mon Sep 17 00:00:00 2001 From: Ansonhkg Date: Tue, 16 Apr 2024 04:45:11 +0100 Subject: [PATCH 003/136] chore: prettified --- e2e-tests/jest-e2e.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e-tests/jest-e2e.test.ts b/e2e-tests/jest-e2e.test.ts index f897a793a2..09d2063509 100644 --- a/e2e-tests/jest-e2e.test.ts +++ b/e2e-tests/jest-e2e.test.ts @@ -1,5 +1,5 @@ // Test command -// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' +// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; From 73111bd29590ccd4b65a1550ded2a57dcf875d29 Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 25 Apr 2024 22:40:36 +0100 Subject: [PATCH 004/136] fix(e2e-tests): Use Jest for example e2e tests, using `runInBand` configuration in `project.json` --- README.md | 1 + e2e-tests/bun-e2e.test.ts | 18 - e2e-tests/jest.config.ts | 11 - e2e-tests/tsconfig.json | 12 - packages/e2e-tests/jest.config.ts | 11 + packages/e2e-tests/package.json | 23 + packages/e2e-tests/project.json | 45 + .../e2e-tests/src}/setup/env-setup.ts | 4 +- .../src}/setup/networkContext.example.json | 0 .../e2e-tests/src/tests/jest-e2e-2.spec.ts | 2 +- packages/e2e-tests/src/tests/jest-e2e.spec.ts | 23 + packages/e2e-tests/tsconfig.json | 22 + packages/e2e-tests/tsconfig.lib.json | 10 + packages/e2e-tests/tsconfig.spec.json | 9 + yarn.lock | 805 +++--------------- 15 files changed, 267 insertions(+), 729 deletions(-) delete mode 100644 e2e-tests/bun-e2e.test.ts delete mode 100644 e2e-tests/jest.config.ts delete mode 100644 e2e-tests/tsconfig.json create mode 100644 packages/e2e-tests/jest.config.ts create mode 100644 packages/e2e-tests/package.json create mode 100644 packages/e2e-tests/project.json rename {e2e-tests => packages/e2e-tests/src}/setup/env-setup.ts (92%) rename {e2e-tests => packages/e2e-tests/src}/setup/networkContext.example.json (100%) rename e2e-tests/jest-e2e.test.ts => packages/e2e-tests/src/tests/jest-e2e-2.spec.ts (89%) create mode 100644 packages/e2e-tests/src/tests/jest-e2e.spec.ts create mode 100644 packages/e2e-tests/tsconfig.json create mode 100644 packages/e2e-tests/tsconfig.lib.json create mode 100644 packages/e2e-tests/tsconfig.spec.json diff --git a/README.md b/README.md index 2a214e4ade..bb95b67bde 100644 --- a/README.md +++ b/README.md @@ -66,6 +66,7 @@ If you're a tech-savvy user and wish to utilize only specific submodules that ou | [@lit-protocol/contracts-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/contracts-sdk) | ![contracts-sdk](https://img.shields.io/badge/-universal-8A6496 'contracts-sdk') | | | [@lit-protocol/core](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/core) | ![core](https://img.shields.io/badge/-universal-8A6496 'core') | | | [@lit-protocol/crypto](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/crypto) | ![crypto](https://img.shields.io/badge/-universal-8A6496 'crypto') | | +| [@lit-protocol/e2e-tests](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/e2e-tests) | ![e2e-tests](https://img.shields.io/badge/-universal-8A6496 'e2e-tests') | | | [@lit-protocol/ecdsa-sdk](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/ecdsa-sdk) | ![ecdsa-sdk](https://img.shields.io/badge/-universal-8A6496 'ecdsa-sdk') | | | [@lit-protocol/encryption](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/encryption) | ![encryption](https://img.shields.io/badge/-universal-8A6496 'encryption') | | | [@lit-protocol/logger](https://github.com/LIT-Protocol/js-sdk/tree/master/packages/logger) | ![logger](https://img.shields.io/badge/-universal-8A6496 'logger') | | diff --git a/e2e-tests/bun-e2e.test.ts b/e2e-tests/bun-e2e.test.ts deleted file mode 100644 index e5d05389a1..0000000000 --- a/e2e-tests/bun-e2e.test.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Test command: -// DEBUG=true bun test bun-e2e.test.ts --timeout 20000 - -import { expect, test } from 'bun:test'; -import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; - -// Test command -// DEBUG=true bun test bun-e2e.test.ts --timeout 20000 -test('test multiple networks', async () => { - for (let network of ['habanero', 'manzano', 'cayenne']) { - console.log(`Testing network: ${network}`); - const litDev: DevEnv = await devEnv({ - network: network as TESTABLE_NETWORK_TYPE, - }); - expect(litDev.litNodeClient.ready).toBe(true); - expect(litDev.litNodeClient.config.litNetwork).toBe(network); - } -}); diff --git a/e2e-tests/jest.config.ts b/e2e-tests/jest.config.ts deleted file mode 100644 index a9fe13eb3b..0000000000 --- a/e2e-tests/jest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -// import { getJestProjects } from '@nx/jest'; - -export default { - roots: [''], - transform: { - '^.+\\.tsx?$': 'ts-jest', - }, - testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$', - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], - // maxWorkers: 1, -}; diff --git a/e2e-tests/tsconfig.json b/e2e-tests/tsconfig.json deleted file mode 100644 index 1633228da3..0000000000 --- a/e2e-tests/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "lib": ["es6", "dom"], - "types": ["jest"], - "strict": true, - "resolveJsonModule": true, - "esModuleInterop": true - }, - "include": ["./**/*"] -} diff --git a/packages/e2e-tests/jest.config.ts b/packages/e2e-tests/jest.config.ts new file mode 100644 index 0000000000..bc5092c135 --- /dev/null +++ b/packages/e2e-tests/jest.config.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +export default { + displayName: 'e2e-tests', + preset: 'ts-jest', + transform: { + '^.+\\.ts$': 'ts-jest', + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/packages/e2e-tests', + setupFilesAfterEnv: ['../../jest.setup.js'], +}; diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json new file mode 100644 index 0000000000..bce91cabcb --- /dev/null +++ b/packages/e2e-tests/package.json @@ -0,0 +1,23 @@ +{ + "name": "@lit-protocol/e2e-tests", + "license": "MIT", + "homepage": "https://github.com/Lit-Protocol/js-sdk", + "repository": { + "type": "git", + "url": "https://github.com/LIT-Protocol/js-sdk" + }, + "keywords": [ + "library" + ], + "bugs": { + "url": "https://github.com/LIT-Protocol/js-sdk/issues" + }, + "type": "commonjs", + "gitHead": "0d7334c2c55f448e91fe32f29edc5db8f5e09e4b", + "tags": [ + "universal" + ], + "version": "4.2.1", + "main": "./dist/src/index.js", + "typings": "./dist/src/index.d.ts" +} diff --git a/packages/e2e-tests/project.json b/packages/e2e-tests/project.json new file mode 100644 index 0000000000..9452e76b4f --- /dev/null +++ b/packages/e2e-tests/project.json @@ -0,0 +1,45 @@ +{ + "name": "e2e-tests", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/e2e-tests/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/packages/e2e-tests", + "main": "packages/e2e-tests/src/index.ts", + "tsConfig": "packages/e2e-tests/tsconfig.lib.json", + "assets": ["packages/e2e-tests/*.md"], + "updateBuildableProjectDepsInPackageJson": true + } + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/e2e-tests/**/*.ts"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/packages/e2e-tests"], + "options": { + "jestConfig": "packages/e2e-tests/jest.config.ts", + "passWithNoTests": true, + "runInBand": true + } + }, + "testWatch": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/packages/e2e-tests"], + "options": { + "jestConfig": "packages/e2e-tests/jest.config.ts", + "passWithNoTests": true, + "watch": true + } + } + }, + "tags": [] +} diff --git a/e2e-tests/setup/env-setup.ts b/packages/e2e-tests/src/setup/env-setup.ts similarity index 92% rename from e2e-tests/setup/env-setup.ts rename to packages/e2e-tests/src/setup/env-setup.ts index 10c46df9f5..93e0565d2a 100644 --- a/e2e-tests/setup/env-setup.ts +++ b/packages/e2e-tests/src/setup/env-setup.ts @@ -2,8 +2,8 @@ import { log } from '@lit-protocol/misc'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; import * as networkContextData from './networkContext.example.json'; -let litNetwork = process.env.NETWORK as any; -const debug = process.env.DEBUG === 'true' ? true : false; +let litNetwork = process.env['NETWORK'] as TESTABLE_NETWORK_TYPE; +const debug = process.env['DEBUG'] === 'true' ? true : false; export type TESTABLE_NETWORK_TYPE = | 'habanero' diff --git a/e2e-tests/setup/networkContext.example.json b/packages/e2e-tests/src/setup/networkContext.example.json similarity index 100% rename from e2e-tests/setup/networkContext.example.json rename to packages/e2e-tests/src/setup/networkContext.example.json diff --git a/e2e-tests/jest-e2e.test.ts b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts similarity index 89% rename from e2e-tests/jest-e2e.test.ts rename to packages/e2e-tests/src/tests/jest-e2e-2.spec.ts index 09d2063509..dceae2f90b 100644 --- a/e2e-tests/jest-e2e.test.ts +++ b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts @@ -1,7 +1,7 @@ // Test command // npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' -import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from './setup/env-setup'; +import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; try { jest.setTimeout(60000); diff --git a/packages/e2e-tests/src/tests/jest-e2e.spec.ts b/packages/e2e-tests/src/tests/jest-e2e.spec.ts new file mode 100644 index 0000000000..dceae2f90b --- /dev/null +++ b/packages/e2e-tests/src/tests/jest-e2e.spec.ts @@ -0,0 +1,23 @@ +// Test command +// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' + +import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('connections', () => { + test('test multiple networks', async () => { + for (let network of ['habanero', 'manzano', 'cayenne']) { + console.log(`Testing network: ${network}`); + const litDev: DevEnv = await devEnv({ + network: network as TESTABLE_NETWORK_TYPE, + }); + expect(litDev.litNodeClient.ready).toBe(true); + expect(litDev.litNodeClient.config.litNetwork).toBe(network); + } + }); +}); diff --git a/packages/e2e-tests/tsconfig.json b/packages/e2e-tests/tsconfig.json new file mode 100644 index 0000000000..f5b85657a8 --- /dev/null +++ b/packages/e2e-tests/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/e2e-tests/tsconfig.lib.json b/packages/e2e-tests/tsconfig.lib.json new file mode 100644 index 0000000000..e85ef50f65 --- /dev/null +++ b/packages/e2e-tests/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": [] + }, + "include": ["**/*.ts"], + "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.test.ts"] +} diff --git a/packages/e2e-tests/tsconfig.spec.json b/packages/e2e-tests/tsconfig.spec.json new file mode 100644 index 0000000000..546f12877f --- /dev/null +++ b/packages/e2e-tests/tsconfig.spec.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"] +} diff --git a/yarn.lock b/yarn.lock index a4b97588b0..6b2917e32b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1970,18 +1970,6 @@ resolved "https://registry.yarnpkg.com/@istanbuljs/schema/-/schema-0.1.3.tgz#e45e384e4b8ec16bce2fd903af78450f6bf7ec98" integrity sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA== -"@jest/console@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/console/-/console-27.5.1.tgz#260fe7239602fe5130a94f1aa386eff54b014bba" - integrity sha512-kZ/tNpS3NXn0mlXXXPNuDZnb4c0oZ20r4K5eemM2k30ZC3G0T02nXUvyhf5YdbXWHPEJLc9qGLxEZ216MdL+Zg== - dependencies: - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - jest-message-util "^27.5.1" - jest-util "^27.5.1" - slash "^3.0.0" - "@jest/console@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/console/-/console-29.7.0.tgz#cd4822dbdb84529265c5a2bdb529a3c9cc950ffc" @@ -1994,50 +1982,40 @@ jest-util "^29.7.0" slash "^3.0.0" -"@jest/core@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/core/-/core-27.5.1.tgz#267ac5f704e09dc52de2922cbf3af9edcd64b626" - integrity sha512-AK6/UTrvQD0Cd24NSqmIA6rKsu0tKIxfiCducZvqxYdmMisOYAsdItspT+fQDQYARPf8XgjAFZi0ogW2agH5nQ== +"@jest/core@^29.7.0": + version "29.7.0" + resolved "https://registry.yarnpkg.com/@jest/core/-/core-29.7.0.tgz#b6cccc239f30ff36609658c5a5e2291757ce448f" + integrity sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg== dependencies: - "@jest/console" "^27.5.1" - "@jest/reporters" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/console" "^29.7.0" + "@jest/reporters" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/transform" "^29.7.0" + "@jest/types" "^29.6.3" "@types/node" "*" ansi-escapes "^4.2.1" chalk "^4.0.0" - emittery "^0.8.1" + ci-info "^3.2.0" exit "^0.1.2" graceful-fs "^4.2.9" - jest-changed-files "^27.5.1" - jest-config "^27.5.1" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-resolve-dependencies "^27.5.1" - jest-runner "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - jest-watcher "^27.5.1" + jest-changed-files "^29.7.0" + jest-config "^29.7.0" + jest-haste-map "^29.7.0" + jest-message-util "^29.7.0" + jest-regex-util "^29.6.3" + jest-resolve "^29.7.0" + jest-resolve-dependencies "^29.7.0" + jest-runner "^29.7.0" + jest-runtime "^29.7.0" + jest-snapshot "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + jest-watcher "^29.7.0" micromatch "^4.0.4" - rimraf "^3.0.0" + pretty-format "^29.7.0" slash "^3.0.0" strip-ansi "^6.0.0" -"@jest/environment@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-27.5.1.tgz#d7425820511fe7158abbecc010140c3fd3be9c74" - integrity sha512-/WQjhPJe3/ghaol/4Bq480JKXV/Rfw8nQdN7f41fM8VDHLcxKXou6QyXAh3EFr9/bVG3x74z1NWDkP87EiY8gA== - dependencies: - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock "^27.5.1" - "@jest/environment@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/environment/-/environment-29.7.0.tgz#24d61f54ff1f786f3cd4073b4b94416383baf2a7" @@ -2063,18 +2041,6 @@ expect "^29.7.0" jest-snapshot "^29.7.0" -"@jest/fake-timers@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-27.5.1.tgz#76979745ce0579c8a94a4678af7a748eda8ada74" - integrity sha512-/aPowoolwa07k7/oM3aASneNeBGCmGQsc3ugN4u6s4C/+s5M64MFo/+djTdiwcbQlRfFElGuDXWzaWj6QgKObQ== - dependencies: - "@jest/types" "^27.5.1" - "@sinonjs/fake-timers" "^8.0.1" - "@types/node" "*" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-util "^27.5.1" - "@jest/fake-timers@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/fake-timers/-/fake-timers-29.7.0.tgz#fd91bf1fffb16d7d0d24a426ab1a47a49881a565" @@ -2087,15 +2053,6 @@ jest-mock "^29.7.0" jest-util "^29.7.0" -"@jest/globals@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-27.5.1.tgz#7ac06ce57ab966566c7963431cef458434601b2b" - integrity sha512-ZEJNB41OBQQgGzgyInAv0UUfDDj3upmHydjieSxFvTRuZElrx7tXg/uVQ5hYVEwiXs3+aMsAeEc9X7xiSKCm4Q== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/types" "^27.5.1" - expect "^27.5.1" - "@jest/globals@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/globals/-/globals-29.7.0.tgz#8d9290f9ec47ff772607fa864ca1d5a2efae1d4d" @@ -2106,38 +2063,7 @@ "@jest/types" "^29.6.3" jest-mock "^29.7.0" -"@jest/reporters@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-27.5.1.tgz#ceda7be96170b03c923c37987b64015812ffec04" - integrity sha512-cPXh9hWIlVJMQkVk84aIvXuBB4uQQmFqZiacloFuGiP3ah1sbCxCosidXFDfqG8+6fO1oR2dTJTlsOy4VFmUfw== - dependencies: - "@bcoe/v8-coverage" "^0.2.3" - "@jest/console" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - collect-v8-coverage "^1.0.0" - exit "^0.1.2" - glob "^7.1.2" - graceful-fs "^4.2.9" - istanbul-lib-coverage "^3.0.0" - istanbul-lib-instrument "^5.1.0" - istanbul-lib-report "^3.0.0" - istanbul-lib-source-maps "^4.0.0" - istanbul-reports "^3.1.3" - jest-haste-map "^27.5.1" - jest-resolve "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" - slash "^3.0.0" - source-map "^0.6.0" - string-length "^4.0.1" - terminal-link "^2.0.0" - v8-to-istanbul "^8.1.0" - -"@jest/reporters@^29.4.1": +"@jest/reporters@^29.4.1", "@jest/reporters@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/reporters/-/reporters-29.7.0.tgz#04b262ecb3b8faa83b0b3d321623972393e8f4c7" integrity sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg== @@ -2174,15 +2100,6 @@ dependencies: "@sinclair/typebox" "^0.27.8" -"@jest/source-map@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-27.5.1.tgz#6608391e465add4205eae073b55e7f279e04e8cf" - integrity sha512-y9NIHUYF3PJRlHk98NdC/N1gl88BL08aQQgu4k4ZopQkCw9t9cV8mtl3TV8b/YCB8XaVTFrmUTAJvjsntDireg== - dependencies: - callsites "^3.0.0" - graceful-fs "^4.2.9" - source-map "^0.6.0" - "@jest/source-map@^29.6.3": version "29.6.3" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-29.6.3.tgz#d90ba772095cf37a34a5eb9413f1b562a08554c4" @@ -2192,16 +2109,6 @@ callsites "^3.0.0" graceful-fs "^4.2.9" -"@jest/test-result@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-27.5.1.tgz#56a6585fa80f7cdab72b8c5fc2e871d03832f5bb" - integrity sha512-EW35l2RYFUcUQxFJz5Cv5MTOxlJIQs4I7gxzi2zVU7PJhOwfYq1MdC5nhSmYjX1gmMmLPvB3sIaC+BkcHRBfag== - dependencies: - "@jest/console" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/istanbul-lib-coverage" "^2.0.0" - collect-v8-coverage "^1.0.0" - "@jest/test-result@^29.4.1", "@jest/test-result@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/test-result/-/test-result-29.7.0.tgz#8db9a80aa1a097bb2262572686734baed9b1657c" @@ -2212,16 +2119,6 @@ "@types/istanbul-lib-coverage" "^2.0.0" collect-v8-coverage "^1.0.0" -"@jest/test-sequencer@^27.5.1": - version "27.5.1" - resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-27.5.1.tgz#4057e0e9cea4439e544c6353c6affe58d095745b" - integrity sha512-LCheJF7WB2+9JuCS7VB/EmGIdQuhtqjRNI9A43idHv3E4KltCTsPsLxvdaubFHSYwY/fNjMWjl6vNRhDiN7vpQ== - dependencies: - "@jest/test-result" "^27.5.1" - graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-runtime "^27.5.1" - "@jest/test-sequencer@^29.7.0": version "29.7.0" resolved "https://registry.yarnpkg.com/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz#6cef977ce1d39834a3aea887a1726628a6f072ce" @@ -4642,13 +4539,6 @@ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.6.0.tgz#3c7c9c46e678feefe7a2e5bb609d3dbd665ffb3f" integrity sha512-t09vSN3MdfsyCHoFcTRCH/iUtG7OJ0CsjzB8cjAmKc/va/kIgeDI/TxsigdncE/4be734m0cvIYwNaV4i2XqAw== -"@sinonjs/commons@^1.7.0": - version "1.8.6" - resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.6.tgz#80c516a4dc264c2a69115e7578d62581ff455ed9" - integrity sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ== - dependencies: - type-detect "4.0.8" - "@sinonjs/commons@^3.0.0": version "3.0.1" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-3.0.1.tgz#1029357e44ca901a615585f6d27738dbc89084cd" @@ -5344,13 +5234,13 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@27.4.1": - version "27.4.1" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.1.tgz#185cbe2926eaaf9662d340cc02e548ce9e11ab6d" - integrity sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw== +"@types/jest@^29.5.12": + version "29.5.12" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.12.tgz#7f7dc6eb4cf246d2474ed78744b05d06ce025544" + integrity sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw== dependencies: - jest-matcher-utils "^27.0.0" - pretty-format "^27.0.0" + expect "^29.0.0" + pretty-format "^29.0.0" "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" @@ -6227,11 +6117,6 @@ JSONStream@^1.0.4, JSONStream@^1.3.5: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^2.0.3, abab@^2.0.5: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - abbrev@1, abbrev@^1.0.0, abbrev@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -6285,30 +6170,17 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-globals@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-6.0.0.tgz#46cdd39f0f8ff08a876619b55f5ac8a6dc770b45" - integrity sha512-ZQl7LOWaF5ePqqcX4hLuv/bLXYQNfNWw2c0/yX/TsPRKamzHcTGQnlCjHT3TsmkOUVEPS3crCxiPfdzE/Trlhg== - dependencies: - acorn "^7.1.1" - acorn-walk "^7.1.1" - acorn-jsx@^5.3.1, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^7.1.1: - version "7.2.0" - resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-7.2.0.tgz#0de889a601203909b0fbe07b8938dc21d2e967bc" - integrity sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA== - acorn-walk@^8.1.1: version "8.3.2" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.2.tgz#7703af9415f1b6db9315d6895503862e231d34aa" integrity sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A== -acorn@^7.1.1, acorn@^7.4.0: +acorn@^7.4.0: version "7.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== @@ -7179,7 +7051,7 @@ babel-helpers@^6.24.1: babel-runtime "^6.22.0" babel-template "^6.24.1" -babel-jest@27.5.1, babel-jest@^27.5.1: +babel-jest@27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/babel-jest/-/babel-jest-27.5.1.tgz#a1bf8d61928edfefd21da27eb86a695bfd691444" integrity sha512-cdQ5dXjGRd0IBRATiQ4mZGlGlRE8kJpjPOixdNRdT+m3UcNqmYWN6rK6nvtXYfY3D76cb8s/O1Ss8ea24PIwcg== @@ -8258,6 +8130,20 @@ builtins@^5.0.0: dependencies: semver "^7.0.0" +bun@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/bun/-/bun-1.1.4.tgz#48c415b2618797674e6d29c3141592d9abf9c91e" + integrity sha512-J78P9T2gMv2eki64AJnHjmAgSU1WuE4QPVvlYuhy/UmLClTwFaCnyoU0Rza7T5q97O4JIoGhmVCpEfI0Ri6anw== + optionalDependencies: + "@oven/bun-darwin-aarch64" "1.1.4" + "@oven/bun-darwin-x64" "1.1.4" + "@oven/bun-darwin-x64-baseline" "1.1.4" + "@oven/bun-linux-aarch64" "1.1.4" + "@oven/bun-linux-x64" "1.1.4" + "@oven/bun-linux-x64-baseline" "1.1.4" + "@oven/bun-windows-x64" "1.1.4" + "@oven/bun-windows-x64-baseline" "1.1.4" + busboy@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" @@ -9501,6 +9387,19 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7: safe-buffer "^5.0.1" sha.js "^2.4.8" +create-jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/create-jest/-/create-jest-29.7.0.tgz#a355c5b3cb1e1af02ba177fe7afd7feee49a5320" + integrity sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q== + dependencies: + "@jest/types" "^29.6.3" + chalk "^4.0.0" + exit "^0.1.2" + graceful-fs "^4.2.9" + jest-config "^29.7.0" + jest-util "^29.7.0" + prompts "^2.0.1" + create-require@^1.1.0: version "1.1.1" resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" @@ -9862,15 +9761,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-urls@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-2.0.0.tgz#156485a72963a970f5d5821aaf642bef2bf2db9b" - integrity sha512-X5eWTSXO/BJmpdIKCRuKUgSCgAN0OwliVK3yPKbwIWU1Tdw5BRajxlzMidvh+gwko9AfQ9zIj52pzF91Q3YAvQ== - dependencies: - abab "^2.0.3" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.0.0" - data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" @@ -9966,11 +9856,6 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== -decimal.js@^10.2.1: - version "10.4.3" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" - integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== - decode-uri-component@^0.2.0, decode-uri-component@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" @@ -10308,11 +10193,6 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" -diff-sequences@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" - integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== - diff-sequences@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" @@ -10408,13 +10288,6 @@ domelementtype@^2.0.1, domelementtype@^2.2.0, domelementtype@^2.3.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== -domexception@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-2.0.1.tgz#fb44aefba793e1574b0af6aed2801d057529f304" - integrity sha512-yxJ2mFy/sibVQlu5qHjOkf9J3K6zgmCxgJ94u2EdvDOV09H+32LtRswEcUsmUWN72pVLOEnTSRaIVVzVQgS0dg== - dependencies: - webidl-conversions "^5.0.0" - domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" @@ -10648,11 +10521,6 @@ emittery@^0.13.1: resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.13.1.tgz#c04b8c3457490e0847ae51fced3af52d338e3dad" integrity sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ== -emittery@^0.8.1: - version "0.8.1" - resolved "https://registry.yarnpkg.com/emittery/-/emittery-0.8.1.tgz#bb23cc86d03b30aa75a7f734819dee2e1ba70860" - integrity sha512-uDfvUjVrfGJJhymx/kz6prltenw1u7WrCg1oa94zYY8xxVpLLUu045LAT0dhDZdXG58/EpPL/5kA180fQ/qudg== - emoji-regex@^7.0.1: version "7.0.3" resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-7.0.3.tgz#933a04052860c85e83c122479c4748a8e4c72156" @@ -11059,17 +10927,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - eslint-config-next@12.2.3: version "12.2.3" resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-12.2.3.tgz#468fe9756ccbf7e4452139062db5b4e6557dc885" @@ -11469,7 +11326,7 @@ espree@^9.0.0, espree@^9.6.0, espree@^9.6.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" -esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: +esprima@^4.0.0, esprima@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -12206,17 +12063,7 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/expect/-/expect-27.5.1.tgz#83ce59f1e5bdf5f9d2b94b61d2050db48f3fef74" - integrity sha512-E1q5hSUG2AmYQwQJ041nvgpkODHQvB+RKlB4IYdru6uJsyFTRyZAP463M+1lINorwbqAmUggi6+WwkD8lCS/Dw== - dependencies: - "@jest/types" "^27.5.1" - jest-get-type "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - -expect@^29.7.0: +expect@^29.0.0, expect@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== @@ -12717,15 +12564,6 @@ form-data-encoder@1.7.1: resolved "https://registry.yarnpkg.com/form-data-encoder/-/form-data-encoder-1.7.1.tgz#ac80660e4f87ee0d3d3c3638b7da8278ddb8ec96" integrity sha512-EFRDrsMm/kyqbTQocNvRXMLjc7Es2Vk+IQFx/YW7hkUH1eBl4J1fqiP34l74Yt0pFLCNpc06fkbVk00008mzjg== -form-data@^3.0.0: - version "3.0.1" - resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f" - integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg== - dependencies: - asynckit "^0.4.0" - combined-stream "^1.0.8" - mime-types "^2.1.12" - form-data@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452" @@ -14659,11 +14497,6 @@ is-port-reachable@4.0.0: resolved "https://registry.yarnpkg.com/is-port-reachable/-/is-port-reachable-4.0.0.tgz#dac044091ef15319c8ab2f34604d8794181f8c2d" integrity sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig== -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - is-regex@^1.1.4, is-regex@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -15054,34 +14887,9 @@ jest-changed-files@^27.5.1: resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.5.1.tgz#a348aed00ec9bf671cc58a66fcbe7c3dfd6a68f5" integrity sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw== dependencies: - "@jest/types" "^27.5.1" execa "^5.0.0" - throat "^6.0.1" - -jest-circus@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-circus/-/jest-circus-27.5.1.tgz#37a5a4459b7bf4406e53d637b49d22c65d125ecc" - integrity sha512-D95R7x5UtlMA5iBYsOHFFbMD/GVA4R/Kdq15f7xYWUfWHBto9NYRsOvnSauTgdF+ogCpJ4tyKOXhUifxS65gdw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - dedent "^0.7.0" - expect "^27.5.1" - is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - slash "^3.0.0" - stack-utils "^2.0.3" - throat "^6.0.1" + jest-util "^29.7.0" + p-limit "^3.1.0" jest-circus@^29.7.0: version "29.7.0" @@ -15109,55 +14917,24 @@ jest-circus@^29.7.0: slash "^3.0.0" stack-utils "^2.0.3" -jest-cli@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-27.5.1.tgz#278794a6e6458ea8029547e6c6cbf673bd30b145" - integrity sha512-Hc6HOOwYq4/74/c62dEE3r5elx8wjYqxY0r0G/nFrLDPMFRu6RA/u8qINOIkvhxG7mMQ5EJsOGfRpI8L6eFUVw== +jest-cli@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-cli/-/jest-cli-29.7.0.tgz#5592c940798e0cae677eec169264f2d839a37995" + integrity sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg== dependencies: - "@jest/core" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/test-result" "^29.7.0" + "@jest/types" "^29.6.3" chalk "^4.0.0" + create-jest "^29.7.0" exit "^0.1.2" - graceful-fs "^4.2.9" import-local "^3.0.2" - jest-config "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - prompts "^2.0.1" - yargs "^16.2.0" - -jest-config@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-27.5.1.tgz#5c387de33dca3f99ad6357ddeccd91bf3a0e4a41" - integrity sha512-5sAsjm6tGdsVbW9ahcChPAFCk4IlkQUknH5AvKjuLTSlcO/wCZKyFdn7Rg0EkC+OGgWODEy2hDpWB1PgzH0JNA== - dependencies: - "@babel/core" "^7.8.0" - "@jest/test-sequencer" "^27.5.1" - "@jest/types" "^27.5.1" - babel-jest "^27.5.1" - chalk "^4.0.0" - ci-info "^3.2.0" - deepmerge "^4.2.2" - glob "^7.1.1" - graceful-fs "^4.2.9" - jest-circus "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-get-type "^27.5.1" - jest-jasmine2 "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runner "^27.5.1" - jest-util "^27.5.1" - jest-validate "^27.5.1" - micromatch "^4.0.4" - parse-json "^5.2.0" - pretty-format "^27.5.1" - slash "^3.0.0" - strip-json-comments "^3.1.1" + jest-config "^29.7.0" + jest-util "^29.7.0" + jest-validate "^29.7.0" + yargs "^17.3.1" -jest-config@^29.4.1: +jest-config@^29.4.1, jest-config@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-config/-/jest-config-29.7.0.tgz#bcbda8806dbcc01b1e316a46bb74085a84b0245f" integrity sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ== @@ -15185,16 +14962,6 @@ jest-config@^29.4.1: slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" - integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== - dependencies: - chalk "^4.0.0" - diff-sequences "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" - jest-diff@^29.4.1, jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" @@ -15205,13 +14972,6 @@ jest-diff@^29.4.1, jest-diff@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" -jest-docblock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-27.5.1.tgz#14092f364a42c6108d42c33c8cf30e058e25f6c0" - integrity sha512-rl7hlABeTsRYxKiUfpHrQrG4e2obOiTQWfMEH3PxPjOtdsfLQO4ReWSZaQ7DETm4xu07rl4q/h4zcKXyU0/OzQ== - dependencies: - detect-newline "^3.0.0" - jest-docblock@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-docblock/-/jest-docblock-29.7.0.tgz#8fddb6adc3cdc955c93e2a87f61cfd350d5d119a" @@ -15219,17 +14979,6 @@ jest-docblock@^29.7.0: dependencies: detect-newline "^3.0.0" -jest-each@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-27.5.1.tgz#5bc87016f45ed9507fed6e4702a5b468a5b2c44e" - integrity sha512-1Ff6p+FbhT/bXQnEouYy00bkNSY7OUpfIcmdl8vZ31A1UUaurOLPA8a8BbJOF2RDUElwJhmeaV7LnagI+5UwNQ== - dependencies: - "@jest/types" "^27.5.1" - chalk "^4.0.0" - jest-get-type "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - jest-each@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-each/-/jest-each-29.7.0.tgz#162a9b3f2328bdd991beaabffbb74745e56577d1" @@ -15241,31 +14990,6 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" -jest-environment-jsdom@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-27.5.1.tgz#ea9ccd1fc610209655a77898f86b2b559516a546" - integrity sha512-TFBvkTC1Hnnnrka/fUb56atfDtJ9VMZ94JkjTbggl1PEpwrYtUBKMezB3inLmWqQsXYLcMwNoDQwoBTAvFfsfw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" - jsdom "^16.6.0" - -jest-environment-node@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-27.5.1.tgz#dedc2cfe52fab6b8f5714b4808aefa85357a365e" - integrity sha512-Jt4ZUnxdOsTGwSRAfKEnE6BcwsSPNOijjwifq5sDFSA2kesnXTvNqKHYgM0hDq3549Uf/KzdXNYn4wMZJPlFLw== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock "^27.5.1" - jest-util "^27.5.1" - jest-environment-node@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" @@ -15278,11 +15002,6 @@ jest-environment-node@^29.7.0: jest-mock "^29.7.0" jest-util "^29.7.0" -jest-get-type@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" - integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== - jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" @@ -15327,37 +15046,6 @@ jest-haste-map@^29.7.0: optionalDependencies: fsevents "^2.3.2" -jest-jasmine2@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-jasmine2/-/jest-jasmine2-27.5.1.tgz#a037b0034ef49a9f3d71c4375a796f3b230d1ac4" - integrity sha512-jtq7VVyG8SqAorDpApwiJJImd0V2wv1xzdheGHRGyuT7gZm6gG47QEskOlzsN1PG/6WNaCo5pmwMHDf3AkG2pQ== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - co "^4.6.0" - expect "^27.5.1" - is-generator-fn "^2.0.0" - jest-each "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-runtime "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - pretty-format "^27.5.1" - throat "^6.0.1" - -jest-leak-detector@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8" - integrity sha512-POXfWAMvfU6WMUXftV4HolnJfnPOGEu10fscNCA76KBpRRhcMN2c8d3iT2pxQS3HLbA+5X4sOUPzYO2NUyIlHQ== - dependencies: - jest-get-type "^27.5.1" - pretty-format "^27.5.1" - jest-leak-detector@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz#5b7ec0dadfdfec0ca383dc9aa016d36b5ea4c728" @@ -15366,16 +15054,6 @@ jest-leak-detector@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" -jest-matcher-utils@^27.0.0, jest-matcher-utils@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" - integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== - dependencies: - chalk "^4.0.0" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - pretty-format "^27.5.1" - jest-matcher-utils@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" @@ -15386,21 +15064,6 @@ jest-matcher-utils@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" -jest-message-util@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.5.1.tgz#bdda72806da10d9ed6425e12afff38cd1458b6cf" - integrity sha512-rMyFe1+jnyAAf+NHwTclDz0eAaLkVDdKVHHBFWsBWHnnh5YeJMNWWsv7AbFYXfK3oTqvL7VTWkhNLu1jX24D+g== - dependencies: - "@babel/code-frame" "^7.12.13" - "@jest/types" "^27.5.1" - "@types/stack-utils" "^2.0.0" - chalk "^4.0.0" - graceful-fs "^4.2.9" - micromatch "^4.0.4" - pretty-format "^27.5.1" - slash "^3.0.0" - stack-utils "^2.0.3" - jest-message-util@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-29.7.0.tgz#8bc392e204e95dfe7564abbe72a404e28e51f7f3" @@ -15416,14 +15079,6 @@ jest-message-util@^29.7.0: slash "^3.0.0" stack-utils "^2.0.3" -jest-mock@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-27.5.1.tgz#19948336d49ef4d9c52021d34ac7b5f36ff967d6" - integrity sha512-K4jKbY1d4ENhbrG2zuPWaQBvDly+iZ2yAW+T1fATN78hc0sInwn7wZB8XtlNnvHug5RMwV897Xm4LqmPM4e2Og== - dependencies: - "@jest/types" "^27.5.1" - "@types/node" "*" - jest-mock@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-mock/-/jest-mock-29.7.0.tgz#4e836cf60e99c6fcfabe9f99d017f3fdd50a6347" @@ -15448,30 +15103,13 @@ jest-regex-util@^29.6.3: resolved "https://registry.yarnpkg.com/jest-regex-util/-/jest-regex-util-29.6.3.tgz#4a556d9c776af68e1c5f48194f4d0327d24e8a52" integrity sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg== -jest-resolve-dependencies@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-27.5.1.tgz#d811ecc8305e731cc86dd79741ee98fed06f1da8" - integrity sha512-QQOOdY4PE39iawDn5rzbIePNigfe5B9Z91GDD1ae/xNDlu9kaat8QQ5EKnNmVWPV54hUdxCVwwj6YMgR2O7IOg== - dependencies: - "@jest/types" "^27.5.1" - jest-regex-util "^27.5.1" - jest-snapshot "^27.5.1" - -jest-resolve@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.5.1.tgz#a2f1c5a0796ec18fe9eb1536ac3814c23617b384" - integrity sha512-FFDy8/9E6CV83IMbDpcjOhumAQPDyETnU2KZ1O98DwTnz8AOBsW/Xv3GySr1mOZdItLR+zDZ7I/UdTFbgSOVCw== +jest-resolve-dependencies@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz#1b04f2c095f37fc776ff40803dc92921b1e88428" + integrity sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA== dependencies: - "@jest/types" "^27.5.1" - chalk "^4.0.0" - graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-pnp-resolver "^1.2.2" - jest-util "^27.5.1" - jest-validate "^27.5.1" - resolve "^1.20.0" - resolve.exports "^1.1.0" - slash "^3.0.0" + jest-regex-util "^29.6.3" + jest-snapshot "^29.7.0" jest-resolve@^29.4.1, jest-resolve@^29.7.0: version "29.7.0" @@ -15488,33 +15126,6 @@ jest-resolve@^29.4.1, jest-resolve@^29.7.0: resolve.exports "^2.0.0" slash "^3.0.0" -jest-runner@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-27.5.1.tgz#071b27c1fa30d90540805c5645a0ec167c7b62e5" - integrity sha512-g4NPsM4mFCOwFKXO4p/H/kWGdJp9V8kURY2lX8Me2drgXqG7rrZAx5kv+5H7wtt/cdFIjhqYx1HrlqWHaOvDaQ== - dependencies: - "@jest/console" "^27.5.1" - "@jest/environment" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - chalk "^4.0.0" - emittery "^0.8.1" - graceful-fs "^4.2.9" - jest-docblock "^27.5.1" - jest-environment-jsdom "^27.5.1" - jest-environment-node "^27.5.1" - jest-haste-map "^27.5.1" - jest-leak-detector "^27.5.1" - jest-message-util "^27.5.1" - jest-resolve "^27.5.1" - jest-runtime "^27.5.1" - jest-util "^27.5.1" - jest-worker "^27.5.1" - source-map-support "^0.5.6" - throat "^6.0.1" - jest-runner@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-runner/-/jest-runner-29.7.0.tgz#809af072d408a53dcfd2e849a4c976d3132f718e" @@ -15542,34 +15153,6 @@ jest-runner@^29.7.0: p-limit "^3.1.0" source-map-support "0.5.13" -jest-runtime@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-27.5.1.tgz#4896003d7a334f7e8e4a53ba93fb9bcd3db0a1af" - integrity sha512-o7gxw3Gf+H2IGt8fv0RiyE1+r83FJBRruoA+FXrlHw6xEyBsU8ugA6IPfTdVyA0w8HClpbK+DGJxH59UrNMx8A== - dependencies: - "@jest/environment" "^27.5.1" - "@jest/fake-timers" "^27.5.1" - "@jest/globals" "^27.5.1" - "@jest/source-map" "^27.5.1" - "@jest/test-result" "^27.5.1" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - chalk "^4.0.0" - cjs-module-lexer "^1.0.0" - collect-v8-coverage "^1.0.0" - execa "^5.0.0" - glob "^7.1.3" - graceful-fs "^4.2.9" - jest-haste-map "^27.5.1" - jest-message-util "^27.5.1" - jest-mock "^27.5.1" - jest-regex-util "^27.5.1" - jest-resolve "^27.5.1" - jest-snapshot "^27.5.1" - jest-util "^27.5.1" - slash "^3.0.0" - strip-bom "^4.0.0" - jest-runtime@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-runtime/-/jest-runtime-29.7.0.tgz#efecb3141cf7d3767a3a0cc8f7c9990587d3d817" @@ -15606,34 +15189,6 @@ jest-serializer@^27.5.1: "@types/node" "*" graceful-fs "^4.2.9" -jest-snapshot@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.5.1.tgz#b668d50d23d38054a51b42c4039cab59ae6eb6a1" - integrity sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA== - dependencies: - "@babel/core" "^7.7.2" - "@babel/generator" "^7.7.2" - "@babel/plugin-syntax-typescript" "^7.7.2" - "@babel/traverse" "^7.7.2" - "@babel/types" "^7.0.0" - "@jest/transform" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/babel__traverse" "^7.0.4" - "@types/prettier" "^2.1.5" - babel-preset-current-node-syntax "^1.0.0" - chalk "^4.0.0" - expect "^27.5.1" - graceful-fs "^4.2.9" - jest-diff "^27.5.1" - jest-get-type "^27.5.1" - jest-haste-map "^27.5.1" - jest-matcher-utils "^27.5.1" - jest-message-util "^27.5.1" - jest-util "^27.5.1" - natural-compare "^1.4.0" - pretty-format "^27.5.1" - semver "^7.3.2" - jest-snapshot@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-29.7.0.tgz#c2c574c3f51865da1bb329036778a69bf88a6be5" @@ -15684,18 +15239,6 @@ jest-util@^29.0.0, jest-util@^29.4.1, jest-util@^29.7.0: graceful-fs "^4.2.9" picomatch "^2.2.3" -jest-validate@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-27.5.1.tgz#9197d54dc0bdb52260b8db40b46ae668e04df067" - integrity sha512-thkNli0LYTmOI1tDB3FI1S1RTp/Bqyd9pTarJwL87OIBFuqEb5Apv5EaApEudYg4g86e3CT6kM0RowkhtEnCBQ== - dependencies: - "@jest/types" "^27.5.1" - camelcase "^6.2.0" - chalk "^4.0.0" - jest-get-type "^27.5.1" - leven "^3.1.0" - pretty-format "^27.5.1" - jest-validate@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-validate/-/jest-validate-29.7.0.tgz#7bf705511c64da591d46b15fce41400d52147d9c" @@ -15708,19 +15251,6 @@ jest-validate@^29.7.0: leven "^3.1.0" pretty-format "^29.7.0" -jest-watcher@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-27.5.1.tgz#71bd85fb9bde3a2c2ec4dc353437971c43c642a2" - integrity sha512-z676SuD6Z8o8qbmEGhoEUFOM1+jfEiL3DXHK/xgEiG2EyNYfFG60jluWcupY6dATjfEsKQuibReS1djInQnoVw== - dependencies: - "@jest/test-result" "^27.5.1" - "@jest/types" "^27.5.1" - "@types/node" "*" - ansi-escapes "^4.2.1" - chalk "^4.0.0" - jest-util "^27.5.1" - string-length "^4.0.1" - jest-watcher@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-watcher/-/jest-watcher-29.7.0.tgz#7810d30d619c3a62093223ce6bb359ca1b28a2f2" @@ -15754,14 +15284,15 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest/-/jest-27.5.1.tgz#dadf33ba70a779be7a6fc33015843b51494f63fc" - integrity sha512-Yn0mADZB89zTtjkPJEXwrac3LHudkQMR+Paqa8uxJHCBr9agxztUifWCyiYrjhMPBoUVBjyny0I7XH6ozDr7QQ== +jest@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" + integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== dependencies: - "@jest/core" "^27.5.1" + "@jest/core" "^29.7.0" + "@jest/types" "^29.6.3" import-local "^3.0.2" - jest-cli "^27.5.1" + jest-cli "^29.7.0" jiti@^1.21.0: version "1.21.6" @@ -15843,39 +15374,6 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== -jsdom@^16.6.0: - version "16.7.0" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-16.7.0.tgz#918ae71965424b197c819f8183a754e18977b710" - integrity sha512-u9Smc2G1USStM+s/x1ru5Sxrl6mPYCbByG1U/hUmqaVsm4tbNyS7CicOSRyuGQYZhTu0h84qkZZQ/I+dzizSVw== - dependencies: - abab "^2.0.5" - acorn "^8.2.4" - acorn-globals "^6.0.0" - cssom "^0.4.4" - cssstyle "^2.3.0" - data-urls "^2.0.0" - decimal.js "^10.2.1" - domexception "^2.0.1" - escodegen "^2.0.0" - form-data "^3.0.0" - html-encoding-sniffer "^2.0.1" - http-proxy-agent "^4.0.1" - https-proxy-agent "^5.0.0" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.0" - parse5 "6.0.1" - saxes "^5.0.1" - symbol-tree "^3.2.4" - tough-cookie "^4.0.0" - w3c-hr-time "^1.0.2" - w3c-xmlserializer "^2.0.0" - webidl-conversions "^6.1.0" - whatwg-encoding "^1.0.5" - whatwg-mimetype "^2.3.0" - whatwg-url "^8.5.0" - ws "^7.4.6" - xml-name-validator "^3.0.0" - jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -16773,7 +16271,7 @@ lodash@4.17.19: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.19.tgz#e48ddedbe30b3321783c5b4301fbd353bc1e4a4b" integrity sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ== -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5, lodash@^4.7.0: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4, lodash@^4.17.5: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -19052,11 +18550,6 @@ parse5-htmlparser2-tree-adapter@^7.0.0: domhandler "^5.0.2" parse5 "^7.0.0" -parse5@6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" - integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== - parse5@^7.0.0: version "7.1.2" resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" @@ -19465,7 +18958,7 @@ pretty-format@^27.0.0, pretty-format@^27.0.2, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-format@^29.7.0: +pretty-format@^29.0.0, pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -20446,11 +19939,6 @@ resolve.exports@1.1.0: resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.0.tgz#5ce842b94b05146c0e03076985d1d0e7e48c90c9" integrity sha512-J1l+Zxxp4XK3LUDZ9m60LRJF/mAe4z6a4xyabPHk7pvK5t35dACV32iIjJDFeWZFfZlO29w6SZ67knR0tHzJtQ== -resolve.exports@^1.1.0: - version "1.1.1" - resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-1.1.1.tgz#05cfd5b3edf641571fd46fa608b610dda9ead999" - integrity sha512-/NtpHNDN7jWhAaQ9BvBUYZ6YTXsRBgfqWFWP7BZBaoMJO/I3G5OFzvTuWNlZC3aPjins1F+TNrLKsGbH4rfsRQ== - resolve.exports@^2.0.0: version "2.0.2" resolved "https://registry.yarnpkg.com/resolve.exports/-/resolve.exports-2.0.2.tgz#f8c934b8e6a13f539e38b7098e2e36134f01e800" @@ -20682,13 +20170,6 @@ safe-stable-stringify@^2.1.0: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -saxes@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-5.0.1.tgz#eebab953fa3b7608dbe94e5dadb15c888fa6696d" - integrity sha512-5LBh1Tls8c9xgGjw3QrMwETmTMVk0oFgvrFSvWx62llR2hcEInrKNZ2GZCCuuy2lvWrdl5jhbpeqc5hRYKFOcw== - dependencies: - xmlchars "^2.2.0" - scheduler@^0.21.0: version "0.21.0" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820" @@ -21637,7 +21118,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: +"string-width-cjs@npm:string-width@^4.2.0": version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -21655,6 +21136,15 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" +"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: + version "4.2.3" + resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -21751,7 +21241,7 @@ stringify-package@^1.0.1: resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: +"strip-ansi-cjs@npm:strip-ansi@^6.0.1": version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -21779,6 +21269,13 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" +strip-ansi@^6.0.0, strip-ansi@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" + integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== + dependencies: + ansi-regex "^5.0.1" + strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -21940,7 +21437,7 @@ supports-color@^8.0.0, supports-color@^8.1.1: dependencies: has-flag "^4.0.0" -supports-hyperlinks@^2.0.0, supports-hyperlinks@^2.1.0: +supports-hyperlinks@^2.1.0: version "2.3.0" resolved "https://registry.yarnpkg.com/supports-hyperlinks/-/supports-hyperlinks-2.3.0.tgz#3943544347c1ff90b15effb03fc14ae45ec10624" integrity sha512-RpsAZlpWcDwOPQA22aCH4J0t7L8JmAvsCxfOSEwm7cQs3LshN36QaTkwd70DnBOXDWGssw2eUoc8CaRWT0XunA== @@ -22001,11 +21498,6 @@ symbol-observable@^2.0.3: resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - synthetix-js@^2.74.1: version "2.101.2" resolved "https://registry.yarnpkg.com/synthetix-js/-/synthetix-js-2.101.2.tgz#9394967368fcf8183743a4b05d49889fd7fdbd21" @@ -22223,11 +21715,6 @@ thread-stream@^0.15.1: dependencies: real-require "^0.1.0" -throat@^6.0.1: - version "6.0.2" - resolved "https://registry.yarnpkg.com/throat/-/throat-6.0.2.tgz#51a3fbb5e11ae72e2cf74861ed5c8020f89f29fe" - integrity sha512-WKexMoJj3vEuK0yFEapj8y64V0A6xcuPuK9Gt1d0R+dzCSJc0lHqQytAbSB4cDAK0dWh4T0E2ETkoLE2WZ41OQ== - throttleit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/throttleit/-/throttleit-1.0.1.tgz#304ec51631c3b770c65c6c6f76938b384000f4d5" @@ -22392,13 +21879,6 @@ toxic@^1.0.0: dependencies: lodash "^4.17.10" -tr46@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-2.1.0.tgz#fa87aa81ca5d5941da8cbf1f9b749dc969a4e240" - integrity sha512-15Ih7phfcdP5YxqiB+iDtLoaTz4Nd35+IiAv0kQ5FNKHzXgdWqPoTIqEDDJmXceQt4JZk6lVPT8lnDlPpGDppw== - dependencies: - punycode "^2.1.1" - tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -23191,15 +22671,6 @@ v8-compile-cache@^2.0.3: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.4.0.tgz#cdada8bec61e15865f05d097c5f4fd30e94dc128" integrity sha512-ocyWc3bAHBB/guyqJQVI5o4BZkPhznPYUG2ea80Gond/BgNWpap8TOmLSeeQG7bnh2KMISxskdADG59j7zruhw== -v8-to-istanbul@^8.1.0: - version "8.1.1" - resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-8.1.1.tgz#77b752fd3975e31bbcef938f85e9bd1c7a8d60ed" - integrity sha512-FGtKtv3xIpR6BYhvgH8MI/y78oT7d8Au3ww4QIxymrCtZEh5b8gCw2siywE+puhEmuWKDtmfrvF5UlB298ut3w== - dependencies: - "@types/istanbul-lib-coverage" "^2.0.1" - convert-source-map "^1.6.0" - source-map "^0.7.3" - v8-to-istanbul@^9.0.1: version "9.2.0" resolved "https://registry.yarnpkg.com/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz#2ed7644a245cddd83d4e087b9b33b3e62dfd10ad" @@ -23290,20 +22761,6 @@ vscode-textmate@^8.0.0: resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== -w3c-hr-time@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz#0a89cdf5cc15822df9c360543676963e0cc308cd" - integrity sha512-z8P5DvDNjKDoFIHK7q8r8lackT6l+jo/Ye3HOle7l9nICP9lf1Ci25fy9vHd0JOWewkIFzXIEig3TdKT7JQ5fQ== - dependencies: - browser-process-hrtime "^1.0.0" - -w3c-xmlserializer@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-2.0.0.tgz#3e7104a05b75146cc60f564380b7f683acf1020a" - integrity sha512-4tzD0mF8iSiMiNs30BiLO3EpfGLZUT2MSX/G+o7ZywDzliWQ3OPtTZ0PTC3B3ca1UAf4cJMHB+2Bf56EriJuRA== - dependencies: - xml-name-validator "^3.0.0" - wait-on@7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-7.0.1.tgz#5cff9f8427e94f4deacbc2762e6b0a489b19eae9" @@ -23702,13 +23159,6 @@ websocket@^1.0.32: utf-8-validate "^5.0.2" yaeti "^0.0.6" -whatwg-encoding@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-1.0.5.tgz#5abacf777c32166a51d085d6b4f3e7d27113ddb0" - integrity sha512-b5lim54JOPN9HtzvK9HFXvBma/rnfFeqsic0hSpjtDbVxR3dJKLc+KB4V6GgiGOvl7CY/KNh8rxSo9DKQrnUEw== - dependencies: - iconv-lite "0.4.24" - whatwg-encoding@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/whatwg-encoding/-/whatwg-encoding-2.0.0.tgz#e7635f597fd87020858626805a2729fa7698ac53" @@ -23726,11 +23176,6 @@ whatwg-fetch@^3.0.0, whatwg-fetch@^3.4.1: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== -whatwg-mimetype@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf" - integrity sha512-M4yMwr6mAnQz76TbJm914+gPpB/nCwvZbJU28cUD6dR004SAxDLOOSUaB1JDRqLtaOV/vi0IC5lEAGFgrjGv/g== - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -23739,15 +23184,6 @@ whatwg-url@^5.0.0: tr46 "~0.0.3" webidl-conversions "^3.0.0" -whatwg-url@^8.0.0, whatwg-url@^8.5.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-8.7.0.tgz#656a78e510ff8f3937bc0bcbe9f5c0ac35941b77" - integrity sha512-gAojqb/m9Q8a5IV96E3fHJM70AzCkgt4uXYX2O7EmuyOnLrViCQlsEBmF9UQIu3/aeAIp2U17rtbpZWNntQqdg== - dependencies: - lodash "^4.7.0" - tr46 "^2.1.0" - webidl-conversions "^6.1.0" - which-boxed-primitive@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz#13757bc89b209b049fe5d86430e21cf40a89a8e6" @@ -23898,6 +23334,15 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -24058,16 +23503,6 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: parse-headers "^2.0.0" xtend "^4.0.0" -xml-name-validator@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a" - integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" From cc64a2d0df1c9bd960740c19bff936aaf8687f2a Mon Sep 17 00:00:00 2001 From: Daryl Collins Date: Thu, 25 Apr 2024 22:56:58 +0100 Subject: [PATCH 005/136] fix(e2e-tests): Use test.each() to describe multiple test cases in a single test with their own timing data --- packages/e2e-tests/src/tests/jest-e2e-2.spec.ts | 11 +++++------ packages/e2e-tests/src/tests/jest-e2e.spec.ts | 9 +++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts index dceae2f90b..8de2336b45 100644 --- a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts +++ b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts @@ -1,5 +1,4 @@ -// Test command -// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' +import { expect, jest, test } from '@jest/globals'; import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; @@ -10,14 +9,14 @@ try { } describe('connections', () => { - test('test multiple networks', async () => { - for (let network of ['habanero', 'manzano', 'cayenne']) { - console.log(`Testing network: ${network}`); + test.each(['habanero', 'manzano', 'cayenne'])( + 'Testing network: %s', + async (network) => { const litDev: DevEnv = await devEnv({ network: network as TESTABLE_NETWORK_TYPE, }); expect(litDev.litNodeClient.ready).toBe(true); expect(litDev.litNodeClient.config.litNetwork).toBe(network); } - }); + ); }); diff --git a/packages/e2e-tests/src/tests/jest-e2e.spec.ts b/packages/e2e-tests/src/tests/jest-e2e.spec.ts index dceae2f90b..7db66d01d7 100644 --- a/packages/e2e-tests/src/tests/jest-e2e.spec.ts +++ b/packages/e2e-tests/src/tests/jest-e2e.spec.ts @@ -2,6 +2,7 @@ // npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; +import { expect, test } from '@jest/globals'; try { jest.setTimeout(60000); @@ -10,14 +11,14 @@ try { } describe('connections', () => { - test('test multiple networks', async () => { - for (let network of ['habanero', 'manzano', 'cayenne']) { - console.log(`Testing network: ${network}`); + test.each(['habanero', 'manzano', 'cayenne'])( + 'Testing network in e2e-2: %s', + async (network) => { const litDev: DevEnv = await devEnv({ network: network as TESTABLE_NETWORK_TYPE, }); expect(litDev.litNodeClient.ready).toBe(true); expect(litDev.litNodeClient.config.litNetwork).toBe(network); } - }); + ); }); From de240c9d97e85100605688ecbcc61bd49be7acf2 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 18 Jul 2024 13:14:15 -0400 Subject: [PATCH 006/136] dev: upgrade tests to use Tinny and fix TSC errors --- local-tests/setup/tinny-environment.ts | 41 - packages/e2e-tests/jest.config.ts | 1 + packages/e2e-tests/package.json | 2 +- packages/e2e-tests/setup/accs/accs.ts | 68 + .../setup/networkContext.example.json | 0 packages/e2e-tests/setup/networkContext.json | 11370 ++++++++++++++++ .../session-sigs/get-eoa-session-sigs.ts | 156 + .../get-lit-action-session-sigs.ts | 167 + .../session-sigs/get-pkp-session-sigs.ts | 47 + packages/e2e-tests/setup/shiva-client.d.ts | 72 + packages/e2e-tests/setup/shiva-client.ts | 299 + packages/e2e-tests/setup/tinny-config.ts | 141 + packages/e2e-tests/setup/tinny-environment.ts | 538 + packages/e2e-tests/setup/tinny-person.ts | 220 + packages/e2e-tests/setup/tinny-utils.ts | 65 + packages/e2e-tests/src/setup/env-setup.ts | 64 - .../e2e-tests/src/tests/jest-e2e-2.spec.ts | 17 +- packages/e2e-tests/src/tests/jest-e2e.spec.ts | 24 - yarn.lock | 206 +- 19 files changed, 13209 insertions(+), 289 deletions(-) create mode 100644 packages/e2e-tests/setup/accs/accs.ts rename packages/e2e-tests/{src => }/setup/networkContext.example.json (100%) create mode 100644 packages/e2e-tests/setup/networkContext.json create mode 100644 packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts create mode 100644 packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts create mode 100644 packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts create mode 100644 packages/e2e-tests/setup/shiva-client.d.ts create mode 100644 packages/e2e-tests/setup/shiva-client.ts create mode 100644 packages/e2e-tests/setup/tinny-config.ts create mode 100644 packages/e2e-tests/setup/tinny-environment.ts create mode 100644 packages/e2e-tests/setup/tinny-person.ts create mode 100644 packages/e2e-tests/setup/tinny-utils.ts delete mode 100644 packages/e2e-tests/src/setup/env-setup.ts delete mode 100644 packages/e2e-tests/src/tests/jest-e2e.spec.ts diff --git a/local-tests/setup/tinny-environment.ts b/local-tests/setup/tinny-environment.ts index 025a18f576..493317a7df 100644 --- a/local-tests/setup/tinny-environment.ts +++ b/local-tests/setup/tinny-environment.ts @@ -484,46 +484,5 @@ export class TinnyEnvironment { } await this.contractsClient.connect(); - - /** - * ==================================== - * Mint a Capacity Credits NFT and get a capacity delegation authSig with it - * ==================================== - */ - - // Disabled for now - async function _mintSuperCapacityDelegationAuthSig() { - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - try { - const capacityTokenId = ( - await this.contractsClient.mintCapacityCreditsNFT({ - requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - ).capacityTokenIdStr; - - this.superCapacityDelegationAuthSig = ( - await this.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: wallet, - capacityTokenId: capacityTokenId, - // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it - uses: '200', - }) - ).capacityDelegationAuthSig; - } catch (e: any) { - if ( - e.message.includes(`Can't allocate capacity beyond the global max`) - ) { - console.log('❗️Skipping capacity delegation auth sig setup.', e); - } else { - console.log( - '❗️Error while setting up capacity delegation auth sig', - e - ); - } - } - } }; } diff --git a/packages/e2e-tests/jest.config.ts b/packages/e2e-tests/jest.config.ts index bc5092c135..7440ea989b 100644 --- a/packages/e2e-tests/jest.config.ts +++ b/packages/e2e-tests/jest.config.ts @@ -8,4 +8,5 @@ export default { moduleFileExtensions: ['ts', 'js', 'html'], coverageDirectory: '../../coverage/packages/e2e-tests', setupFilesAfterEnv: ['../../jest.setup.js'], + diagnostics: false, }; diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index bce91cabcb..da5850e49a 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -17,7 +17,7 @@ "tags": [ "universal" ], - "version": "4.2.1", + "version": "6.2.0", "main": "./dist/src/index.js", "typings": "./dist/src/index.d.ts" } diff --git a/packages/e2e-tests/setup/accs/accs.ts b/packages/e2e-tests/setup/accs/accs.ts new file mode 100644 index 0000000000..db07c7dec1 --- /dev/null +++ b/packages/e2e-tests/setup/accs/accs.ts @@ -0,0 +1,68 @@ +import { + LPACC_EVM_ATOM, + LPACC_EVM_BASIC, + LPACC_SOL, +} from '@lit-protocol/accs-schemas'; + +export namespace AccessControlConditions { + export const getEmvBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_EVM_BASIC[] => { + return [ + { + contractAddress: '', + standardContractType: '', + chain: 'ethereum', + method: '', + parameters: [':userAddress'], + returnValueTest: { + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + + export const getSolBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_SOL[] => { + return [ + { + method: '', + params: [':userAddress'], + pdaParams: [], + pdaInterface: { offset: 0, fields: {} }, + pdaKey: '', + chain: 'solana', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + + export const getCosmosBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_EVM_ATOM[] => { + return [ + { + conditionType: 'cosmos', + path: ':userAddress', + chain: 'cosmos', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; +} diff --git a/packages/e2e-tests/src/setup/networkContext.example.json b/packages/e2e-tests/setup/networkContext.example.json similarity index 100% rename from packages/e2e-tests/src/setup/networkContext.example.json rename to packages/e2e-tests/setup/networkContext.example.json diff --git a/packages/e2e-tests/setup/networkContext.json b/packages/e2e-tests/setup/networkContext.json new file mode 100644 index 0000000000..aabf963710 --- /dev/null +++ b/packages/e2e-tests/setup/networkContext.json @@ -0,0 +1,11370 @@ +{ + "Allowlist": { + "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Allowlist" + }, + "LITToken": { + "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "LITToken" + }, + "Multisender": { + "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Multisender" + }, + "PKPHelper": { + "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPHelper" + }, + "PKPNFT": { + "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPNFT" + }, + "PKPNFTMetadata": { + "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPNFTMetadata" + }, + "PKPPermissions": { + "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPPermissions" + }, + "PubkeyRouter": { + "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PubkeyRouter" + }, + "RateLimitNFT": { + "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "RateLimitNFT" + }, + "Staking": { + "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ComplaintConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setComplaintConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "newConfig", + "type": "tuple" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "complaintConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "Staking" + }, + "StakingBalances": { + "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "StakingBalances" + }, + "ContractResolver": { + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "abi": [ + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AdminRoleRequired", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "SetContract", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ALLOWLIST_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BACKUP_RECOVERY_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_WALLET_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HD_KEY_DERIVER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIT_TOKEN_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTI_SENDER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAYMENT_DELEGATION_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_HELPER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_METADATA_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_PERMISSIONS_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PUB_KEY_ROUTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_LIMIT_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELEASE_REGISTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_BALANCES_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "addAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "adminBeingRemoved", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "removeAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "name": "typeAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "ContractResolver" + } +} diff --git a/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts new file mode 100644 index 0000000000..15db3a3f6f --- /dev/null +++ b/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts @@ -0,0 +1,156 @@ +import { + LitActionResource, + LitPKPResource, + generateAuthSig, + createSiweMessageWithRecaps, +} from '@lit-protocol/auth-helpers'; +import { + AuthCallbackParams, + AuthSig, + LitAbility, + LitResourceAbilityRequest, +} from '@lit-protocol/types'; +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyPerson } from '../tinny-person'; +import { TinnyEnvironment } from '../tinny-environment'; + +/** + * Retrieves the session signatures for an EOA in a given Tinny environment. + * + * @param devEnv - The Tinny environment object. + * @param person - The Tinny person object representing the EOA. + * @param resourceAbilityRequests - Optional. An array of resource ability requests. If not provided, default requests will be used. + * @returns A promise that resolves to the session signatures. + */ +export const getEoaSessionSigs = async ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to eoaSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: _resourceAbilityRequests, + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests, + }: AuthCallbackParams) => { + console.log('resourceAbilityRequests:', resourceAbilityRequests); + + if (!expiration) { + throw new Error('expiration is required'); + } + + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + + if (!uri) { + throw new Error('uri is required'); + } + + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: person.wallet.address, + nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: person.wallet, + toSign, + }); + + return authSig; + }, + + // -- only add this for manzano network because of rate limiting + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] } + : {}), + } as any); // todo: remove any cast + + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + + return sessionSigs; +}; + +export const getEoaSessionSigsWithCapacityDelegations = async ( + devEnv: TinnyEnvironment, + fromWallet: ethers.Wallet, + capacityDelegationAuthSig: AuthSig +) => { + const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests, + }: AuthCallbackParams) => { + if (!expiration) { + throw new Error('expiration is required'); + } + + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + + if (!uri) { + throw new Error('uri is required'); + } + + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: fromWallet.address, + nonce: devEnv.litNodeClient?.latestBlockhash!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: fromWallet, + toSign, + }); + + return authSig; + }, + capacityDelegationAuthSig: capacityDelegationAuthSig, + }); + + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + + return sessionSigs; +}; diff --git a/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts new file mode 100644 index 0000000000..364414733e --- /dev/null +++ b/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts @@ -0,0 +1,167 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyPerson } from '../tinny-person'; +import { TinnyEnvironment } from '../tinny-environment'; + +const VALID_SESSION_SIG_LIT_ACTION_CODE = ` +// Works with an AuthSig AuthMethod +if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { + LitActions.setResponse({ response: "true" }); +} else { + LitActions.setResponse({ response: "false" }); +} +`; + +const INVALID_SESSION_SIG_LIT_ACTION_CODE = ` +(async () => { + let utf8Encode = new TextEncoder(); + const toSign = utf8Encode.encode('This message is exactly 32 bytes'); + const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); +})(); +`; + +/** + * https://cloudflare-ipfs.com/ipfs/QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp + */ +export const VALID_IPFS_ID = 'QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp'; + +/** + * https://cloudflare-ipfs.com/ipfs/QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm + */ +export const INVALID_IPFS_ID = 'QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm'; + +export const getLitActionSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const litActionSessionSigs = + await devEnv.litNodeClient?.getLitActionSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: _resourceAbilityRequests, + litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString( + 'base64' + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + return litActionSessionSigs; +}; + +export const getLitActionSessionSigsUsingIpfsId = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: _resourceAbilityRequests, + litActionIpfsId: VALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp!.publicKey, + sigName: 'unified-auth-sig', + }, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + return litActionSessionSigs; +}; + +export const getInvalidLitActionSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson +) => { + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + ], + litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString( + 'base64' + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + }); + + return litActionSessionSigs; +}; + +export const getInvalidLitActionIpfsSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson +) => { + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + ], + litActionIpfsId: INVALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + }); + + return litActionSessionSigs; +}; diff --git a/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts new file mode 100644 index 0000000000..dd71d4e31f --- /dev/null +++ b/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts @@ -0,0 +1,47 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; +import { log } from '@lit-protocol/misc'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyEnvironment } from '../tinny-environment'; +import { TinnyPerson } from '../tinny-person'; + +export const getPkpSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[], + expiration?: string +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to pkpSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const pkpSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + expiration, + resourceAbilityRequests: _resourceAbilityRequests, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + log('[getPkpSessionSigs]: ', pkpSessionSigs); + + return pkpSessionSigs; +}; diff --git a/packages/e2e-tests/setup/shiva-client.d.ts b/packages/e2e-tests/setup/shiva-client.d.ts new file mode 100644 index 0000000000..7bb27c17a6 --- /dev/null +++ b/packages/e2e-tests/setup/shiva-client.d.ts @@ -0,0 +1,72 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +type ContractAbis = { + litToken: string; + erc20: string; + backupRecovery: string; + staking: string; + stakingBalances: string; + rateLimitNft: string; + pkpnft: string; + pubkeyRouter: string; + pkpPermissions: string; + pkpHelper: string; + contractResolver: string; + paymentDelegation: string; +}; + +type ContractAddresses = { + litToken: string; + backupRecovery: string; + staking: string; + stakingBalances: string; + rateLimitNft: string; + pkpnft: string; + pubkeyRouter: string; + pkpPermissions: string; + pkpHelper: string; + contractResolver: string; + keyDeriver: string; + paymentDelegation: string; +}; + +type TestNetCreateRequest = { + nodeCount: number; + pollingInterval: string; + epochLength: number; + customBuildPath: string | null; + litActionServerCustomBuildPath: string | null; + existingConfigPath: string | null; + which: string | null; + ecdsaRoundTimeout: string | null; + enableRateLimiting: string | null; +}; + +type TestNetInfo = { + contractAddresses: ContractAddresses; + validatorAddresses: Array; + contractResolverAbi: string; + rpcUrl: string; + epochLength: number; + contractAbis: ContractAbis; +}; + +type TestNetResponse = { + testnetId: string; + command: string; + wasCanceled: boolean; + body: T | null; + lastStateObserved: string | null; + messages: Array | null; + errors: Array | null; +}; + +type TestNetState = 'Busy' | 'Active' | 'Mutating' | 'Shutdown' | 'UNKNOWN'; + +export { + ContractAbis, + ContractAddresses, + TestNetCreateRequest, + TestNetInfo, + TestNetResponse, + TestNetState, +}; diff --git a/packages/e2e-tests/setup/shiva-client.ts b/packages/e2e-tests/setup/shiva-client.ts new file mode 100644 index 0000000000..59da1f90d3 --- /dev/null +++ b/packages/e2e-tests/setup/shiva-client.ts @@ -0,0 +1,299 @@ +import { LitContractResolverContext } from '@lit-protocol/types'; +import { ethers } from 'ethers'; +import { + TestNetCreateRequest, + TestNetInfo, + TestNetResponse, + TestNetState, +} from './shiva-client.d'; + +export interface ShivaEnvs { + /** + * If runnnig no localchain this flag will stop the running testnet when the test + * run has finished. Which is when all pending task promises have settled. + */ + STOP_TESTNET: boolean; + + /** + * URL for Testnet manager intigration + */ + TESTNET_MANAGER_URL: string; + + /** + * Path to the Lit Node Binary to use. Can be configured through an env variable + * LIT_NODE_BINARY_PATH where the value is the local path to a built Lit Action Binary + * If flagging to not use the binary path this option will be ignored. + * See {@link USE_LIT_BINARIES} and {@link LIT_ACTION_BINARY_PATH} + */ + LIT_NODE_BINARY_PATH: string; + + /** + * Path to lit action binary to use, Can be defined through env variable + * LIT_ACTION_BINARY_PATH where the value is the local path to a built Lit Action Binary. + * If flagging not to use the binary path this option will be ignored + * See {@link USE_LIT_BINARIES} and {@link LIT_NODE_BINARY_PATH} + */ + LIT_ACTION_BINARY_PATH: string; + + /** + * Flag to indicate if the provided binary path should be used + * or if the testnet should be built from source before starting. + */ + USE_LIT_BINARIES: boolean; +} + +/** + * Client implementation for a single testnet instance managed by the Shiva tool + * Is essentially a localchain setup but allows for programmatic operations to be performed + * on the network from the implementation within this class. Each testnet is a unique network + */ +export class TestnetClient { + private _id: string | undefined; + private _info: TestNetInfo | undefined; + private _processEnvs: ShivaEnvs | undefined; + private _currentState: TestNetState | undefined; + + constructor(id: string, envs: ShivaEnvs) { + this._processEnvs = envs; + this._id = id; + } + + /* + Returns the testnet information + pub struct TestNetInfo { + pub contract_addresses: ContractAddresses, + pub validator_addresses: Vec, + pub contract_resolver_abi: String, + pub rpc_url: String, + pub epoch_length: i32, + } + */ + get Info(): TestNetInfo | undefined { + return this._info; + } + + get ContractContext(): LitContractResolverContext | undefined { + const testNetConfig = this.Info; + if (!testNetConfig) { + return undefined; + } + + const contractResolverAbi: string = testNetConfig.contractResolverAbi; + const contractResolverAddress = + testNetConfig.contractAddresses[`contractResolver`]; + const networkContext = { + abi: JSON.parse(contractResolverAbi), + resolverAddress: contractResolverAddress, + provider: new ethers.providers.JsonRpcProvider( + `http://${testNetConfig.rpcUrl}` + ), + environment: 0, // test deployment uses env value 0 in test common + }; + return networkContext; + } + + /** + * Polls a given testnet for the ACTIVE state + * polls on a 500 milisecond interval + */ + public async pollTestnetForActive(): Promise { + let state = 'Busy'; + while (state != 'Active' && state != `UNKNOWN`) { + const pollRes = await fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/poll/testnet/' + + this._id + ); + const res = await pollRes.json(); + state = res.body; + console.log('found state to be', res); + if (state != 'Active' && state != 'UNKNOWN') { + await new Promise((res, _) => { + setTimeout(() => { + res(); + }, 500); + }); + } else { + break; + } + } + + return state; + } + + /** + * returns the config for a given testnet + * struct reference for config + */ + public getTestnetConfig() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/get/info/testnet/' + + this._id + ) + .then((res: Response) => { + return res.json(); + }) + .then((info: TestNetResponse) => { + this._info = info.body!; + this._currentState = info.lastStateObserved as TestNetState; + console.log('setting testnet info: ', this._info); + }); + } + + /** + * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + public transitionEpochAndWait() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/action/transition/epoch/wait/' + + this._id + ) + .then((res: Response) => { + if (res.status === 200) { + return res.json(); + } else { + throw res; + } + }) + .then((body: any) => { + console.log('Stopped random peer: ', body); + }); + } + + /** + * Stops a random peer and waits for the next epoc to transiton. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + public stopRandomNetworkPeerAndWaitForNextEpoch() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/action/stop/random/wait/' + + this._id + ) + .then((res: Response) => { + if (res.status === 200) { + return res.json(); + } else { + throw res; + } + }) + .then((body: TestNetResponse) => { + console.log('validator kick response: ', body); + return body; + }); + } + + /* + Stops the testnet + */ + public stopTestnet() { + console.log('stopping testnet with id:', this._id); + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/delete/testnet/' + + this._id + ) + .then((res: Response) => { + return res.json(); + }) + .then((body: TestNetResponse) => { + console.log('shutdown respone: ', body); + }); + } +} + +export class ShivaClient { + private _clients: Map; + public processEnvs: ShivaEnvs = { + STOP_TESTNET: process.env[`STOP_TESTNET`] === 'true', + TESTNET_MANAGER_URL: + process.env['TESTNET_MANAGER_URL'] || 'http://0.0.0.0:8000', + USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, + LIT_NODE_BINARY_PATH: + process.env['LIT_NODE_BINARY_PATH'] || + `./../../lit-assets/rust/lit-node/target/debug/lit_node`, + LIT_ACTION_BINARY_PATH: + process.env['LIT_ACTION_BINARY_PATH'] || + `./../../lit-assets/rust/lit-actions/target/debug/lit_actions`, + }; + + constructor() { + this._clients = new Map(); + console.log('Shiva environment loaded current config: ', this.processEnvs); + } + + /** + * Used to start an instance of a lit network through the Lit Testnet Manager + * if an isntance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. + * If an instance does not exist then we create one + * struct reference + pub struct TestNetCreateRequest { + pub node_count: usize, + pub polling_interval: String, + pub epoch_length: i32, + pub custom_build_path: Option, + pub lit_action_server_custom_build_path: Option, + pub existing_config_path: Option, + pub which: Option, + pub ecdsa_round_timeout: Option, + pub enable_rate_limiting: Option, + } + */ + async startTestnetManager( + createReq?: TestNetCreateRequest + ): Promise { + const existingTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets' + ); + const existingTestnets: string[] = await existingTestnetResp.json(); + if (existingTestnets.length > 0) { + this._clients.set( + existingTestnets[0], + new TestnetClient(existingTestnets[0], this.processEnvs) + ); + return this._clients.get(existingTestnets[0])!; + } else { + console.log( + 'lit node binary path: ', + this.processEnvs.LIT_NODE_BINARY_PATH + ); + console.log( + 'lit action server binary path: ', + this.processEnvs.LIT_ACTION_BINARY_PATH + ); + let body: Partial = createReq ?? { + nodeCount: 3, + pollingInterval: '2000', + epochLength: 100, + }; + + if (this.processEnvs.USE_LIT_BINARIES) { + body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; + body.litActionServerCustomBuildPath = + this.processEnvs.LIT_ACTION_BINARY_PATH; + } + console.log('Testnet create args: ', body); + const createTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(body), + } + ); + + const createTestnet = await createTestnetResp.json(); + this._clients.set( + createTestnet.testnetId, + new TestnetClient(createTestnet.testnetId, this.processEnvs) + ); + + return this._clients.get(createTestnet.testnetId)!; + } + } +} diff --git a/packages/e2e-tests/setup/tinny-config.ts b/packages/e2e-tests/setup/tinny-config.ts new file mode 100644 index 0000000000..4ac93019a1 --- /dev/null +++ b/packages/e2e-tests/setup/tinny-config.ts @@ -0,0 +1,141 @@ +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { LitContractResolverContext } from '@lit-protocol/types'; + +export enum LIT_TESTNET { + LOCALCHAIN = 'localchain', + MANZANO = 'manzano', + CAYENNE = 'cayenne', + DATIL_DEV = 'datil-dev', + DATIL_TEST = 'datil-test', +} + +export enum LIT_RPC { + LOCAL_ANVIL = 'http://127.0.0.1:8545', + CHRONICLE = 'https://chain-rpc.litprotocol.com/http', + VESUVIUS = 'https://vesuvius-rpc.litprotocol.com', +} + +/** + * Mapping of testnet names to corresponding RPC endpoints. + */ +export const RPC_MAP = { + [LIT_TESTNET.LOCALCHAIN]: LIT_RPC.LOCAL_ANVIL, + [LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE, + [LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE, + [LIT_TESTNET.DATIL_DEV]: LIT_RPC.VESUVIUS, + [LIT_TESTNET.DATIL_TEST]: LIT_RPC.VESUVIUS, +}; + +/** + * Represents the configuration options for the process environment. + */ +export interface ProcessEnvs { + /** + * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. + */ + MAX_ATTEMPTS: number; + + /** + * The maximum number of milliseconds to wait for a test to complete. + */ + TEST_TIMEOUT: number; + + /** + * The network to use for testing. This can be one of the following: + * - `LIT_TESTNET.LOCALCHAIN` + * - `LIT_TESTNET.MANZANO` + * - `LIT_TESTNET.CAYENNE` + * - `LIT_TESTNET.DATIL_DEV` + */ + NETWORK: LIT_TESTNET; + + /** + * The number of milliseconds to wait between each request. + */ + DEBUG: boolean; + + /** + * Capacity Credits: In order to execute a transaction with Lit, you’ll need to reserve capacity on the network using Capacity Credits. These allow holders to reserve a set number of requests over a desired period of time (by default expiration set to 2 days) + */ + REQUEST_PER_KILOSECOND: number; + + /** + * Wait time in milliseconds if no private keys are available. + */ + WAIT_FOR_KEY_INTERVAL: number; + + /** + * Time to wait before releasing the key after requesting it. + */ + TIME_TO_RELEASE_KEY: number; + + /** + * Run all the tests in a single thread. + */ + RUN_IN_BAND: boolean; + + /** + * The interval in milliseconds to run the tests in a single thread. + */ + RUN_IN_BAND_INTERVAL: number; + + // =========== In most cases you won't need to change the following values =========== + /** + * The URL of Lit RPC server. + * - If it's running locally on Anvil, it should be 'http://127.0.0.1:8545' + * - If it's running on Chronicle, it should be 'https://chain-rpc.litprotocol.com/http' + * - If it's running on Vesuvius, it should be 'https://vesuvius-rpc.litprotocol.com' + */ + 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. + */ + PRIVATE_KEYS: string[]; + + /** + * The list of keys that are currently in use. + */ + KEY_IN_USE: boolean[]; + + /** + * Ignore setup steps. Usually when you run to quickly run a single test. + */ + NO_SETUP: boolean; + + /** + * Use shiva as a test network which will spawn before the test run starts + */ + USE_SHIVA: boolean; + + /** + * The network configuration which will be used for `contract context` if provided. + * it is assumed the context will work with the {@link NETWORK} provided. If the configuration + * is not for the provided network then there could be undefined behavior. + * If {@link USE_SHIVA} is set to true then the network configuration will be loaded implicitly and + * this value will be ignored + */ + NETWORK_CONFIG: string; +} + +/** + * Represents the PKP information. + */ +export type PKPInfo = { + tokenId: string; + publicKey: string; + ethAddress: string; +}; + +export interface TinnyEnvConfig { + rpc: string; + litNodeClient: LitNodeClient; + network: LIT_TESTNET; + processEnvs: ProcessEnvs; + contractContext?: LitContractResolverContext; +} diff --git a/packages/e2e-tests/setup/tinny-environment.ts b/packages/e2e-tests/setup/tinny-environment.ts new file mode 100644 index 0000000000..3c9767de79 --- /dev/null +++ b/packages/e2e-tests/setup/tinny-environment.ts @@ -0,0 +1,538 @@ +import { + LIT_TESTNET, + ProcessEnvs, + RPC_MAP, + TinnyEnvConfig, +} from './tinny-config'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { + AuthSig, + CosmosAuthSig, + LitContractContext, + LitContractResolverContext, + SolanaAuthSig, +} from '@lit-protocol/types'; +import { TinnyPerson } from './tinny-person'; + +import { ethers } from 'ethers'; +import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; +import { ShivaClient, TestnetClient } from './shiva-client'; + +import 'dotenv/config'; +console.log('Loading env vars from dot config...'); +console.log('Done loading env', process.env['DEBUG']); + +declare var globalThis: any; +export class TinnyEnvironment { + public network: LIT_TESTNET; + + /** + * Environment variables used in the process. + */ + public processEnvs: ProcessEnvs = { + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS'] as string) || 1, + TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT'] as string) || 45000, + NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, + DEBUG: process.env['DEBUG'] === 'true', + REQUEST_PER_KILOSECOND: + parseInt(process.env['REQUEST_PER_KILOSECOND'] ?? '') || 200, + LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? 'http://127.0.0.1:8545', // localhost rpc if not provided + 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, + + // Available Accounts + // ================== + // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) + // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) + // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) + // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) + // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) + // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) + // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) + // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) + // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) + PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ + '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', + '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', + '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', + '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', + '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', + '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', + '0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356', + '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', + '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', + ], + KEY_IN_USE: new Array(), + NO_SETUP: process.env['NO_SETUP'] === 'true', + USE_SHIVA: process.env['USE_SHIVA'] === 'true', + NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', + }; + + public litNodeClient: LitNodeClient | undefined; + public contractsClient: LitContracts | undefined; + public rpc: string; + public superCapacityDelegationAuthSig: AuthSig | undefined; + public bareEthAuthSig: AuthSig | undefined; + public bareSolAuthSig: SolanaAuthSig = { + sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', + derivedVia: 'solana.signMessage', + signedMessage: + 'I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z', + address: 'F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1', + }; + + public bareCosmosAuthSig: CosmosAuthSig = { + sig: 'dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==', + derivedVia: 'cosmos.signArbitrary', + signedMessage: + '8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b', + address: 'cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku', + }; + + public testnet: TestnetClient | undefined; + //=========== PRIVATE MEMBERS =========== + private _shivaClient: ShivaClient = new ShivaClient(); + private _contractContext: + | LitContractContext + | LitContractResolverContext + | undefined; + + constructor(network?: LIT_TESTNET) { + // -- setup networkj + this.network = network || this.processEnvs.NETWORK; + + if (Object.values(LIT_TESTNET).indexOf(this.network) === -1) { + throw new Error( + `Invalid network environment. Please use one of ${Object.values( + LIT_TESTNET + )}` + ); + } + + // -- create an empty array to keep track of all keys + this.processEnvs.KEY_IN_USE = new Array( + this.processEnvs.PRIVATE_KEYS.length + ).fill(false); + + // -- setup rpc + // Priority: + // 1. Use environment variable if set + // 2. Use RPC_MAP if network is recognized + // 3. Throw error if neither condition is met + if (this.processEnvs.LIT_RPC_URL) { + // If LIT_RPC_URL is set in the environment, use it + this.rpc = this.processEnvs.LIT_RPC_URL; + } else if (this.network in RPC_MAP) { + // If the network is recognized in RPC_MAP, use the corresponding RPC URL + this.rpc = RPC_MAP[this.network]; + } else { + // If neither condition is met, throw an error with available options + const availableNetworks = Object.keys(RPC_MAP).join(', '); + throw new Error( + `No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}` + ); + } + + console.log( + '[𐬺πŸ§ͺ Tinny Environment𐬺] Done configuring enviorment current config: ', + this.processEnvs + ); + } + + world: Map = new Map(); + + /** + * Retrieves an available private key from a list, marking it as in use and scheduling + * its automatic release. If no unused keys are available, it waits for a set interval + * before rechecking. + * + * This function loops until it finds an unused key, marks it, and returns the key with + * its index. If all keys are in use, it logs a wait message and pauses before retrying. + * + * Outputs: + * - privateKey: The selected private key. + * - index: The index of the selected key. + * + * Environment variables required: + * - KEY_IN_USE: Boolean array indicating key usage. + * - PRIVATE_KEYS: Array of key strings. + * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. + * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. + */ + async getAvailablePrivateKey(): Promise<{ + privateKey: string; + index: number; + }> { + while (true) { + const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key + + if (index !== -1) { + // If an available key is found + this.processEnvs.KEY_IN_USE[index] = true; // Mark the key as in use + // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] πŸ”‘ Selected key at index', index); // Log a message indicating that we have selected a key + + return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index + } else { + // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting + // Wait for the specified interval before checking again + await new Promise((resolve) => + setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) + ); + } + } + } + + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKeyFromUser(user: TinnyPerson) { + const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` + // ); + } + + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKey(index: number) { + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` + // ); + } + + /** + * Initializes the LitNodeClient based on the specified network configuration and environment variables. + * This setup differentiates between local and production environments, adjusts node attestation checks, + * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. + * + * The LitNodeClient is configured differently based on the network: + * - LOCALCHAIN: Uses custom settings for local testing, with node attestation disabled. + * - MANZANO (or other specified testnets): Configures for specific network environments with node attestation enabled. + * + * Logs the process and exits if the client is not ready after attempting to connect. + */ + + async setupLitNodeClient() { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Setting up LitNodeClient'); + + if (this.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = + this?.testnet?.ContractContext ?? this._contractContext; + this.litNodeClient = new LitNodeClient({ + litNetwork: 'custom', + rpcUrl: this.rpc, + debug: this.processEnvs.DEBUG, + checkNodeAttestation: false, // disable node attestation check for local testing + contractContext: networkContext, + }); + } else if (this.network === LIT_TESTNET.MANZANO) { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, // 'habanero' or 'manzano' + checkNodeAttestation: true, + debug: this.processEnvs.DEBUG, + }); + } else { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: false, + debug: this.processEnvs.DEBUG, + }); + } + + if (globalThis.wasmExports) { + console.warn( + 'WASM modules already loaded. Will overide when connect is called' + ); + } + + if (globalThis.wasmECDSA) { + console.warn( + 'WASM modules already loaded. wil overide. when connect is called' + ); + } + + if (globalThis.wasmSevSnpUtils) { + console.warn( + 'WASM modules already loaded. wil overide. when connect is called' + ); + } + + await this.litNodeClient.connect(); + + if (!this.litNodeClient.ready) { + console.error('❌ litNodeClient not ready'); + process.exit(); + } + } + + /** + * Retrieves the environment configuration. + * @returns The TinnyEnvConfig object containing the environment configuration. + */ + getEnvConfig(): TinnyEnvConfig { + const contractContext = + this?.testnet?.ContractContext ?? this._contractContext; + return { + rpc: this.rpc, + litNodeClient: this.litNodeClient!, + network: this.network, + processEnvs: this.processEnvs, + contractContext: contractContext as LitContractResolverContext, + }; + } + + /** + * Creates a new person with the given name. + * @param name - The name of the person. + * @returns The newly created person. + * @throws Error if the name is not provided. + */ + async createNewPerson(name: string) { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Creating new person:', name); + if (!name) { + throw new Error('Name is required'); + } + const key = await this.getAvailablePrivateKey(); + const privateKey = key.privateKey; + const envConfig = this.getEnvConfig(); + + const person = new TinnyPerson({ + privateKey, + envConfig, + }); + + await person.spawn(); + + this.world.set(name, person); + + return person; + } + + /** + * Retrieves a person from the world by their name. + * @param name - The name of the person to retrieve. + * @returns The person object if found, or undefined if not found. + */ + getPerson(name: string) { + return this.world.get(name); + } + + /** + * Creates a random person. + * @returns A promise that resolves to the created person. + */ + async createRandomPerson() { + return await this.createNewPerson('Alice'); + } + + setUnavailable = (network: LIT_TESTNET) => { + if (this.processEnvs.NETWORK === network) { + throw new Error('LIT_IGNORE_TEST'); + } + }; + + /** + * Init + */ + async init() { + if (this.processEnvs.NO_SETUP) { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); + return; + } + if (this.network === LIT_TESTNET.LOCALCHAIN && this.processEnvs.USE_SHIVA) { + this.testnet = await this._shivaClient.startTestnetManager(); + // wait for the testnet to be active before we start the tests. + let state = await this.testnet.pollTestnetForActive(); + if (state === `UNKNOWN`) { + console.log( + 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' + ); + throw new Error(`Error while creating testnet, aborting test run`); + } + + await this.testnet.getTestnetConfig(); + } else if (this.network === LIT_TESTNET.LOCALCHAIN) { + const context = await import('./networkContext.json'); + this._contractContext = context; + } + + await this.setupLitNodeClient(); + await this.setupSuperCapacityDelegationAuthSig(); + await this.setupBareEthAuthSig(); + } + + /** + * Setup bare eth auth sig to test access control and decryption + */ + async setupBareEthAuthSig() { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + const toSign = await createSiweMessage({ + walletAddress: wallet.address, + nonce: this.litNodeClient?.latestBlockhash!, + expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), + litNodeClient: this.litNodeClient, + }); + + this.bareEthAuthSig = await generateAuthSig({ + signer: wallet, + toSign, + }); + } + + //============= SHIVA ENDPOINTS ============= + /** + * Will stop the testnet that is being used in the test run. + */ + async stopTestnet() { + if ( + this.network === LIT_TESTNET.LOCALCHAIN && + this._shivaClient.processEnvs.STOP_TESTNET + ) { + await this.testnet?.stopTestnet(); + } else { + console.log('skipping testnet shutdown.'); + } + } + //============= END SHIVA ENDPOINTS ============= + + /** + * Sends funds from the current wallet to the specified wallet address. + * @param walletAddress - The address of the recipient wallet. + * @param amount - The amount of funds to send (default: '0.001'). + * @throws If there is an error sending the funds. + */ + getFunds = async (walletAddress: string, amount = '0.001') => { + try { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + const tx = await wallet.sendTransaction({ + to: walletAddress, + value: ethers.utils.parseEther(amount), + }); + + await tx.wait(); + } catch (e) { + throw new Error(`Failed to send funds to ${walletAddress}: ${e}`); + } + }; + + /** + * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global + * max capacity. + */ + setupSuperCapacityDelegationAuthSig = async () => { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = + this?.testnet?.ContractContext ?? this._contractContext; + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + rpc: this.rpc, + customContext: networkContext, + }); + } else { + // scoping `this` for function scope + const me = this; + async function _switchWallet() { + // TODO: This wallet should be cached somehwere and reused to create delegation signatures. + // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. + const capacityCreditWallet = + ethers.Wallet.createRandom().connect(provider); + + // get wallet balance + const balance = await wallet.getBalance(); + console.log('this.rpc:', me.rpc); + console.log('this.wallet.address', wallet.address); + console.log('Balance:', balance.toString()); + + const transferTx = await wallet.sendTransaction({ + to: capacityCreditWallet.address, + value: ethers.utils.parseEther('0.001'), + }); + await transferTx.wait(); + } + + // await _switchWallet(); + + this.contractsClient = new LitContracts({ + // signer: capacityCreditWallet, // disabled switch wallet for now + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network, + }); + } + + await this.contractsClient.connect(); + + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + const me = this; + // Disabled for now + const _mintSuperCapacityDelegationAuthSig = async () => { + console.log( + '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' + ); + try { + const capacityTokenId = ( + await me.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + this.superCapacityDelegationAuthSig = ( + await this.litNodeClient?.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId: capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: '200', + }) + )?.capacityDelegationAuthSig; + } catch (e: any) { + if ( + e.message.includes(`Can't allocate capacity beyond the global max`) + ) { + console.log('❗️Skipping capacity delegation auth sig setup.', e); + } else { + console.log( + '❗️Error while setting up capacity delegation auth sig', + e + ); + } + } + }; + }; +} diff --git a/packages/e2e-tests/setup/tinny-person.ts b/packages/e2e-tests/setup/tinny-person.ts new file mode 100644 index 0000000000..5645427e4b --- /dev/null +++ b/packages/e2e-tests/setup/tinny-person.ts @@ -0,0 +1,220 @@ +import { + AuthSig, + generateAuthSig, + createSiweMessage, +} from '@lit-protocol/auth-helpers'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { + AuthMethod, + BaseSiweMessage, + LitContractContext, +} from '@lit-protocol/types'; +import { ethers } from 'ethers'; +import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; +import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; +import { AuthMethodScope } from '@lit-protocol/constants'; + +export class TinnyPerson { + public privateKey: string; + public wallet: ethers.Wallet; + public siweMessage: string | undefined; + public authSig: AuthSig | undefined; + public authMethod: AuthMethod | undefined; + public contractsClient: LitContracts | undefined; + // public capacityTokenId: string; + // public capacityDelegationAuthSig: AuthSig; + public pkp: PKPInfo | undefined; + public authMethodOwnedPkp: PKPInfo | undefined; + + // Pass this to data to sign + public loveLetter: Uint8Array = ethers.utils.arrayify( + ethers.utils.keccak256([1, 2, 3, 4, 5]) + ); + + public provider: ethers.providers.JsonRpcProvider; + + public envConfig: TinnyEnvConfig; + + constructor({ + privateKey, + envConfig, + }: { + privateKey: string; + envConfig: TinnyEnvConfig; + }) { + this.envConfig = envConfig; + + this.privateKey = privateKey; + this.provider = new ethers.providers.JsonRpcProvider(this.envConfig.rpc); + this.wallet = new ethers.Wallet(privateKey, this.provider); + } + + /** + * FIXME: Enabling this is causing the test to fail + * Switches the current wallet to a new funding wallet by creating a new funding wallet, + * funding it with a small amount of ethers, and updating the current wallet to the new one. + * + * @private + * @returns {Promise} A promise that resolves once the wallet has been switched. + */ + private async _switchWallet() { + // Create a new funding wallet, funds it with small amount of ethers, and updates the current wallet to the new one. + const fundingWallet = ethers.Wallet.createRandom().connect(this.provider); + + if (this.envConfig.network != LIT_TESTNET.LOCALCHAIN) { + // check balance this.wallet + const balance = await this.wallet.getBalance(); + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Wallet balance:', + ethers.utils.formatEther(balance) + ); + + const transferTx = await this.wallet.sendTransaction({ + to: fundingWallet.address, + value: ethers.utils.parseEther('0.00001'), + }); + + const transferReciept = await transferTx.wait(); + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Transfered Assets for person tx: ', + transferReciept.transactionHash + ); + this.wallet = fundingWallet; + } + } + + async spawn() { + // await this._switchWallet(); + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Spawning person:', this.wallet.address); + /** + * ==================================== + * Get Hot Wallet Auth Sig + * ==================================== + */ + this.siweMessage = await createSiweMessage({ + nonce: this.envConfig?.litNodeClient?.latestBlockhash!, + walletAddress: this.wallet.address, + }); + + this.authSig = await generateAuthSig({ + signer: this.wallet, + toSign: this.siweMessage, + }); + + /** + * ==================================== + * Craft an authMethod from the authSig for the eth wallet auth method + * ==================================== + */ + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...' + ); + this.authMethod = await EthWalletProvider.authenticate({ + signer: this.wallet, + litNodeClient: this.envConfig.litNodeClient, + }); + + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = this.envConfig.contractContext; + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc + customContext: networkContext as unknown as LitContractContext, + }); + } else { + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + network: this.envConfig.network, + }); + } + + await this.contractsClient.connect(); + + /** + * ==================================== + * Mint a PKP + * ==================================== + */ + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP...'); + const walletMintRes = + await this.contractsClient.pkpNftContractUtils.write.mint(); + + this.pkp = walletMintRes.pkp; + + /** + * ==================================== + * Mint a PKP wiuth eth wallet auth method + * ==================================== + */ + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP with eth wallet auth method...' + ); + this.authMethodOwnedPkp = ( + await this.contractsClient.mintWithAuth({ + authMethod: this.authMethod, + scopes: [AuthMethodScope.SignAnything], + }) + ).pkp; + + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] 🐣 TinnyPerson spawned:', + this.wallet.address + ); + } + + /** + * ==================================== + * Mint a Capacity Credits NFT + * ==================================== + */ + async mintCapacityCreditsNFT() { + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT '); + const capacityTokenId = ( + await this.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: + this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + return capacityTokenId; + } + + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + async createCapacityDelegationAuthSig( + addresses: string[] = [] + ): Promise { + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' + ); + + const capacityTokenId = ( + await this.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: + this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + this.contractsClient!.signer! = this.wallet; + await this.contractsClient?.connect(); + return ( + await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: this.wallet, + capacityTokenId: capacityTokenId, + ...(addresses.length && { delegateeAddresses: addresses }), + }) + ).capacityDelegationAuthSig; + } +} diff --git a/packages/e2e-tests/setup/tinny-utils.ts b/packages/e2e-tests/setup/tinny-utils.ts new file mode 100644 index 0000000000..2be285519e --- /dev/null +++ b/packages/e2e-tests/setup/tinny-utils.ts @@ -0,0 +1,65 @@ +import { importer } from 'ipfs-unixfs-importer'; +import { Buffer } from 'buffer'; + +/** + * Converts a string to an IPFS hash. + * @param input - The input string to convert. + * @returns A Promise that resolves to the IPFS hash. + * @throws An error if the generated hash does not start with 'Qm'. + */ +export async function stringToIpfsHash(input: string): Promise { + const blockput = { + put: async (block: any) => { + return block.cid; + }, + }; + + // Convert the input string to a Buffer + const content = Buffer.from(input); + + // Import the content to create an IPFS file + const files = importer([{ content }], blockput as any); + + // Get the first (and only) file result + const result = (await files.next()).value; + + const ipfsHash = (result as any).cid.toString(); + + if (!ipfsHash.startsWith('Qm')) { + throw new Error('Generated hash does not start with Qm'); + } + + return ipfsHash; +} + +export function randomSolanaPrivateKey() { + const BASE58_ALPHABET = + '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + const SOLANA_PRIVATE_KEY_LENGTH = 88; + + let result = ''; + const charactersLength = BASE58_ALPHABET.length; + for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { + const randomIndex = Math.floor(Math.random() * charactersLength); + result += BASE58_ALPHABET.charAt(randomIndex); + } + return result; +} + +/** + * Wraps a promise with a timeout. + * If the promise does not resolve or reject within the specified time, it will be rejected with a "Timed out" error. + * + * @param promise - The promise to wrap with a timeout. + * @param ms - The timeout duration in milliseconds. + * @returns A new promise that resolves or rejects based on the original promise or the timeout. + */ +export function withTimeout( + promise: Promise, + ms: number +): Promise { + const timeout = new Promise((_, reject) => + setTimeout(() => reject(new Error('Timed out')), ms) + ); + return Promise.race([promise, timeout]); +} diff --git a/packages/e2e-tests/src/setup/env-setup.ts b/packages/e2e-tests/src/setup/env-setup.ts deleted file mode 100644 index 93e0565d2a..0000000000 --- a/packages/e2e-tests/src/setup/env-setup.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import * as networkContextData from './networkContext.example.json'; - -let litNetwork = process.env['NETWORK'] as TESTABLE_NETWORK_TYPE; -const debug = process.env['DEBUG'] === 'true' ? true : false; - -export type TESTABLE_NETWORK_TYPE = - | 'habanero' - | 'manzano' - | 'cayenne' - | 'custom'; - -export interface DevEnv { - network: TESTABLE_NETWORK_TYPE; - litNodeClient: LitNodeClient; -} - -export const devEnv = async (params?: { - network?: TESTABLE_NETWORK_TYPE; -}): Promise => { - /** - * ==================================== - * Setting up Lit Node Client - * ==================================== - */ - log('πŸ§ͺ [env-setup.ts] Starting devEnv'); - let litNodeClient: LitNodeClient; - - litNetwork = params?.network || litNetwork; - - if (litNetwork === 'custom') { - litNodeClient = new LitNodeClient({ - litNetwork: 'custom', - bootstrapUrls: [ - 'http://127.0.0.1:7470', - 'http://127.0.0.1:7471', - 'http://127.0.0.1:7472', - ], - debug, - checkNodeAttestation: false, - networkContext: networkContextData, - }); - } else if (litNetwork === 'manzano' || litNetwork === 'habanero') { - litNodeClient = new LitNodeClient({ - litNetwork, - debug, - checkNodeAttestation: true, - }); - } else { - litNodeClient = new LitNodeClient({ - litNetwork: 'cayenne', - debug, - checkNodeAttestation: false, - }); - } - - await litNodeClient.connect(); - - return { - network: litNetwork, - litNodeClient, - }; -}; diff --git a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts index 8de2336b45..1a9b117557 100644 --- a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts +++ b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts @@ -1,6 +1,6 @@ import { expect, jest, test } from '@jest/globals'; - -import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { LIT_TESTNET } from 'packages/e2e-tests/setup/tinny-config'; try { jest.setTimeout(60000); @@ -8,15 +8,16 @@ try { // ... continue execution } + describe('connections', () => { - test.each(['habanero', 'manzano', 'cayenne'])( + test.each(['manzano', 'datil-dev', 'cayenne'])( 'Testing network: %s', async (network) => { - const litDev: DevEnv = await devEnv({ - network: network as TESTABLE_NETWORK_TYPE, - }); - expect(litDev.litNodeClient.ready).toBe(true); - expect(litDev.litNodeClient.config.litNetwork).toBe(network); + const devEnv = new TinnyEnvironment(network as LIT_TESTNET); + await devEnv.init(); + expect(devEnv.litNodeClient).toBeDefined(); + expect(devEnv.litNodeClient?.ready).toBe(true); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(network); } ); }); diff --git a/packages/e2e-tests/src/tests/jest-e2e.spec.ts b/packages/e2e-tests/src/tests/jest-e2e.spec.ts deleted file mode 100644 index 7db66d01d7..0000000000 --- a/packages/e2e-tests/src/tests/jest-e2e.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Test command -// npx jest './e2e-tests/jest-e2e.test.ts' -c './e2e-tests/jest.config.ts' -t 'connections' - -import { DevEnv, TESTABLE_NETWORK_TYPE, devEnv } from '../setup/env-setup'; -import { expect, test } from '@jest/globals'; - -try { - jest.setTimeout(60000); -} catch (e) { - // ... continue execution -} - -describe('connections', () => { - test.each(['habanero', 'manzano', 'cayenne'])( - 'Testing network in e2e-2: %s', - async (network) => { - const litDev: DevEnv = await devEnv({ - network: network as TESTABLE_NETWORK_TYPE, - }); - expect(litDev.litNodeClient.ready).toBe(true); - expect(litDev.litNodeClient.config.litNetwork).toBe(network); - } - ); -}); diff --git a/yarn.lock b/yarn.lock index 6b2917e32b..e3fcf50caa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,7 +33,7 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.24.7.tgz#d23bbea508c3883ba8251fb4164982c36ea577ed" integrity sha512-qJzAIcv03PyaWqxRgO4mSU3lihncDT296vnyuE2O8uA4w3UHWI4S3hgeZd1L8W1Bft40w9JxJ2b412iDUFFRhw== -"@babel/core@^7.1.0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.21.3", "@babel/core@^7.22.9", "@babel/core@^7.23.9", "@babel/core@^7.7.2", "@babel/core@^7.8.0": +"@babel/core@^7.1.0", "@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.21.3", "@babel/core@^7.22.9", "@babel/core@^7.23.9": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.24.7.tgz#b676450141e0b52a3d43bc91da86aa608f950ac4" integrity sha512-nykK+LEK86ahTkX/3TgauT0ikKoNCfKHEaZYTUVupJdTLzGNvrblu4u6fa7DhZONAltdf8e662t/abY8idrd/g== @@ -1073,7 +1073,7 @@ "@babel/parser" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/traverse@^7.16.0", "@babel/traverse@^7.24.7", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.16.0", "@babel/traverse@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5" integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA== @@ -4553,13 +4553,6 @@ dependencies: "@sinonjs/commons" "^3.0.0" -"@sinonjs/fake-timers@^8.0.1": - version "8.1.0" - resolved "https://registry.yarnpkg.com/@sinonjs/fake-timers/-/fake-timers-8.1.0.tgz#3fdc2b6cb58935b21bfb8d1625eb1300484316e7" - integrity sha512-OAPJUAtgeINhh/TAlUID4QTs53Njm7xzddaVlEs/SXwgtiD1tW22zAB/W1wdqfrpmikgaWQ9Fw6Ws+hsiRm5Vg== - dependencies: - "@sinonjs/commons" "^1.7.0" - "@solana/buffer-layout@^4.0.1": version "4.0.1" resolved "https://registry.yarnpkg.com/@solana/buffer-layout/-/buffer-layout-4.0.1.tgz#b996235eaec15b1e0b5092a8ed6028df77fa6c15" @@ -5165,7 +5158,7 @@ "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" -"@types/babel__traverse@*", "@types/babel__traverse@^7.0.4", "@types/babel__traverse@^7.0.6": +"@types/babel__traverse@*", "@types/babel__traverse@^7.0.6": version "7.20.6" resolved "https://registry.yarnpkg.com/@types/babel__traverse/-/babel__traverse-7.20.6.tgz#8dc9f0ae0f202c08d8d4dab648912c8d6038e3f7" integrity sha512-r1bzfrm0tomOI8g1SzvCaQHo6Lcv6zu0EA+W2kHrt8dyrHQxGzBBL4kdkzIS+jBMV+EYcMAEAqXqYaLJq5rOZg== @@ -5234,13 +5227,13 @@ dependencies: "@types/istanbul-lib-report" "*" -"@types/jest@^29.5.12": - version "29.5.12" - resolved "https://registry.yarnpkg.com/@types/jest/-/jest-29.5.12.tgz#7f7dc6eb4cf246d2474ed78744b05d06ce025544" - integrity sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw== +"@types/jest@27.4.1": + version "27.4.1" + resolved "https://registry.yarnpkg.com/@types/jest/-/jest-27.4.1.tgz#185cbe2926eaaf9662d340cc02e548ce9e11ab6d" + integrity sha512-23iPJADSmicDVrWk+HT58LMJtzLAnB2AgIzplQuq/bSrGaxCrlvRFjGbXmamnnk/mAmCdLStiGqggu28ocUyiw== dependencies: - expect "^29.0.0" - pretty-format "^29.0.0" + jest-matcher-utils "^27.0.0" + pretty-format "^27.0.0" "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" @@ -5315,11 +5308,6 @@ dependencies: "@types/node" "*" -"@types/prettier@^2.1.5": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@types/prettier/-/prettier-2.7.3.tgz#3e51a17e291d01d17d3fc61422015a933af7a08f" - integrity sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA== - "@types/responselike@^1.0.0": version "1.0.3" resolved "https://registry.yarnpkg.com/@types/responselike/-/responselike-1.0.3.tgz#cc29706f0a397cfe6df89debfe4bf5cea159db50" @@ -6185,7 +6173,7 @@ acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.11.3, acorn@^8.2.4, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.9.0: +acorn@^8.11.3, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" integrity sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg== @@ -7912,11 +7900,6 @@ brorand@^1.0.1, brorand@^1.1.0: resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== -browser-process-hrtime@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz#3c9b4b7d782c8121e56f10106d84c0d0ffc94626" - integrity sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow== - browserify-aes@^1.0.4, browserify-aes@^1.0.6, browserify-aes@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/browserify-aes/-/browserify-aes-1.2.0.tgz#326734642f403dabc3003209853bb70ad428ef48" @@ -8130,20 +8113,6 @@ builtins@^5.0.0: dependencies: semver "^7.0.0" -bun@^1.1.3: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bun/-/bun-1.1.4.tgz#48c415b2618797674e6d29c3141592d9abf9c91e" - integrity sha512-J78P9T2gMv2eki64AJnHjmAgSU1WuE4QPVvlYuhy/UmLClTwFaCnyoU0Rza7T5q97O4JIoGhmVCpEfI0Ri6anw== - optionalDependencies: - "@oven/bun-darwin-aarch64" "1.1.4" - "@oven/bun-darwin-x64" "1.1.4" - "@oven/bun-darwin-x64-baseline" "1.1.4" - "@oven/bun-linux-aarch64" "1.1.4" - "@oven/bun-linux-x64" "1.1.4" - "@oven/bun-linux-x64-baseline" "1.1.4" - "@oven/bun-windows-x64" "1.1.4" - "@oven/bun-windows-x64-baseline" "1.1.4" - busboy@1.6.0: version "1.6.0" resolved "https://registry.yarnpkg.com/busboy/-/busboy-1.6.0.tgz#966ea36a9502e43cdb9146962523b92f531f6893" @@ -9217,7 +9186,7 @@ conventional-recommended-bump@^6.1.0: meow "^8.0.0" q "^1.5.1" -convert-source-map@^1.4.0, convert-source-map@^1.5.1, convert-source-map@^1.6.0: +convert-source-map@^1.4.0, convert-source-map@^1.5.1: version "1.9.0" resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-1.9.0.tgz#7faae62353fb4213366d0ca98358d22e8368b05f" integrity sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A== @@ -9531,23 +9500,6 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - cypress-metamask-v2@^1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/cypress-metamask-v2/-/cypress-metamask-v2-1.7.2.tgz#2b49b7c2fad9ed5a8a5c847547ba38578773c2fa" @@ -10193,6 +10145,11 @@ dezalgo@^1.0.0: asap "^2.0.0" wrappy "1" +diff-sequences@^27.5.1: + version "27.5.1" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" + integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== + diff-sequences@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-29.6.3.tgz#4deaf894d11407c51efc8418012f9e70b84ea921" @@ -12063,7 +12020,7 @@ expand-brackets@^2.1.4: snapdragon "^0.8.1" to-regex "^3.0.1" -expect@^29.0.0, expect@^29.7.0: +expect@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/expect/-/expect-29.7.0.tgz#578874590dcb3214514084c08115d8aee61e11bc" integrity sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw== @@ -13053,7 +13010,7 @@ glob@^10.2.2, glob@^10.3.10: minipass "^7.1.2" path-scurry "^1.11.1" -glob@^7.1.1, glob@^7.1.2, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0, glob@~7.2.3: +glob@^7.1.1, glob@^7.1.3, glob@^7.1.4, glob@^7.1.6, glob@^7.2.0, glob@~7.2.3: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -13547,13 +13504,6 @@ hosted-git-info@^7.0.0: dependencies: lru-cache "^10.0.1" -html-encoding-sniffer@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-2.0.1.tgz#42a6dc4fd33f00281176e8b23759ca4e4fa185f3" - integrity sha512-D5JbOMBIR/TVZkubHT+OyT2705QvogUW4IBn6nHd756OwieSF9aDYFj4dv6HHEVGYbHaLETa3WggZYWWMyy3ZQ== - dependencies: - whatwg-encoding "^1.0.5" - html-encoding-sniffer@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-3.0.0.tgz#2cb1a8cf0db52414776e5b2a7a04d5dd98158de9" @@ -14751,7 +14701,7 @@ istanbul-lib-coverage@^3.0.0, istanbul-lib-coverage@^3.2.0: resolved "https://registry.yarnpkg.com/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz#2d166c4b0644d43a39f04bf6c2edd1e585f31756" integrity sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg== -istanbul-lib-instrument@^5.0.4, istanbul-lib-instrument@^5.1.0: +istanbul-lib-instrument@^5.0.4: version "5.2.1" resolved "https://registry.yarnpkg.com/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz#d10c8885c2125574e1c231cacadf955675e1ce3d" integrity sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg== @@ -14882,10 +14832,10 @@ jayson@^4.1.0: uuid "^8.3.2" ws "^7.4.5" -jest-changed-files@^27.5.1: - version "27.5.1" - resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-27.5.1.tgz#a348aed00ec9bf671cc58a66fcbe7c3dfd6a68f5" - integrity sha512-buBLMiByfWGCoMsLLzGUUSpAmIAGnbR2KJoMN10ziLhOLvP4e0SlypHnAel8iqQXTrcbmfEY9sSqae5sgUsTvw== +jest-changed-files@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-changed-files/-/jest-changed-files-29.7.0.tgz#1c06d07e77c78e1585d020424dedc10d6e17ac3a" + integrity sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w== dependencies: execa "^5.0.0" jest-util "^29.7.0" @@ -14962,6 +14912,16 @@ jest-config@^29.4.1, jest-config@^29.7.0: slash "^3.0.0" strip-json-comments "^3.1.1" +jest-diff@^27.5.1: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" + integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== + dependencies: + chalk "^4.0.0" + diff-sequences "^27.5.1" + jest-get-type "^27.5.1" + pretty-format "^27.5.1" + jest-diff@^29.4.1, jest-diff@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-29.7.0.tgz#017934a66ebb7ecf6f205e84699be10afd70458a" @@ -15002,6 +14962,11 @@ jest-environment-node@^29.7.0: jest-mock "^29.7.0" jest-util "^29.7.0" +jest-get-type@^27.5.1: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" + integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== + jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" @@ -15054,6 +15019,16 @@ jest-leak-detector@^29.7.0: jest-get-type "^29.6.3" pretty-format "^29.7.0" +jest-matcher-utils@^27.0.0: + version "27.5.1" + resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.5.1.tgz#9c0cdbda8245bc22d2331729d1091308b40cf8ab" + integrity sha512-z2uTx/T6LBaCoNWNFWwChLBKYxTMcGBRjAt+2SbP929/Fflb9aa5LGma654Rz8z9HLxsrUaYzxE9T/EFIL/PAw== + dependencies: + chalk "^4.0.0" + jest-diff "^27.5.1" + jest-get-type "^27.5.1" + pretty-format "^27.5.1" + jest-matcher-utils@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz#ae8fec79ff249fd592ce80e3ee474e83a6c44f12" @@ -15284,7 +15259,7 @@ jest-worker@^29.7.0: merge-stream "^2.0.0" supports-color "^8.0.0" -jest@^29.7.0: +jest@29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613" integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw== @@ -17802,11 +17777,6 @@ number-to-bn@1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" -nwsapi@^2.2.0: - version "2.2.10" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.10.tgz#0b77a68e21a0b483db70b11fad055906e867cda8" - integrity sha512-QK0sRs7MKv0tKe1+5uZIQk/C8XGza4DAnztJG8iD+TpJIORARrCxczA738awHrZoHeTjSSoHqao2teO0dC/gFQ== - nx@15.9.7, "nx@>=14.8.1 < 16": version "15.9.7" resolved "https://registry.yarnpkg.com/nx/-/nx-15.9.7.tgz#f0e713cedb8637a517d9c4795c99afec4959a1b6" @@ -18958,7 +18928,7 @@ pretty-format@^27.0.0, pretty-format@^27.0.2, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" -pretty-format@^29.0.0, pretty-format@^29.7.0: +pretty-format@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-29.7.0.tgz#ca42c758310f365bfa71a0bda0a807160b776812" integrity sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ== @@ -20815,14 +20785,6 @@ source-map-support@^0.4.15: dependencies: source-map "^0.5.6" -source-map-support@^0.5.6: - version "0.5.21" - resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" - integrity sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w== - dependencies: - buffer-from "^1.0.0" - source-map "^0.6.0" - source-map-url@^0.4.0: version "0.4.1" resolved "https://registry.yarnpkg.com/source-map-url/-/source-map-url-0.4.1.tgz#0af66605a745a5a2f91cf1bbf8a7afbc283dec56" @@ -20833,16 +20795,11 @@ source-map@^0.5.6, source-map@^0.5.7: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== -source-map@^0.7.3: - version "0.7.4" - resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.7.4.tgz#a9bbe705c9d8846f4e08ff6765acf0f1b0898656" - integrity sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA== - sparse-array@^1.3.1: version "1.3.2" resolved "https://registry.yarnpkg.com/sparse-array/-/sparse-array-1.3.2.tgz#0e1a8b71706d356bc916fe754ff496d450ec20b0" @@ -21118,7 +21075,7 @@ string-length@^4.0.1: char-regex "^1.0.2" strip-ansi "^6.0.0" -"string-width-cjs@npm:string-width@^4.2.0": +"string-width-cjs@npm:string-width@^4.2.0", "string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -21136,15 +21093,6 @@ string-width@^1.0.1: is-fullwidth-code-point "^1.0.0" strip-ansi "^3.0.0" -"string-width@^1.0.2 || 2 || 3 || 4", string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3: - version "4.2.3" - resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string-width@^2.0.0, string-width@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/string-width/-/string-width-2.1.1.tgz#ab93f27a8dc13d28cac815c462143a6d9012ae9e" @@ -21241,7 +21189,7 @@ stringify-package@^1.0.1: resolved "https://registry.yarnpkg.com/stringify-package/-/stringify-package-1.0.1.tgz#e5aa3643e7f74d0f28628b72f3dad5cecfc3ba85" integrity sha512-sa4DUQsYciMP1xhKWGuFM04fB0LG/9DlluZoSVywUMRNvzid6XucHK0/90xGxRoHrAaROrcHK1aPKaijCtSrhg== -"strip-ansi-cjs@npm:strip-ansi@^6.0.1": +"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== @@ -21269,13 +21217,6 @@ strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: dependencies: ansi-regex "^4.1.0" -strip-ansi@^6.0.0, strip-ansi@^6.0.1: - version "6.0.1" - resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" - integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A== - dependencies: - ansi-regex "^5.0.1" - strip-ansi@^7.0.1: version "7.1.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-7.1.0.tgz#d5b6568ca689d8561370b0707685d22434faff45" @@ -21671,14 +21612,6 @@ term-size@^2.1.0: resolved "https://registry.yarnpkg.com/term-size/-/term-size-2.2.1.tgz#2a6a54840432c2fb6320fea0f415531e90189f54" integrity sha512-wK0Ri4fOGjv/XPy8SBHZChl8CM7uMc5VML7SqiQ0zG7+J5Vr+RMQDoHa2CNT6KHUnTGIXH34UDMkPzAUyapBZg== -terminal-link@^2.0.0: - version "2.1.1" - resolved "https://registry.yarnpkg.com/terminal-link/-/terminal-link-2.1.1.tgz#14a64a27ab3c0df933ea546fba55f2d078edc994" - integrity sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ== - dependencies: - ansi-escapes "^4.2.1" - supports-hyperlinks "^2.0.0" - test-exclude@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-6.0.0.tgz#04a8698661d805ea6fa293b6cb9e63ac044ef15e" @@ -21844,16 +21777,6 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tough-cookie@^4.0.0: - version "4.1.3" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.3.tgz#97b9adb0728b42280aa3d814b6b999b2ff0318bf" - integrity sha512-aX/y5pVRkfRnfmuX+OdbSdXvPe6ieKX/G2s7e98f4poJHnqH3281gDPm/metm6E/WRamfx7WC4HUqkWHfQHprw== - dependencies: - psl "^1.1.33" - punycode "^2.1.1" - universalify "^0.2.0" - url-parse "^1.5.3" - tough-cookie@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" @@ -23114,16 +23037,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^5.0.0: - version "5.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-5.0.0.tgz#ae59c8a00b121543a2acc65c0434f57b0fc11aff" - integrity sha512-VlZwKPCkYKxQgeSbH5EyngOmRp7Ww7I9rQLERETtf5ofd9pGeswWiOtogpEO850jziPRarreGxn5QIiTqpb2wA== - -webidl-conversions@^6.1.0: - version "6.1.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-6.1.0.tgz#9111b4d7ea80acd40f5270d666621afa78b69514" - integrity sha512-qBIvFLGiBpLjfwmYAaHPXsn+ho5xZnGvyGvsarywGNc8VyQJUMHJ8OBKGGrPER0okBeMDaan4mNBlgBROxuI8w== - webpack-merge@^5.8.0: version "5.10.0" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" @@ -23334,15 +23247,6 @@ wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" - integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== - dependencies: - ansi-styles "^4.0.0" - string-width "^4.1.0" - strip-ansi "^6.0.0" - wrap-ansi@^8.0.1, wrap-ansi@^8.1.0: version "8.1.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214" @@ -23451,7 +23355,7 @@ ws@^5.1.1: dependencies: async-limiter "~1.0.0" -ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.4.5, ws@^7.4.6, ws@^7.5.1: +ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.4.5, ws@^7.5.1: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== @@ -23648,7 +23552,7 @@ yargs@^16.2.0: y18n "^5.0.5" yargs-parser "^20.2.2" -yargs@^17.6.2: +yargs@^17.3.1, yargs@^17.6.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w== From be46a139a4ae23e5c6fd2c4fa2259979fe60e5e1 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 10:44:39 -0400 Subject: [PATCH 007/136] dev: add dotenv loading in setup --- jest.setup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jest.setup.js b/jest.setup.js index f44e2a7ef9..f7eef34dc7 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,3 +1,5 @@ +require('dotenv').config({path: '../../.env'}); +console.log("loaded configuration from .env"); const crypto = require('crypto'); global.TextEncoder = require('util').TextEncoder; From b0d9d99fc395e30a3a1451388cb9d05a6e44b8db Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 10:44:54 -0400 Subject: [PATCH 008/136] dev: wip test migration --- local-tests/setup/tinny-environment.ts | 8 +- packages/e2e-tests/setup/tinny-environment.ts | 6 +- .../src/tests/EOASessionSigs.spec.ts | 173 ++++++++++++++++++ .../e2e-tests/src/tests/connection.spec.ts | 35 ++++ .../e2e-tests/src/tests/jest-e2e-2.spec.ts | 23 --- tsconfig.base.json | 15 +- 6 files changed, 224 insertions(+), 36 deletions(-) create mode 100644 packages/e2e-tests/src/tests/EOASessionSigs.spec.ts create mode 100644 packages/e2e-tests/src/tests/connection.spec.ts delete mode 100644 packages/e2e-tests/src/tests/jest-e2e-2.spec.ts diff --git a/local-tests/setup/tinny-environment.ts b/local-tests/setup/tinny-environment.ts index 493317a7df..958b5738e3 100644 --- a/local-tests/setup/tinny-environment.ts +++ b/local-tests/setup/tinny-environment.ts @@ -19,9 +19,6 @@ import { ethers } from 'ethers'; import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; import { ShivaClient, TestnetClient } from './shiva-client'; -import 'dotenv/config'; -console.log('Loading env vars from dot config...'); -console.log('Done loading env', process.env['DEBUG']); export class TinnyEnvironment { public network: LIT_TESTNET; @@ -32,10 +29,11 @@ export class TinnyEnvironment { MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']) || 45000, NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, - DEBUG: process.env['DEBUG'] === 'true', + DEBUG: true, REQUEST_PER_KILOSECOND: parseInt(process.env['REQUEST_PER_KILOSECOND']) || 200, - LIT_RPC_URL: process.env['LIT_RPC_URL'], + LIT_RPC_URL: + process.env['LIT_RPC_URL'] || 'https://vesuvius-rpc.litprotocol.com', WAIT_FOR_KEY_INTERVAL: parseInt(process.env['WAIT_FOR_KEY_INTERVAL']) || 3000, BOOTSTRAP_URLS: process.env['BOOTSTRAP_URLS']?.split(',') || [ diff --git a/packages/e2e-tests/setup/tinny-environment.ts b/packages/e2e-tests/setup/tinny-environment.ts index 3c9767de79..c83d33f6ba 100644 --- a/packages/e2e-tests/setup/tinny-environment.ts +++ b/packages/e2e-tests/setup/tinny-environment.ts @@ -19,10 +19,6 @@ import { ethers } from 'ethers'; import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; import { ShivaClient, TestnetClient } from './shiva-client'; -import 'dotenv/config'; -console.log('Loading env vars from dot config...'); -console.log('Done loading env', process.env['DEBUG']); - declare var globalThis: any; export class TinnyEnvironment { public network: LIT_TESTNET; @@ -37,7 +33,7 @@ export class TinnyEnvironment { DEBUG: process.env['DEBUG'] === 'true', REQUEST_PER_KILOSECOND: parseInt(process.env['REQUEST_PER_KILOSECOND'] ?? '') || 200, - LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? 'http://127.0.0.1:8545', // localhost rpc if not provided + LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? '', // localhost rpc if not provided WAIT_FOR_KEY_INTERVAL: parseInt(process.env['WAIT_FOR_KEY_INTERVAL'] ?? '') || 3000, BOOTSTRAP_URLS: process.env['BOOTSTRAP_URLS']?.split(',') || [ diff --git a/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts b/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts new file mode 100644 index 0000000000..19f8309878 --- /dev/null +++ b/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts @@ -0,0 +1,173 @@ +import { expect, jest, test } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; +import { AccessControlConditions } from './../../setup/accs/accs'; +import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('EOASessionSignatures', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + it('ExecuteJsSigning', async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe79", + // s: "1c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a", + // recid: 0, + // signature: "0x63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe791c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a1b", + // publicKey: "0423F38A7663289FC58841B5F8E068FA43106BC7DDEE38D1F2542C03ABEC45B6733BE2D85A703C7B238865E45DF2175DD2A1736C56F2BAD0A965837F64BB21FB03", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // } + + // -- assertions + expect(res?.signatures.sig.r).toBeDefined(); + + expect(res?.signatures.sig.s).toBeDefined(); + + if (!res?.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!res?.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + }); + it('ExecuteJsJsonResponse', async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "{\"hello\":\"world\"}", + // logs: "hello world\n", + // } + + // -- assertions + expect(res?.response).toBeDefined(); + expect(res?.logs).toBeDefined(); + expect(res?.logs.includes('hello world')).toBeTruthy(); + expect(res?.success).toBeTruthy(); + }); + + it('DecryptString', async () => { + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + console.log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + devEnv.releasePrivateKeyFromUser(alice); + + if (decryptRes !== 'Hello world') { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + }); +}); diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts new file mode 100644 index 0000000000..c30f8e7006 --- /dev/null +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -0,0 +1,35 @@ +import { expect, jest, test } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { LIT_TESTNET } from 'packages/e2e-tests/setup/tinny-config'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +const NETWORKS: string[] = ['manzano', 'datil-dev', 'cayenne']; + +describe('connections', () => { + test.each(NETWORKS)('Testing network: %s', async (network) => { + const devEnv = new TinnyEnvironment(network as LIT_TESTNET); + await devEnv.init(); + expect(devEnv.litNodeClient).toBeDefined(); + expect(devEnv.litNodeClient?.ready).toBe(true); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(network); + expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); + expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); + expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( + devEnv.litNodeClient?.config?.minNodeCount! + ); + }); + + afterEach(() => { + // TODO: can be removed once v7 is merged with wasm refactors + delete globalThis.wasmExports; + //@ts-ignore defined in global + delete globalThis.wasmSevSnpUtils; + + delete globalThis.wasmECDSA; + }); +}); diff --git a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts b/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts deleted file mode 100644 index 1a9b117557..0000000000 --- a/packages/e2e-tests/src/tests/jest-e2e-2.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { LIT_TESTNET } from 'packages/e2e-tests/setup/tinny-config'; - -try { - jest.setTimeout(60000); -} catch (e) { - // ... continue execution -} - - -describe('connections', () => { - test.each(['manzano', 'datil-dev', 'cayenne'])( - 'Testing network: %s', - async (network) => { - const devEnv = new TinnyEnvironment(network as LIT_TESTNET); - await devEnv.init(); - expect(devEnv.litNodeClient).toBeDefined(); - expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(network); - } - ); -}); diff --git a/tsconfig.base.json b/tsconfig.base.json index d79d1c4238..1dc63356ae 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,15 +10,24 @@ "importHelpers": true, "target": "ES2020", "module": "ES2020", - "lib": ["ES2020", "dom", "ES2021.String"], + "lib": [ + "ES2020", + "dom", + "ES2021.String" + ], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "paths": { - "@lit-protocol/*": ["packages/*/src"] + "@lit-protocol/*": [ + "packages/*/src" + ] } }, - "exclude": ["node_modules", "tmp"] + "exclude": [ + "node_modules", + "tmp" + ] } From 33573cc7faf54c2d64f9e57bca2ef9c1fd43ab85 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 14:30:49 -0400 Subject: [PATCH 009/136] ref: refactor test run command --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4160b85e69..4fb7804fef 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --all --code-coverage", - "test:local": "node ./local-tests/build.mjs && node ./local-tests/build/test.mjs", + "test:local": "nx run e2e-tests:test", "test:unit": "nx run-many --target=test", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", From 87b6ed9985fd4f974ce90ff6c27988333f4a13f4 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 14:31:11 -0400 Subject: [PATCH 010/136] ref: remove invalid config option --- packages/e2e-tests/jest.config.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/e2e-tests/jest.config.ts b/packages/e2e-tests/jest.config.ts index 7440ea989b..bc5092c135 100644 --- a/packages/e2e-tests/jest.config.ts +++ b/packages/e2e-tests/jest.config.ts @@ -8,5 +8,4 @@ export default { moduleFileExtensions: ['ts', 'js', 'html'], coverageDirectory: '../../coverage/packages/e2e-tests', setupFilesAfterEnv: ['../../jest.setup.js'], - diagnostics: false, }; From fb17f72112fda08968a14a812aa08dcca9b6f37b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 14:31:27 -0400 Subject: [PATCH 011/136] dev: Migrate tests wip --- .../src/tests/EOASessionSigs.spec.ts | 406 +++++++++++++++++- .../src/tests/LitActionSessionSigs.spec.ts | 216 ++++++++++ .../e2e-tests/src/tests/connection.spec.ts | 2 +- 3 files changed, 620 insertions(+), 4 deletions(-) create mode 100644 packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts diff --git a/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts b/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts index 19f8309878..ff9e9ea411 100644 --- a/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts @@ -1,10 +1,10 @@ import { expect, jest, test } from '@jest/globals'; import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; import { AccessControlConditions } from './../../setup/accs/accs'; import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; +import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; try { jest.setTimeout(60000); @@ -18,7 +18,7 @@ describe('EOASessionSignatures', () => { devEnv = new TinnyEnvironment(); await devEnv.init(); }); - it('ExecuteJsSigning', async () => { + it('ExecuteJs Signing', async () => { const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); @@ -67,7 +67,7 @@ describe('EOASessionSignatures', () => { throw new Error(`Expected "publicKey" in res.signatures.sig`); } }); - it('ExecuteJsJsonResponse', async () => { + it('ExecuteJs Json Response', async () => { const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); @@ -170,4 +170,404 @@ describe('EOASessionSignatures', () => { ); } }); + + it("DecryptFile", async () => { + const alice = await devEnv.createRandomPerson(); + const message = 'Hello world'; + const blob = new Blob([message], { type: 'text/plain' }); + const blobArray = new Uint8Array(await blob.arrayBuffer()); + + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.wallet.address, + }); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + console.log('encryptRes:', encryptRes); + + // await 5 seconds for the encryption to be mined + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decriptedFile = await LitJsSdk.decryptToFile( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: eoaSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + devEnv.releasePrivateKeyFromUser(alice); + + if (blobArray.length !== decriptedFile.length) { + throw new Error( + `decrypted file should match the original file but received ${decriptedFile}` + ); + } + for (let i = 0; i < blobArray.length; i++) { + if (blobArray[i] !== decriptedFile[i]) { + throw new Error(`decrypted file should match the original file`); + } + } + + console.log('decriptedFile:', decriptedFile); + }); + + it("executeJS ClaimKeys", async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + console.log('res:', res); + + // Expected output: + // { + // claims: { + // foo: { + // signatures: [ + // { + // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", + // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", + // v: 27, + // }, { + // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", + // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", + // v: 27, + // }, { + // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", + // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", + // v: 27, + // } + // ], + // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); + }); + + it("executeJs ClaimKeys Multiple", async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo'].derivedKeyId).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(sig.r).toBeDefined(); + expect(sig.s).toBeDefined(); + expect(sig.v).toBeDefined(); + }); + }); + + it("consoleLog ExecuteJs", async() => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const res = await devEnv?.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + console.log('hello world') + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + console.log('res:', res); + + // Expected output: + // { + // success: true, + // signedData: {}, + // decryptedData: {}, + // claimData: {}, + // response: "", + // logs: "hello world\n", + // } + + // -- assertions + expect(res?.response).toBeDefined(); + expect(res?.logs).toBeDefined(); + expect(res?.logs.includes('hello world')).toBeTruthy(); + expect(res?.success).toBeDefined(); + }); + + + it("ExecuteJs Parallel Sign", async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const fn = async (index: number) => { + console.log(`Index: ${index}`); + + return await devEnv?.litNodeClient?.executeJs({ + sessionSigs: eoaSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice?.pkp?.publicKey, + }, + }); + }; + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + devEnv.releasePrivateKeyFromUser(alice); + console.log('res:', res); + + // -- Expected output: + // [ + // { + // claims: {}, + // signatures: { + // sig: { + // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", + // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", + // recid: 0, + // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", + // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", + // recid: 1, + // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // }, { + // claims: {}, + // signatures: { + // sig: { + // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", + // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", + // recid: 0, + // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", + // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + // ] + + // -- assertions + res.forEach((r) => { + if (!r?.signatures.sig.r) { + throw new Error(`Expected "r" in res.signatures.sig`); + } + if (!r?.signatures.sig.s) { + throw new Error(`Expected "s" in res.signatures.sig`); + } + + if (!r?.signatures.sig.dataSigned) { + throw new Error(`Expected "dataSigned" in res.signatures.sig`); + } + + if (!r?.signatures.sig.publicKey) { + throw new Error(`Expected "publicKey" in res.signatures.sig`); + } + + // -- signatures.sig.signature must start with 0x + if (!r?.signatures.sig.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // -- signatures.sig.recid must be parseable as a number + if (isNaN(r?.signatures.sig.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); + }); + + it("PKP Sign", async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const runWithSessionSigs = await devEnv.litNodeClient?.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp?.publicKey!, + sessionSigs: eoaSessionSigs!, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", + // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", + // recid: 1, + // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", + // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + if (!runWithSessionSigs?.r) { + throw new Error(`Expected "r" in runWithSessionSigs`); + } + if (!runWithSessionSigs?.s) { + throw new Error(`Expected "s" in runWithSessionSigs`); + } + if (!runWithSessionSigs?.dataSigned) { + throw new Error(`Expected "dataSigned" in runWithSessionSigs`); + } + if (!runWithSessionSigs?.publicKey) { + throw new Error(`Expected "publicKey" in runWithSessionSigs`); + } + + // signature must start with 0x + if (!runWithSessionSigs.signature.startsWith('0x')) { + throw new Error(`Expected "signature" to start with 0x`); + } + + // recid must be parseable as a number + if (isNaN(runWithSessionSigs.recid)) { + throw new Error(`Expected "recid" to be parseable as a number`); + } + }); }); diff --git a/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts b/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts new file mode 100644 index 0000000000..a4b65f55f0 --- /dev/null +++ b/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts @@ -0,0 +1,216 @@ +import { expect, jest, test } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; +import { LIT_TESTNET } from './../../setup/tinny-config'; +import { AccessControlConditions } from '../../setup/accs/accs'; +import { getLitActionSessionSigs } from '../../setup/session-sigs/get-lit-action-session-sigs'; +import { LitAbility, LitAccessControlConditionResource, LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient } from '@lit-protocol/types'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + + + +describe("LitActionSessionSigs", () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + it("ExecuteJsConsole", async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const runWithSessionSigs = await devEnv.litNodeClient?.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.pkp?.publicKey!, + sessionSigs: eoaSessionSigs!, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", + // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", + // recid: 1, + // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", + // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + // -- assertions + // r, s, dataSigned, and public key should be present + expect(runWithSessionSigs?.r).toBeDefined(); + expect(!runWithSessionSigs?.s).toBeDefined(); + expect(runWithSessionSigs?.dataSigned).toBeDefined(); + + expect(runWithSessionSigs?.publicKey).toBeDefined(); + + // signature must start with 0x + expect(runWithSessionSigs?.signature?.startsWith('0x')).toBeDefined(); + + // recid must be parseable as a number + expect(isNaN(runWithSessionSigs?.recid!)).toBeFalsy(); + }); + + it("DecryptString", async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + console.log('encryptRes:', encryptRes); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const accsResourceString = + await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + devEnv.releasePrivateKeyFromUser(alice); + + if (decryptRes !== 'Hello world') { + throw new Error( + `Expected decryptRes to be 'Hello world' but got ${decryptRes}` + ); + } + }); + + + it("Claim Keys", async () => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); + }); +}); \ No newline at end of file diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index c30f8e7006..b28277f07c 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -10,7 +10,7 @@ try { const NETWORKS: string[] = ['manzano', 'datil-dev', 'cayenne']; -describe('connections', () => { +describe('Connections', () => { test.each(NETWORKS)('Testing network: %s', async (network) => { const devEnv = new TinnyEnvironment(network as LIT_TESTNET); await devEnv.init(); From 1bff3869eb5f7fada431c9a26aadf7de83863a9b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 14:38:16 -0400 Subject: [PATCH 012/136] ci: remove filter flags wip --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d05d8cee2..58861ea690 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,4 +55,4 @@ jobs: run: yarn build:dev - name: Run End to End Tests if: steps.build.outputs.exit_code == 0 - run: yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning,testUseEoaSessionSigsToPkpSign,testUsePkpSessionSigsToExecuteJsSigning,testUsePkpSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToPkpSign,testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning,testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs,testEthAuthSigToEncryptDecryptString,testExecuteJsSignAndCombineEcdsa,testExecutJsDecryptAndCombine,testExecuteJsBroadcastAndCollect --exclude=Parallel + run: yarn test:local From 1a24a581987a6ab20ed1b15b12d7a62a442e4826 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 22 Jul 2024 14:16:08 -0400 Subject: [PATCH 013/136] ref: refactor env pathing --- jest.setup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jest.setup.js b/jest.setup.js index f7eef34dc7..810a1cb245 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,5 +1,5 @@ -require('dotenv').config({path: '../../.env'}); -console.log("loaded configuration from .env"); +require('dotenv').config({ path: __dirname + '/.env' }); +console.log('loaded configuration from .env', __dirname); const crypto = require('crypto'); global.TextEncoder = require('util').TextEncoder; From 7737f4c1328197169ba5853458c126a58cff85a9 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 22 Jul 2024 14:16:16 -0400 Subject: [PATCH 014/136] chore: fmt --- tsconfig.base.json | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/tsconfig.base.json b/tsconfig.base.json index 1dc63356ae..d79d1c4238 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -10,24 +10,15 @@ "importHelpers": true, "target": "ES2020", "module": "ES2020", - "lib": [ - "ES2020", - "dom", - "ES2021.String" - ], + "lib": ["ES2020", "dom", "ES2021.String"], "skipLibCheck": true, "skipDefaultLibCheck": true, "baseUrl": ".", "allowSyntheticDefaultImports": true, "resolveJsonModule": true, "paths": { - "@lit-protocol/*": [ - "packages/*/src" - ] + "@lit-protocol/*": ["packages/*/src"] } }, - "exclude": [ - "node_modules", - "tmp" - ] + "exclude": ["node_modules", "tmp"] } From b64e39b7b1a60f42f9a06912216af5e7f7abc68d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 22 Jul 2024 14:16:32 -0400 Subject: [PATCH 015/136] test: wip porting local-tests to jest --- .../src/tests/EOASessionSigs.spec.ts | 573 --------------- .../src/tests/LitActionSessionSigs.spec.ts | 216 ------ .../e2e-tests/src/tests/PKPEthers.spec.ts | 690 ++++++++++++++++++ packages/e2e-tests/src/tests/Relayer.spec.ts | 50 ++ .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 66 ++ .../e2e-tests/src/tests/SessionSigs.spec.ts | 432 +++++++++++ .../e2e-tests/src/tests/connection.spec.ts | 4 + packages/e2e-tests/utils/session-generator.ts | 52 ++ 8 files changed, 1294 insertions(+), 789 deletions(-) delete mode 100644 packages/e2e-tests/src/tests/EOASessionSigs.spec.ts delete mode 100644 packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts create mode 100644 packages/e2e-tests/src/tests/PKPEthers.spec.ts create mode 100644 packages/e2e-tests/src/tests/Relayer.spec.ts create mode 100644 packages/e2e-tests/src/tests/SOLAuthSig.spec.ts create mode 100644 packages/e2e-tests/src/tests/SessionSigs.spec.ts create mode 100644 packages/e2e-tests/utils/session-generator.ts diff --git a/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts b/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts deleted file mode 100644 index ff9e9ea411..0000000000 --- a/packages/e2e-tests/src/tests/EOASessionSigs.spec.ts +++ /dev/null @@ -1,573 +0,0 @@ -import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { AccessControlConditions } from './../../setup/accs/accs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; - -try { - jest.setTimeout(60000); -} catch (e) { - // ... continue execution -} - -describe('EOASessionSignatures', () => { - let devEnv: TinnyEnvironment; - beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - it('ExecuteJs Signing', async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.pkp?.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe79", - // s: "1c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a", - // recid: 0, - // signature: "0x63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe791c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a1b", - // publicKey: "0423F38A7663289FC58841B5F8E068FA43106BC7DDEE38D1F2542C03ABEC45B6733BE2D85A703C7B238865E45DF2175DD2A1736C56F2BAD0A965837F64BB21FB03", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // } - - // -- assertions - expect(res?.signatures.sig.r).toBeDefined(); - - expect(res?.signatures.sig.s).toBeDefined(); - - if (!res?.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res?.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - }); - it('ExecuteJs Json Response', async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - console.log('hello world') - - LitActions.setResponse({ - response: JSON.stringify({hello: 'world'}) - }); - - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "{\"hello\":\"world\"}", - // logs: "hello world\n", - // } - - // -- assertions - expect(res?.response).toBeDefined(); - expect(res?.logs).toBeDefined(); - expect(res?.logs.includes('hello world')).toBeTruthy(); - expect(res?.success).toBeTruthy(); - }); - - it('DecryptString', async () => { - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.wallet.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - console.log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: eoaSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - }); - - it("DecryptFile", async () => { - const alice = await devEnv.createRandomPerson(); - const message = 'Hello world'; - const blob = new Blob([message], { type: 'text/plain' }); - const blobArray = new Uint8Array(await blob.arrayBuffer()); - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.wallet.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - console.log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decriptedFile = await LitJsSdk.decryptToFile( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: eoaSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (blobArray.length !== decriptedFile.length) { - throw new Error( - `decrypted file should match the original file but received ${decriptedFile}` - ); - } - for (let i = 0; i < blobArray.length; i++) { - if (blobArray[i] !== decriptedFile[i]) { - throw new Error(`decrypted file should match the original file`); - } - } - - console.log('decriptedFile:', decriptedFile); - }); - - it("executeJS ClaimKeys", async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // claims: { - // foo: { - // signatures: [ - // { - // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", - // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", - // v: 27, - // }, { - // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", - // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", - // v: 27, - // }, { - // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", - // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", - // v: 27, - // } - // ], - // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); - - expect(res?.claims?.['foo'].signatures).toBeDefined(); - - res?.claims?.['foo'].signatures.forEach((sig: any) => { - expect(!sig.r).toBeDefined(); - expect(!sig.s).toBeDefined(); - expect(!sig.v).toBeDefined(); - }); - }); - - it("executeJs ClaimKeys Multiple", async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo'].derivedKeyId).toBeDefined(); - - expect(res?.claims?.['foo'].signatures).toBeDefined(); - - res?.claims?.['foo'].signatures.forEach((sig: any) => { - expect(sig.r).toBeDefined(); - expect(sig.s).toBeDefined(); - expect(sig.v).toBeDefined(); - }); - }); - - it("consoleLog ExecuteJs", async() => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv?.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - console.log('hello world') - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "", - // logs: "hello world\n", - // } - - // -- assertions - expect(res?.response).toBeDefined(); - expect(res?.logs).toBeDefined(); - expect(res?.logs.includes('hello world')).toBeTruthy(); - expect(res?.success).toBeDefined(); - }); - - - it("ExecuteJs Parallel Sign", async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const fn = async (index: number) => { - console.log(`Index: ${index}`); - - return await devEnv?.litNodeClient?.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice?.pkp?.publicKey, - }, - }); - }; - - const res = await Promise.all([fn(1), fn(2), fn(3)]); - devEnv.releasePrivateKeyFromUser(alice); - console.log('res:', res); - - // -- Expected output: - // [ - // { - // claims: {}, - // signatures: { - // sig: { - // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", - // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", - // recid: 0, - // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", - // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", - // recid: 1, - // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", - // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", - // recid: 0, - // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - // ] - - // -- assertions - res.forEach((r) => { - if (!r?.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!r?.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!r?.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!r?.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!r?.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(r?.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }); - }); - - it("PKP Sign", async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const runWithSessionSigs = await devEnv.litNodeClient?.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.pkp?.publicKey!, - sessionSigs: eoaSessionSigs!, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", - // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", - // recid: 1, - // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", - // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!runWithSessionSigs?.r) { - throw new Error(`Expected "r" in runWithSessionSigs`); - } - if (!runWithSessionSigs?.s) { - throw new Error(`Expected "s" in runWithSessionSigs`); - } - if (!runWithSessionSigs?.dataSigned) { - throw new Error(`Expected "dataSigned" in runWithSessionSigs`); - } - if (!runWithSessionSigs?.publicKey) { - throw new Error(`Expected "publicKey" in runWithSessionSigs`); - } - - // signature must start with 0x - if (!runWithSessionSigs.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(runWithSessionSigs.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }); -}); diff --git a/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts b/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts deleted file mode 100644 index a4b65f55f0..0000000000 --- a/packages/e2e-tests/src/tests/LitActionSessionSigs.spec.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; -import { LIT_TESTNET } from './../../setup/tinny-config'; -import { AccessControlConditions } from '../../setup/accs/accs'; -import { getLitActionSessionSigs } from '../../setup/session-sigs/get-lit-action-session-sigs'; -import { LitAbility, LitAccessControlConditionResource, LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient } from '@lit-protocol/types'; - -try { - jest.setTimeout(60000); -} catch (e) { - // ... continue execution -} - - - -describe("LitActionSessionSigs", () => { - let devEnv: TinnyEnvironment; - beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - it("ExecuteJsConsole", async () => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const runWithSessionSigs = await devEnv.litNodeClient?.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.pkp?.publicKey!, - sessionSigs: eoaSessionSigs!, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", - // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", - // recid: 1, - // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", - // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - expect(runWithSessionSigs?.r).toBeDefined(); - expect(!runWithSessionSigs?.s).toBeDefined(); - expect(runWithSessionSigs?.dataSigned).toBeDefined(); - - expect(runWithSessionSigs?.publicKey).toBeDefined(); - - // signature must start with 0x - expect(runWithSessionSigs?.signature?.startsWith('0x')).toBeDefined(); - - // recid must be parseable as a number - expect(isNaN(runWithSessionSigs?.recid!)).toBeFalsy(); - }); - - it("DecryptString", async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - console.log('encryptRes:', encryptRes); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: litActionSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - }); - - - it("Claim Keys", async () => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); - - expect(res?.claims?.['foo'].signatures).toBeDefined(); - - res?.claims?.['foo'].signatures.forEach((sig: any) => { - expect(!sig.r).toBeDefined(); - expect(!sig.s).toBeDefined(); - expect(!sig.v).toBeDefined(); - }); - }); -}); \ No newline at end of file diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts new file mode 100644 index 0000000000..fa6dca9e21 --- /dev/null +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -0,0 +1,690 @@ +import { expect, jest, test } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; +import { + createSiweMessageWithRecaps, + generateAuthSig, + LitAbility, + LitActionResource, + LitPKPResource, +} from '@lit-protocol/auth-helpers'; +import { + AuthCallbackParams, + AuthSig, + LitResourceAbilityRequest, + SessionSigsMap, +} from '@lit-protocol/types'; +import { + PKPEthersWallet, + ethRequestHandler, + signTypedData, +} from '@lit-protocol/pkp-ethers'; +import { ethers } from 'ethers'; +import { sessionGenerators } from '../../utils/session-generator'; + +import { + SignTypedDataVersion, + recoverTypedSignature, +} from '@metamask/eth-sig-util'; +import { + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, +} from '../../setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyPerson } from 'packages/e2e-tests/setup/tinny-person'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('PKP Ethers', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + describe('Sign Message', () => { + it('LitAction Session', async () => { + await signMessage(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signMessage(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signMessage(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signMessage(devEnv, getEoaSessionSigs); + }); + }); + + it.each(sessionGenerators)('ETH Signing', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator.fn(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- test eth_sign + try { + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sign', + params: [alice.pkp?.ethAddress, hexMsg], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + expect(signature.length).toEqual(132); + expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); + + console.log('βœ… recoveredAddr:', recoveredAddr); + } catch (e) { + throw (new Error('❌ Error: ' + (e as Error).message).stack = ( + e as Error + ).stack); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('Sign Transaction', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator.fn(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp?.ethAddress!; + const to = alice.pkp?.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }); + + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); + + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r!, + s: parsedTransaction.s!, + v: parsedTransaction.v!, + }); + + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + + const txHash = ethers.utils.keccak256( + ethers.utils.serializeTransaction(rawTx) + ); + + const { v, r, s } = parsedTransaction; + + const recoveredAddress = ethers.utils.recoverAddress(txHash, { + r: r!, + s: s!, + v: v!, + }); + + // ==================== Post-Validation ==================== + expect(parsedTransaction).toBeDefined(); + + expect(signature.length).toEqual(132); + + expect(recoveredAddress.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + } catch (e) { + if ((e as Error).message.includes('insufficient FPE funds')) { + console.log( + `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` + ); + } else { + throw new Error(`❌ Error: ${(e as Error).toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('Eth Sign Typed Data', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator.fn(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); + + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); + + expect(signature.length).toEqual(132); + + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('Sign Typed Data Util', async () => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + const signature = await signTypedData(pkpEthersWallet, msgParams); + + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); + + expect(signature.length).toEqual(132); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('SignedTypedDataV1', async () => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v1 parameters + try { + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v1', + params: [msgParams, alice.pkp?.ethAddress], + }, + }); + + const signatureBytes = ethers.utils.arrayify(signature); + + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes as any, + version: SignTypedDataVersion.V1, + }); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); + } + + console.log('signature: ', signature); + console.log('recoveredAddr: ', recoveredAddr); + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('SignedTypedDatav3', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator.fn(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + }, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + }, + contents: 'Hello, Bob!', + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); + + const recoveredAddr = recoverTypedSignature({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); + + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); + } + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it.each(sessionGenerators)('Signed Typed Data v4', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator.fn(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], + }, + to: [ + { + name: 'Bob', + wallets: [ + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', + ], + }, + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v4', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); + + const recoveredAddr = recoverTypedSignature({ + data: msgParams as any, + signature: signature, + version: SignTypedDataVersion.V4, + }); + + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); + } + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it('Sign With AuthContext', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpEthersWallet = new PKPEthersWallet({ + pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv.litNodeClient!, + authContext: { + getSessionSigsProps: { + authNeededCallback: async function ( + params: AuthCallbackParams + ): Promise { + const toSign = await createSiweMessageWithRecaps({ + uri: params.uri!, + expiration: params.expiration!, + resources: params.resourceAbilityRequests!, + walletAddress: alice.wallet.address, + nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: alice.wallet, + toSign, + }); + + return authSig; + }, + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + }, + }, + }); + + await pkpEthersWallet.init(); + + try { + const signature = await pkpEthersWallet.signMessage(alice.loveLetter); + console.log('βœ… signature:', signature); + } catch (e) { + throw new Error('❌ Error: ' + (e as Error).message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); +}); + +const signMessage = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- test signMessage + try { + const res = await pkpEthersWallet.signMessage(alice.loveLetter); + expect(res).toBeDefined(); + } catch (e) { + throw new Error('❌ Error: ' + (e as Error).message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts new file mode 100644 index 0000000000..b647b660a5 --- /dev/null +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -0,0 +1,50 @@ +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { + EthWalletProvider, + LitAuthClient, +} from '@lit-protocol/lit-auth-client'; +import { ProviderType } from '@lit-protocol/constants'; + +try { + jest.setTimeout(100_000); +} catch (e) { + // ... continue execution +} + +describe('Relayer', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + it('Fetch PKPS', async () => { + const alice = await devEnv.createRandomPerson(); + + const litAuthClient = new LitAuthClient({ + litRelayConfig: { + relayApiKey: 'test-api-key', + }, + litNodeClient: devEnv.litNodeClient, + }); + + // -- test fetch pkps + const ethWalletProvider = litAuthClient.initProvider( + ProviderType.EthWallet + ); + + const pkps = await ethWalletProvider.fetchPKPsThroughRelayer( + alice.authMethod! + ); + + expect(pkps.length).toBeGreaterThan(0); + }); +}); diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts new file mode 100644 index 0000000000..5b1b87d4c1 --- /dev/null +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -0,0 +1,66 @@ +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { AccessControlConditions } from '../../setup/accs/accs'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient } from '@lit-protocol/types'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('Sol AuthSig', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + it('DecryptString', async () => { + const accs = AccessControlConditions.getSolBasicAccessControlConditions({ + userAddress: devEnv.bareSolAuthSig?.address, + }); + + const encryptRes = await LitJsSdk.encryptString( + { + solRpcConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + console.log('encryptRes:', encryptRes); + + // -- Expected output:Β΄ + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + expect(encryptRes.ciphertext).toBeDefined(); + + expect(encryptRes.dataToEncryptHash).toBeDefined(); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + solRpcConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + authSig: devEnv.bareSolAuthSig, + chain: 'solana', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + expect(decryptRes).toEqual('Hello world'); + }); +}); diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts new file mode 100644 index 0000000000..bdeea48dc7 --- /dev/null +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -0,0 +1,432 @@ +import { expect, jest } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; + +import { LIT_TESTNET } from '../../setup/tinny-config'; +import { AccessControlConditions } from '../../setup/accs/accs'; + +import { + LitAbility, + LitAccessControlConditionResource, + LitActionResource, + LitPKPResource, +} from '@lit-protocol/auth-helpers'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { ILitNodeClient } from '@lit-protocol/types'; + +import { sessionGenerators } from '../../utils/session-generator'; +import { + getInvalidLitActionIpfsSessionSigs, + getInvalidLitActionSessionSigs, +} from '../../setup/session-sigs/get-lit-action-session-sigs'; + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('SessionSigs', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + it.each(sessionGenerators)('DecryptString', async (generator) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: + generator.name === 'EOA' + ? alice.wallet.address + : alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await generator.fn(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + expect(encryptRes.ciphertext).toBeDefined(); + + expect(encryptRes.dataToEncryptHash).toBeDefined(); + + const accsResourceString = + await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const litActionSessionSigs2 = await generator.fn(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(decryptRes).toEqual('Hello world'); + }); + + it.each(sessionGenerators)('Claim Keys', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator.fn(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); + }); + + it.each(sessionGenerators)('Claim Keys Multiple', async (generator) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await generator.fn(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); + }); + it.each(sessionGenerators)('ExecuteJS JSON Response', async (generator) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator.fn(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.response).toBeDefined(); + expect(res?.logs).toBeDefined(); + expect(res?.logs.includes('hello world')).toBeTruthy(); + expect(res?.success).toBeTruthy(); + }); + + it.each(sessionGenerators)('PKP Sign', async (generator) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator.fn(devEnv, alice); + + const res = await devEnv.litNodeClient?.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp?.publicKey!, + sessionSigs: litActionSessionSigs!, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // -- Expected output: + // { + // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", + // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", + // recid: 1, + // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", + // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + expect(res?.r).toBeDefined(); + expect(res?.s).toBeDefined(); + expect(res?.dataSigned).toBeDefined(); + expect(res?.publicKey).toBeDefined(); + }); + it.each(sessionGenerators)('ExecuteJS Signing', async (generator) => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator.fn(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.signatures?.sig.r).toBeDefined(); + expect(res?.signatures?.sig.s).toBeDefined(); + expect(res?.signatures?.sig.dataSigned).toBeDefined(); + expect(res?.signatures?.sig.publicKey).toBeDefined(); + }); + + it.each(sessionGenerators)('ExecteJS Signing Parallel', async (generator) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await generator.fn(devEnv, alice); + + const fn = async (index: number) => { + return await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp?.publicKey, + }, + }); + }; + + devEnv.releasePrivateKeyFromUser(alice); + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + + res.forEach((r) => { + expect(r?.signatures?.sig.r).toBeDefined(); + expect(r?.signatures?.sig.s).toBeDefined(); + expect(r?.signatures?.sig.dataSigned).toBeDefined(); + expect(r?.signatures?.sig.publicKey).toBeDefined(); + }); + }); + + it('Invalid lit action Custom Auth SessionSigs', async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + try { + await getInvalidLitActionSessionSigs(devEnv, alice); + } catch (e: any) { + console.log('❌ This error is expected', e); + if ( + e.message === + 'There was an error getting the signing shares from the nodes' + ) { + console.log( + 'βœ… testUseInvalidLitActionCodeToGenerateSessionSigs passed' + ); + } else { + throw e; + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); + + it('Invalid Lit Action Custom Auth IPFS SessionSigs', async () => { + const alice = await devEnv.createRandomPerson(); + + try { + await getInvalidLitActionIpfsSessionSigs(devEnv, alice); + } catch (e: any) { + console.log('❌ THIS IS EXPECTED: ', e); + + if (e.message === 'An error related to validation has occured.') { + console.log( + 'βœ… testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error' + ); + } else { + throw e; + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } + }); +}); diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index b28277f07c..2443dce80e 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -11,6 +11,10 @@ try { const NETWORKS: string[] = ['manzano', 'datil-dev', 'cayenne']; describe('Connections', () => { + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + test.each(NETWORKS)('Testing network: %s', async (network) => { const devEnv = new TinnyEnvironment(network as LIT_TESTNET); await devEnv.init(); diff --git a/packages/e2e-tests/utils/session-generator.ts b/packages/e2e-tests/utils/session-generator.ts new file mode 100644 index 0000000000..f743bac1c1 --- /dev/null +++ b/packages/e2e-tests/utils/session-generator.ts @@ -0,0 +1,52 @@ +import { LitResourceAbilityRequest, SessionSigsMap } from '@lit-protocol/types'; +import { TinnyEnvironment } from '../setup/tinny-environment'; +import { TinnyPerson } from '../setup/tinny-person'; +import { getEoaSessionSigs } from '../setup/session-sigs/get-eoa-session-sigs'; +import { + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, +} from '../setup/session-sigs/get-lit-action-session-sigs'; +import { getPkpSessionSigs } from '../setup/session-sigs/get-pkp-session-sigs'; + +export const sessionGenerators = [ + { + name: `LitAction`, + fn: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ): Promise => { + return getLitActionSessionSigs(devEnv, person, resources); + }, + }, + { + name: `EOA`, + fn: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ): Promise => { + return getEoaSessionSigs(devEnv, person, resources); + }, + }, + { + name: `LitActionIPFS`, + fn: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ): Promise => { + return getLitActionSessionSigsUsingIpfsId(devEnv, person, resources); + }, + }, + { + name: `PKP`, + fn: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ): Promise => { + return getPkpSessionSigs(devEnv, person, resources); + }, + }, +]; From 6faca675e165c5186578e4207eef2b07c3f3efa2 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 10:19:30 -0400 Subject: [PATCH 016/136] ref: refactor tests for explicit test cases over iterator --- .../e2e-tests/src/tests/PKPEthers.spec.ts | 508 +++++++---- .../e2e-tests/src/tests/SessionSigs.spec.ts | 808 +++++++++++------- 2 files changed, 850 insertions(+), 466 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index fa6dca9e21..918a09325a 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -20,7 +20,6 @@ import { signTypedData, } from '@lit-protocol/pkp-ethers'; import { ethers } from 'ethers'; -import { sessionGenerators } from '../../utils/session-generator'; import { SignTypedDataVersion, @@ -71,9 +70,210 @@ describe('PKP Ethers', () => { }); }); - it.each(sessionGenerators)('ETH Signing', async (generator) => { + describe('ETH Signing', () => { + it('LitAction Session', async () => { + await ethTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethTransaction(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethTransaction(devEnv, getEoaSessionSigs); + }); + }); + + describe('ETH Personal Signing', () => { + it('LitAction Session', async () => { + await ethPersonalSign(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethPersonalSign(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethPersonalSign(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethPersonalSign(devEnv, getEoaSessionSigs); + }); + }); + + describe('Sign Transaction', () => { + it('LitAction Session', async () => { + await signTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTransaction(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTransaction(devEnv, getEoaSessionSigs); + }); + }); + + describe('Eth Sign Typed Data', () => { + it('LitAction Session', async () => { + await signTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + }); + + describe('Sign Typed Data Util', () => { + it('LitAction Session', async () => { + await ethTypedDataUtil(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethTypedDataUtil(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethTypedDataUtil(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethTypedDataUtil(devEnv, getEoaSessionSigs); + }); + }); + + describe('SignedTypedDataV1', () => { + it('LitAction Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + }); + + describe('SignedTypedDatav3', () => { + it('LitAction Session', async () => { + await signTypedDatav3(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDatav3(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDatav3(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDatav3(devEnv, getEoaSessionSigs); + }); + }); + + describe('Signed Typed Data v4', () => { + it('LitAction Session', async () => { + await signTypedDatav4(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDatav4(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDatav4(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDatav4(devEnv, getEoaSessionSigs); + }); + }); + + describe('Sign With AuthContext', () => { + it('LitAction Session', async () => { + await signWithAuthContext(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signWithAuthContext(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signWithAuthContext(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signWithAuthContext(devEnv, getEoaSessionSigs); + }); + }); +}); + +const signMessage = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- test signMessage + try { + const res = await pkpEthersWallet.signMessage(alice.loveLetter); + expect(res).toBeDefined(); + } catch (e) { + throw new Error('❌ Error: ' + (e as Error).message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; + + +const ethTransaction = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator.fn(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv.litNodeClient!, @@ -111,11 +311,18 @@ describe('PKP Ethers', () => { } finally { devEnv.releasePrivateKeyFromUser(alice); } - }); +}; - it.each(sessionGenerators)('Sign Transaction', async (generator) => { +const signTransaction = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator.fn(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv?.litNodeClient!, @@ -203,12 +410,20 @@ describe('PKP Ethers', () => { } } finally { devEnv.releasePrivateKeyFromUser(alice); - } - }); + } +} - it.each(sessionGenerators)('Eth Sign Typed Data', async (generator) => { + +const ethTypedDataUtil = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator.fn(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv?.litNodeClient!, @@ -284,83 +499,18 @@ describe('PKP Ethers', () => { throw new Error(`❌ ${(e as Error).toString()}`); } finally { devEnv.releasePrivateKeyFromUser(alice); - } - }); - - it.each(sessionGenerators)('Sign Typed Data Util', async () => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - const signature = await signTypedData(pkpEthersWallet, msgParams); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); + } +} - expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } - }); - it.each(sessionGenerators)('SignedTypedDataV1', async () => { +const signTypedDataV1 = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); @@ -421,11 +571,19 @@ describe('PKP Ethers', () => { } finally { devEnv.releasePrivateKeyFromUser(alice); } - }); +} + - it.each(sessionGenerators)('SignedTypedDatav3', async (generator) => { +const signTypedDatav3 = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator.fn(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv.litNodeClient!, @@ -512,11 +670,18 @@ describe('PKP Ethers', () => { } finally { devEnv.releasePrivateKeyFromUser(alice); } - }); +} - it.each(sessionGenerators)('Signed Typed Data v4', async (generator) => { +const signTypedDatav4 = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator.fn(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv.litNodeClient!, @@ -603,88 +768,113 @@ describe('PKP Ethers', () => { } finally { devEnv.releasePrivateKeyFromUser(alice); } - }); +} - it('Sign With AuthContext', async () => { + +const signWithAuthContext = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { const alice = await devEnv.createRandomPerson(); const pkpEthersWallet = new PKPEthersWallet({ pkpPubKey: alice.pkp?.publicKey!, litNodeClient: devEnv.litNodeClient!, authContext: { - getSessionSigsProps: { - authNeededCallback: async function ( - params: AuthCallbackParams - ): Promise { - const toSign = await createSiweMessageWithRecaps({ - uri: params.uri!, - expiration: params.expiration!, - resources: params.resourceAbilityRequests!, - walletAddress: alice.wallet.address, - nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: alice.wallet, - toSign, - }); - - return authSig; - }, - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, + getSessionSigsProps: { + authNeededCallback: async function ( + params: AuthCallbackParams + ): Promise { + const toSign = await createSiweMessageWithRecaps({ + uri: params.uri!, + expiration: params.expiration!, + resources: params.resourceAbilityRequests!, + walletAddress: alice.wallet.address, + nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: alice.wallet, + toSign, + }); + + return authSig; + }, + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], }, - ], - }, - }, + } }); +} - await pkpEthersWallet.init(); +const ethPersonalSign = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise + ): Promise => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: pkpSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- personal_sign parameters try { - const signature = await pkpEthersWallet.signMessage(alice.loveLetter); - console.log('βœ… signature:', signature); + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'personal_sign', + params: [hexMsg, alice.pkp?.ethAddress], + }, + }); + + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr !== alice.pkp?.ethAddress) { + throw new Error( + `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` + ); + } + + console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); } catch (e) { throw new Error('❌ Error: ' + (e as Error).message); } finally { devEnv.releasePrivateKeyFromUser(alice); } - }); -}); - -const signMessage = async ( - devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise -): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test signMessage - try { - const res = await pkpEthersWallet.signMessage(alice.loveLetter); - expect(res).toBeDefined(); - } catch (e) { - throw new Error('❌ Error: ' + (e as Error).message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; +} \ No newline at end of file diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index bdeea48dc7..8f0948ef96 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -11,13 +11,17 @@ import { LitPKPResource, } from '@lit-protocol/auth-helpers'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient } from '@lit-protocol/types'; +import { ILitNodeClient, LitResourceAbilityRequest, SessionSigsMap } from '@lit-protocol/types'; + -import { sessionGenerators } from '../../utils/session-generator'; import { getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs, + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, } from '../../setup/session-sigs/get-lit-action-session-sigs'; +import { TinnyPerson } from '../../setup/tinny-person'; +import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs'; try { jest.setTimeout(60000); @@ -40,349 +44,128 @@ describe('SessionSigs', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - it.each(sessionGenerators)('DecryptString', async (generator) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: - generator.name === 'EOA' - ? alice.wallet.address - : alice.authMethodOwnedPkp?.ethAddress!, + describe('DecryptString', () => { + it('LitAction Session', async () => { + await decryptString(devEnv, getLitActionSessionSigs); }); - const litActionSessionSigs = await generator.fn(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - expect(encryptRes.ciphertext).toBeDefined(); - - expect(encryptRes.dataToEncryptHash).toBeDefined(); - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const litActionSessionSigs2 = await generator.fn(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: litActionSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); + it('LitAction IPFS Session', async () => { + await decryptString(devEnv, getLitActionSessionSigsUsingIpfsId); + }); - devEnv.releasePrivateKeyFromUser(alice); + it('EOA Wallet', async () => { + await decryptString(devEnv, getEoaSessionSigs); + }); - expect(decryptRes).toEqual('Hello world'); + it('PKP Session', async () => { + await decryptString(devEnv, getEoaSessionSigs); + }); }); - it.each(sessionGenerators)('Claim Keys', async (generator) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator.fn(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); + describe('Claim Keys', () => { + it('LitAction Session', async () => { + await executeJsCLaimKeys(devEnv, getLitActionSessionSigs); + }); - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, + it('LitAction IPFS Session', async () => { + await executeJsCLaimKeys(devEnv, getLitActionSessionSigsUsingIpfsId); }); - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); - - expect(res?.claims?.['foo'].signatures).toBeDefined(); - - res?.claims?.['foo'].signatures.forEach((sig: any) => { - expect(!sig.r).toBeDefined(); - expect(!sig.s).toBeDefined(); - expect(!sig.v).toBeDefined(); + it('EOA Wallet', async () => { + await executeJsCLaimKeys(devEnv, getEoaSessionSigs); }); - }); - it.each(sessionGenerators)('Claim Keys Multiple', async (generator) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); + it('PKP Session', async () => { + await executeJsCLaimKeys(devEnv, getEoaSessionSigs); + }); + }); - const alice = await devEnv.createRandomPerson(); + describe('Claim Keys Multiple', () => { + it('LitAction Session', async () => { + await executeJsCLaimKey(devEnv, getLitActionSessionSigs); + }); - const litActionSessionSigs = await generator.fn(devEnv, alice); + it('LitAction IPFS Session', async () => { + await executeJsCLaimKey(devEnv, getLitActionSessionSigsUsingIpfsId); + }); - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, + it('EOA Wallet', async () => { + await executeJsCLaimKey(devEnv, getEoaSessionSigs); }); - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); - - expect(res?.claims?.['foo'].signatures).toBeDefined(); - - res?.claims?.['foo'].signatures.forEach((sig: any) => { - expect(!sig.r).toBeDefined(); - expect(!sig.s).toBeDefined(); - expect(!sig.v).toBeDefined(); + it('PKP Session', async () => { + await executeJsCLaimKey(devEnv, getEoaSessionSigs); }); }); - it.each(sessionGenerators)('ExecuteJS JSON Response', async (generator) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator.fn(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - console.log('hello world') - - LitActions.setResponse({ - response: JSON.stringify({hello: 'world'}) - }); + + describe('ExecuteJS JSON Response', () => { + it('LitAction Session', async () => { + await pkpSign(devEnv, getLitActionSessionSigs); + }); - })();`, + it('LitAction IPFS Session', async () => { + await pkpSign(devEnv, getLitActionSessionSigsUsingIpfsId); }); - devEnv.releasePrivateKeyFromUser(alice); + it('EOA Wallet', async () => { + await pkpSign(devEnv, getEoaSessionSigs); + }); - expect(res?.response).toBeDefined(); - expect(res?.logs).toBeDefined(); - expect(res?.logs.includes('hello world')).toBeTruthy(); - expect(res?.success).toBeTruthy(); + it('PKP Session', async () => { + await pkpSign(devEnv, getEoaSessionSigs); + }); }); - it.each(sessionGenerators)('PKP Sign', async (generator) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); + describe('PKP Sign', () => { + it('LitAction Session', async () => { + await pkpSign(devEnv, getLitActionSessionSigs); + }); - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator.fn(devEnv, alice); + it('LitAction IPFS Session', async () => { + await pkpSign(devEnv, getLitActionSessionSigsUsingIpfsId); + }); - const res = await devEnv.litNodeClient?.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.authMethodOwnedPkp?.publicKey!, - sessionSigs: litActionSessionSigs!, + it('EOA Wallet', async () => { + await pkpSign(devEnv, getEoaSessionSigs); }); - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", - // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", - // recid: 1, - // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", - // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - expect(res?.r).toBeDefined(); - expect(res?.s).toBeDefined(); - expect(res?.dataSigned).toBeDefined(); - expect(res?.publicKey).toBeDefined(); + it('PKP Session', async () => { + await pkpSign(devEnv, getEoaSessionSigs); + }); }); - it.each(sessionGenerators)('ExecuteJS Signing', async (generator) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator.fn(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); + describe('ExecuteJS Signing', () => { + it('LitAction Session', async () => { + await pkpSign(devEnv, getLitActionSessionSigs); + }); - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp?.publicKey, - }, + it('LitAction IPFS Session', async () => { + await executeJsSigning(devEnv, getLitActionSessionSigsUsingIpfsId); }); - devEnv.releasePrivateKeyFromUser(alice); + it('EOA Wallet', async () => { + await executeJsSigning(devEnv, getEoaSessionSigs); + }); - expect(res?.signatures?.sig.r).toBeDefined(); - expect(res?.signatures?.sig.s).toBeDefined(); - expect(res?.signatures?.sig.dataSigned).toBeDefined(); - expect(res?.signatures?.sig.publicKey).toBeDefined(); + it('PKP Session', async () => { + await executeJsSigning(devEnv, getEoaSessionSigs); + }); }); - it.each(sessionGenerators)('ExecteJS Signing Parallel', async (generator) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - - const litActionSessionSigs = await generator.fn(devEnv, alice); - - const fn = async (index: number) => { - return await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp?.publicKey, - }, - }); - }; + describe('ExecteJS Signing Parallel', () => { + it('LitAction Session', async () => { + await executeJsSigningParallel(devEnv, getLitActionSessionSigs); + }); - devEnv.releasePrivateKeyFromUser(alice); + it('LitAction IPFS Session', async () => { + await executeJsSigningParallel(devEnv, getLitActionSessionSigsUsingIpfsId); + }); - const res = await Promise.all([fn(1), fn(2), fn(3)]); + it('EOA Wallet', async () => { + await executeJsSigningParallel(devEnv, getEoaSessionSigs); + }); - res.forEach((r) => { - expect(r?.signatures?.sig.r).toBeDefined(); - expect(r?.signatures?.sig.s).toBeDefined(); - expect(r?.signatures?.sig.dataSigned).toBeDefined(); - expect(r?.signatures?.sig.publicKey).toBeDefined(); + it('PKP Session', async () => { + await executeJsSigningParallel(devEnv, getEoaSessionSigs); }); }); @@ -430,3 +213,414 @@ describe('SessionSigs', () => { } }); }); + +const executeJsCLaimKeys = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + Lit.Actions.claimKey({keyId: "bar"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // assertions + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); + + expect(res?.claims?.['bar']).toBeDefined(); + expect(res?.claims?.['bar']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['bar'].signatures).toBeDefined(); + + res?.claims?.['bar'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); +}; + + +const executeJsCLaimKey = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await generator(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + Lit.Actions.claimKey({keyId: "foo"}); + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // Expected output: + // { + // claims: { + // bar: { + // signatures: [ + // { + // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", + // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", + // v: 28, + // }, { + // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", + // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", + // v: 28, + // }, { + // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", + // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", + // v: 28, + // } + // ], + // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", + // }, + // foo: { + // signatures: [ + // { + // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", + // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", + // v: 27, + // }, { + // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", + // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", + // v: 27, + // }, { + // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", + // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", + // v: 27, + // } + // ], + // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", + // }, + // }, + // signatures: {}, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + expect(res?.claims?.['foo']).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + + expect(res?.claims?.['foo'].signatures).toBeDefined(); + + res?.claims?.['foo'].signatures.forEach((sig: any) => { + expect(!sig.r).toBeDefined(); + expect(!sig.s).toBeDefined(); + expect(!sig.v).toBeDefined(); + }); +}; + + +const pkpSign = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator(devEnv, alice); + + const res = await devEnv.litNodeClient?.pkpSign({ + toSign: alice.loveLetter, + pubKey: alice.authMethodOwnedPkp?.publicKey!, + sessionSigs: litActionSessionSigs!, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + // -- Expected output: + // { + // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", + // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", + // recid: 1, + // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", + // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // } + + expect(res?.r).toBeDefined(); + expect(res?.s).toBeDefined(); + expect(res?.dataSigned).toBeDefined(); + expect(res?.publicKey).toBeDefined(); +} + +const executeJsJSONResponse = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + console.log('hello world') + + LitActions.setResponse({ + response: JSON.stringify({hello: 'world'}) + }); + + })();`, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.response).toBeDefined(); + expect(res?.logs).toBeDefined(); + expect(res?.logs.includes('hello world')).toBeTruthy(); + expect(res?.success).toBeTruthy(); +} + +const executeJsSigning = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const litActionSessionSigs = await generator(devEnv, alice, [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.signatures?.sig.r).toBeDefined(); + expect(res?.signatures?.sig.s).toBeDefined(); + expect(res?.signatures?.sig.dataSigned).toBeDefined(); + expect(res?.signatures?.sig.publicKey).toBeDefined(); +} + +const executeJsSigningParallel = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await generator(devEnv, alice); + + const fn = async (index: number) => { + return await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.authMethodOwnedPkp?.publicKey, + }, + }); + }; + + devEnv.releasePrivateKeyFromUser(alice); + + const res = await Promise.all([fn(1), fn(2), fn(3)]); + + res.forEach((r) => { + expect(r?.signatures?.sig.r).toBeDefined(); + expect(r?.signatures?.sig.s).toBeDefined(); + expect(r?.signatures?.sig.dataSigned).toBeDefined(); + expect(r?.signatures?.sig.publicKey).toBeDefined(); + }); +} + + + +const decryptString = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: + generator.name === 'EOA' + ? alice.wallet.address + : alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await generator(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + expect(encryptRes.ciphertext).toBeDefined(); + + expect(encryptRes.dataToEncryptHash).toBeDefined(); + + const accsResourceString = + await LitAccessControlConditionResource.generateResourceString( + accs, + encryptRes.dataToEncryptHash + ); + + const litActionSessionSigs2 = await generator(devEnv, alice, [ + { + resource: new LitAccessControlConditionResource(accsResourceString), + ability: LitAbility.AccessControlConditionDecryption, + }, + ]); + + // -- Decrypt the encrypted string + const decryptRes = await LitJsSdk.decryptToString( + { + accessControlConditions: accs, + ciphertext: encryptRes.ciphertext, + dataToEncryptHash: encryptRes.dataToEncryptHash, + sessionSigs: litActionSessionSigs2, + chain: 'ethereum', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(decryptRes).toEqual('Hello world'); +} \ No newline at end of file From ff8559ce98d64b59c1bcaeabb7d33372c7168537 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 10:51:36 -0400 Subject: [PATCH 017/136] ref: tweaks to test cases after refactor --- .../e2e-tests/src/tests/SessionSigs.spec.ts | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 8f0948ef96..32d18fc062 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -22,6 +22,7 @@ import { } from '../../setup/session-sigs/get-lit-action-session-sigs'; import { TinnyPerson } from '../../setup/tinny-person'; import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs'; +import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; try { jest.setTimeout(60000); @@ -58,7 +59,7 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await decryptString(devEnv, getEoaSessionSigs); + await decryptString(devEnv, getPkpSessionSigs); }); }); @@ -76,7 +77,7 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await executeJsCLaimKeys(devEnv, getEoaSessionSigs); + await executeJsCLaimKeys(devEnv, getPkpSessionSigs); }); }); @@ -94,25 +95,25 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await executeJsCLaimKey(devEnv, getEoaSessionSigs); + await executeJsCLaimKey(devEnv, getPkpSessionSigs); }); }); describe('ExecuteJS JSON Response', () => { it('LitAction Session', async () => { - await pkpSign(devEnv, getLitActionSessionSigs); + await executeJsJSONResponse(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await pkpSign(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsJSONResponse(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await pkpSign(devEnv, getEoaSessionSigs); + await executeJsJSONResponse(devEnv, getEoaSessionSigs); }); it('PKP Session', async () => { - await pkpSign(devEnv, getEoaSessionSigs); + await executeJsJSONResponse(devEnv, getPkpSessionSigs); }); }); @@ -130,7 +131,7 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await pkpSign(devEnv, getEoaSessionSigs); + await pkpSign(devEnv, getPkpSessionSigs); }); }); describe('ExecuteJS Signing', () => { @@ -147,7 +148,7 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await executeJsSigning(devEnv, getEoaSessionSigs); + await executeJsSigning(devEnv, getPkpSessionSigs); }); }); @@ -165,7 +166,7 @@ describe('SessionSigs', () => { }); it('PKP Session', async () => { - await executeJsSigningParallel(devEnv, getEoaSessionSigs); + await executeJsSigningParallel(devEnv, getPkpSessionSigs); }); }); @@ -569,7 +570,7 @@ const decryptString = async ( // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: - generator.name === 'EOA' + generator.name === 'getEoaSessionSigs' ? alice.wallet.address : alice.authMethodOwnedPkp?.ethAddress!, }); From a38d6a2723785bd3b60eb677a6f133b90a846a93 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:23:03 -0400 Subject: [PATCH 018/136] test: migrate wrapped keys tests --- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 1374 +++++++++++++++++ 1 file changed, 1374 insertions(+) create mode 100644 packages/e2e-tests/src/tests/WrappedKeys.spec.ts diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts new file mode 100644 index 0000000000..6bca4c715f --- /dev/null +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -0,0 +1,1374 @@ +import { expect, jest } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { + EthereumLitTransaction, + SerializedTransaction, + api, +} from '@lit-protocol/wrapped-keys'; +import { + Connection, + Keypair, + LAMPORTS_PER_SOL, + PublicKey, + SystemProgram, + Transaction, + clusterApiUrl, +} from '@solana/web3.js'; +import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; + +import nacl from 'tweetnacl'; +import bs58 from 'bs58'; +import { ethers } from 'ethers'; +import { + AuthSig, + LIT_NETWORKS_KEYS, + SessionSigsMap, +} from '@lit-protocol/types'; +import { encryptString } from '@lit-protocol/encryption'; +import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs'; +import { LIT_CHAINS } from '@lit-protocol/constants'; +import { LIT_ACTION_CID_REPOSITORY } from '../../../wrapped-keys/src/lib/lit-actions-client/constants'; +import { getPkpAccessControlCondition } from '../../../wrapped-keys/src/lib/utils'; +import { LIT_PREFIX } from '../../../wrapped-keys/src/lib/constants'; + +const { + importPrivateKey, + signTransactionWithEncryptedKey, + signMessageWithEncryptedKey, + generatePrivateKey, + exportPrivateKey, +} = api; + +/** + * Helper migrated from tinny utils due to an issue with root level dependency resolve + * Migration is acceptible due to aggreagation of test casses into a snigle file context. + * @returns {string} + */ +export function randomSolanaPrivateKey() { + const BASE58_ALPHABET = + '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + const SOLANA_PRIVATE_KEY_LENGTH = 88; + + let result = ''; + const charactersLength = BASE58_ALPHABET.length; + for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { + const randomIndex = Math.floor(Math.random() * charactersLength); + result += BASE58_ALPHABET.charAt(randomIndex); + } + return result; +} + +try { + jest.setTimeout(60000); +} catch (e) { + // ... continue execution +} + +describe('Wrapped Keys', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + it('Sign Tx Sol Encrypted Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const solanaKeypair = Keypair.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv?.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + const solanaTransaction = new Transaction(); + solanaTransaction.add( + SystemProgram.transfer({ + fromPubkey: solanaKeypair.publicKey, + toPubkey: new PublicKey(solanaKeypair.publicKey), + lamports: LAMPORTS_PER_SOL / 100, // Transfer 0.01 SOL + }) + ); + solanaTransaction.feePayer = solanaKeypair.publicKey; + + const solanaConnection = new Connection( + clusterApiUrl('devnet'), + 'confirmed' + ); + const { blockhash } = await solanaConnection.getLatestBlockhash(); + solanaTransaction.recentBlockhash = blockhash; + + const serializedTransaction = solanaTransaction + .serialize({ + requireAllSignatures: false, // should be false as we're not signing the message + verifySignatures: false, // should be false as we're not signing the message + }) + .toString('base64'); + + const unsignedTransaction: SerializedTransaction = { + serializedTransaction, + chain: 'devnet', + }; + + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'solana', + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv?.litNodeClient!, + }); + + console.log('signedTx'); + console.log(signedTx); + + const signatureBuffer = Buffer.from(signedTx, 'base64'); + solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); + + if (!solanaTransaction.verifySignatures()) { + throw new Error( + `Signature: ${signedTx} doesn't validate for the Solana transaction.` + ); + } + }); + + it('Sign Message Sol Encryption Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const solanaKeypair = Keypair.generate(); + const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv?.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const messageToSign = 'This is a test message'; + + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'solana', + messageToSign, + litNodeClient: devEnv?.litNodeClient!, + }); + + console.log('signature'); + console.log(signature); + + const signatureIsValidForPublicKey = nacl.sign.detached.verify( + Buffer.from(messageToSign), + bs58.decode(signature), + solanaKeypair.publicKey.toBuffer() + ); + + if (!signatureIsValidForPublicKey) + throw new Error( + `signature: ${signature} doesn't validate for the Solana public key: ${solanaKeypair.publicKey.toString()}` + ); + }); + + it('Import Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = randomSolanaPrivateKey(); + // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv?.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + }); + + it('Generate Solana Wrapped Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + network: 'solana', + litNodeClient: devEnv?.litNodeClient!, + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const messageToSign = 'This is a test message'; + + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + litNodeClient: devEnv?.litNodeClient!, + network: 'solana', + messageToSign, + }); + + const signatureIsValidForPublicKey = nacl.sign.detached.verify( + Buffer.from(messageToSign), + bs58.decode(signature), + bs58.decode(generatedPublicKey) + ); + + if (!signatureIsValidForPublicKey) + throw new Error( + `signature: ${signature} doesn't validate for the Solana public key: ${generatedPublicKey}` + ); + + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport!, + litNodeClient: devEnv?.litNodeClient!, + network: 'solana', + }); + + const solanaKeyPair = Keypair.fromSecretKey( + Buffer.from(decryptedPrivateKey, 'hex') + ); + const decryptedPublicKey = solanaKeyPair.publicKey; + + if (decryptedPublicKey.toString() !== generatedPublicKey) { + throw new Error( + `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` + ); + } + }); + + it('Generate ETH Wrapped Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + network: 'evm', + litNodeClient: devEnv.litNodeClient!, + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsExport); + + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport!, + litNodeClient: devEnv.litNodeClient!, + network: 'evm', + }); + + const wallet = new ethers.Wallet(decryptedPrivateKey); + const decryptedPublicKey = wallet.publicKey; + + if (decryptedPublicKey !== generatedPublicKey) { + throw new Error( + `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` + ); + } + }); + + it('Fail Import Wrapped Key Same Private Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = + '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; // Already exists in the DB + + try { + await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + } catch (e: any) { + if ( + e.message.includes( + 'Failed to make request for wrapped key: There is already a wrapped key stored with the same dataToEncryptHash. A wrapped key may only be associated with a single pkpAddress' + ) + ) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithSamePrivateKey is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Import Wrapped Key Same PKP', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey1 = randomSolanaPrivateKey(); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey: privateKey1, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + console.log('βœ… testFailImportWrappedKeysWithSamePkp'); + + try { + const privateKey2 = randomSolanaPrivateKey(); + + await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey: privateKey2, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + } catch (e: any) { + if ( + e.message.includes( + 'There is already a wrapped key stored, either for the provided pkpAddress, or with the same dataToEncryptHash; a pkpAddress may only have 1 wrapped key, and a wrapped key may only be associated with a single pkpAddress.' + ) + ) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithSamePkp is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Max Expiration Session Sig', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + console.log(pkpSessionSigs); + + try { + const privateKey = randomSolanaPrivateKey(); + + await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + } catch (e: any) { + if (e.message.includes('Expires too far in the future')) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithMaxExpirySessionSig is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Import Invalid Session Sig', async () => { + const tamperPkpSessionSigs = ( + pkpSessionSig: SessionSigsMap + ): SessionSigsMap => { + const tamperedPkpSessionSigs: SessionSigsMap = {}; + + for (const key in pkpSessionSig) { + if (pkpSessionSig.hasOwnProperty(key)) { + const authSig = pkpSessionSig[key]; + const updatedAuthSig: AuthSig = { + ...authSig, + address: authSig.address.slice(0, -1), + }; + tamperedPkpSessionSigs[key] = updatedAuthSig; + } + } + + console.log(tamperedPkpSessionSigs); + + return tamperedPkpSessionSigs; + }; + + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + + console.log(pkpSessionSigs); + + try { + const privateKey = randomSolanaPrivateKey(); + + await importPrivateKey({ + pkpSessionSigs: tamperPkpSessionSigs(pkpSessionSigs!), + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + } catch (e: any) { + if (e.message.includes('bad public key size')) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithInvalidSessionSig is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Import Expired Session Sig', async () => { + const pkpSessionSigs: SessionSigsMap = { + 'https://207.244.70.36:8474': { + sig: '1827d1c7b79c979ce76d0b9e130f6804dbf7c7838b6dfa41d4cadf690b9a8bec23321dde6cc573e8a592c395193074ade303d94f3c198d8f0017ca0aca91bd0f', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8474"}`, + address: + '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + 'https://207.244.70.36:8473': { + sig: '762b9849d2cc77d0c75aa354c3cce63abca008a9a07ec3efc69ee8a4954650c3362b8cb83cd3d63310ad98b446be5e68cb8193f9d486453b2df72188dc698d0e', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8473"}`, + address: + '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + 'https://207.244.70.36:8475': { + sig: '5e506dc973cc1540dcb3bd1de251afa687caf277cb5f3efe107339ecf4c25607d4bdf5d8c8910874519252e026a49cc66cea0b07bc5d38342c7cb2613decbe0a', + derivedVia: 'litSessionSignViaNacl', + signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8475"}`, + address: + '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', + algo: 'ed25519', + }, + }; + + try { + const privateKey = randomSolanaPrivateKey(); + + const res = await importPrivateKey({ + pkpSessionSigs, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + console.log(res); + } catch (e: any) { + if (e.message.includes('Invalid sessionSig: Expired')) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithExpiredSessionSig is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail EOA Session Sig', async () => { + const alice = await devEnv.createRandomPerson(); + + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + + console.log(eoaSessionSigs); + + const privateKey = randomSolanaPrivateKey(); + + try { + await importPrivateKey({ + pkpSessionSigs: eoaSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + } catch (e: any) { + if (e.message.includes('SessionSig is not from a PKP')) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailImportWrappedKeysWithEoaSessionSig is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Eth Sign Tx Missing Params', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + const privateKey = ethers.Wallet.createRandom().privateKey; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + try { + const _res = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction: { + ...getChainForNetwork(devEnv.litNodeClient?.config?.litNetwork!), + // @ts-expect-error This test is intentionally using the type incorrectly. + serializedTransaction: 'random-value', + }, + broadcast: false, + litNodeClient: devEnv.litNodeClient!, + }); + } catch (e: any) { + if ( + e.message.includes( + 'Error executing the Signing Lit Action: Error: Missing required field: toAddress' + ) + ) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailEthereumSignTransactionWrappedKeyWithMissingParam is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Eth Sign Invalid Param', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = ethers.Wallet.createRandom().privateKey; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedTransaction: EthereumLitTransaction = { + ...getBaseTransactionForNetwork({ + network: devEnv.litNodeClient!.config.litNetwork, + toAddress: alice.wallet.address, + }), + dataHex: 'Test transaction from Alice to bob', + }; + + try { + const _res = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient!, + }); + } catch (e: any) { + if ( + e.message.includes( + 'Error executing the Signing Lit Action: Error: When signing transaction- invalid hexlify value' + ) + ) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailEthereumSignTransactionWrappedKeyWithInvalidParam is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Fail Eth TX Invalid Decryption', async () => { + const alice = await devEnv.createRandomPerson(); + const privateKey = ethers.Wallet.createRandom().privateKey; + const alicePkpAddress = alice.authMethodOwnedPkp!.ethAddress; + const decryptionAccessControlCondition = + getPkpAccessControlCondition(alicePkpAddress); + const { ciphertext, dataToEncryptHash } = await encryptString( + { + accessControlConditions: [decryptionAccessControlCondition], + dataToEncrypt: LIT_PREFIX + privateKey, + }, + devEnv.litNodeClient! + ); + + const bob = await devEnv.createRandomPerson(); + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + bob, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + console.log(pkpSessionSigsSigning); + + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient?.config.litNetwork!, + toAddress: alice.wallet.address, + }); + + try { + const _res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: pkpSessionSigsSigning, + ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, + jsParams: { + ciphertext, + dataToEncryptHash, + unsignedTransaction, + accessControlConditions: [decryptionAccessControlCondition], + }, + }); + } catch (e: any) { + if ( + e.message.includes( + 'There was an error getting the signing shares from the nodes' + ) + ) { + console.log('βœ… THIS IS EXPECTED: ', e); + console.log(e.message); + console.log( + 'βœ… testFailEthereumSignTransactionWrappedKeyInvalidDecryption is expected to have an error' + ); + } else { + throw e; + } + } + }); + + it('Export', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigsImport = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsImport); + + const privateKey = randomSolanaPrivateKey(); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigsImport!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsExport = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsExport); + + const { decryptedPrivateKey } = await exportPrivateKey({ + pkpSessionSigs: pkpSessionSigsExport!, + litNodeClient: devEnv.litNodeClient!, + network: 'solana', + }); + + if (decryptedPrivateKey !== privateKey) { + throw new Error( + `Decrypted private key: ${decryptedPrivateKey} doesn't match with the original private key: ${privateKey}` + ); + } + }); + + it('Eth Sign Tx', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = ethers.Wallet.createRandom().privateKey; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient?.config.litNetwork!, + toAddress: alice.wallet.address, + }); + + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction, + broadcast: false, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signedTx'); + console.log(signedTx); + + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + }); + + it('Eth Sign Message', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = ethers.Wallet.createRandom().privateKey; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedStringMessage = 'This is a test message'; + + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signature'); + console.log(signature); + + if (!ethers.utils.isHexString(signature)) { + throw new Error(`signature isn't hex: ${signature}`); + } + + const unsignedBinaryMessage = ethers.utils.arrayify( + ethers.utils.toUtf8Bytes(unsignedStringMessage) + ); + + const signatureBinary = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signatureBinary'); + console.log(signatureBinary); + + if (!ethers.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + + if (signatureBinary !== signature) { + throw new Error( + `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` + ); + } + }); + + it('Eth Sign Message Generate Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const privateKey = ethers.Wallet.createRandom().privateKey; + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedStringMessage = 'This is a test message'; + + const signature = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + messageToSign: unsignedStringMessage, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signature'); + console.log(signature); + + if (!ethers.utils.isHexString(signature)) { + throw new Error(`signature isn't hex: ${signature}`); + } + + const unsignedBinaryMessage = ethers.utils.arrayify( + ethers.utils.toUtf8Bytes(unsignedStringMessage) + ); + + const signatureBinary = await signMessageWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + messageToSign: unsignedBinaryMessage, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signatureBinary'); + console.log(signatureBinary); + + if (!ethers.utils.isHexString(signatureBinary)) { + throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); + } + + if (signatureBinary !== signature) { + throw new Error( + `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` + ); + } + }); + + it('Eth Broadcast With Fetch Gas Params', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const wrappedKeysWallet = ethers.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedTransaction: EthereumLitTransaction = { + toAddress: alice.wallet.address, + value: '0.0001', // in ethers (Lit tokens) + dataHex: ethers.utils.hexlify( + ethers.utils.toUtf8Bytes('Test transaction from Alice to bob') + ), + ...getChainForNetwork(devEnv.litNodeClient?.config.litNetwork!), + }; + + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signedTx'); + console.log(signedTx); + + // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + }); + + it('Eth Broadcast Tx', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const wrappedKeysWallet = ethers.Wallet.createRandom(); + const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; + + const wrappedKeysWalletAddress = wrappedKeysWallet.address; + console.log(`Sending funds to ${wrappedKeysWalletAddress}`); + await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); + + const pkpAddress = await importPrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + privateKey: wrappedKeysWalletPrivateKey, + litNodeClient: devEnv.litNodeClient!, + publicKey: '0xdeadbeef', + keyType: 'K256', + }); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient?.config.litNetwork!, + toAddress: alice.wallet.address, + }); + + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signedTx'); + console.log(signedTx); + + // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + }); + + it('Eth Broadcast Tx Generated Key', async () => { + const alice = await devEnv.createRandomPerson(); + + const pkpSessionSigs = await getPkpSessionSigs( + devEnv, + alice, + null, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigs); + + const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + pkpSessionSigs: pkpSessionSigs!, + network: 'evm', + litNodeClient: devEnv.litNodeClient!, + }); + + const generatedKeysWalletAddress = + ethers.utils.computeAddress(generatedPublicKey); + console.log(`Sending funds to ${generatedKeysWalletAddress}`); + await devEnv.getFunds(generatedKeysWalletAddress, '0.005'); + + const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; + if (pkpAddress !== alicePkpAddress) { + throw new Error( + `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` + ); + } + + const pkpSessionSigsSigning = await getPkpSessionSigs( + devEnv, + alice, + undefined, + new Date(Date.now() + 1000 * 60 * 10).toISOString() + ); // 10 mins expiry + + console.log(pkpSessionSigsSigning); + + const unsignedTransaction = getBaseTransactionForNetwork({ + network: devEnv.litNodeClient?.config.litNetwork!, + toAddress: alice.wallet.address, + }); + + const signedTx = await signTransactionWithEncryptedKey({ + pkpSessionSigs: pkpSessionSigsSigning!, + network: 'evm', + unsignedTransaction, + broadcast: true, + litNodeClient: devEnv.litNodeClient!, + }); + + console.log('signedTx'); + console.log(signedTx); + + if (!ethers.utils.isHexString(signedTx)) { + throw new Error(`signedTx isn't hex: ${signedTx}`); + } + }); +}); + +/** + * UTILITIES + */ +export function getChainForNetwork(network: LIT_NETWORKS_KEYS): { + chain: string; + chainId: number; +} { + switch (network) { + case 'cayenne': + case 'habanero': + case 'manzano': + return { + chain: 'chronicleTestnet', + chainId: LIT_CHAINS['chronicleTestnet'].chainId, + }; + case 'datil-dev': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; + case 'datil-test': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} + +export function getGasParamsForNetwork(network: LIT_NETWORKS_KEYS): { + gasPrice?: string; + gasLimit: number; +} { + switch (network) { + case 'cayenne': + case 'habanero': + case 'manzano': + return { + gasPrice: '0.001', + gasLimit: 30000, + }; + case 'datil-dev': + return { gasLimit: 5000000 }; + case 'datil-test': + return { gasLimit: 5000000 }; + default: + throw new Error(`Cannot identify chain params for ${network}`); + } +} + +export function getBaseTransactionForNetwork({ + toAddress, + network, +}: { + toAddress: string; + network: LIT_NETWORKS_KEYS; +}): EthereumLitTransaction { + return { + toAddress, + value: '0.0001', // in ethers (Lit tokens) + ...getChainForNetwork(network), + ...getGasParamsForNetwork(network), + dataHex: ethers.utils.hexlify( + ethers.utils.toUtf8Bytes('Test transaction from Alice to bob') + ), + }; +} From 0dca2ea4373faf7b5e772d50cae8d63ec94ff1ac Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:23:21 -0400 Subject: [PATCH 019/136] ref: Migrate to explicit test cases --- .../e2e-tests/src/tests/connection.spec.ts | 44 +++++++++++++++---- 1 file changed, 35 insertions(+), 9 deletions(-) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 2443dce80e..f3c7fbe568 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -15,12 +15,21 @@ describe('Connections', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - test.each(NETWORKS)('Testing network: %s', async (network) => { - const devEnv = new TinnyEnvironment(network as LIT_TESTNET); + afterEach(() => { + // TODO: can be removed once v7 is merged with wasm refactors + delete globalThis.wasmExports; + //@ts-ignore defined in global + delete globalThis.wasmSevSnpUtils; + + delete globalThis.wasmECDSA; + }); + + it('Testing network: Manzano', async () => { + const devEnv = new TinnyEnvironment(NETWORKS[0] as LIT_TESTNET); await devEnv.init(); expect(devEnv.litNodeClient).toBeDefined(); expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(network); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[0]); expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( @@ -28,12 +37,29 @@ describe('Connections', () => { ); }); - afterEach(() => { - // TODO: can be removed once v7 is merged with wasm refactors - delete globalThis.wasmExports; - //@ts-ignore defined in global - delete globalThis.wasmSevSnpUtils; + it('Testing network: Datil Dev', async () => { + const devEnv = new TinnyEnvironment(NETWORKS[1] as LIT_TESTNET); + await devEnv.init(); + expect(devEnv.litNodeClient).toBeDefined(); + expect(devEnv.litNodeClient?.ready).toBe(true); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[1]); + expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); + expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); + expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( + devEnv.litNodeClient?.config?.minNodeCount! + ); + }); - delete globalThis.wasmECDSA; + it('Testing network: Cayenne', async () => { + const devEnv = new TinnyEnvironment(NETWORKS[2] as LIT_TESTNET); + await devEnv.init(); + expect(devEnv.litNodeClient).toBeDefined(); + expect(devEnv.litNodeClient?.ready).toBe(true); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[2]); + expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); + expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); + expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( + devEnv.litNodeClient?.config?.minNodeCount! + ); }); }); From 506ec01de347fd725f7e3ed4fe274911635b029a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:23:33 -0400 Subject: [PATCH 020/136] test: add delegation tests --- .../e2e-tests/src/tests/Delegation.spec.ts | 260 ++++++++++++++++++ 1 file changed, 260 insertions(+) create mode 100644 packages/e2e-tests/src/tests/Delegation.spec.ts diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts new file mode 100644 index 0000000000..13bf11da10 --- /dev/null +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -0,0 +1,260 @@ +import { expect, jest } from '@jest/globals'; +import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { + LitAbility, + LitActionResource, + LitPKPResource, +} from '@lit-protocol/auth-helpers'; +import { getEoaSessionSigsWithCapacityDelegations } from '../../setup/session-sigs/get-eoa-session-sigs'; +import { AuthMethodScope, AuthMethodType } from '@lit-protocol/constants'; + +describe('Delegation', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + it('PKP to PKP delegation executeJS', async () => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + // Checking the scopes of the PKP owned by Bob + const bobsAuthMethodAuthId = await LitAuthClient.getAuthIdByAuthMethod( + bob.authMethod + ); + + const scopes = + await bob.contractsClient?.pkpPermissionsContract.read.getPermittedAuthMethodScopes( + bob.authMethodOwnedPkp?.tokenId!, + AuthMethodType.EthWallet, + bobsAuthMethodAuthId, + 3 + ); + + if (!scopes![AuthMethodScope.SignAnything]) { + throw new Error('Bob does not have the "SignAnything" scope on his PKP'); + } + + // As a dApp owner, create a capacity delegation authSig for Bob's PKP wallet + const capacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig([bob.pkp?.ethAddress!]); + + // As a dApp owner, delegate the capacity credits NFT to Bob + const bobPkpSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: bob.authMethodOwnedPkp?.publicKey!, + authMethods: [bob.authMethod!], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + capabilityAuthSigs: [capacityDelegationAuthSig], + }); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: bobPkpSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.authMethodOwnedPkp?.publicKey, + }, + }); + + console.log('βœ… res:', res); + + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + + // -- Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237", + // s: "480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc", + // recid: 0, + // signature: "0x00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc1b", + // publicKey: "0465BFEE5CCFF60C0AF1D9B9481B680C2E34894A88F68F44CC094BA27501FD062A3C4AC61FA850BFA22D81D41AF72CBF983909501440FE51187F5FB3D1BC55C44E", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + expect(res?.signatures?.sig.r).toBeDefined(); + expect(res?.signatures?.sig.s).toBeDefined(); + expect(res?.signatures?.sig.dataSigned).toBeDefined(); + expect(res?.signatures?.sig.publicKey).toBeDefined(); + + // -- signatures.sig.signature must start with 0x + expect(res?.signatures.sig.signature.startsWith('0x')).toBeDefined(); + }); + + it('PKP to EOA ExecuteJs', async () => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + + // Expected output: + // { + // claims: {}, + // signatures: { + // sig: { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // }, + // decryptions: [], + // response: undefined, + // logs: "", + // } + + // -- assertions + expect(res?.signatures?.sig.r).toBeDefined(); + expect(res?.signatures?.sig.s).toBeDefined(); + expect(res?.signatures?.sig.dataSigned).toBeDefined(); + expect(res?.signatures?.sig.publicKey).toBeDefined(); + + // -- signatures.sig.signature must start with 0x + expect(res?.signatures.sig.signature.startsWith('0x')).toBeDefined(); + + // -- signatures.sig.recid must be parseable as a number + expect(isNaN(res?.signatures.sig.recid)).toBeTruthy(); + }); + + it('PKP to EOA PKP Sign', async () => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = + await alice.createCapacityDelegationAuthSig([bob.wallet.address]); + + // 4. Bob receives the capacity delegation authSig use it to generate session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient?.pkpSign({ + sessionSigs: bobsSessionSigs!, + toSign: alice.loveLetter, + pubKey: bob.pkp?.publicKey!, + }); + + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + + // Expected output: + // { + // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", + // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", + // recid: 1, + // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", + // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", + // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", + // }, + // + // } + + // -- assertions + expect(res?.r).toBeDefined(); + expect(res?.s).toBeDefined(); + expect(res?.dataSigned).toBeDefined(); + expect(res?.publicKey).toBeDefined(); + + // -- signatures.sig.signature must start with 0x + expect(res?.signature.startsWith('0x')).toBeDefined(); + + // -- signatures.sig.recid must be parseable as a number + expect(isNaN(res?.recid!)).toBeTruthy(); + }); +}); From 10779fe9949c28f0739f5cc3156f61d0dd26fddf Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:23:54 -0400 Subject: [PATCH 021/136] chore: version bump --- packages/e2e-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index da5850e49a..5b3a5d4375 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -17,7 +17,7 @@ "tags": [ "universal" ], - "version": "6.2.0", + "version": "6.2.2", "main": "./dist/src/index.js", "typings": "./dist/src/index.d.ts" } From 57c18574f7d0c2f778af0c38a2256f0a44b165ec Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:24:09 -0400 Subject: [PATCH 022/136] ref: add back dep --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e10e1ce1e6..acf5e7bf51 100644 --- a/package.json +++ b/package.json @@ -120,6 +120,7 @@ "ethereum-abi-types-generator": "^1.3.2", "express": "^4.18.2", "inquirer": "^9.2.21", + "ipfs-unixfs-importer": "12.0.1", "jest": "29.7.0", "lerna": "^5.4.3", "live-server": "^1.2.2", From 57005ef0f8063202faaa512b63871cad9a6c5ddb Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:24:27 -0400 Subject: [PATCH 023/136] ref: refactor to explicit test cases --- .../e2e-tests/src/tests/PKPEthers.spec.ts | 1350 ++++++++--------- .../e2e-tests/src/tests/SessionSigs.spec.ts | 32 +- 2 files changed, 689 insertions(+), 693 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 918a09325a..864ec09a13 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -72,164 +72,164 @@ describe('PKP Ethers', () => { describe('ETH Signing', () => { it('LitAction Session', async () => { - await ethTransaction(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await ethTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await ethTransaction(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await ethTransaction(devEnv, getEoaSessionSigs); - }); + await ethTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethTransaction(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethTransaction(devEnv, getEoaSessionSigs); + }); }); describe('ETH Personal Signing', () => { it('LitAction Session', async () => { - await ethPersonalSign(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await ethPersonalSign(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await ethPersonalSign(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await ethPersonalSign(devEnv, getEoaSessionSigs); - }); + await ethPersonalSign(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethPersonalSign(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethPersonalSign(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethPersonalSign(devEnv, getEoaSessionSigs); + }); }); describe('Sign Transaction', () => { it('LitAction Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await signTransaction(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await signTransaction(devEnv, getEoaSessionSigs); - }); + await signTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTransaction(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTransaction(devEnv, getEoaSessionSigs); + }); }); describe('Eth Sign Typed Data', () => { it('LitAction Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); - }); + await signTransaction(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); }); describe('Sign Typed Data Util', () => { it('LitAction Session', async () => { - await ethTypedDataUtil(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await ethTypedDataUtil(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await ethTypedDataUtil(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await ethTypedDataUtil(devEnv, getEoaSessionSigs); - }); + await ethTypedDataUtil(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await ethTypedDataUtil(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await ethTypedDataUtil(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await ethTypedDataUtil(devEnv, getEoaSessionSigs); + }); + }); + + describe('SignedTypedDataV1', () => { + it('LitAction Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDataV1(devEnv, getEoaSessionSigs); + }); }); - describe('SignedTypedDataV1', () => { - it('LitAction Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); - }); - }); - - describe('SignedTypedDatav3', () => { - it('LitAction Session', async () => { - await signTypedDatav3(devEnv, getLitActionSessionSigs); - }); - - it('LitAction IPFS Session', async () => { - await signTypedDatav3(devEnv, getLitActionSessionSigsUsingIpfsId); - }); - - it('EOA Wallet', async () => { - await signTypedDatav3(devEnv, getEoaSessionSigs); - }); - - it('PKP Session', async () => { - await signTypedDatav3(devEnv, getEoaSessionSigs); - }); + describe('SignedTypedDatav3', () => { + it('LitAction Session', async () => { + await signTypedDatav3(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signTypedDatav3(devEnv, getLitActionSessionSigsUsingIpfsId); + }); + + it('EOA Wallet', async () => { + await signTypedDatav3(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signTypedDatav3(devEnv, getEoaSessionSigs); }); + }); describe('Signed Typed Data v4', () => { it('LitAction Session', async () => { - await signTypedDatav4(devEnv, getLitActionSessionSigs); + await signTypedDatav4(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTypedDatav4(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTypedDatav4(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTypedDatav4(devEnv, getEoaSessionSigs); + await signTypedDatav4(devEnv, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTypedDatav4(devEnv, getEoaSessionSigs); - }); + await signTypedDatav4(devEnv, getEoaSessionSigs); + }); }); describe('Sign With AuthContext', () => { it('LitAction Session', async () => { - await signWithAuthContext(devEnv, getLitActionSessionSigs); + await signWithAuthContext(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signWithAuthContext(devEnv, getLitActionSessionSigsUsingIpfsId); + await signWithAuthContext(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signWithAuthContext(devEnv, getEoaSessionSigs); + await signWithAuthContext(devEnv, getEoaSessionSigs); }); it('PKP Session', async () => { - await signWithAuthContext(devEnv, getEoaSessionSigs); - }); + await signWithAuthContext(devEnv, getEoaSessionSigs); + }); }); }); @@ -263,618 +263,612 @@ const signMessage = async ( } }; - const ethTransaction = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test eth_sign - try { - // Message to sign - const message = 'Hello world'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // DATA, 20 Bytes - address - // DATA, N Bytes - message to sign - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sign', - params: [alice.pkp?.ethAddress, hexMsg], - }, - }); - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - expect(signature.length).toEqual(132); - expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); - - console.log('βœ… recoveredAddr:', recoveredAddr); - } catch (e) { - throw (new Error('❌ Error: ' + (e as Error).message).stack = ( - e as Error - ).stack); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- test eth_sign + try { + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_sign', + params: [alice.pkp?.ethAddress, hexMsg], + }, + }); + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + expect(signature.length).toEqual(132); + expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); + + console.log('βœ… recoveredAddr:', recoveredAddr); + } catch (e) { + throw (new Error('❌ Error: ' + (e as Error).message).stack = ( + e as Error + ).stack); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } }; const signTransaction = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp?.ethAddress!; - const to = alice.pkp?.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - // eth_sendTransaction parameters - // Transaction - Object - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction - // A serialized form of the whole transaction - const rawSignedTx = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTransaction', - params: [tx], - }, - }); - - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r!, - s: parsedTransaction.s!, - v: parsedTransaction.v!, - }); - - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); - const { v, r, s } = parsedTransaction; + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); - const recoveredAddress = ethers.utils.recoverAddress(txHash, { - r: r!, - s: s!, - v: v!, - }); + await pkpEthersWallet.init(); - // ==================== Post-Validation ==================== - expect(parsedTransaction).toBeDefined(); + // -- eth_sendTransaction parameters + try { + // Transaction to sign and send + const from = alice.pkp?.ethAddress!; + const to = alice.pkp?.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + const rawSignedTx = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }); - expect(signature.length).toEqual(132); + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - expect(recoveredAddress.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - if ((e as Error).message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${(e as Error).toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -} + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r!, + s: parsedTransaction.s!, + v: parsedTransaction.v!, + }); + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + + const txHash = ethers.utils.keccak256( + ethers.utils.serializeTransaction(rawTx) + ); + + const { v, r, s } = parsedTransaction; + + const recoveredAddress = ethers.utils.recoverAddress(txHash, { + r: r!, + s: s!, + v: v!, + }); + + // ==================== Post-Validation ==================== + expect(parsedTransaction).toBeDefined(); + + expect(signature.length).toEqual(132); + + expect(recoveredAddress.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + } catch (e) { + if ((e as Error).message.includes('insufficient FPE funds')) { + console.log( + `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` + ); + } else { + throw new Error(`❌ Error: ${(e as Error).toString()}`); + } + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; const ethTypedDataUtil = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData parameters + try { + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, - }; + contents: 'Hello, Bob!', + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); - expect(signature.length).toEqual(132); - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -} + expect(signature.length).toEqual(132); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; const signTypedDataV1 = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v1 parameters - try { - const msgParams = [ - { - type: 'string', - name: 'Message', - value: 'Hi, Alice!', - }, - { - type: 'uint32', - name: 'A number', - value: '1337', - }, - ]; + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v1', - params: [msgParams, alice.pkp?.ethAddress], - }, - }); - - const signatureBytes = ethers.utils.arrayify(signature); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signatureBytes as any, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } - - console.log('signature: ', signature); - console.log('recoveredAddr: ', recoveredAddr); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv?.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v1 parameters + try { + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v1', + params: [msgParams, alice.pkp?.ethAddress], + }, + }); + + const signatureBytes = ethers.utils.arrayify(signature); + + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signatureBytes as any, + version: SignTypedDataVersion.V1, + }); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); } -} + console.log('signature: ', signature); + console.log('recoveredAddr: ', recoveredAddr); + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; const signTypedDatav3 = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: { - // @ts-ignore - types: msgParams.types, - // @ts-ignore - domain: msgParams.domain, - // @ts-ignore - primaryType: msgParams.primaryType, - // @ts-ignore - message: msgParams.message, + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, - signature: signature, - version: SignTypedDataVersion.V3, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); + contents: 'Hello, Bob!', + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); + + const recoveredAddr = recoverTypedSignature({ + data: { + // @ts-ignore + types: msgParams.types, + // @ts-ignore + domain: msgParams.domain, + // @ts-ignore + primaryType: msgParams.primaryType, + // @ts-ignore + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); + + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); } -} + + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); + } + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; const signTypedDatav4 = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - domain: { - chainId: 80001, - name: 'Ether Mail', - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - version: '1', + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const eoaSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: eoaSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- eth_signTypedData_v3 parameters + try { + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], }, - message: { - contents: 'Hello, Bob!', - from: { - name: 'Cow', + to: [ + { + name: 'Bob', wallets: [ - '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', ], }, - to: [ - { - name: 'Bob', - wallets: [ - '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', - '0xB0B0b0b0b0b0B000000000000000000000000000', - ], - }, - ], - }, - primaryType: 'Mail', - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person[]' }, - { name: 'contents', type: 'string' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallets', type: 'address[]' }, - ], - }, - }; + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; + + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v4', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }); - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v4', - params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams as any, - signature: signature, - version: SignTypedDataVersion.V4, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); + const recoveredAddr = recoverTypedSignature({ + data: msgParams as any, + signature: signature, + version: SignTypedDataVersion.V4, + }); + + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); } -} + if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { + throw new Error( + `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` + ); + } + } catch (e) { + throw new Error(`❌ ${(e as Error).toString()}`); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; const signWithAuthContext = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - - const pkpEthersWallet = new PKPEthersWallet({ - pkpPubKey: alice.pkp?.publicKey!, - litNodeClient: devEnv.litNodeClient!, - authContext: { - getSessionSigsProps: { - authNeededCallback: async function ( - params: AuthCallbackParams - ): Promise { - const toSign = await createSiweMessageWithRecaps({ - uri: params.uri!, - expiration: params.expiration!, - resources: params.resourceAbilityRequests!, - walletAddress: alice.wallet.address, - nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: alice.wallet, - toSign, - }); - - return authSig; - }, - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - }, - } - }); -} + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const pkpEthersWallet = new PKPEthersWallet({ + pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv.litNodeClient!, + authContext: { + getSessionSigsProps: { + authNeededCallback: async function ( + params: AuthCallbackParams + ): Promise { + const toSign = await createSiweMessageWithRecaps({ + uri: params.uri!, + expiration: params.expiration!, + resources: params.resourceAbilityRequests!, + walletAddress: alice.wallet.address, + nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: alice.wallet, + toSign, + }); + + return authSig; + }, + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + }, + }, + }); +}; const ethPersonalSign = async ( + devEnv: TinnyEnvironment, + generator: ( devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise - ): Promise => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await generator(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- personal_sign parameters - try { - // Message to sign - const message = 'Free the web'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // personal_sign parameters - // DATA, N Bytes - message to sign. - // DATA, 20 Bytes - address - // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'personal_sign', - params: [hexMsg, alice.pkp?.ethAddress], - }, - }); - - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp?.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + (e as Error).message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise +): Promise => { + const alice = await devEnv.createRandomPerson(); + const pkpSessionSigs = await generator(devEnv, alice); + + const pkpEthersWallet = new PKPEthersWallet({ + litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey!, + controllerSessionSigs: pkpSessionSigs, + }); + + await pkpEthersWallet.init(); + + // -- personal_sign parameters + try { + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + const signature = await ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'personal_sign', + params: [hexMsg, alice.pkp?.ethAddress], + }, + }); + + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); } -} \ No newline at end of file + + if (recoveredAddr !== alice.pkp?.ethAddress) { + throw new Error( + `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` + ); + } + + console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); + } catch (e) { + throw new Error('❌ Error: ' + (e as Error).message); + } finally { + devEnv.releasePrivateKeyFromUser(alice); + } +}; diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 32d18fc062..8814aa6464 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -11,8 +11,11 @@ import { LitPKPResource, } from '@lit-protocol/auth-helpers'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitResourceAbilityRequest, SessionSigsMap } from '@lit-protocol/types'; - +import { + ILitNodeClient, + LitResourceAbilityRequest, + SessionSigsMap, +} from '@lit-protocol/types'; import { getInvalidLitActionIpfsSessionSigs, @@ -98,7 +101,7 @@ describe('SessionSigs', () => { await executeJsCLaimKey(devEnv, getPkpSessionSigs); }); }); - + describe('ExecuteJS JSON Response', () => { it('LitAction Session', async () => { await executeJsJSONResponse(devEnv, getLitActionSessionSigs); @@ -158,7 +161,10 @@ describe('SessionSigs', () => { }); it('LitAction IPFS Session', async () => { - await executeJsSigningParallel(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsSigningParallel( + devEnv, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { @@ -315,7 +321,6 @@ const executeJsCLaimKeys = async ( }); }; - const executeJsCLaimKey = async ( devEnv: TinnyEnvironment, generator: ( @@ -397,8 +402,7 @@ const executeJsCLaimKey = async ( }); }; - -const pkpSign = async ( +const pkpSign = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, @@ -433,9 +437,9 @@ const pkpSign = async ( expect(res?.s).toBeDefined(); expect(res?.dataSigned).toBeDefined(); expect(res?.publicKey).toBeDefined(); -} +}; -const executeJsJSONResponse = async ( +const executeJsJSONResponse = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, @@ -466,7 +470,7 @@ const executeJsJSONResponse = async ( expect(res?.logs).toBeDefined(); expect(res?.logs.includes('hello world')).toBeTruthy(); expect(res?.success).toBeTruthy(); -} +}; const executeJsSigning = async ( devEnv: TinnyEnvironment, @@ -509,7 +513,7 @@ const executeJsSigning = async ( expect(res?.signatures?.sig.s).toBeDefined(); expect(res?.signatures?.sig.dataSigned).toBeDefined(); expect(res?.signatures?.sig.publicKey).toBeDefined(); -} +}; const executeJsSigningParallel = async ( devEnv: TinnyEnvironment, @@ -552,9 +556,7 @@ const executeJsSigningParallel = async ( expect(r?.signatures?.sig.dataSigned).toBeDefined(); expect(r?.signatures?.sig.publicKey).toBeDefined(); }); -} - - +}; const decryptString = async ( devEnv: TinnyEnvironment, @@ -624,4 +626,4 @@ const decryptString = async ( devEnv.releasePrivateKeyFromUser(alice); expect(decryptRes).toEqual('Hello world'); -} \ No newline at end of file +}; From 755f8196336f72972e651802747d60819353cdaf Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 15:31:15 -0400 Subject: [PATCH 024/136] ref: change null to undefnied --- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 6bca4c715f..a87e07bf8c 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -1249,7 +1249,7 @@ describe('Wrapped Keys', () => { const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, - null, + undefined, new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry From 84af687c307db3169f247c83d441f6275e7d2a5d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 16:31:33 -0400 Subject: [PATCH 025/136] test: add in action combine tests --- .../e2e-tests/src/tests/LitActionOps.spec.ts | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 packages/e2e-tests/src/tests/LitActionOps.spec.ts diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts new file mode 100644 index 0000000000..79d9a79561 --- /dev/null +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -0,0 +1,191 @@ +import { getLitActionSessionSigs } from "../../setup/session-sigs/get-lit-action-session-sigs"; +import { AccessControlConditions } from "../../setup/accs/accs"; +import { LIT_TESTNET } from "../../setup/tinny-config"; +import { TinnyEnvironment } from "../../setup/tinny-environment"; +import { ILitNodeClient } from "@lit-protocol/types"; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { getEoaSessionSigsWithCapacityDelegations } from "../../setup/session-sigs/get-eoa-session-sigs"; + +describe("Lit Action Ops", () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + it("Broadcast and Collect", async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + let rand = Math.floor(Math.random() * 100); + const resp = await Lit.Actions.broadcastAndCollect({ + name: "temperature", + value: rand.toString(), + }); + Lit.Actions.setResponse({ + response: JSON.stringify(resp) + }); + })();`, + jsParams: {}, + }); + devEnv.releasePrivateKeyFromUser(alice); + + const response = res?.response; + expect(response).toBeDefined(); + }); + + + it("Decrypt And Combine", async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const resp = await Lit.Actions.decryptAndCombine({ + accessControlConditions, + ciphertext, + dataToEncryptHash, + authSig: null, + chain: 'ethereum', + }); + Lit.Actions.setResponse({ + response: resp + }); + })();`, + jsParams: { + accessControlConditions: accs, + dataToEncryptHash: encryptRes.dataToEncryptHash, + ciphertext: encryptRes.ciphertext, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.response).toEqual('Hello world') + }); + + + it("Sign and Combine ECDSA", async () => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = ( + await devEnv.litNodeClient?.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet!, + }) + )?.capacityDelegationAuthSig; + + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig! + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs![devEnv.litNodeClient?.config.bootstrapUrls[0]!]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 4. Bob can now execute JS code using the capacity credits NFT + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signAndCombineEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + Lit.Actions.setResponse({ + response: sigShare + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + + /** + Response format + { + "success": true, + "signedData": {}, + "decryptedData": {}, + "claimData": {}, + "response": "{\"r\":\"026eede14267ca76064a7e22dbe6f9e44d786c7b5917b7d023f45ee4e84ce1ea47\",\"s\":\"22a6048bcb88d724d45bdb6161fefd151483f41d592d167e5c33f42e9fe6dac6\",\"v\":0}", + "logs": "" + } + */ + + expect(res?.response).toBeDefined(); + const sig = JSON.parse(res?.response as string); + expect(sig.r).toBeDefined(); + expect(sig.s).toBeDefined(); + expect(sig.v).toBeDefined(); + }); +}); \ No newline at end of file From e5989d2cbd95e9095dd879b2da91941b503562ef Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 16:51:56 -0400 Subject: [PATCH 026/136] ci: add filter flag for test suite --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 58861ea690..9e3f6b9bd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,4 +55,4 @@ jobs: run: yarn build:dev - name: Run End to End Tests if: steps.build.outputs.exit_code == 0 - run: yarn test:local + run: yarn test:local -t SessionSigs From f2840d2aaf5141ae66b796dc68e4ace5f503a173 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 23 Jul 2024 17:50:29 -0400 Subject: [PATCH 027/136] ref: up test timeout --- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 8814aa6464..333a2e8862 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -28,7 +28,7 @@ import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; try { - jest.setTimeout(60000); + jest.setTimeout(100_000); } catch (e) { // ... continue execution } From 27dbea49eb51692eee1c1c75a3e52e74e07902ee Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 11:25:17 -0400 Subject: [PATCH 028/136] dev: Move Tinny to package --- packages/tinny/.eslintrc.json | 25 + packages/tinny/README.md | 11 + packages/tinny/jest.config.ts | 11 + packages/tinny/package.json | 10 + packages/tinny/project.json | 33 + packages/tinny/src/index.ts | 23 + packages/tinny/src/lib/accs/accs.ts | 68 + .../tinny/src/lib/networkContext.example.json | 11268 +++++++++++++++ packages/tinny/src/lib/networkContext.json | 11370 ++++++++++++++++ .../lib/session-sigs/get-eoa-session-sigs.ts | 156 + .../get-lit-action-session-sigs.ts | 167 + .../lib/session-sigs/get-pkp-session-sigs.ts | 47 + packages/tinny/src/lib/shiva-client.d.ts | 72 + packages/tinny/src/lib/shiva-client.ts | 299 + packages/tinny/src/lib/tinny-config.ts | 141 + packages/tinny/src/lib/tinny-environment.ts | 533 + packages/tinny/src/lib/tinny-person.ts | 220 + packages/tinny/src/lib/tinny-utils.ts | 65 + packages/tinny/src/lib/tinny.spec.ts | 7 + packages/tinny/tsconfig.json | 22 + packages/tinny/tsconfig.lib.json | 10 + packages/tinny/tsconfig.spec.json | 14 + 22 files changed, 24572 insertions(+) create mode 100644 packages/tinny/.eslintrc.json create mode 100644 packages/tinny/README.md create mode 100644 packages/tinny/jest.config.ts create mode 100644 packages/tinny/package.json create mode 100644 packages/tinny/project.json create mode 100644 packages/tinny/src/index.ts create mode 100644 packages/tinny/src/lib/accs/accs.ts create mode 100644 packages/tinny/src/lib/networkContext.example.json create mode 100644 packages/tinny/src/lib/networkContext.json create mode 100644 packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts create mode 100644 packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts create mode 100644 packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts create mode 100644 packages/tinny/src/lib/shiva-client.d.ts create mode 100644 packages/tinny/src/lib/shiva-client.ts create mode 100644 packages/tinny/src/lib/tinny-config.ts create mode 100644 packages/tinny/src/lib/tinny-environment.ts create mode 100644 packages/tinny/src/lib/tinny-person.ts create mode 100644 packages/tinny/src/lib/tinny-utils.ts create mode 100644 packages/tinny/src/lib/tinny.spec.ts create mode 100644 packages/tinny/tsconfig.json create mode 100644 packages/tinny/tsconfig.lib.json create mode 100644 packages/tinny/tsconfig.spec.json diff --git a/packages/tinny/.eslintrc.json b/packages/tinny/.eslintrc.json new file mode 100644 index 0000000000..adbe7ae2df --- /dev/null +++ b/packages/tinny/.eslintrc.json @@ -0,0 +1,25 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.json"], + "parser": "jsonc-eslint-parser", + "rules": { + "@nx/dependency-checks": "error" + } + } + ] +} diff --git a/packages/tinny/README.md b/packages/tinny/README.md new file mode 100644 index 0000000000..60a09abfe3 --- /dev/null +++ b/packages/tinny/README.md @@ -0,0 +1,11 @@ +# tinny + +This library was generated with [Nx](https://nx.dev). + +## Building + +Run `nx build tinny` to build the library. + +## Running unit tests + +Run `nx test tinny` to execute the unit tests via [Jest](https://jestjs.io). diff --git a/packages/tinny/jest.config.ts b/packages/tinny/jest.config.ts new file mode 100644 index 0000000000..04643a7ef0 --- /dev/null +++ b/packages/tinny/jest.config.ts @@ -0,0 +1,11 @@ +/* eslint-disable */ +export default { + displayName: 'tinny', + preset: '../../jest.preset.js', + testEnvironment: 'node', + transform: { + '^.+\\.[tj]s$': ['ts-jest', { tsconfig: '/tsconfig.spec.json' }], + }, + moduleFileExtensions: ['ts', 'js', 'html'], + coverageDirectory: '../../coverage/packages/tinny', +}; diff --git a/packages/tinny/package.json b/packages/tinny/package.json new file mode 100644 index 0000000000..d502fc748b --- /dev/null +++ b/packages/tinny/package.json @@ -0,0 +1,10 @@ +{ + "name": "@lit-protocol/tinny", + "version": "6.2.2", + "dependencies": { + "tslib": "^2.3.0" + }, + "type": "commonjs", + "main": "./dist/src/index.js", + "typings": "./dist/src/index.d.ts" +} diff --git a/packages/tinny/project.json b/packages/tinny/project.json new file mode 100644 index 0000000000..79939cafc0 --- /dev/null +++ b/packages/tinny/project.json @@ -0,0 +1,33 @@ +{ + "name": "tinny", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "packages/tinny/src", + "projectType": "library", + "targets": { + "build": { + "executor": "@nx/js:tsc", + "outputs": ["{options.outputPath}"], + "options": { + "outputPath": "dist/packages/tinny", + "main": "packages/tinny/src/index.ts", + "tsConfig": "packages/tinny/tsconfig.lib.json", + "assets": ["packages/tinny/*.md"] + } + }, + "lint": { + "executor": "@nx/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["packages/logger/**/*.ts"] + } + }, + "test": { + "executor": "@nx/jest:jest", + "outputs": ["{workspaceRoot}/coverage/{projectRoot}"], + "options": { + "jestConfig": "packages/tinny/jest.config.ts" + } + } + }, + "tags": [] +} diff --git a/packages/tinny/src/index.ts b/packages/tinny/src/index.ts new file mode 100644 index 0000000000..47ebe4c4a8 --- /dev/null +++ b/packages/tinny/src/index.ts @@ -0,0 +1,23 @@ +import { TinnyEnvironment } from './lib/tinny-environment'; +import { TinnyPerson } from './lib/tinny-person'; +import { ShivaClient } from './lib/shiva-client'; +import { getEoaSessionSigs, getEoaSessionSigsWithCapacityDelegations } from './lib/session-sigs/get-eoa-session-sigs'; +import { getPkpSessionSigs } from './lib/session-sigs/get-pkp-session-sigs'; +import { getLitActionSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs } from './lib/session-sigs/get-lit-action-session-sigs'; +import { AccessControlConditions } from './lib/accs/accs'; +import { LIT_TESTNET } from './lib/tinny-config'; + +export { +LIT_TESTNET, + TinnyEnvironment, + TinnyPerson, + ShivaClient, + getEoaSessionSigs, + getEoaSessionSigsWithCapacityDelegations, + getPkpSessionSigs, + getInvalidLitActionIpfsSessionSigs, + getInvalidLitActionSessionSigs, + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, + AccessControlConditions, +}; diff --git a/packages/tinny/src/lib/accs/accs.ts b/packages/tinny/src/lib/accs/accs.ts new file mode 100644 index 0000000000..db07c7dec1 --- /dev/null +++ b/packages/tinny/src/lib/accs/accs.ts @@ -0,0 +1,68 @@ +import { + LPACC_EVM_ATOM, + LPACC_EVM_BASIC, + LPACC_SOL, +} from '@lit-protocol/accs-schemas'; + +export namespace AccessControlConditions { + export const getEmvBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_EVM_BASIC[] => { + return [ + { + contractAddress: '', + standardContractType: '', + chain: 'ethereum', + method: '', + parameters: [':userAddress'], + returnValueTest: { + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + + export const getSolBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_SOL[] => { + return [ + { + method: '', + params: [':userAddress'], + pdaParams: [], + pdaInterface: { offset: 0, fields: {} }, + pdaKey: '', + chain: 'solana', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; + + export const getCosmosBasicAccessControlConditions = ({ + userAddress, + }: { + userAddress: string; + }): LPACC_EVM_ATOM[] => { + return [ + { + conditionType: 'cosmos', + path: ':userAddress', + chain: 'cosmos', + returnValueTest: { + key: '', + comparator: '=', + value: userAddress, + }, + }, + ]; + }; +} diff --git a/packages/tinny/src/lib/networkContext.example.json b/packages/tinny/src/lib/networkContext.example.json new file mode 100644 index 0000000000..307fd9f508 --- /dev/null +++ b/packages/tinny/src/lib/networkContext.example.json @@ -0,0 +1,11268 @@ +{ + "Allowlist": { + "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Allowlist" + }, + "LITToken": { + "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "LITToken" + }, + "Multisender": { + "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Multisender" + }, + "PKPHelper": { + "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPHelper" + }, + "PKPNFT": { + "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPNFT" + }, + "PKPNFTMetadata": { + "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPNFTMetadata" + }, + "PKPPermissions": { + "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPPermissions" + }, + "PubkeyRouter": { + "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PubkeyRouter" + }, + "RateLimitNFT": { + "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "RateLimitNFT" + }, + "Staking": { + "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newComplaintTolerance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newComplaintIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newComplaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newComplaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "Staking" + }, + "StakingBalances": { + "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "StakingBalances" + }, + "ContractResolver": { + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "abi": [ + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AdminRoleRequired", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "SetContract", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ALLOWLIST_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BACKUP_RECOVERY_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_WALLET_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HD_KEY_DERIVER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIT_TOKEN_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTI_SENDER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAYMENT_DELEGATION_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_HELPER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_METADATA_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_PERMISSIONS_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PUB_KEY_ROUTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_LIMIT_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELEASE_REGISTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_BALANCES_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "addAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "adminBeingRemoved", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "removeAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "name": "typeAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "ContractResolver" + } +} diff --git a/packages/tinny/src/lib/networkContext.json b/packages/tinny/src/lib/networkContext.json new file mode 100644 index 0000000000..aabf963710 --- /dev/null +++ b/packages/tinny/src/lib/networkContext.json @@ -0,0 +1,11370 @@ +{ + "Allowlist": { + "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", + "abi": [ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "ItemNotAllowed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "allowAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "allowedItems", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "isAllowed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "_allowAll", + "type": "bool" + } + ], + "name": "setAllowAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "key", + "type": "bytes32" + } + ], + "name": "setNotAllowed", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Allowlist" + }, + "LITToken": { + "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", + "abi": [ + { + "inputs": [ + { + "internalType": "uint256", + "name": "cap", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "InvalidShortString", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "str", + "type": "string" + } + ], + "name": "StringTooLong", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "fromDelegate", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "toDelegate", + "type": "address" + } + ], + "name": "DelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousBalance", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newBalance", + "type": "uint256" + } + ], + "name": "DelegateVotesChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [], + "name": "EIP712DomainChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "CLOCK_MODE", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_SEPARATOR", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MINTER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAUSER_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + } + ], + "name": "allowance", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "burnFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "cap", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint32", + "name": "pos", + "type": "uint32" + } + ], + "name": "checkpoints", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "fromBlock", + "type": "uint32" + }, + { + "internalType": "uint224", + "name": "votes", + "type": "uint224" + } + ], + "internalType": "struct ERC20Votes.Checkpoint", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "clock", + "outputs": [ + { + "internalType": "uint48", + "name": "", + "type": "uint48" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "decimals", + "outputs": [ + { + "internalType": "uint8", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "subtractedValue", + "type": "uint256" + } + ], + "name": "decreaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + } + ], + "name": "delegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "delegatee", + "type": "address" + }, + { + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiry", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "delegateBySig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "eip712Domain", + "outputs": [ + { + "internalType": "bytes1", + "name": "fields", + "type": "bytes1" + }, + { + "internalType": "string", + "name": "name", + "type": "string" + }, + { + "internalType": "string", + "name": "version", + "type": "string" + }, + { + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "verifyingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "salt", + "type": "bytes32" + }, + { + "internalType": "uint256[]", + "name": "extensions", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastTotalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "timepoint", + "type": "uint256" + } + ], + "name": "getPastVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getVotes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "addedValue", + "type": "uint256" + } + ], + "name": "increaseAllowance", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_recipient", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "nonces", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "numCheckpoints", + "outputs": [ + { + "internalType": "uint32", + "name": "", + "type": "uint32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "spender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "name": "permit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transfer", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "LITToken" + }, + "Multisender": { + "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + } + ], + "name": "sendEth", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "_recipients", + "type": "address[]" + }, + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "sendTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "tokenContract", + "type": "address" + } + ], + "name": "withdrawTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "Multisender" + }, + "PKPHelper": { + "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "internalType": "struct LibPKPNFTStorage.ClaimMaterial", + "name": "claimMaterial", + "type": "tuple" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "internalType": "struct PKPHelper.AuthMethodData", + "name": "authMethodData", + "type": "tuple" + } + ], + "name": "claimAndMintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getDomainWalletRegistry", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPKPNftMetdataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethods", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes[]", + "name": "permittedIpfsCIDs", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedIpfsCIDScopes", + "type": "uint256[][]" + }, + { + "internalType": "address[]", + "name": "permittedAddresses", + "type": "address[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAddressScopes", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddAuthMethodsWithTypes", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypes", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIds", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeys", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopes", + "type": "uint256[][]" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + }, + { + "internalType": "bool", + "name": "addPkpEthAddressAsPermittedAddress", + "type": "bool" + }, + { + "internalType": "bool", + "name": "sendPkpToItself", + "type": "bool" + } + ], + "name": "mintNextAndAddDomainWalletMetadata", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "name": "onERC721Received", + "outputs": [ + { + "internalType": "bytes4", + "name": "", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removePkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string[]", + "name": "nftMetadata", + "type": "string[]" + } + ], + "name": "setPkpMetadata", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPHelper" + }, + "PKPNFT": { + "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "MintCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "PKPMinted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + }, + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + } + ], + "name": "claimAndMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getNextDerivedKeyId", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftMetadataAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpPermissionsAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "mintCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "mintGrantAndBurnNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "name": "mintNext", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "redeemedFreeMintIds", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMintCost", + "type": "uint256" + } + ], + "name": "setMintCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PKPNFT" + }, + "PKPNFTMetadata": { + "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_resolver", + "type": "address" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "_env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "buffer", + "type": "bytes" + } + ], + "name": "bytesToHex", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "contract ContractResolver", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "env", + "outputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeProfileForPkp", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "removeUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "imgUrl", + "type": "string" + } + ], + "name": "setProfileForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "string", + "name": "url", + "type": "string" + } + ], + "name": "setUrlForPKP", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubKey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPNFTMetadata" + }, + "PKPPermissions": { + "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "PermittedAuthMethodRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "PermittedAuthMethodScopeRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "RootHashUpdated", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod", + "name": "authMethod", + "type": "tuple" + }, + { + "internalType": "uint256[]", + "name": "scopes", + "type": "uint256[]" + } + ], + "name": "addPermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "addPermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToAdd", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToAdd", + "type": "bytes[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodPubkeysToAdd", + "type": "bytes[]" + }, + { + "internalType": "uint256[][]", + "name": "permittedAuthMethodScopesToAdd", + "type": "uint256[][]" + }, + { + "internalType": "uint256[]", + "name": "permittedAuthMethodTypesToRemove", + "type": "uint256[]" + }, + { + "internalType": "bytes[]", + "name": "permittedAuthMethodIdsToRemove", + "type": "bytes[]" + } + ], + "name": "batchAddRemoveAuthMethods", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getAuthMethodId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedActions", + "outputs": [ + { + "internalType": "bytes[]", + "name": "", + "type": "bytes[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "maxScopeId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethodScopes", + "outputs": [ + { + "internalType": "bool[]", + "name": "", + "type": "bool[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPermittedAuthMethods", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "userPubkey", + "type": "bytes" + } + ], + "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getRouterAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getTokenIdsForAuthMethod", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "getUserPubkeyForAuthMethod", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "isPermittedAction", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "isPermittedAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "isPermittedAuthMethod", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "isPermittedAuthMethodScopePresent", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "ipfsCID", + "type": "bytes" + } + ], + "name": "removePermittedAction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user", + "type": "address" + } + ], + "name": "removePermittedAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + } + ], + "name": "removePermittedAuthMethod", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "authMethodType", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "id", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "scopeId", + "type": "uint256" + } + ], + "name": "removePermittedAuthMethodScope", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "setRootHash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "verifyState", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "group", + "type": "uint256" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "proofFlags", + "type": "bool[]" + }, + { + "internalType": "bytes32[]", + "name": "leaves", + "type": "bytes32[]" + } + ], + "name": "verifyStates", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "PKPPermissions" + }, + "PubkeyRouter": { + "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ContractResolverAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "PubkeyRoutingDataSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct IPubkeyRouter.RootKey", + "name": "rootKey", + "type": "tuple" + } + ], + "name": "RootKeySet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "adminResetRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + } + ], + "internalType": "struct IPubkeyRouter.Signature[]", + "name": "signatures", + "type": "tuple[]" + }, + { + "internalType": "bytes", + "name": "signedMessage", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + } + ], + "name": "checkNodeSignatures", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + } + ], + "name": "deriveEthAddressFromPubkey", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "ethAddress", + "type": "address" + } + ], + "name": "ethAddressToPkpId", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "getDerivedPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getEthAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getPkpNftAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getPubkey", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + } + ], + "name": "getRootKeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getRoutingData", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isRouted", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "pubkeys", + "outputs": [ + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingData", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "address", + "name": "stakingContract", + "type": "address" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "derivedKeyId", + "type": "bytes32" + } + ], + "name": "setRoutingDataAsAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingContractAddress", + "type": "address" + }, + { + "components": [ + { + "internalType": "bytes", + "name": "pubkey", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "keyType", + "type": "uint256" + } + ], + "internalType": "struct IPubkeyRouter.RootKey[]", + "name": "newRootKeys", + "type": "tuple[]" + } + ], + "name": "voteForRootKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "PubkeyRouter" + }, + "RateLimitNFT": { + "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "AdditionalRequestsPerKilosecondCostSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "approved", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Approval", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "FreeMintSignerSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "FreeRequestsPerRateLimitWindowSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RLIHolderRateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "RateLimitWindowSecondsSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "Transfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrew", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "approve", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "getApproved", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "mint", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newAdditionalRequestsPerKilosecondCost", + "type": "uint256" + } + ], + "name": "setAdditionalRequestsPerKilosecondCost", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newFreeMintSigner", + "type": "address" + } + ], + "name": "setFreeMintSigner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newFreeRequestsPerRateLimitWindow", + "type": "uint256" + } + ], + "name": "setFreeRequestsPerRateLimitWindow", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxExpirationSeconds", + "type": "uint256" + } + ], + "name": "setMaxExpirationSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "setMaxRequestsPerKilosecond", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRLIHolderRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRLIHolderRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newRateLimitWindowSeconds", + "type": "uint256" + } + ], + "name": "setRateLimitWindowSeconds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "symbol", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "tokenOfOwnerByIndex", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "totalSupply", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "transferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "RLIHolderRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "additionalRequestsPerKilosecondCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateCost", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "payingAmount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "calculateRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "capacity", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "internalType": "struct LibRateLimitNFTStorage.RateLimit", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "requestedRequestsPerKilosecond", + "type": "uint256" + } + ], + "name": "checkBelowMaxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentSoldRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "defaultRateLimitWindowSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestsPerKilosecond", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sVal", + "type": "bytes32" + } + ], + "name": "freeMintSigTest", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeMintSigner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "freeRequestsPerRateLimitWindow", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "isExpired", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxExpirationSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maxRequestsPerKilosecond", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "hash", + "type": "bytes32" + } + ], + "name": "prefixed", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "msgHash", + "type": "bytes32" + } + ], + "name": "redeemedFreeMints", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tokenIdCounter", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenId", + "type": "uint256" + } + ], + "name": "tokenSVG", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "expiresAt", + "type": "uint256" + } + ], + "name": "totalSoldRequestsPerKilosecondByExpirationTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "RateLimitNFT" + }, + "Staking": { + "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [], + "name": "CannotKickBelowCurrentValidatorThreshold", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakingAddress", + "type": "address" + } + ], + "name": "CannotRejoinUntilNextEpochBecauseKicked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "CannotReuseCommsKeys", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "CannotVoteTwice", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "CouldNotMapNodeAddressToStakerAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedOrPausedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInActiveOrUnlockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInNextValidatorSetLockedState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "state", + "type": "uint8" + } + ], + "name": "MustBeInReadyForNextEpochState", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "MustBeValidatorInNextEpochToKick", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentTimestamp", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "epochEndTime", + "type": "uint256" + } + ], + "name": "NotEnoughTimeElapsedSinceLastEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "validatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsInNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "nextReadyValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCountToBeReady", + "type": "uint256" + } + ], + "name": "NotEnoughValidatorsReadyForNextEpoch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "currentEpochNumber", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receivedEpochNumber", + "type": "uint256" + } + ], + "name": "SignaledReadyForWrongEpochNumber", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validator", + "type": "address" + }, + { + "internalType": "address[]", + "name": "validatorsInNextEpoch", + "type": "address[]" + } + ], + "name": "ValidatorIsNotInNextEpoch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "ComplaintConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "newKeyTypes", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumValidatorCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxConcurrentRequests", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMinTripleCount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newPeerCheckingIntervalSecs", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxTripleConcurrency", + "type": "uint256" + } + ], + "name": "ConfigSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "EpochEndTimeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "EpochLengthSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "EpochTimeoutSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "KickPenaltyPercentSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "ReadyForNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Recovered", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToJoin", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "RequestToLeave", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverContractAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newDuration", + "type": "uint256" + } + ], + "name": "RewardsDurationUpdated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newStakingTokenAddress", + "type": "address" + } + ], + "name": "StakingTokenSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "StateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amountBurned", + "type": "uint256" + } + ], + "name": "ValidatorKickedFromNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "ValidatorRejoinedNextEpoch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "reporter", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "VotedToKickValidatorInNextEpoch", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + } + ], + "name": "adminKickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "adminRejoinValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "adminResetEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amountToPenalize", + "type": "uint256" + } + ], + "name": "adminSlashValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "advanceEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "exit", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "kickValidatorInNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "lockValidatorsForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "requestToJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeave", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "requestToLeaveAsNode", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "config", + "type": "tuple" + } + ], + "name": "setComplaintConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "newConfig", + "type": "tuple" + } + ], + "name": "setConfig", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochEndTime", + "type": "uint256" + } + ], + "name": "setEpochEndTime", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochLength", + "type": "uint256" + } + ], + "name": "setEpochLength", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "newState", + "type": "uint8" + } + ], + "name": "setEpochState", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newEpochTimeout", + "type": "uint256" + } + ], + "name": "setEpochTimeout", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "setIpPortNodeAddressAndCommunicationPubKeys", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "newKickPenaltyPercent", + "type": "uint256" + } + ], + "name": "setKickPenaltyPercent", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + } + ], + "name": "signalReadyForNextEpoch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "name": "stakeAndJoin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "index", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "indexed": false, + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "VersionRequirementsUpdated", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "checkVersion", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMaxVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersion", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getMinVersionString", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMaxVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "major", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minor", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "patch", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Version", + "name": "version", + "type": "tuple" + } + ], + "name": "setMinVersion", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "complaintConfig", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "intervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "kickPenaltyPercent", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.ComplaintConfig", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "config", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "tokenRewardPerTokenPerEpoch", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintTolerance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "DEPRECATED_complaintIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "keyTypes", + "type": "uint256[]" + }, + { + "internalType": "uint256", + "name": "minimumValidatorCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxConcurrentRequests", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minTripleCount", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "peerCheckingIntervalSecs", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxTripleConcurrency", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Config", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfCurrentValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "countOfNextValidatorsReadyForNextEpoch", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "currentValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "epoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint256", + "name": "epochLength", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "number", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "endTime", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "retries", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "timeout", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Epoch", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKeyTypes", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getKickedValidators", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getNodeStakerAddressMappings", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "internalType": "struct LibStakingStorage.AddressMapping[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingBalancesAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInCurrentEpochLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsInNextEpoch", + "outputs": [ + { + "internalType": "address[]", + "name": "", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "addresses", + "type": "address[]" + } + ], + "name": "getValidatorsStructs", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInCurrentEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getValidatorsStructsInNextEpoch", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "epochNumber", + "type": "uint256" + }, + { + "internalType": "address", + "name": "validatorStakerAddress", + "type": "address" + }, + { + "internalType": "address", + "name": "voterStakerAddress", + "type": "address" + } + ], + "name": "getVotingStatusToKickValidator", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "isActiveValidatorByNodeAddress", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "isReadyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "reason", + "type": "uint256" + } + ], + "name": "kickPenaltyPercentByReason", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "nextValidatorCountForConsensus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + } + ], + "name": "nodeAddressToStakerAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "readyForNextEpoch", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "shouldKickValidator", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "state", + "outputs": [ + { + "internalType": "enum LibStakingStorage.States", + "name": "", + "type": "uint8" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "validators", + "outputs": [ + { + "components": [ + { + "internalType": "uint32", + "name": "ip", + "type": "uint32" + }, + { + "internalType": "uint128", + "name": "ipv6", + "type": "uint128" + }, + { + "internalType": "uint32", + "name": "port", + "type": "uint32" + }, + { + "internalType": "address", + "name": "nodeAddress", + "type": "address" + }, + { + "internalType": "uint256", + "name": "reward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "senderPubKey", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "receiverPubKey", + "type": "uint256" + } + ], + "internalType": "struct LibStakingStorage.Validator", + "name": "", + "type": "tuple" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "Staking" + }, + "StakingBalances": { + "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", + "abi": [ + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotAddFunctionToDiamondThatAlreadyExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotAddSelectorsToZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveFunctionThatDoesNotExist", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotRemoveImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionThatDoesNotExists", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4[]", + "name": "_selectors", + "type": "bytes4[]" + } + ], + "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_selector", + "type": "bytes4" + } + ], + "name": "CannotReplaceImmutableFunction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint8", + "name": "_action", + "type": "uint8" + } + ], + "name": "IncorrectFacetCutAction", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_initializationContractAddress", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "InitializationFunctionReverted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_contractAddress", + "type": "address" + }, + { + "internalType": "string", + "name": "_message", + "type": "string" + } + ], + "name": "NoBytecodeAtAddress", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "NoSelectorsProvidedForFacetForCut", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_user", + "type": "address" + }, + { + "internalType": "address", + "name": "_contractOwner", + "type": "address" + } + ], + "name": "NotContractOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facetAddress", + "type": "address" + } + ], + "name": "RemoveFacetAddressMustBeZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "indexed": false, + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "indexed": false, + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "DiamondCut", + "type": "event" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "enum IDiamond.FacetCutAction", + "name": "action", + "type": "uint8" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamond.FacetCut[]", + "name": "_diamondCut", + "type": "tuple[]" + }, + { + "internalType": "address", + "name": "_init", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_calldata", + "type": "bytes" + } + ], + "name": "diamondCut", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_functionSelector", + "type": "bytes4" + } + ], + "name": "facetAddress", + "outputs": [ + { + "internalType": "address", + "name": "facetAddress_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facetAddresses", + "outputs": [ + { + "internalType": "address[]", + "name": "facetAddresses_", + "type": "address[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_facet", + "type": "address" + } + ], + "name": "facetFunctionSelectors", + "outputs": [ + { + "internalType": "bytes4[]", + "name": "_facetFunctionSelectors", + "type": "bytes4[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "facets", + "outputs": [ + { + "components": [ + { + "internalType": "address", + "name": "facetAddress", + "type": "address" + }, + { + "internalType": "bytes4[]", + "name": "functionSelectors", + "type": "bytes4[]" + } + ], + "internalType": "struct IDiamondLoupe.Facet[]", + "name": "facets_", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "_interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "ActiveValidatorsCannotLeave", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + }, + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "AliasNotOwnedBySender", + "type": "error" + }, + { + "inputs": [], + "name": "CallerNotOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "CannotRemoveAliasOfActiveValidator", + "type": "error" + }, + { + "inputs": [], + "name": "CannotStakeZero", + "type": "error" + }, + { + "inputs": [], + "name": "CannotWithdrawZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "aliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountReached", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "OnlyStakingContract", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeGreaterThanMinimumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amountStaked", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maximumStake", + "type": "uint256" + } + ], + "name": "StakeMustBeLessThanMaximumStake", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "stakerAddress", + "type": "address" + } + ], + "name": "StakerNotPermitted", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "yourBalance", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "requestedWithdrawlAmount", + "type": "uint256" + } + ], + "name": "TryingToWithdrawMoreThanStaked", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "AliasRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "MaxAliasCountSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "MaximumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "MinimumStakeSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "PermittedStakerRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bool", + "name": "permittedStakersOn", + "type": "bool" + } + ], + "name": "PermittedStakersOnChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "ResolverContractAddressSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Staked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "newTokenRewardPerTokenPerEpoch", + "type": "uint256" + } + ], + "name": "TokenRewardPerTokenPerEpochSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "ValidatorNotRewardedBecauseAlias", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorRewarded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "ValidatorTokensPenalized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "Withdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "addAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "addPermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "stakers", + "type": "address[]" + } + ], + "name": "addPermittedStakers", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "checkStakingAmounts", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractResolver", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "getReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getTokenAddress", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "isPermittedStaker", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "maximumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumStake", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "penalizeTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "permittedStakersOn", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "aliasAccount", + "type": "address" + } + ], + "name": "removeAlias", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + } + ], + "name": "removePermittedStaker", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "staker", + "type": "address" + }, + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "restakePenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "rewardValidator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newResolverAddress", + "type": "address" + } + ], + "name": "setContractResolver", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaxAliasCount", + "type": "uint256" + } + ], + "name": "setMaxAliasCount", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMaximumStake", + "type": "uint256" + } + ], + "name": "setMaximumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "newMinimumStake", + "type": "uint256" + } + ], + "name": "setMinimumStake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bool", + "name": "permitted", + "type": "bool" + } + ], + "name": "setPermittedStakersOn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalStaked", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + }, + { + "internalType": "address", + "name": "recipient", + "type": "address" + } + ], + "name": "transferPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "balance", + "type": "uint256" + } + ], + "name": "withdrawPenaltyTokens", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "name": "StakingBalances" + }, + "ContractResolver": { + "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", + "abi": [ + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AdminRoleRequired", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "AllowedEnvRemoved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "indexed": false, + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "SetContract", + "type": "event" + }, + { + "inputs": [], + "name": "ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "ALLOWLIST_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "BACKUP_RECOVERY_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "DOMAIN_WALLET_REGISTRY", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "HD_KEY_DERIVER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "LIT_TOKEN_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "MULTI_SENDER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PAYMENT_DELEGATION_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_HELPER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_NFT_METADATA_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PKP_PERMISSIONS_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PUB_KEY_ROUTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RATE_LIMIT_NFT_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "RELEASE_REGISTER_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_BALANCES_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "STAKING_CONTRACT", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "addAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "addAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "getContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "adminBeingRemoved", + "type": "address" + } + ], + "name": "removeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + } + ], + "name": "removeAllowedEnv", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "typ", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "env", + "type": "uint8" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "setContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "enum ContractResolver.Env", + "name": "", + "type": "uint8" + } + ], + "name": "typeAddresses", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "name": "ContractResolver" + } +} diff --git a/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts new file mode 100644 index 0000000000..15db3a3f6f --- /dev/null +++ b/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts @@ -0,0 +1,156 @@ +import { + LitActionResource, + LitPKPResource, + generateAuthSig, + createSiweMessageWithRecaps, +} from '@lit-protocol/auth-helpers'; +import { + AuthCallbackParams, + AuthSig, + LitAbility, + LitResourceAbilityRequest, +} from '@lit-protocol/types'; +import { log } from '@lit-protocol/misc'; +import { ethers } from 'ethers'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyPerson } from '../tinny-person'; +import { TinnyEnvironment } from '../tinny-environment'; + +/** + * Retrieves the session signatures for an EOA in a given Tinny environment. + * + * @param devEnv - The Tinny environment object. + * @param person - The Tinny person object representing the EOA. + * @param resourceAbilityRequests - Optional. An array of resource ability requests. If not provided, default requests will be used. + * @returns A promise that resolves to the session signatures. + */ +export const getEoaSessionSigs = async ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to eoaSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: _resourceAbilityRequests, + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests, + }: AuthCallbackParams) => { + console.log('resourceAbilityRequests:', resourceAbilityRequests); + + if (!expiration) { + throw new Error('expiration is required'); + } + + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + + if (!uri) { + throw new Error('uri is required'); + } + + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: person.wallet.address, + nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: person.wallet, + toSign, + }); + + return authSig; + }, + + // -- only add this for manzano network because of rate limiting + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] } + : {}), + } as any); // todo: remove any cast + + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + + return sessionSigs; +}; + +export const getEoaSessionSigsWithCapacityDelegations = async ( + devEnv: TinnyEnvironment, + fromWallet: ethers.Wallet, + capacityDelegationAuthSig: AuthSig +) => { + const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ + chain: 'ethereum', + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ], + authNeededCallback: async ({ + uri, + expiration, + resourceAbilityRequests, + }: AuthCallbackParams) => { + if (!expiration) { + throw new Error('expiration is required'); + } + + if (!resourceAbilityRequests) { + throw new Error('resourceAbilityRequests is required'); + } + + if (!uri) { + throw new Error('uri is required'); + } + + const toSign = await createSiweMessageWithRecaps({ + uri: uri, + expiration: expiration, + resources: resourceAbilityRequests, + walletAddress: fromWallet.address, + nonce: devEnv.litNodeClient?.latestBlockhash!, + litNodeClient: devEnv.litNodeClient, + }); + + const authSig = await generateAuthSig({ + signer: fromWallet, + toSign, + }); + + return authSig; + }, + capacityDelegationAuthSig: capacityDelegationAuthSig, + }); + + log('[getEoaSessionSigs]: ', getEoaSessionSigs); + + return sessionSigs; +}; diff --git a/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts new file mode 100644 index 0000000000..364414733e --- /dev/null +++ b/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts @@ -0,0 +1,167 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyPerson } from '../tinny-person'; +import { TinnyEnvironment } from '../tinny-environment'; + +const VALID_SESSION_SIG_LIT_ACTION_CODE = ` +// Works with an AuthSig AuthMethod +if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { + LitActions.setResponse({ response: "true" }); +} else { + LitActions.setResponse({ response: "false" }); +} +`; + +const INVALID_SESSION_SIG_LIT_ACTION_CODE = ` +(async () => { + let utf8Encode = new TextEncoder(); + const toSign = utf8Encode.encode('This message is exactly 32 bytes'); + const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); +})(); +`; + +/** + * https://cloudflare-ipfs.com/ipfs/QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp + */ +export const VALID_IPFS_ID = 'QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp'; + +/** + * https://cloudflare-ipfs.com/ipfs/QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm + */ +export const INVALID_IPFS_ID = 'QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm'; + +export const getLitActionSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const litActionSessionSigs = + await devEnv.litNodeClient?.getLitActionSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: _resourceAbilityRequests, + litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString( + 'base64' + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + return litActionSessionSigs; +}; + +export const getLitActionSessionSigsUsingIpfsId = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[] +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: _resourceAbilityRequests, + litActionIpfsId: VALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp!.publicKey, + sigName: 'unified-auth-sig', + }, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + return litActionSessionSigs; +}; + +export const getInvalidLitActionSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson +) => { + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + ], + litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString( + 'base64' + ), + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + }); + + return litActionSessionSigs; +}; + +export const getInvalidLitActionIpfsSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson +) => { + const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + resourceAbilityRequests: [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + ], + litActionIpfsId: INVALID_IPFS_ID, + jsParams: { + publicKey: alice.authMethodOwnedPkp?.publicKey, + sigName: 'unified-auth-sig', + }, + }); + + return litActionSessionSigs; +}; diff --git a/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts new file mode 100644 index 0000000000..dd71d4e31f --- /dev/null +++ b/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts @@ -0,0 +1,47 @@ +import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; +import { log } from '@lit-protocol/misc'; +import { LitNetwork } from '@lit-protocol/constants'; +import { TinnyEnvironment } from '../tinny-environment'; +import { TinnyPerson } from '../tinny-person'; + +export const getPkpSessionSigs = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson, + resourceAbilityRequests?: LitResourceAbilityRequest[], + expiration?: string +) => { + if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { + console.warn( + 'Manzano network detected. Adding capacityDelegationAuthSig to pkpSessionSigs' + ); + } + + // Use default resourceAbilityRequests if not provided + const _resourceAbilityRequests = resourceAbilityRequests || [ + { + resource: new LitPKPResource('*'), + ability: LitAbility.PKPSigning, + }, + { + resource: new LitActionResource('*'), + ability: LitAbility.LitActionExecution, + }, + ]; + + const pkpSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, + authMethods: [alice.authMethod!], + expiration, + resourceAbilityRequests: _resourceAbilityRequests, + + // -- only add this for manzano network + ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano + ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } + : {}), + }); + + log('[getPkpSessionSigs]: ', pkpSessionSigs); + + return pkpSessionSigs; +}; diff --git a/packages/tinny/src/lib/shiva-client.d.ts b/packages/tinny/src/lib/shiva-client.d.ts new file mode 100644 index 0000000000..7bb27c17a6 --- /dev/null +++ b/packages/tinny/src/lib/shiva-client.d.ts @@ -0,0 +1,72 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +type ContractAbis = { + litToken: string; + erc20: string; + backupRecovery: string; + staking: string; + stakingBalances: string; + rateLimitNft: string; + pkpnft: string; + pubkeyRouter: string; + pkpPermissions: string; + pkpHelper: string; + contractResolver: string; + paymentDelegation: string; +}; + +type ContractAddresses = { + litToken: string; + backupRecovery: string; + staking: string; + stakingBalances: string; + rateLimitNft: string; + pkpnft: string; + pubkeyRouter: string; + pkpPermissions: string; + pkpHelper: string; + contractResolver: string; + keyDeriver: string; + paymentDelegation: string; +}; + +type TestNetCreateRequest = { + nodeCount: number; + pollingInterval: string; + epochLength: number; + customBuildPath: string | null; + litActionServerCustomBuildPath: string | null; + existingConfigPath: string | null; + which: string | null; + ecdsaRoundTimeout: string | null; + enableRateLimiting: string | null; +}; + +type TestNetInfo = { + contractAddresses: ContractAddresses; + validatorAddresses: Array; + contractResolverAbi: string; + rpcUrl: string; + epochLength: number; + contractAbis: ContractAbis; +}; + +type TestNetResponse = { + testnetId: string; + command: string; + wasCanceled: boolean; + body: T | null; + lastStateObserved: string | null; + messages: Array | null; + errors: Array | null; +}; + +type TestNetState = 'Busy' | 'Active' | 'Mutating' | 'Shutdown' | 'UNKNOWN'; + +export { + ContractAbis, + ContractAddresses, + TestNetCreateRequest, + TestNetInfo, + TestNetResponse, + TestNetState, +}; diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts new file mode 100644 index 0000000000..59da1f90d3 --- /dev/null +++ b/packages/tinny/src/lib/shiva-client.ts @@ -0,0 +1,299 @@ +import { LitContractResolverContext } from '@lit-protocol/types'; +import { ethers } from 'ethers'; +import { + TestNetCreateRequest, + TestNetInfo, + TestNetResponse, + TestNetState, +} from './shiva-client.d'; + +export interface ShivaEnvs { + /** + * If runnnig no localchain this flag will stop the running testnet when the test + * run has finished. Which is when all pending task promises have settled. + */ + STOP_TESTNET: boolean; + + /** + * URL for Testnet manager intigration + */ + TESTNET_MANAGER_URL: string; + + /** + * Path to the Lit Node Binary to use. Can be configured through an env variable + * LIT_NODE_BINARY_PATH where the value is the local path to a built Lit Action Binary + * If flagging to not use the binary path this option will be ignored. + * See {@link USE_LIT_BINARIES} and {@link LIT_ACTION_BINARY_PATH} + */ + LIT_NODE_BINARY_PATH: string; + + /** + * Path to lit action binary to use, Can be defined through env variable + * LIT_ACTION_BINARY_PATH where the value is the local path to a built Lit Action Binary. + * If flagging not to use the binary path this option will be ignored + * See {@link USE_LIT_BINARIES} and {@link LIT_NODE_BINARY_PATH} + */ + LIT_ACTION_BINARY_PATH: string; + + /** + * Flag to indicate if the provided binary path should be used + * or if the testnet should be built from source before starting. + */ + USE_LIT_BINARIES: boolean; +} + +/** + * Client implementation for a single testnet instance managed by the Shiva tool + * Is essentially a localchain setup but allows for programmatic operations to be performed + * on the network from the implementation within this class. Each testnet is a unique network + */ +export class TestnetClient { + private _id: string | undefined; + private _info: TestNetInfo | undefined; + private _processEnvs: ShivaEnvs | undefined; + private _currentState: TestNetState | undefined; + + constructor(id: string, envs: ShivaEnvs) { + this._processEnvs = envs; + this._id = id; + } + + /* + Returns the testnet information + pub struct TestNetInfo { + pub contract_addresses: ContractAddresses, + pub validator_addresses: Vec, + pub contract_resolver_abi: String, + pub rpc_url: String, + pub epoch_length: i32, + } + */ + get Info(): TestNetInfo | undefined { + return this._info; + } + + get ContractContext(): LitContractResolverContext | undefined { + const testNetConfig = this.Info; + if (!testNetConfig) { + return undefined; + } + + const contractResolverAbi: string = testNetConfig.contractResolverAbi; + const contractResolverAddress = + testNetConfig.contractAddresses[`contractResolver`]; + const networkContext = { + abi: JSON.parse(contractResolverAbi), + resolverAddress: contractResolverAddress, + provider: new ethers.providers.JsonRpcProvider( + `http://${testNetConfig.rpcUrl}` + ), + environment: 0, // test deployment uses env value 0 in test common + }; + return networkContext; + } + + /** + * Polls a given testnet for the ACTIVE state + * polls on a 500 milisecond interval + */ + public async pollTestnetForActive(): Promise { + let state = 'Busy'; + while (state != 'Active' && state != `UNKNOWN`) { + const pollRes = await fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/poll/testnet/' + + this._id + ); + const res = await pollRes.json(); + state = res.body; + console.log('found state to be', res); + if (state != 'Active' && state != 'UNKNOWN') { + await new Promise((res, _) => { + setTimeout(() => { + res(); + }, 500); + }); + } else { + break; + } + } + + return state; + } + + /** + * returns the config for a given testnet + * struct reference for config + */ + public getTestnetConfig() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/get/info/testnet/' + + this._id + ) + .then((res: Response) => { + return res.json(); + }) + .then((info: TestNetResponse) => { + this._info = info.body!; + this._currentState = info.lastStateObserved as TestNetState; + console.log('setting testnet info: ', this._info); + }); + } + + /** + * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + public transitionEpochAndWait() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/action/transition/epoch/wait/' + + this._id + ) + .then((res: Response) => { + if (res.status === 200) { + return res.json(); + } else { + throw res; + } + }) + .then((body: any) => { + console.log('Stopped random peer: ', body); + }); + } + + /** + * Stops a random peer and waits for the next epoc to transiton. + * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. + */ + public stopRandomNetworkPeerAndWaitForNextEpoch() { + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/action/stop/random/wait/' + + this._id + ) + .then((res: Response) => { + if (res.status === 200) { + return res.json(); + } else { + throw res; + } + }) + .then((body: TestNetResponse) => { + console.log('validator kick response: ', body); + return body; + }); + } + + /* + Stops the testnet + */ + public stopTestnet() { + console.log('stopping testnet with id:', this._id); + return fetch( + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/delete/testnet/' + + this._id + ) + .then((res: Response) => { + return res.json(); + }) + .then((body: TestNetResponse) => { + console.log('shutdown respone: ', body); + }); + } +} + +export class ShivaClient { + private _clients: Map; + public processEnvs: ShivaEnvs = { + STOP_TESTNET: process.env[`STOP_TESTNET`] === 'true', + TESTNET_MANAGER_URL: + process.env['TESTNET_MANAGER_URL'] || 'http://0.0.0.0:8000', + USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, + LIT_NODE_BINARY_PATH: + process.env['LIT_NODE_BINARY_PATH'] || + `./../../lit-assets/rust/lit-node/target/debug/lit_node`, + LIT_ACTION_BINARY_PATH: + process.env['LIT_ACTION_BINARY_PATH'] || + `./../../lit-assets/rust/lit-actions/target/debug/lit_actions`, + }; + + constructor() { + this._clients = new Map(); + console.log('Shiva environment loaded current config: ', this.processEnvs); + } + + /** + * Used to start an instance of a lit network through the Lit Testnet Manager + * if an isntance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. + * If an instance does not exist then we create one + * struct reference + pub struct TestNetCreateRequest { + pub node_count: usize, + pub polling_interval: String, + pub epoch_length: i32, + pub custom_build_path: Option, + pub lit_action_server_custom_build_path: Option, + pub existing_config_path: Option, + pub which: Option, + pub ecdsa_round_timeout: Option, + pub enable_rate_limiting: Option, + } + */ + async startTestnetManager( + createReq?: TestNetCreateRequest + ): Promise { + const existingTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets' + ); + const existingTestnets: string[] = await existingTestnetResp.json(); + if (existingTestnets.length > 0) { + this._clients.set( + existingTestnets[0], + new TestnetClient(existingTestnets[0], this.processEnvs) + ); + return this._clients.get(existingTestnets[0])!; + } else { + console.log( + 'lit node binary path: ', + this.processEnvs.LIT_NODE_BINARY_PATH + ); + console.log( + 'lit action server binary path: ', + this.processEnvs.LIT_ACTION_BINARY_PATH + ); + let body: Partial = createReq ?? { + nodeCount: 3, + pollingInterval: '2000', + epochLength: 100, + }; + + if (this.processEnvs.USE_LIT_BINARIES) { + body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; + body.litActionServerCustomBuildPath = + this.processEnvs.LIT_ACTION_BINARY_PATH; + } + console.log('Testnet create args: ', body); + const createTestnetResp = await fetch( + this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', + { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify(body), + } + ); + + const createTestnet = await createTestnetResp.json(); + this._clients.set( + createTestnet.testnetId, + new TestnetClient(createTestnet.testnetId, this.processEnvs) + ); + + return this._clients.get(createTestnet.testnetId)!; + } + } +} diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts new file mode 100644 index 0000000000..4ac93019a1 --- /dev/null +++ b/packages/tinny/src/lib/tinny-config.ts @@ -0,0 +1,141 @@ +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { LitContractResolverContext } from '@lit-protocol/types'; + +export enum LIT_TESTNET { + LOCALCHAIN = 'localchain', + MANZANO = 'manzano', + CAYENNE = 'cayenne', + DATIL_DEV = 'datil-dev', + DATIL_TEST = 'datil-test', +} + +export enum LIT_RPC { + LOCAL_ANVIL = 'http://127.0.0.1:8545', + CHRONICLE = 'https://chain-rpc.litprotocol.com/http', + VESUVIUS = 'https://vesuvius-rpc.litprotocol.com', +} + +/** + * Mapping of testnet names to corresponding RPC endpoints. + */ +export const RPC_MAP = { + [LIT_TESTNET.LOCALCHAIN]: LIT_RPC.LOCAL_ANVIL, + [LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE, + [LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE, + [LIT_TESTNET.DATIL_DEV]: LIT_RPC.VESUVIUS, + [LIT_TESTNET.DATIL_TEST]: LIT_RPC.VESUVIUS, +}; + +/** + * Represents the configuration options for the process environment. + */ +export interface ProcessEnvs { + /** + * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. + */ + MAX_ATTEMPTS: number; + + /** + * The maximum number of milliseconds to wait for a test to complete. + */ + TEST_TIMEOUT: number; + + /** + * The network to use for testing. This can be one of the following: + * - `LIT_TESTNET.LOCALCHAIN` + * - `LIT_TESTNET.MANZANO` + * - `LIT_TESTNET.CAYENNE` + * - `LIT_TESTNET.DATIL_DEV` + */ + NETWORK: LIT_TESTNET; + + /** + * The number of milliseconds to wait between each request. + */ + DEBUG: boolean; + + /** + * Capacity Credits: In order to execute a transaction with Lit, you’ll need to reserve capacity on the network using Capacity Credits. These allow holders to reserve a set number of requests over a desired period of time (by default expiration set to 2 days) + */ + REQUEST_PER_KILOSECOND: number; + + /** + * Wait time in milliseconds if no private keys are available. + */ + WAIT_FOR_KEY_INTERVAL: number; + + /** + * Time to wait before releasing the key after requesting it. + */ + TIME_TO_RELEASE_KEY: number; + + /** + * Run all the tests in a single thread. + */ + RUN_IN_BAND: boolean; + + /** + * The interval in milliseconds to run the tests in a single thread. + */ + RUN_IN_BAND_INTERVAL: number; + + // =========== In most cases you won't need to change the following values =========== + /** + * The URL of Lit RPC server. + * - If it's running locally on Anvil, it should be 'http://127.0.0.1:8545' + * - If it's running on Chronicle, it should be 'https://chain-rpc.litprotocol.com/http' + * - If it's running on Vesuvius, it should be 'https://vesuvius-rpc.litprotocol.com' + */ + 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. + */ + PRIVATE_KEYS: string[]; + + /** + * The list of keys that are currently in use. + */ + KEY_IN_USE: boolean[]; + + /** + * Ignore setup steps. Usually when you run to quickly run a single test. + */ + NO_SETUP: boolean; + + /** + * Use shiva as a test network which will spawn before the test run starts + */ + USE_SHIVA: boolean; + + /** + * The network configuration which will be used for `contract context` if provided. + * it is assumed the context will work with the {@link NETWORK} provided. If the configuration + * is not for the provided network then there could be undefined behavior. + * If {@link USE_SHIVA} is set to true then the network configuration will be loaded implicitly and + * this value will be ignored + */ + NETWORK_CONFIG: string; +} + +/** + * Represents the PKP information. + */ +export type PKPInfo = { + tokenId: string; + publicKey: string; + ethAddress: string; +}; + +export interface TinnyEnvConfig { + rpc: string; + litNodeClient: LitNodeClient; + network: LIT_TESTNET; + processEnvs: ProcessEnvs; + contractContext?: LitContractResolverContext; +} diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts new file mode 100644 index 0000000000..f7ecaee000 --- /dev/null +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -0,0 +1,533 @@ +import { + LIT_TESTNET, + ProcessEnvs, + RPC_MAP, + TinnyEnvConfig, +} from './tinny-config'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { + AuthSig, + CosmosAuthSig, + LitContractContext, + LitContractResolverContext, + SolanaAuthSig, +} from '@lit-protocol/types'; +import { TinnyPerson } from './tinny-person'; + +import { ethers } from 'ethers'; +import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; +import { ShivaClient, TestnetClient } from './shiva-client'; + +declare var globalThis: any; +export class TinnyEnvironment { + public network: LIT_TESTNET; + + /** + * Environment variables used in the process. + */ + public processEnvs: ProcessEnvs = { + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS'] as string) || 1, + TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT'] as string) || 45000, + NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, + DEBUG: process.env['DEBUG'] === 'true', + REQUEST_PER_KILOSECOND: + parseInt(process.env['REQUEST_PER_KILOSECOND'] ?? '') || 200, + LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? '', // localhost rpc if not provided + 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, + + // Available Accounts + // ================== + // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) + // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) + // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) + // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) + // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) + // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) + // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) + // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) + // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) + PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ + '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', + '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', + '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', + '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', + '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', + '0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356', + '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', + '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', + ], + KEY_IN_USE: new Array(), + NO_SETUP: process.env['NO_SETUP'] === 'true', + USE_SHIVA: process.env['USE_SHIVA'] === 'true', + NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', + }; + + public litNodeClient: LitNodeClient | undefined; + public contractsClient: LitContracts | undefined; + public rpc: string; + public superCapacityDelegationAuthSig: AuthSig | undefined; + public bareEthAuthSig: AuthSig | undefined; + public bareSolAuthSig: SolanaAuthSig = { + sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', + derivedVia: 'solana.signMessage', + signedMessage: + 'I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z', + address: 'F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1', + }; + + public bareCosmosAuthSig: CosmosAuthSig = { + sig: 'dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==', + derivedVia: 'cosmos.signArbitrary', + signedMessage: + '8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b', + address: 'cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku', + }; + + public testnet: TestnetClient | undefined; + //=========== PRIVATE MEMBERS =========== + private _shivaClient: ShivaClient = new ShivaClient(); + private _contractContext: + | LitContractContext + | LitContractResolverContext + | undefined; + + constructor(network?: LIT_TESTNET) { + // -- setup networkj + this.network = network || this.processEnvs.NETWORK; + + if (Object.values(LIT_TESTNET).indexOf(this.network) === -1) { + throw new Error( + `Invalid network environment. Please use one of ${Object.values( + LIT_TESTNET + )}` + ); + } + + // -- create an empty array to keep track of all keys + this.processEnvs.KEY_IN_USE = new Array( + this.processEnvs.PRIVATE_KEYS.length + ).fill(false); + + // -- setup rpc + // Priority: + // 1. Use environment variable if set + // 2. Use RPC_MAP if network is recognized + // 3. Throw error if neither condition is met + if (this.processEnvs.LIT_RPC_URL) { + // If LIT_RPC_URL is set in the environment, use it + this.rpc = this.processEnvs.LIT_RPC_URL; + } else if (this.network in RPC_MAP) { + // If the network is recognized in RPC_MAP, use the corresponding RPC URL + this.rpc = RPC_MAP[this.network]; + } else { + // If neither condition is met, throw an error with available options + const availableNetworks = Object.keys(RPC_MAP).join(', '); + throw new Error( + `No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}` + ); + } + + console.log( + '[𐬺πŸ§ͺ Tinny Environment𐬺] Done configuring enviorment current config: ', + this.processEnvs + ); + } + + world: Map = new Map(); + + /** + * Retrieves an available private key from a list, marking it as in use and scheduling + * its automatic release. If no unused keys are available, it waits for a set interval + * before rechecking. + * + * This function loops until it finds an unused key, marks it, and returns the key with + * its index. If all keys are in use, it logs a wait message and pauses before retrying. + * + * Outputs: + * - privateKey: The selected private key. + * - index: The index of the selected key. + * + * Environment variables required: + * - KEY_IN_USE: Boolean array indicating key usage. + * - PRIVATE_KEYS: Array of key strings. + * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. + * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. + */ + async getAvailablePrivateKey(): Promise<{ + privateKey: string; + index: number; + }> { + while (true) { + const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key + + if (index !== -1) { + // If an available key is found + this.processEnvs.KEY_IN_USE[index] = true; // Mark the key as in use + // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] πŸ”‘ Selected key at index', index); // Log a message indicating that we have selected a key + + return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index + } else { + // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting + // Wait for the specified interval before checking again + await new Promise((resolve) => + setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) + ); + } + } + } + + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKeyFromUser(user: TinnyPerson) { + const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` + // ); + } + + /** + * Marks a private key as available again after use. + * @param {number} index - The index of the key to mark as available. + */ + releasePrivateKey(index: number) { + this.processEnvs.KEY_IN_USE[index] = false; + // console.log( + // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` + // ); + } + + /** + * Initializes the LitNodeClient based on the specified network configuration and environment variables. + * This setup differentiates between local and production environments, adjusts node attestation checks, + * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. + * + * The LitNodeClient is configured differently based on the network: + * - LOCALCHAIN: Uses custom settings for local testing, with node attestation disabled. + * - MANZANO (or other specified testnets): Configures for specific network environments with node attestation enabled. + * + * Logs the process and exits if the client is not ready after attempting to connect. + */ + + async setupLitNodeClient() { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Setting up LitNodeClient'); + + if (this.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = + this?.testnet?.ContractContext ?? this._contractContext; + this.litNodeClient = new LitNodeClient({ + litNetwork: 'custom', + rpcUrl: this.rpc, + debug: this.processEnvs.DEBUG, + checkNodeAttestation: false, // disable node attestation check for local testing + contractContext: networkContext, + }); + } else if (this.network === LIT_TESTNET.MANZANO) { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, // 'habanero' or 'manzano' + checkNodeAttestation: true, + debug: this.processEnvs.DEBUG, + }); + } else { + this.litNodeClient = new LitNodeClient({ + litNetwork: this.network, + checkNodeAttestation: false, + debug: this.processEnvs.DEBUG, + }); + } + + if (globalThis.wasmExports) { + console.warn( + 'WASM modules already loaded. Will overide when connect is called' + ); + } + + if (globalThis.wasmECDSA) { + console.warn( + 'WASM modules already loaded. wil overide. when connect is called' + ); + } + + if (globalThis.wasmSevSnpUtils) { + console.warn( + 'WASM modules already loaded. wil overide. when connect is called' + ); + } + + await this.litNodeClient.connect(); + + if (!this.litNodeClient.ready) { + console.error('❌ litNodeClient not ready'); + process.exit(); + } + } + + /** + * Retrieves the environment configuration. + * @returns The TinnyEnvConfig object containing the environment configuration. + */ + getEnvConfig(): TinnyEnvConfig { + const contractContext = + this?.testnet?.ContractContext ?? this._contractContext; + return { + rpc: this.rpc, + litNodeClient: this.litNodeClient!, + network: this.network, + processEnvs: this.processEnvs, + contractContext: contractContext as LitContractResolverContext, + }; + } + + /** + * Creates a new person with the given name. + * @param name - The name of the person. + * @returns The newly created person. + * @throws Error if the name is not provided. + */ + async createNewPerson(name: string) { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Creating new person:', name); + if (!name) { + throw new Error('Name is required'); + } + const key = await this.getAvailablePrivateKey(); + const privateKey = key.privateKey; + const envConfig = this.getEnvConfig(); + + const person = new TinnyPerson({ + privateKey, + envConfig, + }); + + await person.spawn(); + + this.world.set(name, person); + + return person; + } + + /** + * Retrieves a person from the world by their name. + * @param name - The name of the person to retrieve. + * @returns The person object if found, or undefined if not found. + */ + getPerson(name: string) { + return this.world.get(name); + } + + /** + * Creates a random person. + * @returns A promise that resolves to the created person. + */ + async createRandomPerson() { + return await this.createNewPerson('Alice'); + } + + setUnavailable = (network: LIT_TESTNET) => { + if (this.processEnvs.NETWORK === network) { + throw new Error('LIT_IGNORE_TEST'); + } + }; + + /** + * Init + */ + async init() { + if (this.processEnvs.NO_SETUP) { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); + return; + } + if (this.network === LIT_TESTNET.LOCALCHAIN && this.processEnvs.USE_SHIVA) { + this.testnet = await this._shivaClient.startTestnetManager(); + // wait for the testnet to be active before we start the tests. + let state = await this.testnet.pollTestnetForActive(); + if (state === `UNKNOWN`) { + console.log( + 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' + ); + throw new Error(`Error while creating testnet, aborting test run`); + } + + await this.testnet.getTestnetConfig(); + } else if (this.network === LIT_TESTNET.LOCALCHAIN) { + const context = await import('./networkContext.json'); + this._contractContext = context; + } + + await this.setupLitNodeClient(); + await this.setupSuperCapacityDelegationAuthSig(); + await this.setupBareEthAuthSig(); + } + + /** + * Setup bare eth auth sig to test access control and decryption + */ + async setupBareEthAuthSig() { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + const toSign = await createSiweMessage({ + walletAddress: wallet.address, + nonce: this.litNodeClient?.latestBlockhash!, + expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), + litNodeClient: this.litNodeClient, + }); + + this.bareEthAuthSig = await generateAuthSig({ + signer: wallet, + toSign, + }); + } + + //============= SHIVA ENDPOINTS ============= + /** + * Will stop the testnet that is being used in the test run. + */ + async stopTestnet() { + if ( + this.network === LIT_TESTNET.LOCALCHAIN && + this._shivaClient.processEnvs.STOP_TESTNET + ) { + await this.testnet?.stopTestnet(); + } else { + console.log('skipping testnet shutdown.'); + } + } + //============= END SHIVA ENDPOINTS ============= + + /** + * Sends funds from the current wallet to the specified wallet address. + * @param walletAddress - The address of the recipient wallet. + * @param amount - The amount of funds to send (default: '0.001'). + * @throws If there is an error sending the funds. + */ + getFunds = async (walletAddress: string, amount = '0.001') => { + try { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + const tx = await wallet.sendTransaction({ + to: walletAddress, + value: ethers.utils.parseEther(amount), + }); + + await tx.wait(); + } catch (e) { + throw new Error(`Failed to send funds to ${walletAddress}: ${e}`); + } + }; + + /** + * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global + * max capacity. + */ + setupSuperCapacityDelegationAuthSig = async () => { + const privateKey = await this.getAvailablePrivateKey(); + const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); + const wallet = new ethers.Wallet(privateKey.privateKey, provider); + + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = + this?.testnet?.ContractContext ?? this._contractContext; + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + rpc: this.rpc, + customContext: networkContext, + }); + } else { + // scoping `this` for function scope + const me = this; + async function _switchWallet() { + // TODO: This wallet should be cached somehwere and reused to create delegation signatures. + // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. + const capacityCreditWallet = + ethers.Wallet.createRandom().connect(provider); + + // get wallet balance + const balance = await wallet.getBalance(); + console.log('this.rpc:', me.rpc); + console.log('this.wallet.address', wallet.address); + console.log('Balance:', balance.toString()); + + const transferTx = await wallet.sendTransaction({ + to: capacityCreditWallet.address, + value: ethers.utils.parseEther('0.001'), + }); + await transferTx.wait(); + } + + // await _switchWallet(); + + this.contractsClient = new LitContracts({ + // signer: capacityCreditWallet, // disabled switch wallet for now + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network, + }); + } + + await this.contractsClient.connect(); + + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + const me = this; + // Disabled for now + const _mintSuperCapacityDelegationAuthSig = async () => { + console.log( + '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' + ); + try { + const capacityTokenId = ( + await me.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + this.superCapacityDelegationAuthSig = ( + await this.litNodeClient?.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId: capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: '200', + }) + )?.capacityDelegationAuthSig; + } catch (e: any) { + if ( + e.message.includes(`Can't allocate capacity beyond the global max`) + ) { + console.log('❗️Skipping capacity delegation auth sig setup.', e); + } else { + console.log( + '❗️Error while setting up capacity delegation auth sig', + e + ); + } + } + }; + }; +} diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts new file mode 100644 index 0000000000..5645427e4b --- /dev/null +++ b/packages/tinny/src/lib/tinny-person.ts @@ -0,0 +1,220 @@ +import { + AuthSig, + generateAuthSig, + createSiweMessage, +} from '@lit-protocol/auth-helpers'; +import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { + AuthMethod, + BaseSiweMessage, + LitContractContext, +} from '@lit-protocol/types'; +import { ethers } from 'ethers'; +import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; +import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; +import { AuthMethodScope } from '@lit-protocol/constants'; + +export class TinnyPerson { + public privateKey: string; + public wallet: ethers.Wallet; + public siweMessage: string | undefined; + public authSig: AuthSig | undefined; + public authMethod: AuthMethod | undefined; + public contractsClient: LitContracts | undefined; + // public capacityTokenId: string; + // public capacityDelegationAuthSig: AuthSig; + public pkp: PKPInfo | undefined; + public authMethodOwnedPkp: PKPInfo | undefined; + + // Pass this to data to sign + public loveLetter: Uint8Array = ethers.utils.arrayify( + ethers.utils.keccak256([1, 2, 3, 4, 5]) + ); + + public provider: ethers.providers.JsonRpcProvider; + + public envConfig: TinnyEnvConfig; + + constructor({ + privateKey, + envConfig, + }: { + privateKey: string; + envConfig: TinnyEnvConfig; + }) { + this.envConfig = envConfig; + + this.privateKey = privateKey; + this.provider = new ethers.providers.JsonRpcProvider(this.envConfig.rpc); + this.wallet = new ethers.Wallet(privateKey, this.provider); + } + + /** + * FIXME: Enabling this is causing the test to fail + * Switches the current wallet to a new funding wallet by creating a new funding wallet, + * funding it with a small amount of ethers, and updating the current wallet to the new one. + * + * @private + * @returns {Promise} A promise that resolves once the wallet has been switched. + */ + private async _switchWallet() { + // Create a new funding wallet, funds it with small amount of ethers, and updates the current wallet to the new one. + const fundingWallet = ethers.Wallet.createRandom().connect(this.provider); + + if (this.envConfig.network != LIT_TESTNET.LOCALCHAIN) { + // check balance this.wallet + const balance = await this.wallet.getBalance(); + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Wallet balance:', + ethers.utils.formatEther(balance) + ); + + const transferTx = await this.wallet.sendTransaction({ + to: fundingWallet.address, + value: ethers.utils.parseEther('0.00001'), + }); + + const transferReciept = await transferTx.wait(); + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Transfered Assets for person tx: ', + transferReciept.transactionHash + ); + this.wallet = fundingWallet; + } + } + + async spawn() { + // await this._switchWallet(); + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Spawning person:', this.wallet.address); + /** + * ==================================== + * Get Hot Wallet Auth Sig + * ==================================== + */ + this.siweMessage = await createSiweMessage({ + nonce: this.envConfig?.litNodeClient?.latestBlockhash!, + walletAddress: this.wallet.address, + }); + + this.authSig = await generateAuthSig({ + signer: this.wallet, + toSign: this.siweMessage, + }); + + /** + * ==================================== + * Craft an authMethod from the authSig for the eth wallet auth method + * ==================================== + */ + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...' + ); + this.authMethod = await EthWalletProvider.authenticate({ + signer: this.wallet, + litNodeClient: this.envConfig.litNodeClient, + }); + + /** + * ==================================== + * Setup contracts-sdk client + * ==================================== + */ + if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) { + const networkContext = this.envConfig.contractContext; + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc + customContext: networkContext as unknown as LitContractContext, + }); + } else { + this.contractsClient = new LitContracts({ + signer: this.wallet, + debug: this.envConfig.processEnvs.DEBUG, + network: this.envConfig.network, + }); + } + + await this.contractsClient.connect(); + + /** + * ==================================== + * Mint a PKP + * ==================================== + */ + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP...'); + const walletMintRes = + await this.contractsClient.pkpNftContractUtils.write.mint(); + + this.pkp = walletMintRes.pkp; + + /** + * ==================================== + * Mint a PKP wiuth eth wallet auth method + * ==================================== + */ + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP with eth wallet auth method...' + ); + this.authMethodOwnedPkp = ( + await this.contractsClient.mintWithAuth({ + authMethod: this.authMethod, + scopes: [AuthMethodScope.SignAnything], + }) + ).pkp; + + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] 🐣 TinnyPerson spawned:', + this.wallet.address + ); + } + + /** + * ==================================== + * Mint a Capacity Credits NFT + * ==================================== + */ + async mintCapacityCreditsNFT() { + console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT '); + const capacityTokenId = ( + await this.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: + this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + return capacityTokenId; + } + + /** + * ==================================== + * Mint a Capacity Credits NFT and get a capacity delegation authSig with it + * ==================================== + */ + async createCapacityDelegationAuthSig( + addresses: string[] = [] + ): Promise { + console.log( + '[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' + ); + + const capacityTokenId = ( + await this.contractsClient?.mintCapacityCreditsNFT({ + requestsPerKilosecond: + this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + )?.capacityTokenIdStr; + + this.contractsClient!.signer! = this.wallet; + await this.contractsClient?.connect(); + return ( + await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: this.wallet, + capacityTokenId: capacityTokenId, + ...(addresses.length && { delegateeAddresses: addresses }), + }) + ).capacityDelegationAuthSig; + } +} diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts new file mode 100644 index 0000000000..2be285519e --- /dev/null +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -0,0 +1,65 @@ +import { importer } from 'ipfs-unixfs-importer'; +import { Buffer } from 'buffer'; + +/** + * Converts a string to an IPFS hash. + * @param input - The input string to convert. + * @returns A Promise that resolves to the IPFS hash. + * @throws An error if the generated hash does not start with 'Qm'. + */ +export async function stringToIpfsHash(input: string): Promise { + const blockput = { + put: async (block: any) => { + return block.cid; + }, + }; + + // Convert the input string to a Buffer + const content = Buffer.from(input); + + // Import the content to create an IPFS file + const files = importer([{ content }], blockput as any); + + // Get the first (and only) file result + const result = (await files.next()).value; + + const ipfsHash = (result as any).cid.toString(); + + if (!ipfsHash.startsWith('Qm')) { + throw new Error('Generated hash does not start with Qm'); + } + + return ipfsHash; +} + +export function randomSolanaPrivateKey() { + const BASE58_ALPHABET = + '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + const SOLANA_PRIVATE_KEY_LENGTH = 88; + + let result = ''; + const charactersLength = BASE58_ALPHABET.length; + for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { + const randomIndex = Math.floor(Math.random() * charactersLength); + result += BASE58_ALPHABET.charAt(randomIndex); + } + return result; +} + +/** + * Wraps a promise with a timeout. + * If the promise does not resolve or reject within the specified time, it will be rejected with a "Timed out" error. + * + * @param promise - The promise to wrap with a timeout. + * @param ms - The timeout duration in milliseconds. + * @returns A new promise that resolves or rejects based on the original promise or the timeout. + */ +export function withTimeout( + promise: Promise, + ms: number +): Promise { + const timeout = new Promise((_, reject) => + setTimeout(() => reject(new Error('Timed out')), ms) + ); + return Promise.race([promise, timeout]); +} diff --git a/packages/tinny/src/lib/tinny.spec.ts b/packages/tinny/src/lib/tinny.spec.ts new file mode 100644 index 0000000000..d3e628e323 --- /dev/null +++ b/packages/tinny/src/lib/tinny.spec.ts @@ -0,0 +1,7 @@ +import { tinny } from './tinny'; + +describe('tinny', () => { + it('should work', () => { + expect(tinny()).toEqual('tinny'); + }); +}); diff --git a/packages/tinny/tsconfig.json b/packages/tinny/tsconfig.json new file mode 100644 index 0000000000..f5b85657a8 --- /dev/null +++ b/packages/tinny/tsconfig.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "module": "commonjs", + "forceConsistentCasingInFileNames": true, + "strict": true, + "noImplicitOverride": true, + "noPropertyAccessFromIndexSignature": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" + } + ] +} diff --git a/packages/tinny/tsconfig.lib.json b/packages/tinny/tsconfig.lib.json new file mode 100644 index 0000000000..33eca2c2cd --- /dev/null +++ b/packages/tinny/tsconfig.lib.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "declaration": true, + "types": ["node"] + }, + "include": ["src/**/*.ts"], + "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts"] +} diff --git a/packages/tinny/tsconfig.spec.json b/packages/tinny/tsconfig.spec.json new file mode 100644 index 0000000000..9b2a121d11 --- /dev/null +++ b/packages/tinny/tsconfig.spec.json @@ -0,0 +1,14 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "module": "commonjs", + "types": ["jest", "node"] + }, + "include": [ + "jest.config.ts", + "src/**/*.test.ts", + "src/**/*.spec.ts", + "src/**/*.d.ts" + ] +} From d1bd379ce3644a3ae13213742513e08f5d5f36c3 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 11:25:54 -0400 Subject: [PATCH 029/136] chore: package updates for jest (dev deps) --- package.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index acf5e7bf51..c61a18c5cd 100644 --- a/package.json +++ b/package.json @@ -93,8 +93,10 @@ "@nx/react": "17.3.0", "@nx/web": "17.3.0", "@solana/web3.js": "^1.92.2", + "@swc-node/register": "~1.6.7", "@swc/core": "1.3.107", - "@types/jest": "27.4.1", + "@swc/helpers": "~0.5.2", + "@types/jest": "^29.4.0", "@types/node": "18.19.18", "@types/secp256k1": "^4.0.6", "@typescript-eslint/eslint-plugin": "6.21.0", @@ -122,6 +124,7 @@ "inquirer": "^9.2.21", "ipfs-unixfs-importer": "12.0.1", "jest": "29.7.0", + "jest-environment-node": "^29.4.1", "lerna": "^5.4.3", "live-server": "^1.2.2", "node-fetch": "^2.6.1", @@ -131,8 +134,9 @@ "prettier": "^2.6.2", "react-router-dom": "6.11.2", "ts-jest": "29.1.2", + "ts-node": "10.9.1", "typedoc": "^0.23.10", - "typescript": "~4.7.2" + "typescript": "~5.3.2" }, "workspaces": [ "packages/*" From 9b77385c897644bd42676971b18297fd75c4e258 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 11:26:10 -0400 Subject: [PATCH 030/136] ref: run tests parallel --- packages/e2e-tests/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/project.json b/packages/e2e-tests/project.json index 9452e76b4f..a4cde159b2 100644 --- a/packages/e2e-tests/project.json +++ b/packages/e2e-tests/project.json @@ -28,7 +28,7 @@ "options": { "jestConfig": "packages/e2e-tests/jest.config.ts", "passWithNoTests": true, - "runInBand": true + "runInBand": false } }, "testWatch": { From 3f63560ac7e9d1d005cc99aafe671e8b8e112dc2 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 11:26:20 -0400 Subject: [PATCH 031/136] ref: remove session generators --- packages/e2e-tests/utils/session-generator.ts | 52 ------------------- 1 file changed, 52 deletions(-) delete mode 100644 packages/e2e-tests/utils/session-generator.ts diff --git a/packages/e2e-tests/utils/session-generator.ts b/packages/e2e-tests/utils/session-generator.ts deleted file mode 100644 index f743bac1c1..0000000000 --- a/packages/e2e-tests/utils/session-generator.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { LitResourceAbilityRequest, SessionSigsMap } from '@lit-protocol/types'; -import { TinnyEnvironment } from '../setup/tinny-environment'; -import { TinnyPerson } from '../setup/tinny-person'; -import { getEoaSessionSigs } from '../setup/session-sigs/get-eoa-session-sigs'; -import { - getLitActionSessionSigs, - getLitActionSessionSigsUsingIpfsId, -} from '../setup/session-sigs/get-lit-action-session-sigs'; -import { getPkpSessionSigs } from '../setup/session-sigs/get-pkp-session-sigs'; - -export const sessionGenerators = [ - { - name: `LitAction`, - fn: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ): Promise => { - return getLitActionSessionSigs(devEnv, person, resources); - }, - }, - { - name: `EOA`, - fn: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ): Promise => { - return getEoaSessionSigs(devEnv, person, resources); - }, - }, - { - name: `LitActionIPFS`, - fn: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ): Promise => { - return getLitActionSessionSigsUsingIpfsId(devEnv, person, resources); - }, - }, - { - name: `PKP`, - fn: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ): Promise => { - return getPkpSessionSigs(devEnv, person, resources); - }, - }, -]; From ebe2f65d5cb927d946a6da49f5fbc5ca4408f453 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 11:27:02 -0400 Subject: [PATCH 032/136] dev: update imports for tinny package --- .../e2e-tests/src/tests/LitActionOps.spec.ts | 278 +++++++++--------- .../e2e-tests/src/tests/PKPEthers.spec.ts | 10 +- packages/e2e-tests/src/tests/Relayer.spec.ts | 2 +- .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 2 +- .../e2e-tests/src/tests/SessionSigs.spec.ts | 16 +- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 5 +- .../e2e-tests/src/tests/connection.spec.ts | 3 +- 7 files changed, 149 insertions(+), 167 deletions(-) diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts index 79d9a79561..85e53ebf97 100644 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -1,40 +1,40 @@ -import { getLitActionSessionSigs } from "../../setup/session-sigs/get-lit-action-session-sigs"; -import { AccessControlConditions } from "../../setup/accs/accs"; -import { LIT_TESTNET } from "../../setup/tinny-config"; -import { TinnyEnvironment } from "../../setup/tinny-environment"; -import { ILitNodeClient } from "@lit-protocol/types"; +import { getLitActionSessionSigs } from '@lit-protocol/tinny'; +import { AccessControlConditions } from '@lit-protocol/tinny'; +import { LIT_TESTNET } from '../../setup/tinny-config'; +import { TinnyEnvironment } from '@lit-protocol/tinny'; +import { ILitNodeClient } from '@lit-protocol/types'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { getEoaSessionSigsWithCapacityDelegations } from "../../setup/session-sigs/get-eoa-session-sigs"; +import { getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; -describe("Lit Action Ops", () => { - let devEnv: TinnyEnvironment; - beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); +describe('Lit Action Ops', () => { + let devEnv: TinnyEnvironment; + beforeAll(async () => { + devEnv = new TinnyEnvironment(); + await devEnv.init(); + }); - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); - }); + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + beforeEach(() => { + jest.spyOn(console, 'warn').mockImplementation(() => {}); + }); + + it('Broadcast and Collect', async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); - beforeEach(() => { - jest.spyOn(console, 'warn').mockImplementation(() => {}); + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, }); - it("Broadcast and Collect", async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { let rand = Math.floor(Math.random() * 100); const resp = await Lit.Actions.broadcastAndCollect({ name: "temperature", @@ -44,52 +44,51 @@ describe("Lit Action Ops", () => { response: JSON.stringify(resp) }); })();`, - jsParams: {}, - }); - devEnv.releasePrivateKeyFromUser(alice); - - const response = res?.response; - expect(response).toBeDefined(); + jsParams: {}, + }); + devEnv.releasePrivateKeyFromUser(alice); + + const response = res?.response; + expect(response).toBeDefined(); + }); + + it('Decrypt And Combine', async () => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, }); + const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } - it("Decrypt And Combine", async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { const resp = await Lit.Actions.decryptAndCombine({ accessControlConditions, ciphertext, @@ -101,57 +100,56 @@ describe("Lit Action Ops", () => { response: resp }); })();`, - jsParams: { - accessControlConditions: accs, - dataToEncryptHash: encryptRes.dataToEncryptHash, - ciphertext: encryptRes.ciphertext, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - expect(res?.response).toEqual('Hello world') + jsParams: { + accessControlConditions: accs, + dataToEncryptHash: encryptRes.dataToEncryptHash, + ciphertext: encryptRes.ciphertext, + }, }); + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.response).toEqual('Hello world'); + }); - it("Sign and Combine ECDSA", async () => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = ( - await devEnv.litNodeClient?.createCapacityDelegationAuthSig({ - dAppOwnerWallet: alice.wallet!, - }) - )?.capacityDelegationAuthSig; - - // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig! - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs![devEnv.litNodeClient?.config.bootstrapUrls[0]!]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 4. Bob can now execute JS code using the capacity credits NFT - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { + it('Sign and Combine ECDSA', async () => { + const alice = await devEnv.createRandomPerson(); + const bob = await devEnv.createRandomPerson(); + + const appOwnersCapacityDelegationAuthSig = ( + await devEnv.litNodeClient?.createCapacityDelegationAuthSig({ + dAppOwnerWallet: alice.wallet!, + }) + )?.capacityDelegationAuthSig; + + // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs + const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( + devEnv, + bob.wallet, + appOwnersCapacityDelegationAuthSig! + ); + + // -- printing out the recaps from the session sigs + const bobsSingleSessionSig = + bobsSessionSigs![devEnv.litNodeClient?.config.bootstrapUrls[0]!]; + + console.log('bobsSingleSessionSig:', bobsSingleSessionSig); + + const regex = /urn:recap:[\w+\/=]+/g; + + const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; + + recaps.forEach((r) => { + const encodedRecap = r.split(':')[2]; + const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); + console.log(decodedRecap); + }); + + // 4. Bob can now execute JS code using the capacity credits NFT + // 5. Bob can now execute JS code using the capacity credits NFT + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { const sigShare = await LitActions.signAndCombineEcdsa({ toSign: dataToSign, publicKey, @@ -161,16 +159,16 @@ describe("Lit Action Ops", () => { response: sigShare }); })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp?.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - /** + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + + /** Response format { "success": true, @@ -181,11 +179,11 @@ describe("Lit Action Ops", () => { "logs": "" } */ - - expect(res?.response).toBeDefined(); - const sig = JSON.parse(res?.response as string); - expect(sig.r).toBeDefined(); - expect(sig.s).toBeDefined(); - expect(sig.v).toBeDefined(); - }); -}); \ No newline at end of file + + expect(res?.response).toBeDefined(); + const sig = JSON.parse(res?.response as string); + expect(sig.r).toBeDefined(); + expect(sig.s).toBeDefined(); + expect(sig.v).toBeDefined(); + }); +}); diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 864ec09a13..7dbf621de0 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -1,6 +1,6 @@ import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { getEoaSessionSigs } from './../../setup/session-sigs/get-eoa-session-sigs'; +import { TinnyEnvironment, getEoaSessionSigs, TinnyPerson, getLitActionSessionSigs, getLitActionSessionSigsUsingIpfsId } from '@lit-protocol/tinny'; + import { createSiweMessageWithRecaps, generateAuthSig, @@ -25,11 +25,7 @@ import { SignTypedDataVersion, recoverTypedSignature, } from '@metamask/eth-sig-util'; -import { - getLitActionSessionSigs, - getLitActionSessionSigsUsingIpfsId, -} from '../../setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyPerson } from 'packages/e2e-tests/setup/tinny-person'; + try { jest.setTimeout(60000); diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts index b647b660a5..1c88995ed1 100644 --- a/packages/e2e-tests/src/tests/Relayer.spec.ts +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -1,4 +1,4 @@ -import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { TinnyEnvironment } from '@lit-protocol/tinny'; import { EthWalletProvider, LitAuthClient, diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index 5b1b87d4c1..fd905614f1 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -1,4 +1,4 @@ -import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { TinnyEnvironment } from '@lit-protocol/tinny'; import { AccessControlConditions } from '../../setup/accs/accs'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { ILitNodeClient } from '@lit-protocol/types'; diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 333a2e8862..fbf8d09698 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -1,8 +1,8 @@ import { expect, jest } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { AccessControlConditions, TinnyEnvironment, TinnyPerson, getLitActionSessionSigs, getEoaSessionSigs, getPkpSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs } from '@lit-protocol/tinny'; + +import { LIT_TESTNET } from '@lit-protocol/tinny'; -import { LIT_TESTNET } from '../../setup/tinny-config'; -import { AccessControlConditions } from '../../setup/accs/accs'; import { LitAbility, @@ -17,16 +17,6 @@ import { SessionSigsMap, } from '@lit-protocol/types'; -import { - getInvalidLitActionIpfsSessionSigs, - getInvalidLitActionSessionSigs, - getLitActionSessionSigs, - getLitActionSessionSigsUsingIpfsId, -} from '../../setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyPerson } from '../../setup/tinny-person'; -import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs'; -import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; - try { jest.setTimeout(100_000); } catch (e) { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index a87e07bf8c..8ad1af51c1 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -1,5 +1,5 @@ import { expect, jest } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; +import { TinnyEnvironment, getPkpSessionSigs, getEoaSessionSigs } from '@lit-protocol/tinny'; import { EthereumLitTransaction, SerializedTransaction, @@ -14,7 +14,6 @@ import { Transaction, clusterApiUrl, } from '@solana/web3.js'; -import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; import nacl from 'tweetnacl'; import bs58 from 'bs58'; @@ -25,7 +24,7 @@ import { SessionSigsMap, } from '@lit-protocol/types'; import { encryptString } from '@lit-protocol/encryption'; -import { getEoaSessionSigs } from '../../setup/session-sigs/get-eoa-session-sigs'; + import { LIT_CHAINS } from '@lit-protocol/constants'; import { LIT_ACTION_CID_REPOSITORY } from '../../../wrapped-keys/src/lib/lit-actions-client/constants'; import { getPkpAccessControlCondition } from '../../../wrapped-keys/src/lib/utils'; diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index f3c7fbe568..3eaa61ccaf 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -1,6 +1,5 @@ import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { LIT_TESTNET } from 'packages/e2e-tests/setup/tinny-config'; +import { TinnyEnvironment, LIT_TESTNET } from '@lit-protocol/tinny'; try { jest.setTimeout(60000); From ca39af6f7ba5402acc6e6ca57361fea59dbe0d16 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 13:42:58 -0400 Subject: [PATCH 033/136] ref: add back yellow stone config --- packages/tinny/src/lib/tinny-config.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts index 4ac93019a1..037052c4f5 100644 --- a/packages/tinny/src/lib/tinny-config.ts +++ b/packages/tinny/src/lib/tinny-config.ts @@ -13,6 +13,7 @@ export enum LIT_RPC { LOCAL_ANVIL = 'http://127.0.0.1:8545', CHRONICLE = 'https://chain-rpc.litprotocol.com/http', VESUVIUS = 'https://vesuvius-rpc.litprotocol.com', + YELLOWSTONE = 'https://yellowstone-rpc.litprotocol.com' } /** @@ -22,8 +23,8 @@ export const RPC_MAP = { [LIT_TESTNET.LOCALCHAIN]: LIT_RPC.LOCAL_ANVIL, [LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE, [LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE, - [LIT_TESTNET.DATIL_DEV]: LIT_RPC.VESUVIUS, - [LIT_TESTNET.DATIL_TEST]: LIT_RPC.VESUVIUS, + [LIT_TESTNET.DATIL_DEV]: LIT_RPC.YELLOWSTONE, + [LIT_TESTNET.DATIL_TEST]: LIT_RPC.YELLOWSTONE, }; /** From 67da99af1305e0484f0ee7b7d432b61d329e27d3 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 13:56:47 -0400 Subject: [PATCH 034/136] docs: Add comment on pathing import --- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 8ad1af51c1..0c3b689c0c 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -26,6 +26,8 @@ import { import { encryptString } from '@lit-protocol/encryption'; import { LIT_CHAINS } from '@lit-protocol/constants'; + +// Using absolute pathing as these members are not exported from the module import { LIT_ACTION_CID_REPOSITORY } from '../../../wrapped-keys/src/lib/lit-actions-client/constants'; import { getPkpAccessControlCondition } from '../../../wrapped-keys/src/lib/utils'; import { LIT_PREFIX } from '../../../wrapped-keys/src/lib/constants'; From bb1ee3caa883cfef7232b61e442c42b9e662a960 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 14:17:28 -0400 Subject: [PATCH 035/136] dev: formatting and ts ignore for formally incompatible types. --- packages/e2e-tests/src/tests/PKPEthers.spec.ts | 9 +++++++-- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 13 +++++++++++-- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 6 +++++- packages/encryption/src/lib/encryption.ts | 2 ++ packages/tinny/src/index.ts | 14 +++++++++++--- packages/tinny/src/lib/tinny-config.ts | 2 +- 6 files changed, 37 insertions(+), 9 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 7dbf621de0..c935f5bd36 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -1,5 +1,11 @@ import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment, getEoaSessionSigs, TinnyPerson, getLitActionSessionSigs, getLitActionSessionSigsUsingIpfsId } from '@lit-protocol/tinny'; +import { + TinnyEnvironment, + getEoaSessionSigs, + TinnyPerson, + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, +} from '@lit-protocol/tinny'; import { createSiweMessageWithRecaps, @@ -26,7 +32,6 @@ import { recoverTypedSignature, } from '@metamask/eth-sig-util'; - try { jest.setTimeout(60000); } catch (e) { diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index fbf8d09698..1b7d20b5ab 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -1,9 +1,18 @@ import { expect, jest } from '@jest/globals'; -import { AccessControlConditions, TinnyEnvironment, TinnyPerson, getLitActionSessionSigs, getEoaSessionSigs, getPkpSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs } from '@lit-protocol/tinny'; +import { + AccessControlConditions, + TinnyEnvironment, + TinnyPerson, + getLitActionSessionSigs, + getEoaSessionSigs, + getPkpSessionSigs, + getLitActionSessionSigsUsingIpfsId, + getInvalidLitActionIpfsSessionSigs, + getInvalidLitActionSessionSigs, +} from '@lit-protocol/tinny'; import { LIT_TESTNET } from '@lit-protocol/tinny'; - import { LitAbility, LitAccessControlConditionResource, diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 0c3b689c0c..9328358f3b 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -1,5 +1,9 @@ import { expect, jest } from '@jest/globals'; -import { TinnyEnvironment, getPkpSessionSigs, getEoaSessionSigs } from '@lit-protocol/tinny'; +import { + TinnyEnvironment, + getPkpSessionSigs, + getEoaSessionSigs, +} from '@lit-protocol/tinny'; import { EthereumLitTransaction, SerializedTransaction, diff --git a/packages/encryption/src/lib/encryption.ts b/packages/encryption/src/lib/encryption.ts index f591549e02..4b50e5e01b 100644 --- a/packages/encryption/src/lib/encryption.ts +++ b/packages/encryption/src/lib/encryption.ts @@ -142,6 +142,7 @@ export async function decryptFromJson( // FIXME: The return type of this function is inferrable based on the value of `params.dataType` if (parsedJsonData.dataType === 'string') { + //@ts-ignore compatible but not formally return decryptToString( { accessControlConditions: parsedJsonData.accessControlConditions, @@ -157,6 +158,7 @@ export async function decryptFromJson( litNodeClient ); } else if (parsedJsonData.dataType === 'file') { + //@ts-ignore compatible but not formally return decryptToFile( { accessControlConditions: parsedJsonData.accessControlConditions, diff --git a/packages/tinny/src/index.ts b/packages/tinny/src/index.ts index 47ebe4c4a8..2bd278e36e 100644 --- a/packages/tinny/src/index.ts +++ b/packages/tinny/src/index.ts @@ -1,14 +1,22 @@ import { TinnyEnvironment } from './lib/tinny-environment'; import { TinnyPerson } from './lib/tinny-person'; import { ShivaClient } from './lib/shiva-client'; -import { getEoaSessionSigs, getEoaSessionSigsWithCapacityDelegations } from './lib/session-sigs/get-eoa-session-sigs'; +import { + getEoaSessionSigs, + getEoaSessionSigsWithCapacityDelegations, +} from './lib/session-sigs/get-eoa-session-sigs'; import { getPkpSessionSigs } from './lib/session-sigs/get-pkp-session-sigs'; -import { getLitActionSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs } from './lib/session-sigs/get-lit-action-session-sigs'; +import { + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, + getInvalidLitActionIpfsSessionSigs, + getInvalidLitActionSessionSigs, +} from './lib/session-sigs/get-lit-action-session-sigs'; import { AccessControlConditions } from './lib/accs/accs'; import { LIT_TESTNET } from './lib/tinny-config'; export { -LIT_TESTNET, + LIT_TESTNET, TinnyEnvironment, TinnyPerson, ShivaClient, diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts index 037052c4f5..9b80a2c3e3 100644 --- a/packages/tinny/src/lib/tinny-config.ts +++ b/packages/tinny/src/lib/tinny-config.ts @@ -13,7 +13,7 @@ export enum LIT_RPC { LOCAL_ANVIL = 'http://127.0.0.1:8545', CHRONICLE = 'https://chain-rpc.litprotocol.com/http', VESUVIUS = 'https://vesuvius-rpc.litprotocol.com', - YELLOWSTONE = 'https://yellowstone-rpc.litprotocol.com' + YELLOWSTONE = 'https://yellowstone-rpc.litprotocol.com', } /** From 5b3605185328e5b80a8d2ed79b35f7ac5e744624 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 15:21:01 -0400 Subject: [PATCH 036/136] ref: change TS version back to 4.x.x --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce66ecd482..efd7d5ee0e 100644 --- a/package.json +++ b/package.json @@ -137,7 +137,7 @@ "ts-jest": "29.1.2", "ts-node": "10.9.1", "typedoc": "^0.23.10", - "typescript": "~5.3.2" + "typescript": "4.7.2" }, "workspaces": [ "packages/*" From cf59162327cf44da2555ddbf693f3b0bb5fc4e50 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 24 Jul 2024 16:03:09 -0400 Subject: [PATCH 037/136] ref: revert package file changes --- package.json | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index efd7d5ee0e..abd4bba304 100644 --- a/package.json +++ b/package.json @@ -94,10 +94,8 @@ "@nx/react": "17.3.0", "@nx/web": "17.3.0", "@solana/web3.js": "^1.92.2", - "@swc-node/register": "~1.6.7", "@swc/core": "1.3.107", - "@swc/helpers": "~0.5.2", - "@types/jest": "^29.4.0", + "@types/jest": "27.4.1", "@types/node": "18.19.18", "@types/secp256k1": "^4.0.6", "@typescript-eslint/eslint-plugin": "6.21.0", @@ -125,7 +123,6 @@ "inquirer": "^9.2.21", "ipfs-unixfs-importer": "12.0.1", "jest": "29.7.0", - "jest-environment-node": "^29.4.1", "lerna": "^5.4.3", "live-server": "^1.2.2", "node-fetch": "^2.6.1", @@ -135,9 +132,8 @@ "prettier": "^2.6.2", "react-router-dom": "6.11.2", "ts-jest": "29.1.2", - "ts-node": "10.9.1", "typedoc": "^0.23.10", - "typescript": "4.7.2" + "typescript": "~4.7.2" }, "workspaces": [ "packages/*" From 4063ceb34eca4361323dc2638ed8824f1318afd1 Mon Sep 17 00:00:00 2001 From: Anson Date: Wed, 24 Jul 2024 21:48:19 +0100 Subject: [PATCH 038/136] chore: upgrade `contracts` package to `0.0.39` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index abd4bba304..0cc154fed4 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@cosmjs/proto-signing": "0.30.1", "@cosmjs/stargate": "0.30.1", "@lit-protocol/accs-schemas": "0.0.7", - "@lit-protocol/contracts": "^0.0.37", + "@lit-protocol/contracts": "^0.0.39", "@metamask/eth-sig-util": "5.0.2", "@mysten/sui.js": "^0.37.1", "@simplewebauthn/browser": "^7.2.0", From bb98694f7cc84eab7a706ac4b7dd5d9666eebbd0 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 13:01:37 -0400 Subject: [PATCH 039/136] chore: bump package version --- packages/e2e-tests/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 5b3a5d4375..f9b918e10e 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -17,7 +17,7 @@ "tags": [ "universal" ], - "version": "6.2.2", + "version": "6.3.0", "main": "./dist/src/index.js", "typings": "./dist/src/index.d.ts" } From 3725969be26da55ffcd58ebdd702f6f38504bda3 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 13:02:01 -0400 Subject: [PATCH 040/136] ref: Fix type errors --- packages/tinny/src/lib/shiva-client.ts | 248 ++++++++++++++----------- packages/tinny/src/lib/tinny-person.ts | 2 + 2 files changed, 140 insertions(+), 110 deletions(-) diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 59da1f90d3..3c04eb9c5f 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -1,4 +1,7 @@ -import { LitContractResolverContext } from '@lit-protocol/types'; +import { + LitContractContext, + LitContractResolverContext, +} from '@lit-protocol/types'; import { ethers } from 'ethers'; import { TestNetCreateRequest, @@ -7,6 +10,20 @@ import { TestNetState, } from './shiva-client.d'; +class ShivaError extends Error { + constructor(shivaResponse: TestNetResponse) { + let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; + + for (const error of shivaResponse.errors || []) { + message += ' ' + error; + } + + super(message); + this.name = 'ShivaError'; + this.message = message; + } +} + export interface ShivaEnvs { /** * If runnnig no localchain this flag will stop the running testnet when the test @@ -48,9 +65,9 @@ export interface ShivaEnvs { * on the network from the implementation within this class. Each testnet is a unique network */ export class TestnetClient { - private _id: string | undefined; + private _id: string; private _info: TestNetInfo | undefined; - private _processEnvs: ShivaEnvs | undefined; + private _processEnvs: ShivaEnvs; private _currentState: TestNetState | undefined; constructor(id: string, envs: ShivaEnvs) { @@ -58,36 +75,65 @@ export class TestnetClient { this._id = id; } - /* - Returns the testnet information - pub struct TestNetInfo { - pub contract_addresses: ContractAddresses, - pub validator_addresses: Vec, - pub contract_resolver_abi: String, - pub rpc_url: String, - pub epoch_length: i32, - } + /** + Returns info on a given testnet instance + if information cannot be accessed we retured undefined + @returns TestNetInfo | undefined */ get Info(): TestNetInfo | undefined { return this._info; } - get ContractContext(): LitContractResolverContext | undefined { + get ContractContext(): LitContractContext | undefined { const testNetConfig = this.Info; if (!testNetConfig) { return undefined; } - const contractResolverAbi: string = testNetConfig.contractResolverAbi; - const contractResolverAddress = - testNetConfig.contractAddresses[`contractResolver`]; const networkContext = { - abi: JSON.parse(contractResolverAbi), - resolverAddress: contractResolverAddress, - provider: new ethers.providers.JsonRpcProvider( - `http://${testNetConfig.rpcUrl}` - ), - environment: 0, // test deployment uses env value 0 in test common + Staking: { + name: 'Staking', + address: testNetConfig.contractAddresses.staking, + //abi: JSON.parse(testNetConfig.contractAbis.staking), + }, + Allowlist: {}, + RateLimitNFT: { + name: 'RateLimitNFT', + //abi: JSON.parse(testNetConfig.contractAbis.rateLimitNft), + address: testNetConfig.contractAddresses.rateLimitNft, + }, + PubkeyRouter: { + name: 'PubkeyRouter', + //abi: JSON.parse(testNetConfig.contractAbis.pubkeyRouter), + address: testNetConfig.contractAddresses.pubkeyRouter, + }, + PKPHelper: { + name: 'PKPHelper', + //abi: JSON.parse(testNetConfig.contractAbis.pkpHelper), + address: testNetConfig.contractAddresses.pkpHelper, + }, + PKPPermissions: { + name: 'PKPPermissions', + //abi: JSON.parse(testNetConfig.contractAbis.pkpPermissions), + address: testNetConfig.contractAddresses.pkpPermissions, + }, + PKPNFTMetadata: {}, + PKPNFT: { + name: 'PKPNFT', + address: testNetConfig.contractAddresses.pkpnft, + //abi: JSON.parse(testNetConfig.contractAbis.pkpnft), + }, + Multisender: {}, + LITToken: { + name: 'LITToken', + //abi: JSON.parse(testNetConfig.contractAbis.litToken), + address: testNetConfig.contractAddresses.litToken, + }, + StakingBalances: { + name: 'StakingBalances', + //abi: JSON.parse(testNetConfig.contractAbis.stakingBalances), + address: testNetConfig.contractAddresses.stakingBalances, + }, }; return networkContext; } @@ -99,109 +145,80 @@ export class TestnetClient { public async pollTestnetForActive(): Promise { let state = 'Busy'; while (state != 'Active' && state != `UNKNOWN`) { - const pollRes = await fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/poll/testnet/' + - this._id + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id ); - const res = await pollRes.json(); - state = res.body; - console.log('found state to be', res); - if (state != 'Active' && state != 'UNKNOWN') { - await new Promise((res, _) => { - setTimeout(() => { - res(); - }, 500); - }); - } else { - break; - } + const stateRes: TestNetResponse = + await _processTestnetResponse(res); + state = stateRes.body!; + console.log('found state to be', state); + + await new Promise((res, _) => { + setTimeout(() => { + res(); + }, 500); + }); } return state; } /** - * returns the config for a given testnet - * struct reference for config + * Returns the config for a given testnet */ - public getTestnetConfig() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + + public async getTestnetConfig() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + '/test/get/info/testnet/' + this._id - ) - .then((res: Response) => { - return res.json(); - }) - .then((info: TestNetResponse) => { - this._info = info.body!; - this._currentState = info.lastStateObserved as TestNetState; - console.log('setting testnet info: ', this._info); - }); + ); + + const resp: TestNetResponse = + await _processTestnetResponse(res); + this._info = resp.body!; + return resp; } /** * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. */ - public transitionEpochAndWait() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + + public async transitionEpochAndWait() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + '/test/action/transition/epoch/wait/' + this._id - ) - .then((res: Response) => { - if (res.status === 200) { - return res.json(); - } else { - throw res; - } - }) - .then((body: any) => { - console.log('Stopped random peer: ', body); - }); + ); + + let transitionEpochAndWaitRes = _processTestnetResponse(res); + + return transitionEpochAndWaitRes; } /** * Stops a random peer and waits for the next epoc to transiton. * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. */ - public stopRandomNetworkPeerAndWaitForNextEpoch() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + + public async stopRandomNetworkPeerAndWaitForNextEpoch() { + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + '/test/action/stop/random/wait/' + this._id - ) - .then((res: Response) => { - if (res.status === 200) { - return res.json(); - } else { - throw res; - } - }) - .then((body: TestNetResponse) => { - console.log('validator kick response: ', body); - return body; - }); + ); + + return _processTestnetResponse(res); } /* Stops the testnet */ - public stopTestnet() { + public async stopTestnet() { console.log('stopping testnet with id:', this._id); - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/delete/testnet/' + - this._id - ) - .then((res: Response) => { - return res.json(); - }) - .then((body: TestNetResponse) => { - console.log('shutdown respone: ', body); - }); + const res = await fetch( + this._processEnvs.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id + ); + + return _processTestnetResponse(res); } } @@ -226,21 +243,9 @@ export class ShivaClient { } /** - * Used to start an instance of a lit network through the Lit Testnet Manager - * if an isntance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. - * If an instance does not exist then we create one - * struct reference - pub struct TestNetCreateRequest { - pub node_count: usize, - pub polling_interval: String, - pub epoch_length: i32, - pub custom_build_path: Option, - pub lit_action_server_custom_build_path: Option, - pub existing_config_path: Option, - pub which: Option, - pub ecdsa_round_timeout: Option, - pub enable_rate_limiting: Option, - } + * Used to start an instance of a lit network through the Lit Testnet Manager + * if an instance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. + * If an instance does not exist then we create one */ async startTestnetManager( createReq?: TestNetCreateRequest @@ -276,7 +281,7 @@ export class ShivaClient { this.processEnvs.LIT_ACTION_BINARY_PATH; } console.log('Testnet create args: ', body); - const createTestnetResp = await fetch( + const createTestnetResp: Response = await fetch( this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', { method: 'POST', @@ -287,7 +292,10 @@ export class ShivaClient { } ); - const createTestnet = await createTestnetResp.json(); + const createTestnet = await _processTestnetResponse( + createTestnetResp + ); + this._clients.set( createTestnet.testnetId, new TestnetClient(createTestnet.testnetId, this.processEnvs) @@ -297,3 +305,23 @@ export class ShivaClient { } } } + +async function _processTestnetResponse( + response: Response +): Promise> { + let createTestnet: TestNetResponse; + try { + createTestnet = (await response.json()) as TestNetResponse; + } catch (err) { + let message = await response.text(); + throw new Error('Error while performing testnet request: ' + message); + } + + // if we get a 500 status and the JSON parsed we know that we should + // throw the custom error type + if (response.status === 500) { + throw new ShivaError(createTestnet); + } + + return createTestnet; +} diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index 5645427e4b..607a6652d1 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -7,6 +7,7 @@ import { LitContracts } from '@lit-protocol/contracts-sdk'; import { AuthMethod, BaseSiweMessage, + LIT_NETWORKS_KEYS, LitContractContext, } from '@lit-protocol/types'; import { ethers } from 'ethers'; @@ -122,6 +123,7 @@ export class TinnyPerson { if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) { const networkContext = this.envConfig.contractContext; this.contractsClient = new LitContracts({ + network: this.envConfig.network as LIT_NETWORKS_KEYS, signer: this.wallet, debug: this.envConfig.processEnvs.DEBUG, rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc From 305adaa7e0503e2bc2ebc7b5ff9cb3bae7923166 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 13:02:11 -0400 Subject: [PATCH 041/136] ref: test updates --- .../e2e-tests/src/tests/PKPEthers.spec.ts | 2 +- .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 2 +- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 68 ++++++++++++++----- 3 files changed, 54 insertions(+), 18 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index c935f5bd36..6c4d73600e 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -33,7 +33,7 @@ import { } from '@metamask/eth-sig-util'; try { - jest.setTimeout(60000); + jest.setTimeout(100_000); } catch (e) { // ... continue execution } diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index fd905614f1..637ea8b888 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -4,7 +4,7 @@ import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { ILitNodeClient } from '@lit-protocol/types'; try { - jest.setTimeout(60000); + jest.setTimeout(100_000); } catch (e) { // ... continue execution } diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 9328358f3b..fdbe055553 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -64,7 +64,7 @@ export function randomSolanaPrivateKey() { } try { - jest.setTimeout(60000); + jest.setTimeout(100_0000); } catch (e) { // ... continue execution } @@ -98,12 +98,13 @@ describe('Wrapped Keys', () => { const solanaKeypair = Keypair.generate(); const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv?.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -155,6 +156,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: false, litNodeClient: devEnv?.litNodeClient!, + id, }); console.log('signedTx'); @@ -185,12 +187,13 @@ describe('Wrapped Keys', () => { const solanaKeypair = Keypair.generate(); const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv?.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -216,6 +219,7 @@ describe('Wrapped Keys', () => { network: 'solana', messageToSign, litNodeClient: devEnv?.litNodeClient!, + id, }); console.log('signature'); @@ -248,12 +252,13 @@ describe('Wrapped Keys', () => { const privateKey = randomSolanaPrivateKey(); // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv?.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -276,10 +281,11 @@ describe('Wrapped Keys', () => { console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'solana', litNodeClient: devEnv?.litNodeClient!, + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -305,6 +311,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv?.litNodeClient!, network: 'solana', messageToSign, + id, }); const signatureIsValidForPublicKey = nacl.sign.detached.verify( @@ -329,6 +336,7 @@ describe('Wrapped Keys', () => { pkpSessionSigs: pkpSessionSigsExport!, litNodeClient: devEnv?.litNodeClient!, network: 'solana', + id, }); const solanaKeyPair = Keypair.fromSecretKey( @@ -355,10 +363,11 @@ describe('Wrapped Keys', () => { console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'evm', litNodeClient: devEnv.litNodeClient!, + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -381,6 +390,7 @@ describe('Wrapped Keys', () => { pkpSessionSigs: pkpSessionSigsExport!, litNodeClient: devEnv.litNodeClient!, network: 'evm', + id, }); const wallet = new ethers.Wallet(decryptedPrivateKey); @@ -415,6 +425,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); } catch (e: any) { if ( @@ -447,12 +458,13 @@ describe('Wrapped Keys', () => { const privateKey1 = randomSolanaPrivateKey(); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey: privateKey1, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -473,6 +485,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); } catch (e: any) { if ( @@ -507,6 +520,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); } catch (e: any) { if (e.message.includes('Expires too far in the future')) { @@ -558,6 +572,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); } catch (e: any) { if (e.message.includes('bad public key size')) { @@ -609,6 +624,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); console.log(res); } catch (e: any) { @@ -640,6 +656,7 @@ describe('Wrapped Keys', () => { litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); } catch (e: any) { if (e.message.includes('SessionSig is not from a PKP')) { @@ -666,12 +683,13 @@ describe('Wrapped Keys', () => { const privateKey = ethers.Wallet.createRandom().privateKey; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -733,12 +751,13 @@ describe('Wrapped Keys', () => { const privateKey = ethers.Wallet.createRandom().privateKey; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -772,6 +791,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: false, litNodeClient: devEnv.litNodeClient!, + id, }); } catch (e: any) { if ( @@ -860,12 +880,13 @@ describe('Wrapped Keys', () => { const privateKey = randomSolanaPrivateKey(); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigsImport!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -888,6 +909,7 @@ describe('Wrapped Keys', () => { pkpSessionSigs: pkpSessionSigsExport!, litNodeClient: devEnv.litNodeClient!, network: 'solana', + id, }); if (decryptedPrivateKey !== privateKey) { @@ -911,12 +933,13 @@ describe('Wrapped Keys', () => { const privateKey = ethers.Wallet.createRandom().privateKey; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -946,6 +969,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: false, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signedTx'); @@ -970,12 +994,13 @@ describe('Wrapped Keys', () => { const privateKey = ethers.Wallet.createRandom().privateKey; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -1001,6 +1026,7 @@ describe('Wrapped Keys', () => { network: 'evm', messageToSign: unsignedStringMessage, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signature'); @@ -1019,6 +1045,7 @@ describe('Wrapped Keys', () => { network: 'evm', messageToSign: unsignedBinaryMessage, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signatureBinary'); @@ -1049,12 +1076,13 @@ describe('Wrapped Keys', () => { const privateKey = ethers.Wallet.createRandom().privateKey; - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -1080,6 +1108,7 @@ describe('Wrapped Keys', () => { network: 'evm', messageToSign: unsignedStringMessage, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signature'); @@ -1098,6 +1127,7 @@ describe('Wrapped Keys', () => { network: 'evm', messageToSign: unsignedBinaryMessage, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signatureBinary'); @@ -1133,12 +1163,13 @@ describe('Wrapped Keys', () => { console.log(`Sending funds to ${wrappedKeysWalletAddress}`); await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey: wrappedKeysWalletPrivateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -1172,6 +1203,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: true, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signedTx'); @@ -1202,12 +1234,13 @@ describe('Wrapped Keys', () => { console.log(`Sending funds to ${wrappedKeysWalletAddress}`); await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); - const pkpAddress = await importPrivateKey({ + const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey: wrappedKeysWalletPrivateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', + memo: 'Test Key', }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; @@ -1237,6 +1270,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: true, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signedTx'); @@ -1260,10 +1294,11 @@ describe('Wrapped Keys', () => { console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey } = await generatePrivateKey({ + const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'evm', litNodeClient: devEnv.litNodeClient!, + memo: 'Test Key', }); const generatedKeysWalletAddress = @@ -1298,6 +1333,7 @@ describe('Wrapped Keys', () => { unsignedTransaction, broadcast: true, litNodeClient: devEnv.litNodeClient!, + id, }); console.log('signedTx'); From 7967d239939d92b85c3c0e8386a7fd6e2bb64852 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 14:34:00 -0400 Subject: [PATCH 042/136] test: add timeout --- packages/e2e-tests/src/tests/LitActionOps.spec.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts index 85e53ebf97..a4285e54f4 100644 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -6,6 +6,13 @@ import { ILitNodeClient } from '@lit-protocol/types'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; + +try { + jest.setTimeout(100_000); +} catch (e) { + // ... continue execution +} + describe('Lit Action Ops', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { From 432a2d2687fb138f86e4623066202cc84b9799fd Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 14:34:18 -0400 Subject: [PATCH 043/136] ci: add explicit runners per test desc for now --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ddde5f8413..33771787b5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,6 +56,15 @@ jobs: run: yarn build:dev - name: Copy ENV File run: cp .env.ci .env - - name: Run End to End Tests + - name: End Tests Connection + if: steps.build.outputs.exit_code == 0 + run: yarn test:local -t `Connections` + - name: End Tests Session Compaitiblity if: steps.build.outputs.exit_code == 0 run: yarn test:local -t SessionSigs + - name: End Tests PKP Ethers + if: steps.build.outputs.exit_code == 0 + run: yarn test:local -t `PKP Ethers` + - name: End Tests Session Compaitiblity + if: steps.build.outputs.exit_code == 0 + run: yarn test:local -t `Lit Action Ops` \ No newline at end of file From fc76bda6fa1ee1ee87963d77f3477d12dea091e4 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 14:42:13 -0400 Subject: [PATCH 044/136] ref: fix string literals --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33771787b5..19b674f91c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,13 +58,13 @@ jobs: run: cp .env.ci .env - name: End Tests Connection if: steps.build.outputs.exit_code == 0 - run: yarn test:local -t `Connections` + run: yarn test:local -t 'Connections' - name: End Tests Session Compaitiblity if: steps.build.outputs.exit_code == 0 - run: yarn test:local -t SessionSigs + run: yarn test:local -t 'SessionSigs' - name: End Tests PKP Ethers if: steps.build.outputs.exit_code == 0 - run: yarn test:local -t `PKP Ethers` + run: yarn test:local -t 'PKP Ethers' - name: End Tests Session Compaitiblity if: steps.build.outputs.exit_code == 0 - run: yarn test:local -t `Lit Action Ops` \ No newline at end of file + run: yarn test:local -t 'Lit Action Ops' \ No newline at end of file From 92e78af3b688761466c448011ee787676ab5b4c9 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 25 Jul 2024 14:44:44 -0400 Subject: [PATCH 045/136] chore: fmt --- packages/e2e-tests/src/tests/LitActionOps.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts index a4285e54f4..139985e8a5 100644 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -6,7 +6,6 @@ import { ILitNodeClient } from '@lit-protocol/types'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; - try { jest.setTimeout(100_000); } catch (e) { From 4e886061e14a0d2f26cd5586d8f46bc5c9f8ff42 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 10:14:48 -0400 Subject: [PATCH 046/136] ci: add run conditions --- .github/workflows/ci.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 19b674f91c..cf44d018a8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,14 +57,18 @@ jobs: - name: Copy ENV File run: cp .env.ci .env - name: End Tests Connection + id: connection if: steps.build.outputs.exit_code == 0 run: yarn test:local -t 'Connections' - name: End Tests Session Compaitiblity - if: steps.build.outputs.exit_code == 0 + id: session + if: steps.connection.outputs.exit_code == 0 run: yarn test:local -t 'SessionSigs' - name: End Tests PKP Ethers - if: steps.build.outputs.exit_code == 0 + if: steps.session.outputs.exit_code == 0 + id: pkp run: yarn test:local -t 'PKP Ethers' - - name: End Tests Session Compaitiblity - if: steps.build.outputs.exit_code == 0 + - name: End Tests Lit Action Combiners + id: combiners + if: steps.pkp.outputs.exit_code == 0 run: yarn test:local -t 'Lit Action Ops' \ No newline at end of file From 6de4c0bb4b448a4460eda30803418acbf0a9b9e5 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 14:22:10 -0400 Subject: [PATCH 047/136] dev: refactor wrapped keys tests --- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 273 +++--------------- 1 file changed, 42 insertions(+), 231 deletions(-) diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index fdbe055553..6762a2b554 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -83,6 +83,12 @@ describe('Wrapped Keys', () => { beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + + afterAll(() => { + devEnv.litNodeClient?.disconnect(); + }); + + it('Sign Tx Sol Encrypted Key', async () => { const alice = await devEnv.createRandomPerson(); @@ -93,7 +99,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); const solanaKeypair = Keypair.generate(); const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); @@ -108,11 +113,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -159,17 +160,11 @@ describe('Wrapped Keys', () => { id, }); - console.log('signedTx'); - console.log(signedTx); - const signatureBuffer = Buffer.from(signedTx, 'base64'); solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); - if (!solanaTransaction.verifySignatures()) { - throw new Error( - `Signature: ${signedTx} doesn't validate for the Solana transaction.` - ); - } + expect(solanaTransaction.verifySignatures()).toBeTruthy(); + }); it('Sign Message Sol Encryption Key', async () => { @@ -182,8 +177,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const solanaKeypair = Keypair.generate(); const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); @@ -210,8 +203,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const messageToSign = 'This is a test message'; const signature = await signMessageWithEncryptedKey({ @@ -231,10 +222,7 @@ describe('Wrapped Keys', () => { solanaKeypair.publicKey.toBuffer() ); - if (!signatureIsValidForPublicKey) - throw new Error( - `signature: ${signature} doesn't validate for the Solana public key: ${solanaKeypair.publicKey.toString()}` - ); + expect(signatureIsValidForPublicKey).toBeTruthy(); }); it('Import Key', async () => { @@ -262,11 +250,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress) }); it('Generate Solana Wrapped Key', async () => { @@ -289,11 +273,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -302,8 +282,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const messageToSign = 'This is a test message'; const signature = await signMessageWithEncryptedKey({ @@ -344,11 +322,7 @@ describe('Wrapped Keys', () => { ); const decryptedPublicKey = solanaKeyPair.publicKey; - if (decryptedPublicKey.toString() !== generatedPublicKey) { - throw new Error( - `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` - ); - } + expect(decryptedPublicKey.toString()).toEqual(generatedPublicKey); }); it('Generate ETH Wrapped Key', async () => { @@ -361,8 +335,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'evm', @@ -384,7 +356,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsExport); const { decryptedPrivateKey } = await exportPrivateKey({ pkpSessionSigs: pkpSessionSigsExport!, @@ -396,11 +367,7 @@ describe('Wrapped Keys', () => { const wallet = new ethers.Wallet(decryptedPrivateKey); const decryptedPublicKey = wallet.publicKey; - if (decryptedPublicKey !== generatedPublicKey) { - throw new Error( - `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` - ); - } + expect(decryptedPublicKey).toEqual(generatedPublicKey); }); it('Fail Import Wrapped Key Same Private Key', async () => { @@ -413,8 +380,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey = '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; // Already exists in the DB @@ -434,10 +399,6 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithSamePrivateKey is expected to have an error' - ); } else { throw e; } @@ -468,14 +429,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - console.log('βœ… testFailImportWrappedKeysWithSamePkp'); - + expect(pkpAddress).toEqual(alicePkpAddress); try { const privateKey2 = randomSolanaPrivateKey(); @@ -494,10 +448,6 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithSamePkp is expected to have an error' - ); } else { throw e; } @@ -524,11 +474,6 @@ describe('Wrapped Keys', () => { }); } catch (e: any) { if (e.message.includes('Expires too far in the future')) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithMaxExpirySessionSig is expected to have an error' - ); } else { throw e; } @@ -552,8 +497,6 @@ describe('Wrapped Keys', () => { } } - console.log(tamperedPkpSessionSigs); - return tamperedPkpSessionSigs; }; @@ -561,8 +504,6 @@ describe('Wrapped Keys', () => { const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - console.log(pkpSessionSigs); - try { const privateKey = randomSolanaPrivateKey(); @@ -577,10 +518,6 @@ describe('Wrapped Keys', () => { } catch (e: any) { if (e.message.includes('bad public key size')) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithInvalidSessionSig is expected to have an error' - ); } else { throw e; } @@ -618,7 +555,7 @@ describe('Wrapped Keys', () => { try { const privateKey = randomSolanaPrivateKey(); - const res = await importPrivateKey({ + await importPrivateKey({ pkpSessionSigs, privateKey, litNodeClient: devEnv.litNodeClient!, @@ -626,14 +563,10 @@ describe('Wrapped Keys', () => { keyType: 'K256', memo: 'Test Key', }); - console.log(res); + } catch (e: any) { if (e.message.includes('Invalid sessionSig: Expired')) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithExpiredSessionSig is expected to have an error' - ); } else { throw e; } @@ -661,10 +594,6 @@ describe('Wrapped Keys', () => { } catch (e: any) { if (e.message.includes('SessionSig is not from a PKP')) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithEoaSessionSig is expected to have an error' - ); } else { throw e; } @@ -693,11 +622,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -706,10 +631,8 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - try { - const _res = await signTransactionWithEncryptedKey({ + await signTransactionWithEncryptedKey({ pkpSessionSigs: pkpSessionSigsSigning!, network: 'evm', unsignedTransaction: { @@ -727,10 +650,7 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyWithMissingParam is expected to have an error' - ); + } else { throw e; } @@ -761,11 +681,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -774,8 +690,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const unsignedTransaction: EthereumLitTransaction = { ...getBaseTransactionForNetwork({ network: devEnv.litNodeClient!.config.litNetwork, @@ -785,7 +699,7 @@ describe('Wrapped Keys', () => { }; try { - const _res = await signTransactionWithEncryptedKey({ + await signTransactionWithEncryptedKey({ pkpSessionSigs: pkpSessionSigsSigning!, network: 'evm', unsignedTransaction, @@ -800,10 +714,6 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyWithInvalidParam is expected to have an error' - ); } else { throw e; } @@ -831,7 +741,6 @@ describe('Wrapped Keys', () => { undefined, new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); const unsignedTransaction = getBaseTransactionForNetwork({ network: devEnv.litNodeClient?.config.litNetwork!, @@ -839,7 +748,7 @@ describe('Wrapped Keys', () => { }); try { - const _res = await devEnv.litNodeClient?.executeJs({ + await devEnv.litNodeClient?.executeJs({ sessionSigs: pkpSessionSigsSigning, ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, jsParams: { @@ -856,10 +765,6 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyInvalidDecryption is expected to have an error' - ); } else { throw e; } @@ -876,8 +781,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsImport); - const privateKey = randomSolanaPrivateKey(); const { pkpAddress, id } = await importPrivateKey({ @@ -890,11 +793,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress) const pkpSessionSigsExport = await getPkpSessionSigs( devEnv, @@ -903,8 +802,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsExport); - const { decryptedPrivateKey } = await exportPrivateKey({ pkpSessionSigs: pkpSessionSigsExport!, litNodeClient: devEnv.litNodeClient!, @@ -912,11 +809,7 @@ describe('Wrapped Keys', () => { id, }); - if (decryptedPrivateKey !== privateKey) { - throw new Error( - `Decrypted private key: ${decryptedPrivateKey} doesn't match with the original private key: ${privateKey}` - ); - } + expect(decryptedPrivateKey).toEqual(privateKey); }); it('Eth Sign Tx', async () => { @@ -929,8 +822,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey = ethers.Wallet.createRandom().privateKey; const { pkpAddress, id } = await importPrivateKey({ @@ -943,11 +834,8 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -956,8 +844,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const unsignedTransaction = getBaseTransactionForNetwork({ network: devEnv.litNodeClient?.config.litNetwork!, toAddress: alice.wallet.address, @@ -972,12 +858,7 @@ describe('Wrapped Keys', () => { id, }); - console.log('signedTx'); - console.log(signedTx); - - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } + expect(!ethers.utils.isHexString(signedTx)).toBeTruthy(); }); it('Eth Sign Message', async () => { @@ -990,7 +871,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); const privateKey = ethers.Wallet.createRandom().privateKey; @@ -1004,11 +884,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -1017,8 +893,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const unsignedStringMessage = 'This is a test message'; const signature = await signMessageWithEncryptedKey({ @@ -1032,9 +906,7 @@ describe('Wrapped Keys', () => { console.log('signature'); console.log(signature); - if (!ethers.utils.isHexString(signature)) { - throw new Error(`signature isn't hex: ${signature}`); - } + expect(ethers.utils.isHexString(signature)).toBeTruthy(); const unsignedBinaryMessage = ethers.utils.arrayify( ethers.utils.toUtf8Bytes(unsignedStringMessage) @@ -1048,18 +920,9 @@ describe('Wrapped Keys', () => { id, }); - console.log('signatureBinary'); - console.log(signatureBinary); + expect(ethers.utils.isHexString(signatureBinary)).toBeTruthy(); - if (!ethers.utils.isHexString(signatureBinary)) { - throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); - } - - if (signatureBinary !== signature) { - throw new Error( - `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` - ); - } + expect(signatureBinary).toEqual(signature) }); it('Eth Sign Message Generate Key', async () => { @@ -1072,8 +935,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey = ethers.Wallet.createRandom().privateKey; const { pkpAddress, id } = await importPrivateKey({ @@ -1086,11 +947,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -1099,7 +956,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); const unsignedStringMessage = 'This is a test message'; @@ -1111,12 +967,8 @@ describe('Wrapped Keys', () => { id, }); - console.log('signature'); - console.log(signature); - if (!ethers.utils.isHexString(signature)) { - throw new Error(`signature isn't hex: ${signature}`); - } + expect(ethers.utils.isHexString(signature)).toBeTruthy(); const unsignedBinaryMessage = ethers.utils.arrayify( ethers.utils.toUtf8Bytes(unsignedStringMessage) @@ -1130,18 +982,9 @@ describe('Wrapped Keys', () => { id, }); - console.log('signatureBinary'); - console.log(signatureBinary); - - if (!ethers.utils.isHexString(signatureBinary)) { - throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); - } + expect(ethers.utils.isHexString(signature)).toBeTruthy(); - if (signatureBinary !== signature) { - throw new Error( - `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` - ); - } + expect(signatureBinary).toEqual(signature); }); it('Eth Broadcast With Fetch Gas Params', async () => { @@ -1154,8 +997,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const wrappedKeysWallet = ethers.Wallet.createRandom(); const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; @@ -1186,8 +1027,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const unsignedTransaction: EthereumLitTransaction = { toAddress: alice.wallet.address, value: '0.0001', // in ethers (Lit tokens) @@ -1206,13 +1045,10 @@ describe('Wrapped Keys', () => { id, }); - console.log('signedTx'); - console.log(signedTx); + // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } + expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); }); it('Eth Broadcast Tx', async () => { @@ -1225,8 +1061,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const wrappedKeysWallet = ethers.Wallet.createRandom(); const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; @@ -1244,11 +1078,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -1257,7 +1087,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); const unsignedTransaction = getBaseTransactionForNetwork({ network: devEnv.litNodeClient?.config.litNetwork!, @@ -1273,13 +1102,8 @@ describe('Wrapped Keys', () => { id, }); - console.log('signedTx'); - console.log(signedTx); - // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } + expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); }); it('Eth Broadcast Tx Generated Key', async () => { @@ -1292,8 +1116,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'evm', @@ -1307,11 +1129,7 @@ describe('Wrapped Keys', () => { await devEnv.getFunds(generatedKeysWalletAddress, '0.005'); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -1320,8 +1138,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigsSigning); - const unsignedTransaction = getBaseTransactionForNetwork({ network: devEnv.litNodeClient?.config.litNetwork!, toAddress: alice.wallet.address, @@ -1336,12 +1152,7 @@ describe('Wrapped Keys', () => { id, }); - console.log('signedTx'); - console.log(signedTx); - - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } + expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); }); }); From 229b2403096f483e00f3186492bfb98131f189ea Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 14:22:31 -0400 Subject: [PATCH 048/136] dev: add disconect calls in connect tests --- packages/e2e-tests/src/tests/connection.spec.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 3eaa61ccaf..bbcdd009c3 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -34,6 +34,8 @@ describe('Connections', () => { expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( devEnv.litNodeClient?.config?.minNodeCount! ); + + devEnv.litNodeClient?.disconnect(); }); it('Testing network: Datil Dev', async () => { @@ -47,6 +49,8 @@ describe('Connections', () => { expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( devEnv.litNodeClient?.config?.minNodeCount! ); + + devEnv.litNodeClient?.disconnect(); }); it('Testing network: Cayenne', async () => { @@ -60,5 +64,7 @@ describe('Connections', () => { expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( devEnv.litNodeClient?.config?.minNodeCount! ); + + devEnv.litNodeClient?.disconnect(); }); }); From a8e6be63e019f79b349243b8059767b594c59dc6 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 14:23:00 -0400 Subject: [PATCH 049/136] chore: sync package version --- packages/tinny/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tinny/package.json b/packages/tinny/package.json index d502fc748b..730db84981 100644 --- a/packages/tinny/package.json +++ b/packages/tinny/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/tinny", - "version": "6.2.2", + "version": "6.3.0", "dependencies": { "tslib": "^2.3.0" }, From 23011430f5d9a6fd8e033a3a4a11f55c1f5de44d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 14:30:32 -0400 Subject: [PATCH 050/136] ref: cleanup --- .../e2e-tests/src/tests/Delegation.spec.ts | 33 +++---------------- .../e2e-tests/src/tests/LitActionOps.spec.ts | 4 +++ .../e2e-tests/src/tests/PKPEthers.spec.ts | 31 ++++------------- .../e2e-tests/src/tests/SessionSigs.spec.ts | 4 +++ 4 files changed, 19 insertions(+), 53 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 13bf11da10..e8ae87dbe6 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -23,6 +23,10 @@ describe('Delegation', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + afterAll(() => { + devEnv.litNodeClient?.disconnect(); + }); + it('PKP to PKP delegation executeJS', async () => { const alice = await devEnv.createRandomPerson(); const bob = await devEnv.createRandomPerson(); @@ -80,8 +84,6 @@ describe('Delegation', () => { }, }); - console.log('βœ… res:', res); - devEnv.releasePrivateKeyFromUser(alice); devEnv.releasePrivateKeyFromUser(bob); @@ -131,18 +133,6 @@ describe('Delegation', () => { const bobsSingleSessionSig = bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - // 5. Bob can now execute JS code using the capacity credits NFT const res = await devEnv.litNodeClient?.executeJs({ sessionSigs: bobsSessionSigs, @@ -207,21 +197,6 @@ describe('Delegation', () => { appOwnersCapacityDelegationAuthSig ); - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); // 5. Bob can now execute JS code using the capacity credits NFT const res = await devEnv.litNodeClient?.pkpSign({ diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts index 139985e8a5..176ed4d68c 100644 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -27,6 +27,10 @@ describe('Lit Action Ops', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + afterAll(() => { + devEnv.litNodeClient?.disconnect(); + }); + it('Broadcast and Collect', async () => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 6c4d73600e..610fd9d200 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -303,7 +303,6 @@ const ethTransaction = async ( expect(signature.length).toEqual(132); expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); - console.log('βœ… recoveredAddr:', recoveredAddr); } catch (e) { throw (new Error('❌ Error: ' + (e as Error).message).stack = ( e as Error @@ -556,14 +555,8 @@ const signTypedDataV1 = async ( throw new Error('❌ signature should be 132 characters long'); } - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } + expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - console.log('signature: ', signature); - console.log('recoveredAddr: ', recoveredAddr); } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { @@ -653,15 +646,10 @@ const signTypedDatav3 = async ( version: SignTypedDataVersion.V3, }); - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } + expect(signature.length).toEqual(132); + + expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { @@ -751,15 +739,10 @@ const signTypedDatav4 = async ( version: SignTypedDataVersion.V4, }); - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } + expect(signature.length).toEqual(132); + + expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - if (recoveredAddr.toLowerCase() !== alice.pkp?.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp?.ethAddress}` - ); - } } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 1b7d20b5ab..5adafa0831 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -47,6 +47,10 @@ describe('SessionSigs', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + afterAll(() => { + devEnv.litNodeClient?.disconnect(); + }); + describe('DecryptString', () => { it('LitAction Session', async () => { await decryptString(devEnv, getLitActionSessionSigs); From d2b41d1ef2fc6b87a1d0ce698b443cafa302d368 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 26 Jul 2024 14:34:42 -0400 Subject: [PATCH 051/136] chore: fmt --- .../e2e-tests/src/tests/Delegation.spec.ts | 1 - .../e2e-tests/src/tests/PKPEthers.spec.ts | 16 ++++++---- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 32 ++++++------------- 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index e8ae87dbe6..52b0aa405a 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -197,7 +197,6 @@ describe('Delegation', () => { appOwnersCapacityDelegationAuthSig ); - // 5. Bob can now execute JS code using the capacity credits NFT const res = await devEnv.litNodeClient?.pkpSign({ sessionSigs: bobsSessionSigs!, diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 610fd9d200..67c13d020e 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -302,7 +302,6 @@ const ethTransaction = async ( const recoveredAddr = ethers.utils.verifyMessage(message, signature); expect(signature.length).toEqual(132); expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); - } catch (e) { throw (new Error('❌ Error: ' + (e as Error).message).stack = ( e as Error @@ -555,8 +554,9 @@ const signTypedDataV1 = async ( throw new Error('❌ signature should be 132 characters long'); } - expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { @@ -648,8 +648,9 @@ const signTypedDatav3 = async ( expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { @@ -741,8 +742,9 @@ const signTypedDatav4 = async ( expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual(alice.pkp?.ethAddress.toLowerCase()); - + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); } catch (e) { throw new Error(`❌ ${(e as Error).toString()}`); } finally { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 6762a2b554..8eecb8eab4 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -88,7 +88,6 @@ describe('Wrapped Keys', () => { devEnv.litNodeClient?.disconnect(); }); - it('Sign Tx Sol Encrypted Key', async () => { const alice = await devEnv.createRandomPerson(); @@ -99,7 +98,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - const solanaKeypair = Keypair.generate(); const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); @@ -164,7 +162,6 @@ describe('Wrapped Keys', () => { solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); expect(solanaTransaction.verifySignatures()).toBeTruthy(); - }); it('Sign Message Sol Encryption Key', async () => { @@ -250,7 +247,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - expect(pkpAddress).toEqual(alicePkpAddress) + expect(pkpAddress).toEqual(alicePkpAddress); }); it('Generate Solana Wrapped Key', async () => { @@ -356,7 +353,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - const { decryptedPrivateKey } = await exportPrivateKey({ pkpSessionSigs: pkpSessionSigsExport!, litNodeClient: devEnv.litNodeClient!, @@ -563,7 +559,6 @@ describe('Wrapped Keys', () => { keyType: 'K256', memo: 'Test Key', }); - } catch (e: any) { if (e.message.includes('Invalid sessionSig: Expired')) { console.log('βœ… THIS IS EXPECTED: ', e); @@ -650,7 +645,6 @@ describe('Wrapped Keys', () => { ) ) { console.log('βœ… THIS IS EXPECTED: ', e); - } else { throw e; } @@ -681,7 +675,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - expect(pkpAddress).toEqual(alicePkpAddress); + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, @@ -793,7 +787,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - expect(pkpAddress).toEqual(alicePkpAddress) + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsExport = await getPkpSessionSigs( devEnv, @@ -809,7 +803,7 @@ describe('Wrapped Keys', () => { id, }); - expect(decryptedPrivateKey).toEqual(privateKey); + expect(decryptedPrivateKey).toEqual(privateKey); }); it('Eth Sign Tx', async () => { @@ -858,7 +852,7 @@ describe('Wrapped Keys', () => { id, }); - expect(!ethers.utils.isHexString(signedTx)).toBeTruthy(); + expect(!ethers.utils.isHexString(signedTx)).toBeTruthy(); }); it('Eth Sign Message', async () => { @@ -871,7 +865,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - const privateKey = ethers.Wallet.createRandom().privateKey; const { pkpAddress, id } = await importPrivateKey({ @@ -922,7 +915,7 @@ describe('Wrapped Keys', () => { expect(ethers.utils.isHexString(signatureBinary)).toBeTruthy(); - expect(signatureBinary).toEqual(signature) + expect(signatureBinary).toEqual(signature); }); it('Eth Sign Message Generate Key', async () => { @@ -956,7 +949,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - const unsignedStringMessage = 'This is a test message'; const signature = await signMessageWithEncryptedKey({ @@ -967,8 +959,7 @@ describe('Wrapped Keys', () => { id, }); - - expect(ethers.utils.isHexString(signature)).toBeTruthy(); + expect(ethers.utils.isHexString(signature)).toBeTruthy(); const unsignedBinaryMessage = ethers.utils.arrayify( ethers.utils.toUtf8Bytes(unsignedStringMessage) @@ -982,9 +973,9 @@ describe('Wrapped Keys', () => { id, }); - expect(ethers.utils.isHexString(signature)).toBeTruthy(); + expect(ethers.utils.isHexString(signature)).toBeTruthy(); - expect(signatureBinary).toEqual(signature); + expect(signatureBinary).toEqual(signature); }); it('Eth Broadcast With Fetch Gas Params', async () => { @@ -1045,8 +1036,6 @@ describe('Wrapped Keys', () => { id, }); - - // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); }); @@ -1087,7 +1076,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - const unsignedTransaction = getBaseTransactionForNetwork({ network: devEnv.litNodeClient?.config.litNetwork!, toAddress: alice.wallet.address, @@ -1152,7 +1140,7 @@ describe('Wrapped Keys', () => { id, }); - expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); + expect(ethers.utils.isHexString(signedTx)).toBeTruthy(); }); }); From 5569d377be404e3bd2a9cbf3cf05faad23b8d69d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:09:25 -0400 Subject: [PATCH 052/136] dev: merge 'master' --- package.json | 3 +- yarn.lock | 136 +++++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 124 insertions(+), 15 deletions(-) diff --git a/package.json b/package.json index 2dc136ba6c..64cb63ae47 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --all --code-coverage", - "test:local": "nx run e2e-tests:test", + "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- nx run e2e-tests:test", "test:unit": "nx run-many --target=test", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", @@ -40,6 +40,7 @@ "@cosmjs/encoding": "0.30.1", "@cosmjs/proto-signing": "0.30.1", "@cosmjs/stargate": "0.30.1", + "@dotenvx/dotenvx": "^1.6.4", "@lit-protocol/accs-schemas": "0.0.7", "@lit-protocol/contracts": "^0.0.39", "@metamask/eth-sig-util": "5.0.2", diff --git a/yarn.lock b/yarn.lock index 7fb695266b..3c1465ff34 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1106,14 +1106,6 @@ "@truffle/contract" "^4.2.6" ethers "^4.0.45" -"@clack/core@^0.3.4": - version "0.3.4" - resolved "https://registry.yarnpkg.com/@clack/core/-/core-0.3.4.tgz#375e82fc8fe46650b37cab2f2ea8752c6b7f0450" - integrity sha512-H4hxZDXgHtWTwV3RAVenqcC4VbJZNegbBjlPvzOzCouXtS2y3sDvlO3IsbrPNWuLWPPlYVYPghQdSF64683Ldw== - dependencies: - picocolors "^1.0.0" - sisteransi "^1.0.5" - "@colors/colors@1.5.0": version "1.5.0" resolved "https://registry.yarnpkg.com/@colors/colors/-/colors-1.5.0.tgz#bb504579c1cae923e6576a4f5da43d25f97bdbd9" @@ -1287,6 +1279,35 @@ debug "^3.1.0" lodash.once "^4.1.1" +"@dabh/diagnostics@^2.0.2": + version "2.0.3" + resolved "https://registry.yarnpkg.com/@dabh/diagnostics/-/diagnostics-2.0.3.tgz#7f7e97ee9a725dffc7808d93668cc984e1dc477a" + integrity sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA== + dependencies: + colorspace "1.1.x" + enabled "2.0.x" + kuler "^2.0.0" + +"@dotenvx/dotenvx@^1.6.4": + version "1.6.4" + resolved "https://registry.yarnpkg.com/@dotenvx/dotenvx/-/dotenvx-1.6.4.tgz#cd1f465bf85d5fcd1896fa5aa838d85397dff077" + integrity sha512-2jbcxpqbJDafeZo9i2ha38qGyB0KISgCht6KDTyvR4LlWK922pflm9t8M1jY97uYgW3PNZZjCmQjzQ+IB/V4rQ== + dependencies: + chalk "^4.1.2" + commander "^11.1.0" + conf "^10.2.0" + diff "^5.2.0" + dotenv "^16.4.5" + eciesjs "^0.4.6" + execa "^5.1.1" + fdir "^6.1.1" + ignore "^5.3.0" + object-treeify "1.1.33" + picomatch "^3.0.1" + which "^4.0.0" + winston "^3.11.0" + xxhashjs "^0.2.2" + "@ensdomains/address-encoder@^0.1.7": version "0.1.9" resolved "https://registry.yarnpkg.com/@ensdomains/address-encoder/-/address-encoder-0.1.9.tgz#f948c485443d9ef7ed2c0c4790e931c33334d02d" @@ -3193,7 +3214,12 @@ resolved "https://registry.yarnpkg.com/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-13.3.0.tgz#db7b55fee834dc8c2c484c696469e65bae2ee770" integrity sha512-Reer6rkLLcoOvB0dd66+Y7WrWVFH7sEEkF/4bJCIfsSKnTStTYaHtwIJAwbqnt9I392Tqvku0KkoqZOryWV9LQ== -"@noble/curves@1.4.2", "@noble/curves@^1.0.0", "@noble/curves@^1.4.2", "@noble/curves@~1.4.0": +"@noble/ciphers@^0.5.3": + version "0.5.3" + resolved "https://registry.yarnpkg.com/@noble/ciphers/-/ciphers-0.5.3.tgz#48b536311587125e0d0c1535f73ec8375cd76b23" + integrity sha512-B0+6IIHiqEs3BPMT0hcRmHvEj2QHOLu+uwt+tqDDeVd0oyVzh7BPrDcPjRnV1PV/5LaknXJJQvOuRGR0zQJz+w== + +"@noble/curves@1.4.2", "@noble/curves@^1.0.0", "@noble/curves@^1.4.0", "@noble/curves@^1.4.2", "@noble/curves@~1.4.0": version "1.4.2" resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== @@ -5362,6 +5388,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/triple-beam@^1.3.2": + version "1.3.5" + resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" + integrity sha512-6WaYesThRMCl19iryMYP7/x2OVgCtbIVflDGFpWnb9irXI3UjYE4AzmYuiUKY1AJstGijoY+MgUszMgRxIYTYw== + "@types/trusted-types@^2.0.2": version "2.0.7" resolved "https://registry.yarnpkg.com/@types/trusted-types/-/trusted-types-2.0.7.tgz#baccb07a970b91707df3a3e8ba6896c57ead2d11" @@ -6290,7 +6321,7 @@ ajv@^6.10.0, ajv@^6.12.3, ajv@^6.12.4, ajv@^6.12.5: json-schema-traverse "^0.4.1" uri-js "^4.2.2" -ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.9.0: +ajv@^8.0.0, ajv@^8.0.1, ajv@^8.12.0, ajv@^8.6.3, ajv@^8.9.0: version "8.17.1" resolved "https://registry.yarnpkg.com/ajv/-/ajv-8.17.1.tgz#37d9a5c776af6bc92d7f4f9510eba4c0a60d11a6" integrity sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g== @@ -6436,7 +6467,7 @@ aproba@^1.0.3: resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc" integrity sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ== -arch@^2.1.1, arch@^2.2.0: +arch@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/arch/-/arch-2.2.0.tgz#1bc47818f305764f23ab3306b0bfc086c5a29d11" integrity sha512-Of/R0wqp83cgHozfIYLbBMnej79U/SVGOOyuB3VVFv1NRM/PSFMK12x9KVtiYzJqmnU5WR2qp0Z5rHb7sWGnFQ== @@ -8867,6 +8898,14 @@ color-support@^1.1.2, color-support@^1.1.3: resolved "https://registry.yarnpkg.com/color-support/-/color-support-1.1.3.tgz#93834379a1cc9a0c61f82f52f0d04322251bd5a2" integrity sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg== +color@^3.1.3: + version "3.2.1" + resolved "https://registry.yarnpkg.com/color/-/color-3.2.1.tgz#3544dc198caf4490c3ecc9a790b54fe9ff45e164" + integrity sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA== + dependencies: + color-convert "^1.9.3" + color-string "^1.6.0" + colorette@^2.0.16: version "2.0.20" resolved "https://registry.yarnpkg.com/colorette/-/colorette-2.0.20.tgz#9eb793e6833067f7235902fcd3b09917a000a95a" @@ -8913,6 +8952,11 @@ commander@5.1.0, commander@^5.1.0: resolved "https://registry.yarnpkg.com/commander/-/commander-5.1.0.tgz#46abbd1652f8e059bddaef99bbdcb2ad9cf179ae" integrity sha512-P0CysNDQ7rtVw4QIQtm+MRxV66vKFSvlsQvGYXZWR3qFU0jlMKHZZZgw8e+8DSah4UDKMqnknRDQz+xuQXQ/Zg== +commander@^11.1.0: + version "11.1.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-11.1.0.tgz#62fdce76006a68e5c1ab3314dc92e800eb83d906" + integrity sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ== + commander@^2.20.3, commander@^2.8.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -9003,6 +9047,22 @@ concat-stream@^2.0.0: readable-stream "^3.0.2" typedarray "^0.0.6" +conf@^10.2.0: + version "10.2.0" + resolved "https://registry.yarnpkg.com/conf/-/conf-10.2.0.tgz#838e757be963f1a2386dfe048a98f8f69f7b55d6" + integrity sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg== + dependencies: + ajv "^8.6.3" + ajv-formats "^2.1.1" + atomically "^1.7.0" + debounce-fn "^4.0.0" + dot-prop "^6.0.1" + env-paths "^2.2.1" + json-schema-typed "^7.0.3" + onetime "^5.1.2" + pkg-up "^3.1.0" + semver "^7.3.5" + confbox@^0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/confbox/-/confbox-0.1.7.tgz#ccfc0a2bcae36a84838e83a3b7f770fb17d6c579" @@ -9509,6 +9569,28 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" +cssom@^0.4.4: + version "0.4.4" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" + integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== + +cssom@~0.3.6: + version "0.3.8" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" + integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== + +cssstyle@^2.3.0: + version "2.3.0" + resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" + integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== + dependencies: + cssom "~0.3.6" + +cuint@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" + integrity sha512-d4ZVpCW31eWwCMe1YT3ur7mUDnTXbgwyzaL320DrcRT45rfjYxkt5QWLrmOJ+/UEAI2+fQgKe/fCjR8l4TpRgw== + cypress-metamask-v2@^1.7.2: version "1.7.2" resolved "https://registry.yarnpkg.com/cypress-metamask-v2/-/cypress-metamask-v2-1.7.2.tgz#2b49b7c2fad9ed5a8a5c847547ba38578773c2fa" @@ -14620,7 +14702,7 @@ is-wsl@^1.1.0: resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d" integrity sha512-gfygJYZ2gLTDlmbWMI0CE2MwnFzSN/2SZfkMlItC4K/JBlsWVDB0bO6XhqcY13YXE7iMcAJnzTCJjPiTeJJ0Mw== -is-wsl@^2.1.1, is-wsl@^2.2.0: +is-wsl@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.2.0.tgz#74a4c76e77ca9fd3f932f290c17ea326cd157271" integrity sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww== @@ -16308,6 +16390,18 @@ log-update@^4.0.0: slice-ansi "^4.0.0" wrap-ansi "^6.2.0" +logform@^2.3.2, logform@^2.4.0: + version "2.6.1" + resolved "https://registry.yarnpkg.com/logform/-/logform-2.6.1.tgz#71403a7d8cae04b2b734147963236205db9b3df0" + integrity sha512-CdaO738xRapbKIMVn2m4F6KTj4j7ooJ8POVnebSgKo3KBz5axNXRAL7ZdRjIV6NOr2Uf4vjtRkxrFETOioCqSA== + dependencies: + "@colors/colors" "1.6.0" + "@types/triple-beam" "^1.3.2" + fecha "^4.2.0" + ms "^2.1.1" + safe-stable-stringify "^2.3.1" + triple-beam "^1.3.0" + long@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/long/-/long-4.0.0.tgz#9a7b71cfb7d361a194ea555241c92f7468d5bf28" @@ -18863,6 +18957,13 @@ pkg-up@^2.0.0: dependencies: find-up "^2.1.0" +pkg-up@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-3.1.0.tgz#100ec235cc150e4fd42519412596a28512a0def5" + integrity sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA== + dependencies: + find-up "^3.0.0" + playwright-core@1.45.3: version "1.45.3" resolved "https://registry.yarnpkg.com/playwright-core/-/playwright-core-1.45.3.tgz#e77bc4c78a621b96c3e629027534ee1d25faac93" @@ -20180,7 +20281,7 @@ safe-regex@^1.1.0: dependencies: ret "~0.1.10" -safe-stable-stringify@^2.1.0: +safe-stable-stringify@^2.1.0, safe-stable-stringify@^2.3.1: version "2.4.3" resolved "https://registry.yarnpkg.com/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz#138c84b6f6edb3db5f8ef3ef7115b8f55ccbf886" integrity sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g== @@ -20603,6 +20704,13 @@ simple-get@^2.7.0: once "^1.3.1" simple-concat "^1.0.0" +simple-swizzle@^0.2.2: + version "0.2.2" + resolved "https://registry.yarnpkg.com/simple-swizzle/-/simple-swizzle-0.2.2.tgz#a4da6b635ffcccca33f70d17cb92592de95e557a" + integrity sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg== + dependencies: + is-arrayish "^0.3.1" + sisteransi@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/sisteransi/-/sisteransi-1.0.5.tgz#134d681297756437cc05ca01370d3a7a571075ed" @@ -22284,7 +22392,7 @@ undici-types@~5.26.4: resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== -undici@^5.14.0, undici@^5.28.3: +undici@^5.14.0: version "5.28.4" resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== From 8e6a523987f7038926ce3000afc9d867ba896495 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:11:51 -0400 Subject: [PATCH 053/136] dev: add network key to contract sdk init --- packages/tinny/src/lib/tinny-environment.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index f7ecaee000..6d3e52c5c7 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -9,6 +9,7 @@ import { LitContracts } from '@lit-protocol/contracts-sdk'; import { AuthSig, CosmosAuthSig, + LIT_NETWORKS_KEYS, LitContractContext, LitContractResolverContext, SolanaAuthSig, @@ -450,6 +451,7 @@ export class TinnyEnvironment { const networkContext = this?.testnet?.ContractContext ?? this._contractContext; this.contractsClient = new LitContracts({ + network: this.processEnvs.NETWORK as LIT_NETWORKS_KEYS, signer: wallet, debug: this.processEnvs.DEBUG, rpc: this.rpc, From 413f999c7ed61991fbace2b86fcfe068cd0b258e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:12:46 -0400 Subject: [PATCH 054/136] ref: refactor contract context --- packages/tinny/src/lib/shiva-client.ts | 64 +++++++------------------- 1 file changed, 16 insertions(+), 48 deletions(-) diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 3c04eb9c5f..31b2e46119 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -84,57 +84,25 @@ export class TestnetClient { return this._info; } - get ContractContext(): LitContractContext | undefined { + get ContractContext(): LitContractResolverContext | undefined { const testNetConfig = this.Info; if (!testNetConfig) { return undefined; } + const contractResolverAbi: string = testNetConfig.contractResolverAbi; + const contractResolverAddress = + testNetConfig.contractAddresses[`contractResolver`]; + const networkContext = { - Staking: { - name: 'Staking', - address: testNetConfig.contractAddresses.staking, - //abi: JSON.parse(testNetConfig.contractAbis.staking), - }, - Allowlist: {}, - RateLimitNFT: { - name: 'RateLimitNFT', - //abi: JSON.parse(testNetConfig.contractAbis.rateLimitNft), - address: testNetConfig.contractAddresses.rateLimitNft, - }, - PubkeyRouter: { - name: 'PubkeyRouter', - //abi: JSON.parse(testNetConfig.contractAbis.pubkeyRouter), - address: testNetConfig.contractAddresses.pubkeyRouter, - }, - PKPHelper: { - name: 'PKPHelper', - //abi: JSON.parse(testNetConfig.contractAbis.pkpHelper), - address: testNetConfig.contractAddresses.pkpHelper, - }, - PKPPermissions: { - name: 'PKPPermissions', - //abi: JSON.parse(testNetConfig.contractAbis.pkpPermissions), - address: testNetConfig.contractAddresses.pkpPermissions, - }, - PKPNFTMetadata: {}, - PKPNFT: { - name: 'PKPNFT', - address: testNetConfig.contractAddresses.pkpnft, - //abi: JSON.parse(testNetConfig.contractAbis.pkpnft), - }, - Multisender: {}, - LITToken: { - name: 'LITToken', - //abi: JSON.parse(testNetConfig.contractAbis.litToken), - address: testNetConfig.contractAddresses.litToken, - }, - StakingBalances: { - name: 'StakingBalances', - //abi: JSON.parse(testNetConfig.contractAbis.stakingBalances), - address: testNetConfig.contractAddresses.stakingBalances, - }, - }; + abi: JSON.parse(contractResolverAbi), + resolverAddress: contractResolverAddress, + provider: new ethers.providers.StaticJsonRpcProvider( + `http://${testNetConfig.rpcUrl}` + ), + environment: 0, // test deployment uses env value 0 in test common + } + return networkContext; } @@ -190,7 +158,7 @@ export class TestnetClient { this._id ); - let transitionEpochAndWaitRes = _processTestnetResponse(res); + const transitionEpochAndWaitRes = _processTestnetResponse(res); return transitionEpochAndWaitRes; } @@ -269,7 +237,7 @@ export class ShivaClient { 'lit action server binary path: ', this.processEnvs.LIT_ACTION_BINARY_PATH ); - let body: Partial = createReq ?? { + const body: Partial = createReq ?? { nodeCount: 3, pollingInterval: '2000', epochLength: 100, @@ -313,7 +281,7 @@ async function _processTestnetResponse( try { createTestnet = (await response.json()) as TestNetResponse; } catch (err) { - let message = await response.text(); + const message = await response.text(); throw new Error('Error while performing testnet request: ' + message); } From fa0a968de76738f48f8556c76d78e8c423176d2b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:13:07 -0400 Subject: [PATCH 055/136] dev: update jest hooks --- packages/e2e-tests/src/tests/Delegation.spec.ts | 13 +++++-------- packages/e2e-tests/src/tests/LitActionOps.spec.ts | 13 +++++-------- packages/e2e-tests/src/tests/PKPEthers.spec.ts | 13 +++++++------ packages/e2e-tests/src/tests/Relayer.spec.ts | 13 +++++++------ packages/e2e-tests/src/tests/SOLAuthSig.spec.ts | 14 ++++++++------ packages/e2e-tests/src/tests/SessionSigs.spec.ts | 13 +++++-------- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 13 +++++-------- 7 files changed, 42 insertions(+), 50 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 52b0aa405a..d1e475cf0b 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -11,20 +11,17 @@ import { AuthMethodScope, AuthMethodType } from '@lit-protocol/constants'; describe('Delegation', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - afterAll(() => { - devEnv.litNodeClient?.disconnect(); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); }); it('PKP to PKP delegation executeJS', async () => { diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts index 176ed4d68c..496aa1d754 100644 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ b/packages/e2e-tests/src/tests/LitActionOps.spec.ts @@ -15,20 +15,17 @@ try { describe('Lit Action Ops', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - afterAll(() => { - devEnv.litNodeClient?.disconnect(); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); }); it('Broadcast and Collect', async () => { diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 67c13d020e..9b2eede2ea 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -41,18 +41,19 @@ try { describe('PKP Ethers', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); + }); + describe('Sign Message', () => { it('LitAction Session', async () => { await signMessage(devEnv, getLitActionSessionSigs); diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts index 1c88995ed1..6d5c219866 100644 --- a/packages/e2e-tests/src/tests/Relayer.spec.ts +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -14,18 +14,19 @@ try { describe('Relayer', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); + }); + it('Fetch PKPS', async () => { const alice = await devEnv.createRandomPerson(); diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index 637ea8b888..bc4e645c84 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -12,17 +12,19 @@ try { describe('Sol AuthSig', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); + + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); + }); + it('DecryptString', async () => { const accs = AccessControlConditions.getSolBasicAccessControlConditions({ userAddress: devEnv.bareSolAuthSig?.address, diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 5adafa0831..05a557b49c 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -35,20 +35,17 @@ try { describe('SessionSigs', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - afterAll(() => { - devEnv.litNodeClient?.disconnect(); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); }); describe('DecryptString', () => { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 8eecb8eab4..445ca9e54f 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -72,20 +72,17 @@ try { describe('Wrapped Keys', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); - }); - - afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + //@ts-ignore + devEnv = global.devEnv; }); beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - afterAll(() => { - devEnv.litNodeClient?.disconnect(); + afterAll(async () => { + //@ts-ignore + await global.devEnv.litNodeClient?.disconnect(); }); it('Sign Tx Sol Encrypted Key', async () => { From 2e696487fb1e87140b332120db4ac5eb45ecef6c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:13:56 -0400 Subject: [PATCH 056/136] chore: fmt --- jest.setup.js | 2 +- packages/e2e-tests/jest.config.ts | 2 +- packages/e2e-tests/setup.config.js | 6 ++---- packages/tinny/src/lib/shiva-client.ts | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/jest.setup.js b/jest.setup.js index cc86c42171..f44e2a7ef9 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -2,4 +2,4 @@ const crypto = require('crypto'); global.TextEncoder = require('util').TextEncoder; global.TextDecoder = require('util').TextDecoder; -global.crypto = crypto; \ No newline at end of file +global.crypto = crypto; diff --git a/packages/e2e-tests/jest.config.ts b/packages/e2e-tests/jest.config.ts index ce8bdb9886..23b7c8501a 100644 --- a/packages/e2e-tests/jest.config.ts +++ b/packages/e2e-tests/jest.config.ts @@ -8,5 +8,5 @@ export default { moduleFileExtensions: ['ts', 'js', 'html'], coverageDirectory: '../../coverage/packages/e2e-tests', setupFilesAfterEnv: ['../../jest.setup.js'], - testEnvironment: './setup.config.js' + testEnvironment: './setup.config.js', }; diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index 0e0c6ba959..32198ef6ba 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -1,17 +1,15 @@ /** * Global setup file for jest e2e tests * Loads all global context and provides to each test runner as needed - * env loading has been moved into + * env loading has been moved into */ - const NodeEnvironment = require('jest-environment-node'); const TinnyEnvironment = require('@lit-protocol/tinny').TinnyEnvironment; require('dotenv').config(); console.log('loaded configuration from .env', __dirname); - class CustomEnvironment extends NodeEnvironment { constructor(config) { super(config); @@ -32,4 +30,4 @@ class CustomEnvironment extends NodeEnvironment { } } -module.exports = CustomEnvironment; \ No newline at end of file +module.exports = CustomEnvironment; diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 31b2e46119..23cccbf39e 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -101,7 +101,7 @@ export class TestnetClient { `http://${testNetConfig.rpcUrl}` ), environment: 0, // test deployment uses env value 0 in test common - } + }; return networkContext; } From ea5ef285e2f9b1e4127cc210b4a7cb41566483b4 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 29 Jul 2024 13:29:22 -0400 Subject: [PATCH 057/136] ref: Change import per jest docs --- packages/e2e-tests/setup.config.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index 32198ef6ba..f33515c9bc 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -1,15 +1,18 @@ /** + * Jest Node Env docs: https://jestjs.io/docs/configuration#testenvironment-string * Global setup file for jest e2e tests * Loads all global context and provides to each test runner as needed - * env loading has been moved into + * env loading has been moved into */ -const NodeEnvironment = require('jest-environment-node'); + +const NodeEnvironment = require('jest-environment-node').TestEnvironment; const TinnyEnvironment = require('@lit-protocol/tinny').TinnyEnvironment; require('dotenv').config(); console.log('loaded configuration from .env', __dirname); + class CustomEnvironment extends NodeEnvironment { constructor(config) { super(config); @@ -30,4 +33,4 @@ class CustomEnvironment extends NodeEnvironment { } } -module.exports = CustomEnvironment; +module.exports = CustomEnvironment; \ No newline at end of file From f13f07c9ab6aad1136deb16a524626e0afb3d419 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 10:25:10 -0400 Subject: [PATCH 058/136] ref: aggregate Lti Action testing --- .../e2e-tests/src/tests/LitActionOps.spec.ts | 196 ------------- .../e2e-tests/src/tests/SessionSigs.spec.ts | 268 +++++++++++++++--- 2 files changed, 236 insertions(+), 228 deletions(-) delete mode 100644 packages/e2e-tests/src/tests/LitActionOps.spec.ts diff --git a/packages/e2e-tests/src/tests/LitActionOps.spec.ts b/packages/e2e-tests/src/tests/LitActionOps.spec.ts deleted file mode 100644 index 496aa1d754..0000000000 --- a/packages/e2e-tests/src/tests/LitActionOps.spec.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { getLitActionSessionSigs } from '@lit-protocol/tinny'; -import { AccessControlConditions } from '@lit-protocol/tinny'; -import { LIT_TESTNET } from '../../setup/tinny-config'; -import { TinnyEnvironment } from '@lit-protocol/tinny'; -import { ILitNodeClient } from '@lit-protocol/types'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; - -try { - jest.setTimeout(100_000); -} catch (e) { - // ... continue execution -} - -describe('Lit Action Ops', () => { - let devEnv: TinnyEnvironment; - beforeAll(async () => { - //@ts-ignore - devEnv = global.devEnv; - }); - - beforeEach(() => { - jest.spyOn(console, 'warn').mockImplementation(() => {}); - }); - - afterAll(async () => { - //@ts-ignore - await global.devEnv.litNodeClient?.disconnect(); - }); - - it('Broadcast and Collect', async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - let rand = Math.floor(Math.random() * 100); - const resp = await Lit.Actions.broadcastAndCollect({ - name: "temperature", - value: rand.toString(), - }); - Lit.Actions.setResponse({ - response: JSON.stringify(resp) - }); - })();`, - jsParams: {}, - }); - devEnv.releasePrivateKeyFromUser(alice); - - const response = res?.response; - expect(response).toBeDefined(); - }); - - it('Decrypt And Combine', async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const resp = await Lit.Actions.decryptAndCombine({ - accessControlConditions, - ciphertext, - dataToEncryptHash, - authSig: null, - chain: 'ethereum', - }); - Lit.Actions.setResponse({ - response: resp - }); - })();`, - jsParams: { - accessControlConditions: accs, - dataToEncryptHash: encryptRes.dataToEncryptHash, - ciphertext: encryptRes.ciphertext, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - expect(res?.response).toEqual('Hello world'); - }); - - it('Sign and Combine ECDSA', async () => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = ( - await devEnv.litNodeClient?.createCapacityDelegationAuthSig({ - dAppOwnerWallet: alice.wallet!, - }) - )?.capacityDelegationAuthSig; - - // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig! - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs![devEnv.litNodeClient?.config.bootstrapUrls[0]!]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 4. Bob can now execute JS code using the capacity credits NFT - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signAndCombineEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - Lit.Actions.setResponse({ - response: sigShare - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp?.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - /** - Response format - { - "success": true, - "signedData": {}, - "decryptedData": {}, - "claimData": {}, - "response": "{\"r\":\"026eede14267ca76064a7e22dbe6f9e44d786c7b5917b7d023f45ee4e84ce1ea47\",\"s\":\"22a6048bcb88d724d45bdb6161fefd151483f41d592d167e5c33f42e9fe6dac6\",\"v\":0}", - "logs": "" - } - */ - - expect(res?.response).toBeDefined(); - const sig = JSON.parse(res?.response as string); - expect(sig.r).toBeDefined(); - expect(sig.s).toBeDefined(); - expect(sig.v).toBeDefined(); - }); -}); diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 05a557b49c..96fc7a7cbf 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -66,39 +66,39 @@ describe('SessionSigs', () => { }); }); - describe('Claim Keys', () => { + describe('Claim Key', () => { it('LitAction Session', async () => { - await executeJsCLaimKeys(devEnv, getLitActionSessionSigs); + await executeJsClaimKey(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsCLaimKeys(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsClaimKey(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await executeJsCLaimKeys(devEnv, getEoaSessionSigs); + await executeJsClaimKey(devEnv, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsCLaimKeys(devEnv, getPkpSessionSigs); + await executeJsClaimKey(devEnv, getPkpSessionSigs); }); }); - describe('Claim Keys Multiple', () => { + describe('Claim Key Multiple', () => { it('LitAction Session', async () => { - await executeJsCLaimKey(devEnv, getLitActionSessionSigs); + await executeJsClaimKeys(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsCLaimKey(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsClaimKeys(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await executeJsCLaimKey(devEnv, getEoaSessionSigs); + await executeJsClaimKeys(devEnv, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsCLaimKey(devEnv, getPkpSessionSigs); + await executeJsClaimKeys(devEnv, getPkpSessionSigs); }); }); @@ -137,6 +137,7 @@ describe('SessionSigs', () => { await pkpSign(devEnv, getPkpSessionSigs); }); }); + describe('ExecuteJS Signing', () => { it('LitAction Session', async () => { await pkpSign(devEnv, getLitActionSessionSigs); @@ -155,7 +156,7 @@ describe('SessionSigs', () => { }); }); - describe('ExecteJS Signing Parallel', () => { + describe('ExecuteJS Signing Parallel', () => { it('LitAction Session', async () => { await executeJsSigningParallel(devEnv, getLitActionSessionSigs); }); @@ -176,6 +177,71 @@ describe('SessionSigs', () => { }); }); + describe("Broadcast And Collect", () => { + it('LitAction Session', async () => { + await broadcastAndCollect(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await broadcastAndCollect( + devEnv, + getLitActionSessionSigsUsingIpfsId + ); + }); + + it('EOA Wallet', async () => { + await broadcastAndCollect(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await broadcastAndCollect(devEnv, getPkpSessionSigs); + }); + }); + + + + describe("Decrypt And Combine", () => { + it('LitAction Session', async () => { + await decryptAndCombine(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await decryptAndCombine( + devEnv, + getLitActionSessionSigsUsingIpfsId + ); + }); + + it('EOA Wallet', async () => { + await decryptAndCombine(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await decryptAndCombine(devEnv, getPkpSessionSigs); + }); + }); + + describe("Sign And Combine ECDSA", () => { + it('LitAction Session', async () => { + await signAndCombine(devEnv, getLitActionSessionSigs); + }); + + it('LitAction IPFS Session', async () => { + await signAndCombine( + devEnv, + getLitActionSessionSigsUsingIpfsId + ); + }); + + it('EOA Wallet', async () => { + await signAndCombine(devEnv, getEoaSessionSigs); + }); + + it('PKP Session', async () => { + await signAndCombine(devEnv, getPkpSessionSigs); + }); + }); + it('Invalid lit action Custom Auth SessionSigs', async () => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); @@ -221,7 +287,7 @@ describe('SessionSigs', () => { }); }); -const executeJsCLaimKeys = async ( +const executeJsClaimKeys = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, @@ -321,7 +387,7 @@ const executeJsCLaimKeys = async ( }); }; -const executeJsCLaimKey = async ( +const executeJsClaimKey = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, @@ -364,25 +430,7 @@ const executeJsCLaimKey = async ( // } // ], // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, + // } // }, // signatures: {}, // decryptions: [], @@ -627,3 +675,159 @@ const decryptString = async ( expect(decryptRes).toEqual('Hello world'); }; + + +const broadcastAndCollect = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await generator(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + let rand = Math.floor(Math.random() * 100); + const resp = await Lit.Actions.broadcastAndCollect({ + name: "temperature", + value: rand.toString(), + }); + Lit.Actions.setResponse({ + response: JSON.stringify(resp) + }); + })();`, + jsParams: {}, + }); + devEnv.releasePrivateKeyFromUser(alice); + + const response = res?.response; + expect(response).toBeDefined(); +}; + + +const decryptAndCombine = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); + + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: generator.name === "getEoaSessionSigs" ? alice.authSig?.address! : alice.authMethodOwnedPkp?.ethAddress!, + }); + + const litActionSessionSigs = await generator(devEnv, alice); + + const encryptRes = await LitJsSdk.encryptString( + { + accessControlConditions: accs, + dataToEncrypt: 'Hello world', + }, + devEnv.litNodeClient as unknown as ILitNodeClient + ); + + // -- Expected output: + // { + // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", + // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", + // } + + // -- assertions + if (!encryptRes.ciphertext) { + throw new Error(`Expected "ciphertext" in encryptRes`); + } + + if (!encryptRes.dataToEncryptHash) { + throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); + } + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const resp = await Lit.Actions.decryptAndCombine({ + accessControlConditions, + ciphertext, + dataToEncryptHash, + authSig: null, + chain: 'ethereum', + }); + Lit.Actions.setResponse({ + response: resp + }); + })();`, + jsParams: { + accessControlConditions: accs, + dataToEncryptHash: encryptRes.dataToEncryptHash, + ciphertext: encryptRes.ciphertext, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + expect(res?.response).toEqual('Hello world'); +} + +const signAndCombine = async ( + devEnv: TinnyEnvironment, + generator: ( + devEnv: TinnyEnvironment, + person: TinnyPerson, + resources?: LitResourceAbilityRequest[] + ) => Promise) => { + const alice = await devEnv.createRandomPerson(); + + const litActionSessionSigs = await generator(devEnv, alice); + + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { + const sigShare = await LitActions.signAndCombineEcdsa({ + toSign: dataToSign, + publicKey, + sigName: "sig", + }); + Lit.Actions.setResponse({ + response: sigShare + }); + })();`, + jsParams: { + dataToSign: alice.loveLetter, + publicKey: alice.pkp?.publicKey, + }, + }); + + devEnv.releasePrivateKeyFromUser(alice); + + + /** + Response format + { + "success": true, + "signedData": {}, + "decryptedData": {}, + "claimData": {}, + "response": "{\"r\":\"026eede14267ca76064a7e22dbe6f9e44d786c7b5917b7d023f45ee4e84ce1ea47\",\"s\":\"22a6048bcb88d724d45bdb6161fefd151483f41d592d167e5c33f42e9fe6dac6\",\"v\":0}", + "logs": "" + } + */ + + expect(res?.response).toBeDefined(); + const sig = JSON.parse(res?.response as string); + expect(sig.r).toBeDefined(); + expect(sig.s).toBeDefined(); + expect(sig.v).toBeDefined(); +}; \ No newline at end of file From 22eb3039b8523b5f7c46c663b23c0c48bde31fb4 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 10:25:38 -0400 Subject: [PATCH 059/136] ref: move to explicit options --- jest.preset.js | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/jest.preset.js b/jest.preset.js index f078ddcec1..9b09d41309 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -1,3 +1,34 @@ -const nxPreset = require('@nx/jest/preset').default; - -module.exports = { ...nxPreset }; +/** + * Taken from https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts + */ +module.exports = { + // This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring + testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], + resolver: '@nx/jest/plugins/resolver', + moduleFileExtensions: ['ts', 'js', 'mjs', 'html'], + coverageReporters: ['html'], + transform: { + '^.+\\.(ts|js|html)$': [ + 'ts-jest', + { tsconfig: '/tsconfig.spec.json' }, + ], + }, + testEnvironment: 'jsdom', + maxWorkers: 10, + /** + * manually set the exports names to load in common js, to mimic the behaviors of jest 27 + * before jest didn't fully support package exports and would load in common js code (typically via main field). now jest 28+ will load in the browser esm code, but jest esm support is not fully supported. + * In this case we will tell jest to load in the common js code regardless of environment. + * + * this can be removed via just overriding this setting in it's usage + * + * @example + * module.exports = { + * ...nxPreset, + * testEnvironmentOptions: {}, + * } + */ + testEnvironmentOptions: { + customExportConditions: ['node', 'require', 'default'], + }, +}; From 15d12992591b7332e1df9f30cba2f8a824e71b0e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 10:27:01 -0400 Subject: [PATCH 060/136] chore: fmt --- jest.preset.js | 2 +- packages/e2e-tests/setup.config.js | 6 +- .../e2e-tests/src/tests/SessionSigs.spec.ts | 80 +++++++++---------- 3 files changed, 39 insertions(+), 49 deletions(-) diff --git a/jest.preset.js b/jest.preset.js index 9b09d41309..abdfc7a088 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -2,7 +2,7 @@ * Taken from https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts */ module.exports = { - // This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring + // This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], resolver: '@nx/jest/plugins/resolver', moduleFileExtensions: ['ts', 'js', 'mjs', 'html'], diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index f33515c9bc..a89a9861da 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -2,17 +2,15 @@ * Jest Node Env docs: https://jestjs.io/docs/configuration#testenvironment-string * Global setup file for jest e2e tests * Loads all global context and provides to each test runner as needed - * env loading has been moved into + * env loading has been moved into */ - const NodeEnvironment = require('jest-environment-node').TestEnvironment; const TinnyEnvironment = require('@lit-protocol/tinny').TinnyEnvironment; require('dotenv').config(); console.log('loaded configuration from .env', __dirname); - class CustomEnvironment extends NodeEnvironment { constructor(config) { super(config); @@ -33,4 +31,4 @@ class CustomEnvironment extends NodeEnvironment { } } -module.exports = CustomEnvironment; \ No newline at end of file +module.exports = CustomEnvironment; diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 96fc7a7cbf..835e3ba504 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -177,16 +177,13 @@ describe('SessionSigs', () => { }); }); - describe("Broadcast And Collect", () => { + describe('Broadcast And Collect', () => { it('LitAction Session', async () => { await broadcastAndCollect(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await broadcastAndCollect( - devEnv, - getLitActionSessionSigsUsingIpfsId - ); + await broadcastAndCollect(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { @@ -195,21 +192,16 @@ describe('SessionSigs', () => { it('PKP Session', async () => { await broadcastAndCollect(devEnv, getPkpSessionSigs); - }); + }); }); - - - describe("Decrypt And Combine", () => { + describe('Decrypt And Combine', () => { it('LitAction Session', async () => { await decryptAndCombine(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await decryptAndCombine( - devEnv, - getLitActionSessionSigsUsingIpfsId - ); + await decryptAndCombine(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { @@ -218,19 +210,16 @@ describe('SessionSigs', () => { it('PKP Session', async () => { await decryptAndCombine(devEnv, getPkpSessionSigs); - }); + }); }); - describe("Sign And Combine ECDSA", () => { + describe('Sign And Combine ECDSA', () => { it('LitAction Session', async () => { await signAndCombine(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signAndCombine( - devEnv, - getLitActionSessionSigsUsingIpfsId - ); + await signAndCombine(devEnv, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { @@ -239,7 +228,7 @@ describe('SessionSigs', () => { it('PKP Session', async () => { await signAndCombine(devEnv, getPkpSessionSigs); - }); + }); }); it('Invalid lit action Custom Auth SessionSigs', async () => { @@ -676,27 +665,27 @@ const decryptString = async ( expect(decryptRes).toEqual('Hello world'); }; - const broadcastAndCollect = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] - ) => Promise) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); + ) => Promise +) => { + devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); + const alice = await devEnv.createRandomPerson(); + // set access control conditions for encrypting and decrypting + const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ + userAddress: alice.authMethodOwnedPkp?.ethAddress!, + }); - const litActionSessionSigs = await generator(devEnv, alice); + const litActionSessionSigs = await generator(devEnv, alice); - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: litActionSessionSigs, + code: `(async () => { let rand = Math.floor(Math.random() * 100); const resp = await Lit.Actions.broadcastAndCollect({ name: "temperature", @@ -706,28 +695,31 @@ const broadcastAndCollect = async ( response: JSON.stringify(resp) }); })();`, - jsParams: {}, - }); - devEnv.releasePrivateKeyFromUser(alice); + jsParams: {}, + }); + devEnv.releasePrivateKeyFromUser(alice); - const response = res?.response; - expect(response).toBeDefined(); + const response = res?.response; + expect(response).toBeDefined(); }; - const decryptAndCombine = async ( devEnv: TinnyEnvironment, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] - ) => Promise) => { + ) => Promise +) => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); const alice = await devEnv.createRandomPerson(); // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: generator.name === "getEoaSessionSigs" ? alice.authSig?.address! : alice.authMethodOwnedPkp?.ethAddress!, + userAddress: + generator.name === 'getEoaSessionSigs' + ? alice.authSig?.address! + : alice.authMethodOwnedPkp?.ethAddress!, }); const litActionSessionSigs = await generator(devEnv, alice); @@ -779,7 +771,7 @@ const decryptAndCombine = async ( devEnv.releasePrivateKeyFromUser(alice); expect(res?.response).toEqual('Hello world'); -} +}; const signAndCombine = async ( devEnv: TinnyEnvironment, @@ -787,7 +779,8 @@ const signAndCombine = async ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] - ) => Promise) => { + ) => Promise +) => { const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice); @@ -812,7 +805,6 @@ const signAndCombine = async ( devEnv.releasePrivateKeyFromUser(alice); - /** Response format { @@ -830,4 +822,4 @@ const signAndCombine = async ( expect(sig.r).toBeDefined(); expect(sig.s).toBeDefined(); expect(sig.v).toBeDefined(); -}; \ No newline at end of file +}; From 6d211b945575841c365e6fca74dc33f55f3c984e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 10:27:46 -0400 Subject: [PATCH 061/136] ref: remove test step --- .github/workflows/ci.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf44d018a8..4e993f29cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -68,7 +68,4 @@ jobs: if: steps.session.outputs.exit_code == 0 id: pkp run: yarn test:local -t 'PKP Ethers' - - name: End Tests Lit Action Combiners - id: combiners - if: steps.pkp.outputs.exit_code == 0 - run: yarn test:local -t 'Lit Action Ops' \ No newline at end of file + From bcbf810482b1f08a2b06ea3d0c2fc2d67c9f624b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 11:08:19 -0400 Subject: [PATCH 062/136] ref: fix test --- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 835e3ba504..c46a17d9e6 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -140,7 +140,7 @@ describe('SessionSigs', () => { describe('ExecuteJS Signing', () => { it('LitAction Session', async () => { - await pkpSign(devEnv, getLitActionSessionSigs); + await executeJsSigning(devEnv, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { From 1efe7a0fc4b1eac0056d5d73127c18066c78c6b8 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 12:51:23 -0400 Subject: [PATCH 063/136] ref: change jest test runner --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 64cb63ae47..00d9fe1a3b 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --all --code-coverage", - "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- nx run e2e-tests:test", + "test:e2e": "dotenvx run --env-file=.env -- nx run e2e-tests:test", + "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", "test:unit": "nx run-many --target=test", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", From 4387c4cc956dc729e5bc0a9eb1cfd7d6e821534a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 12:51:56 -0400 Subject: [PATCH 064/136] ci: change test run comand in ci for jest --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e993f29cb..d91fd119fe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -59,13 +59,13 @@ jobs: - name: End Tests Connection id: connection if: steps.build.outputs.exit_code == 0 - run: yarn test:local -t 'Connections' + run: yarn test:e2e -t 'Connections' - name: End Tests Session Compaitiblity id: session if: steps.connection.outputs.exit_code == 0 - run: yarn test:local -t 'SessionSigs' + run: yarn test:e2e -t 'SessionSigs' - name: End Tests PKP Ethers if: steps.session.outputs.exit_code == 0 id: pkp - run: yarn test:local -t 'PKP Ethers' + run: yarn test:e2e -t 'PKP Ethers' From 6b06cc87d722befe269fb7bbb41d9ec6c816d47a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 30 Jul 2024 13:05:58 -0400 Subject: [PATCH 065/136] ref: change readme for new test runner --- README.md | 6 +++--- packages/e2e-tests/package.json | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 8fe5d4acee..bddbe34e4e 100644 --- a/README.md +++ b/README.md @@ -131,14 +131,14 @@ yarn build ## Run unit tests -``` +```sh yarn test:unit ``` ## Run E2E tests in nodejs -``` -yarn test:local +```sh +yarn test:e2e ``` # Advanced diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index f9b918e10e..f5a0821652 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -19,5 +19,6 @@ ], "version": "6.3.0", "main": "./dist/src/index.js", - "typings": "./dist/src/index.d.ts" + "typings": "./dist/src/index.d.ts", + "private": true } From 66318e0caee19560b38bb6634e891acbea47e67c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 7 Aug 2024 13:56:24 -0400 Subject: [PATCH 066/136] add scope to e2e tests --- packages/e2e-tests/project.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/project.json b/packages/e2e-tests/project.json index a4cde159b2..dad0e4f51b 100644 --- a/packages/e2e-tests/project.json +++ b/packages/e2e-tests/project.json @@ -41,5 +41,5 @@ } } }, - "tags": [] + "tags": ["scope:e2e-tests"] } From 4e11c415b8118a448dd9ab8a57583dfc6e2bc21f Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 10:02:04 -0400 Subject: [PATCH 067/136] chore: update versions --- packages/e2e-tests/package.json | 6 +++--- packages/tinny/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index f5a0821652..0a476f08a5 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -17,8 +17,8 @@ "tags": [ "universal" ], - "version": "6.3.0", + "version": "6.4.1", + "private": true, "main": "./dist/src/index.js", - "typings": "./dist/src/index.d.ts", - "private": true + "typings": "./dist/src/index.d.ts" } diff --git a/packages/tinny/package.json b/packages/tinny/package.json index 730db84981..85ed0399c1 100644 --- a/packages/tinny/package.json +++ b/packages/tinny/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/tinny", - "version": "6.3.0", + "version": "6.4.1", "dependencies": { "tslib": "^2.3.0" }, From d5f60ae72b65562cb2fb9ca032a463f80723ff4c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 10:41:39 -0400 Subject: [PATCH 068/136] dev: update per review comments --- packages/e2e-tests/src/tests/connection.spec.ts | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index bbcdd009c3..8bd7167290 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -14,15 +14,6 @@ describe('Connections', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - afterEach(() => { - // TODO: can be removed once v7 is merged with wasm refactors - delete globalThis.wasmExports; - //@ts-ignore defined in global - delete globalThis.wasmSevSnpUtils; - - delete globalThis.wasmECDSA; - }); - it('Testing network: Manzano', async () => { const devEnv = new TinnyEnvironment(NETWORKS[0] as LIT_TESTNET); await devEnv.init(); @@ -35,7 +26,7 @@ describe('Connections', () => { devEnv.litNodeClient?.config?.minNodeCount! ); - devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('Testing network: Datil Dev', async () => { @@ -50,7 +41,7 @@ describe('Connections', () => { devEnv.litNodeClient?.config?.minNodeCount! ); - devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('Testing network: Cayenne', async () => { @@ -65,6 +56,6 @@ describe('Connections', () => { devEnv.litNodeClient?.config?.minNodeCount! ); - devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); }); From 4906a886a37da651738628915ef04385a3157f2e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 11:12:58 -0400 Subject: [PATCH 069/136] dev: update connection tests --- .../e2e-tests/src/tests/connection.spec.ts | 36 ++----------------- 1 file changed, 2 insertions(+), 34 deletions(-) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 8bd7167290..e2ebe5c433 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -7,49 +7,17 @@ try { // ... continue execution } -const NETWORKS: string[] = ['manzano', 'datil-dev', 'cayenne']; - describe('Connections', () => { beforeEach(() => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); it('Testing network: Manzano', async () => { - const devEnv = new TinnyEnvironment(NETWORKS[0] as LIT_TESTNET); - await devEnv.init(); - expect(devEnv.litNodeClient).toBeDefined(); - expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[0]); - expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); - expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); - expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( - devEnv.litNodeClient?.config?.minNodeCount! - ); - - await devEnv.litNodeClient?.disconnect(); - }); - - it('Testing network: Datil Dev', async () => { - const devEnv = new TinnyEnvironment(NETWORKS[1] as LIT_TESTNET); - await devEnv.init(); - expect(devEnv.litNodeClient).toBeDefined(); - expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[1]); - expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); - expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); - expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( - devEnv.litNodeClient?.config?.minNodeCount! - ); - - await devEnv.litNodeClient?.disconnect(); - }); - - it('Testing network: Cayenne', async () => { - const devEnv = new TinnyEnvironment(NETWORKS[2] as LIT_TESTNET); + const devEnv = new TinnyEnvironment(); await devEnv.init(); expect(devEnv.litNodeClient).toBeDefined(); expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(NETWORKS[2]); + expect(devEnv.litNodeClient?.config.litNetwork).toBe(devEnv.processEnvs.NETWORK); expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( From e1ffd6c4cd0da75ce8f8f16ff1bd7c02a16a0afa Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 11:13:10 -0400 Subject: [PATCH 070/136] dev: update tinny --- packages/tinny/src/lib/shiva-client.ts | 34 ++- packages/tinny/src/lib/tinny-environment.ts | 240 ++++++++++++-------- packages/tinny/src/lib/tinny-utils.ts | 23 ++ 3 files changed, 177 insertions(+), 120 deletions(-) diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 23cccbf39e..9fcdebc73a 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -1,7 +1,4 @@ -import { - LitContractContext, - LitContractResolverContext, -} from '@lit-protocol/types'; +import { LitContractResolverContext } from '@lit-protocol/types'; import { ethers } from 'ethers'; import { TestNetCreateRequest, @@ -13,8 +10,7 @@ import { class ShivaError extends Error { constructor(shivaResponse: TestNetResponse) { let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; - - for (const error of shivaResponse.errors || []) { + for (const error of shivaResponse.errors) { message += ' ' + error; } @@ -66,9 +62,9 @@ export interface ShivaEnvs { */ export class TestnetClient { private _id: string; - private _info: TestNetInfo | undefined; + private _info: TestNetInfo; private _processEnvs: ShivaEnvs; - private _currentState: TestNetState | undefined; + private _currentState: TestNetState; constructor(id: string, envs: ShivaEnvs) { this._processEnvs = envs; @@ -93,7 +89,6 @@ export class TestnetClient { const contractResolverAbi: string = testNetConfig.contractResolverAbi; const contractResolverAddress = testNetConfig.contractAddresses[`contractResolver`]; - const networkContext = { abi: JSON.parse(contractResolverAbi), resolverAddress: contractResolverAddress, @@ -102,7 +97,6 @@ export class TestnetClient { ), environment: 0, // test deployment uses env value 0 in test common }; - return networkContext; } @@ -118,10 +112,10 @@ export class TestnetClient { ); const stateRes: TestNetResponse = await _processTestnetResponse(res); - state = stateRes.body!; + state = stateRes.body as TestNetState; console.log('found state to be', state); - await new Promise((res, _) => { + await new Promise((res) => { setTimeout(() => { res(); }, 500); @@ -141,10 +135,10 @@ export class TestnetClient { this._id ); - const resp: TestNetResponse = - await _processTestnetResponse(res); - this._info = resp.body!; - return resp; + const testnetInfoRes = await _processTestnetResponse(res); + this._info = testnetInfoRes.body as TestNetInfo; + + return testnetInfoRes; } /** @@ -227,7 +221,7 @@ export class ShivaClient { existingTestnets[0], new TestnetClient(existingTestnets[0], this.processEnvs) ); - return this._clients.get(existingTestnets[0])!; + return this._clients.get(existingTestnets[0]) as TestnetClient; } else { console.log( 'lit node binary path: ', @@ -240,7 +234,7 @@ export class ShivaClient { const body: Partial = createReq ?? { nodeCount: 3, pollingInterval: '2000', - epochLength: 100, + epochLength: 90_000, }; if (this.processEnvs.USE_LIT_BINARIES) { @@ -269,7 +263,7 @@ export class ShivaClient { new TestnetClient(createTestnet.testnetId, this.processEnvs) ); - return this._clients.get(createTestnet.testnetId)!; + return this._clients.get(createTestnet.testnetId) as TestnetClient; } } } @@ -292,4 +286,4 @@ async function _processTestnetResponse( } return createTestnet; -} +} \ No newline at end of file diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 6d3e52c5c7..16fac979b7 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -1,26 +1,31 @@ -import { - LIT_TESTNET, - ProcessEnvs, - RPC_MAP, - TinnyEnvConfig, -} from './tinny-config'; -import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { ethers, Signer } from 'ethers'; + +import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; +import { CENTRALISATION_BY_NETWORK } from '@lit-protocol/constants'; import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; import { AuthSig, CosmosAuthSig, - LIT_NETWORKS_KEYS, LitContractContext, LitContractResolverContext, SolanaAuthSig, } from '@lit-protocol/types'; -import { TinnyPerson } from './tinny-person'; -import { ethers } from 'ethers'; -import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; import { ShivaClient, TestnetClient } from './shiva-client'; +import { + LIT_TESTNET, + ProcessEnvs, + RPC_MAP, + TinnyEnvConfig, +} from './tinny-config'; +// eslint-disable-next-line @nrwl/nx/enforce-module-boundaries +import { TinnyPerson } from '@lit-protocol/tinny'; + +import { toErrorWithMessage } from './tinny-utils'; -declare var globalThis: any; + +console.log('checking env', process.env['DEBUG']); export class TinnyEnvironment { public network: LIT_TESTNET; @@ -28,25 +33,26 @@ export class TinnyEnvironment { * Environment variables used in the process. */ public processEnvs: ProcessEnvs = { - MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS'] as string) || 1, - TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT'] as string) || 45000, + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, + TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']) || 45000, NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, DEBUG: process.env['DEBUG'] === 'true', REQUEST_PER_KILOSECOND: - parseInt(process.env['REQUEST_PER_KILOSECOND'] ?? '') || 200, - LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? '', // localhost rpc if not provided + parseInt(process.env['REQUEST_PER_KILOSECOND']) || + (process.env['NETWORK'] as LIT_TESTNET) === 'datil-dev' + ? 1 + : 200, + LIT_RPC_URL: process.env['LIT_RPC_URL'], WAIT_FOR_KEY_INTERVAL: - parseInt(process.env['WAIT_FOR_KEY_INTERVAL'] ?? '') || 3000, + 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, + 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, + RUN_IN_BAND_INTERVAL: parseInt(process.env['RUN_IN_BAND_INTERVAL']) || 5000, // Available Accounts // ================== @@ -60,6 +66,7 @@ export class TinnyEnvironment { // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ + '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', @@ -69,17 +76,17 @@ export class TinnyEnvironment { '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', ], - KEY_IN_USE: new Array(), + KEY_IN_USE: [], NO_SETUP: process.env['NO_SETUP'] === 'true', USE_SHIVA: process.env['USE_SHIVA'] === 'true', NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', }; - public litNodeClient: LitNodeClient | undefined; - public contractsClient: LitContracts | undefined; + public litNodeClient: LitNodeClient; + public contractsClient: LitContracts; public rpc: string; - public superCapacityDelegationAuthSig: AuthSig | undefined; - public bareEthAuthSig: AuthSig | undefined; + public superCapacityDelegationAuthSig: AuthSig; + public bareEthAuthSig: AuthSig; public bareSolAuthSig: SolanaAuthSig = { sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', derivedVia: 'solana.signMessage', @@ -99,10 +106,7 @@ export class TinnyEnvironment { public testnet: TestnetClient | undefined; //=========== PRIVATE MEMBERS =========== private _shivaClient: ShivaClient = new ShivaClient(); - private _contractContext: - | LitContractContext - | LitContractResolverContext - | undefined; + private _contractContext: LitContractContext | LitContractResolverContext; constructor(network?: LIT_TESTNET) { // -- setup networkj @@ -146,7 +150,7 @@ export class TinnyEnvironment { ); } - world: Map = new Map(); + world: Map = new Map(); /** * Retrieves an available private key from a list, marking it as in use and scheduling @@ -170,6 +174,7 @@ export class TinnyEnvironment { privateKey: string; index: number; }> { + // eslint-disable-next-line no-constant-condition while (true) { const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key @@ -180,7 +185,7 @@ export class TinnyEnvironment { return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index } else { - // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting // Wait for the specified interval before checking again await new Promise((resolve) => setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) @@ -227,7 +232,13 @@ export class TinnyEnvironment { async setupLitNodeClient() { console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Setting up LitNodeClient'); - if (this.network === LIT_TESTNET.LOCALCHAIN) { + console.log('this.network:', this.network); + const centralisation = CENTRALISATION_BY_NETWORK[this.network]; + + if ( + this.network === LIT_TESTNET.LOCALCHAIN || + centralisation === 'unknown' + ) { const networkContext = this?.testnet?.ContractContext ?? this._contractContext; this.litNodeClient = new LitNodeClient({ @@ -237,18 +248,20 @@ export class TinnyEnvironment { checkNodeAttestation: false, // disable node attestation check for local testing contractContext: networkContext, }); - } else if (this.network === LIT_TESTNET.MANZANO) { + } else if (centralisation === 'decentralised') { this.litNodeClient = new LitNodeClient({ - litNetwork: this.network, // 'habanero' or 'manzano' + litNetwork: this.network, checkNodeAttestation: true, debug: this.processEnvs.DEBUG, }); - } else { + } else if (centralisation === 'centralised') { this.litNodeClient = new LitNodeClient({ litNetwork: this.network, checkNodeAttestation: false, debug: this.processEnvs.DEBUG, }); + } else { + throw new Error(`Network not supported: "${this.network}"`); } if (globalThis.wasmExports) { @@ -286,7 +299,7 @@ export class TinnyEnvironment { this?.testnet?.ContractContext ?? this._contractContext; return { rpc: this.rpc, - litNodeClient: this.litNodeClient!, + litNodeClient: this.litNodeClient, network: this.network, processEnvs: this.processEnvs, contractContext: contractContext as LitContractResolverContext, @@ -347,30 +360,42 @@ export class TinnyEnvironment { * Init */ async init() { - if (this.processEnvs.NO_SETUP) { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); - return; - } - if (this.network === LIT_TESTNET.LOCALCHAIN && this.processEnvs.USE_SHIVA) { - this.testnet = await this._shivaClient.startTestnetManager(); - // wait for the testnet to be active before we start the tests. - let state = await this.testnet.pollTestnetForActive(); - if (state === `UNKNOWN`) { - console.log( - 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' - ); - throw new Error(`Error while creating testnet, aborting test run`); + try { + if (this.processEnvs.NO_SETUP) { + console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); + return; } + if ( + this.network === LIT_TESTNET.LOCALCHAIN && + this.processEnvs.USE_SHIVA + ) { + this.testnet = await this._shivaClient.startTestnetManager(); + // wait for the testnet to be active before we start the tests. + const state = await this.testnet.pollTestnetForActive(); + if (state === `UNKNOWN`) { + console.log( + 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' + ); + throw new Error(`Error while creating testnet, aborting test run`); + } - await this.testnet.getTestnetConfig(); - } else if (this.network === LIT_TESTNET.LOCALCHAIN) { - const context = await import('./networkContext.json'); - this._contractContext = context; - } + await this.testnet.getTestnetConfig(); + } else if (this.network === LIT_TESTNET.LOCALCHAIN) { + const context = await import('./networkContext.json'); + this._contractContext = context; + } - await this.setupLitNodeClient(); - await this.setupSuperCapacityDelegationAuthSig(); - await this.setupBareEthAuthSig(); + await this.setupLitNodeClient(); + await this.setupSuperCapacityDelegationAuthSig(); + await this.setupBareEthAuthSig(); + } catch (e) { + const err = toErrorWithMessage(e); + console.log( + `[𐬺πŸ§ͺ Tinny Environment𐬺] Failed to init() tinny ${err.message}` + ); + console.log(err.stack); + process.exit(1); + } } /** @@ -383,7 +408,7 @@ export class TinnyEnvironment { const toSign = await createSiweMessage({ walletAddress: wallet.address, - nonce: this.litNodeClient?.latestBlockhash!, + nonce: await this.litNodeClient.getLatestBlockhash(), expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), litNodeClient: this.litNodeClient, }); @@ -451,15 +476,24 @@ export class TinnyEnvironment { const networkContext = this?.testnet?.ContractContext ?? this._contractContext; this.contractsClient = new LitContracts({ - network: this.processEnvs.NETWORK as LIT_NETWORKS_KEYS, signer: wallet, debug: this.processEnvs.DEBUG, rpc: this.rpc, customContext: networkContext, }); - } else { - // scoping `this` for function scope - const me = this; + } else if ( + CENTRALISATION_BY_NETWORK[this.network] === 'decentralised' || + CENTRALISATION_BY_NETWORK[this.network] === 'centralised' + ) { + this.contractsClient = new LitContracts({ + signer: wallet, + debug: this.processEnvs.DEBUG, + network: this.network, + }); + } + + // THE FOLLOWING WILL TECHNICALLY NEVER BE CALLED, BUT IT'S HERE FOR FUTURE REFERENCE FOR SWITCHING WALLETS + else { async function _switchWallet() { // TODO: This wallet should be cached somehwere and reused to create delegation signatures. // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. @@ -468,7 +502,7 @@ export class TinnyEnvironment { // get wallet balance const balance = await wallet.getBalance(); - console.log('this.rpc:', me.rpc); + console.log('this.rpc:', this.rpc); console.log('this.wallet.address', wallet.address); console.log('Balance:', balance.toString()); @@ -489,6 +523,11 @@ export class TinnyEnvironment { }); } + if (!this.contractsClient) { + console.log('❗️Contracts client not initialized'); + process.exit(); + } + await this.contractsClient.connect(); /** @@ -496,40 +535,41 @@ export class TinnyEnvironment { * Mint a Capacity Credits NFT and get a capacity delegation authSig with it * ==================================== */ - const me = this; - // Disabled for now - const _mintSuperCapacityDelegationAuthSig = async () => { - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - try { - const capacityTokenId = ( - await me.contractsClient?.mintCapacityCreditsNFT({ - requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - )?.capacityTokenIdStr; - - this.superCapacityDelegationAuthSig = ( - await this.litNodeClient?.createCapacityDelegationAuthSig({ - dAppOwnerWallet: wallet, - capacityTokenId: capacityTokenId, - // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it - uses: '200', - }) - )?.capacityDelegationAuthSig; - } catch (e: any) { - if ( - e.message.includes(`Can't allocate capacity beyond the global max`) - ) { - console.log('❗️Skipping capacity delegation auth sig setup.', e); - } else { - console.log( - '❗️Error while setting up capacity delegation auth sig', - e - ); - } - } - }; + if (CENTRALISATION_BY_NETWORK[this.network] === 'decentralised') { + await this.mintSuperCapacityDelegationAuthSig(wallet); + } }; -} + + async mintSuperCapacityDelegationAuthSig(wallet: Signer) { + console.log( + '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' + ); + + const capacityTokenId = ( + await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }) + ).capacityTokenIdStr; + + try { + this.superCapacityDelegationAuthSig = ( + await this.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId: capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: '200', + }) + ).capacityDelegationAuthSig; + } catch (e: any) { + if (e.message.includes(`Can't allocate capacity beyond the global max`)) { + console.log('❗️Skipping capacity delegation auth sig setup.', e); + } else { + console.log( + '❗️Error while setting up capacity delegation auth sig', + e + ); + } + } + } +} \ No newline at end of file diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts index 2be285519e..ce3788bae8 100644 --- a/packages/tinny/src/lib/tinny-utils.ts +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -63,3 +63,26 @@ export function withTimeout( ); return Promise.race([promise, timeout]); } + + +function isErrorWithMessage(error: unknown): error is Error { + return ( + typeof error === 'object' && + error !== null && + 'message' in error && + typeof (error as Record)['message'] === 'string' + ); +} + +// eslint-disable-next-line import/prefer-default-export +export function toErrorWithMessage(maybeError: unknown): Error { + if (isErrorWithMessage(maybeError)) return maybeError as Error; + + try { + return new Error(JSON.stringify(maybeError)); + } catch { + // fallback in case there's an error stringifying the maybeError + // like with circular references for example. + return new Error(String(maybeError)); + } +} \ No newline at end of file From 6950c4e45314af61fb2e90bac4df6766f97ab644 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 12:09:57 -0400 Subject: [PATCH 071/136] ref: fix tsc errors --- packages/tinny/src/lib/shiva-client.d.ts | 26 +++---- packages/tinny/src/lib/shiva-client.ts | 32 ++++++--- packages/tinny/src/lib/tinny-environment.ts | 78 +++++++++++---------- 3 files changed, 75 insertions(+), 61 deletions(-) diff --git a/packages/tinny/src/lib/shiva-client.d.ts b/packages/tinny/src/lib/shiva-client.d.ts index 7bb27c17a6..babd930377 100644 --- a/packages/tinny/src/lib/shiva-client.d.ts +++ b/packages/tinny/src/lib/shiva-client.d.ts @@ -1,5 +1,5 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -type ContractAbis = { +interface ContractAbis { litToken: string; erc20: string; backupRecovery: string; @@ -12,9 +12,9 @@ type ContractAbis = { pkpHelper: string; contractResolver: string; paymentDelegation: string; -}; +} -type ContractAddresses = { +interface ContractAddresses { litToken: string; backupRecovery: string; staking: string; @@ -27,9 +27,9 @@ type ContractAddresses = { contractResolver: string; keyDeriver: string; paymentDelegation: string; -}; +} -type TestNetCreateRequest = { +interface TestNetCreateRequest { nodeCount: number; pollingInterval: string; epochLength: number; @@ -39,26 +39,26 @@ type TestNetCreateRequest = { which: string | null; ecdsaRoundTimeout: string | null; enableRateLimiting: string | null; -}; +} -type TestNetInfo = { +interface TestNetInfo { contractAddresses: ContractAddresses; - validatorAddresses: Array; + validatorAddresses: string[]; contractResolverAbi: string; rpcUrl: string; epochLength: number; contractAbis: ContractAbis; -}; +} -type TestNetResponse = { +interface TestNetResponse { testnetId: string; command: string; wasCanceled: boolean; body: T | null; lastStateObserved: string | null; - messages: Array | null; - errors: Array | null; -}; + messages: string[] | null; + errors: string[] | null; +} type TestNetState = 'Busy' | 'Active' | 'Mutating' | 'Shutdown' | 'UNKNOWN'; diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 9fcdebc73a..868fc1f5af 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -1,5 +1,7 @@ -import { LitContractResolverContext } from '@lit-protocol/types'; import { ethers } from 'ethers'; + +import { LitContractResolverContext } from '@lit-protocol/types'; + import { TestNetCreateRequest, TestNetInfo, @@ -8,8 +10,18 @@ import { } from './shiva-client.d'; class ShivaError extends Error { + // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(shivaResponse: TestNetResponse) { let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; + + if (!shivaResponse.errors) { + super(message); + this.name = 'ShivaError'; + this.message = message; + + return; + } + for (const error of shivaResponse.errors) { message += ' ' + error; } @@ -61,10 +73,10 @@ export interface ShivaEnvs { * on the network from the implementation within this class. Each testnet is a unique network */ export class TestnetClient { - private _id: string; - private _info: TestNetInfo; - private _processEnvs: ShivaEnvs; - private _currentState: TestNetState; + private _id: string | undefined; + private _info: TestNetInfo | undefined; + private _processEnvs: ShivaEnvs | undefined; + private _currentState: TestNetState | undefined; constructor(id: string, envs: ShivaEnvs) { this._processEnvs = envs; @@ -108,7 +120,7 @@ export class TestnetClient { let state = 'Busy'; while (state != 'Active' && state != `UNKNOWN`) { const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id + this._processEnvs?.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id ); const stateRes: TestNetResponse = await _processTestnetResponse(res); @@ -130,7 +142,7 @@ export class TestnetClient { */ public async getTestnetConfig() { const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + + this._processEnvs?.TESTNET_MANAGER_URL + '/test/get/info/testnet/' + this._id ); @@ -147,7 +159,7 @@ export class TestnetClient { */ public async transitionEpochAndWait() { const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + + this._processEnvs?.TESTNET_MANAGER_URL + '/test/action/transition/epoch/wait/' + this._id ); @@ -163,7 +175,7 @@ export class TestnetClient { */ public async stopRandomNetworkPeerAndWaitForNextEpoch() { const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + + this._processEnvs?.TESTNET_MANAGER_URL + '/test/action/stop/random/wait/' + this._id ); @@ -177,7 +189,7 @@ export class TestnetClient { public async stopTestnet() { console.log('stopping testnet with id:', this._id); const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id + this._processEnvs?.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id ); return _processTestnetResponse(res); diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 16fac979b7..d51c6fc2cd 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -20,9 +20,8 @@ import { TinnyEnvConfig, } from './tinny-config'; // eslint-disable-next-line @nrwl/nx/enforce-module-boundaries -import { TinnyPerson } from '@lit-protocol/tinny'; - import { toErrorWithMessage } from './tinny-utils'; +import { TinnyPerson } from '../index'; console.log('checking env', process.env['DEBUG']); @@ -33,26 +32,26 @@ export class TinnyEnvironment { * Environment variables used in the process. */ public processEnvs: ProcessEnvs = { - MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, - TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']) || 45000, + MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']!) || 1, + TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']!) || 45000, NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, DEBUG: process.env['DEBUG'] === 'true', REQUEST_PER_KILOSECOND: - parseInt(process.env['REQUEST_PER_KILOSECOND']) || + parseInt(process.env['REQUEST_PER_KILOSECOND']!) || (process.env['NETWORK'] as LIT_TESTNET) === 'datil-dev' ? 1 : 200, - LIT_RPC_URL: process.env['LIT_RPC_URL'], + LIT_RPC_URL: process.env['LIT_RPC_URL']!, WAIT_FOR_KEY_INTERVAL: - parseInt(process.env['WAIT_FOR_KEY_INTERVAL']) || 3000, + 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, + 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, + RUN_IN_BAND_INTERVAL: parseInt(process.env['RUN_IN_BAND_INTERVAL']!) || 5000, // Available Accounts // ================== @@ -82,11 +81,11 @@ export class TinnyEnvironment { NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', }; - public litNodeClient: LitNodeClient; - public contractsClient: LitContracts; + public litNodeClient: LitNodeClient | undefined; + public contractsClient: LitContracts | undefined; public rpc: string; - public superCapacityDelegationAuthSig: AuthSig; - public bareEthAuthSig: AuthSig; + public superCapacityDelegationAuthSig: AuthSig | undefined; + public bareEthAuthSig: AuthSig | undefined; public bareSolAuthSig: SolanaAuthSig = { sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', derivedVia: 'solana.signMessage', @@ -106,7 +105,7 @@ export class TinnyEnvironment { public testnet: TestnetClient | undefined; //=========== PRIVATE MEMBERS =========== private _shivaClient: ShivaClient = new ShivaClient(); - private _contractContext: LitContractContext | LitContractResolverContext; + private _contractContext: LitContractContext | LitContractResolverContext | undefined; constructor(network?: LIT_TESTNET) { // -- setup networkj @@ -276,7 +275,8 @@ export class TinnyEnvironment { ); } - if (globalThis.wasmSevSnpUtils) { + // @ts-expect-error property is defined on globalThis + if (globalThis['wasmSevSnpUtils']) { console.warn( 'WASM modules already loaded. wil overide. when connect is called' ); @@ -299,7 +299,7 @@ export class TinnyEnvironment { this?.testnet?.ContractContext ?? this._contractContext; return { rpc: this.rpc, - litNodeClient: this.litNodeClient, + litNodeClient: this.litNodeClient!, network: this.network, processEnvs: this.processEnvs, contractContext: contractContext as LitContractResolverContext, @@ -408,7 +408,7 @@ export class TinnyEnvironment { const toSign = await createSiweMessage({ walletAddress: wallet.address, - nonce: await this.litNodeClient.getLatestBlockhash(), + nonce: await this.litNodeClient?.getLatestBlockhash() as string, expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), litNodeClient: this.litNodeClient, }); @@ -494,25 +494,6 @@ export class TinnyEnvironment { // THE FOLLOWING WILL TECHNICALLY NEVER BE CALLED, BUT IT'S HERE FOR FUTURE REFERENCE FOR SWITCHING WALLETS else { - async function _switchWallet() { - // TODO: This wallet should be cached somehwere and reused to create delegation signatures. - // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. - const capacityCreditWallet = - ethers.Wallet.createRandom().connect(provider); - - // get wallet balance - const balance = await wallet.getBalance(); - console.log('this.rpc:', this.rpc); - console.log('this.wallet.address', wallet.address); - console.log('Balance:', balance.toString()); - - const transferTx = await wallet.sendTransaction({ - to: capacityCreditWallet.address, - value: ethers.utils.parseEther('0.001'), - }); - await transferTx.wait(); - } - // await _switchWallet(); this.contractsClient = new LitContracts({ @@ -546,6 +527,7 @@ export class TinnyEnvironment { ); const capacityTokenId = ( + //@ts-expect-error client is defined await this.contractsClient.mintCapacityCreditsNFT({ requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, @@ -554,6 +536,7 @@ export class TinnyEnvironment { try { this.superCapacityDelegationAuthSig = ( + //@ts-expect-error cliet is defined await this.litNodeClient.createCapacityDelegationAuthSig({ dAppOwnerWallet: wallet, capacityTokenId: capacityTokenId, @@ -561,8 +544,8 @@ export class TinnyEnvironment { uses: '200', }) ).capacityDelegationAuthSig; - } catch (e: any) { - if (e.message.includes(`Can't allocate capacity beyond the global max`)) { + } catch (e: unknown) { + if ((e as Error).message.includes(`Can't allocate capacity beyond the global max`)) { console.log('❗️Skipping capacity delegation auth sig setup.', e); } else { console.log( @@ -572,4 +555,23 @@ export class TinnyEnvironment { } } } + + async _switchWallet(wallet: ethers.Wallet, provider: ethers.providers.Provider) { + // TODO: This wallet should be cached somehwere and reused to create delegation signatures. + // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. + const capacityCreditWallet = + ethers.Wallet.createRandom().connect(provider); + + // get wallet balance + const balance = await wallet.getBalance(); + console.log('this.rpc:', this.rpc); + console.log('this.wallet.address', wallet.address); + console.log('Balance:', balance.toString()); + + const transferTx = await wallet.sendTransaction({ + to: capacityCreditWallet.address, + value: ethers.utils.parseEther('0.001'), + }); + await transferTx.wait(); + } } \ No newline at end of file From 3959b1ba5183563724fe8b11d0961120eb47ef52 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 12:36:31 -0400 Subject: [PATCH 072/136] dev: ass eslint config and fix errors --- packages/e2e-tests/.eslintrc.json | 18 ++++++++++++++++++ .../e2e-tests/src/tests/Delegation.spec.ts | 16 ++++++++++++---- .../e2e-tests/src/tests/connection.spec.ts | 7 +++++-- packages/tinny/src/lib/tinny-utils.ts | 9 +++++++-- 4 files changed, 42 insertions(+), 8 deletions(-) create mode 100644 packages/e2e-tests/.eslintrc.json diff --git a/packages/e2e-tests/.eslintrc.json b/packages/e2e-tests/.eslintrc.json new file mode 100644 index 0000000000..9d9c0db55b --- /dev/null +++ b/packages/e2e-tests/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "extends": ["../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["*.ts", "*.tsx"], + "rules": {} + }, + { + "files": ["*.js", "*.jsx"], + "rules": {} + } + ] +} diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index d1e475cf0b..7bf6bcca7f 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -1,26 +1,28 @@ +/* eslint-disable @typescript-eslint/no-non-null-asserted-optional-chain */ import { expect, jest } from '@jest/globals'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; + import { LitAbility, LitActionResource, LitPKPResource, } from '@lit-protocol/auth-helpers'; -import { getEoaSessionSigsWithCapacityDelegations } from '../../setup/session-sigs/get-eoa-session-sigs'; import { AuthMethodScope, AuthMethodType } from '@lit-protocol/constants'; +import { TinnyEnvironment, getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; describe('Delegation', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error is defined devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error is defined await global.devEnv.litNodeClient?.disconnect(); }); @@ -35,6 +37,7 @@ describe('Delegation', () => { const scopes = await bob.contractsClient?.pkpPermissionsContract.read.getPermittedAuthMethodScopes( + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain bob.authMethodOwnedPkp?.tokenId!, AuthMethodType.EthWallet, bobsAuthMethodAuthId, @@ -47,10 +50,12 @@ describe('Delegation', () => { // As a dApp owner, create a capacity delegation authSig for Bob's PKP wallet const capacityDelegationAuthSig = + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain await alice.createCapacityDelegationAuthSig([bob.pkp?.ethAddress!]); // As a dApp owner, delegate the capacity credits NFT to Bob const bobPkpSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain pkpPublicKey: bob.authMethodOwnedPkp?.publicKey!, authMethods: [bob.authMethod!], resourceAbilityRequests: [ @@ -127,7 +132,9 @@ describe('Delegation', () => { ); // -- printing out the recaps from the session sigs + // eslint-disable-next-line @typescript-eslint/no-unused-vars const bobsSingleSessionSig = + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; // 5. Bob can now execute JS code using the capacity credits NFT @@ -198,6 +205,7 @@ describe('Delegation', () => { const res = await devEnv.litNodeClient?.pkpSign({ sessionSigs: bobsSessionSigs!, toSign: alice.loveLetter, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain pubKey: bob.pkp?.publicKey!, }); diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index e2ebe5c433..119aec4700 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -1,5 +1,6 @@ -import { expect, jest, test } from '@jest/globals'; -import { TinnyEnvironment, LIT_TESTNET } from '@lit-protocol/tinny'; +import { expect, jest } from '@jest/globals'; + +import { TinnyEnvironment } from '@lit-protocol/tinny'; try { jest.setTimeout(60000); @@ -9,6 +10,7 @@ try { describe('Connections', () => { beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); @@ -21,6 +23,7 @@ describe('Connections', () => { expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain devEnv.litNodeClient?.config?.minNodeCount! ); diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts index ce3788bae8..d127a809bc 100644 --- a/packages/tinny/src/lib/tinny-utils.ts +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -1,6 +1,8 @@ -import { importer } from 'ipfs-unixfs-importer'; import { Buffer } from 'buffer'; +import * as ipfs from 'ipfs-unixfs-importer'; + + /** * Converts a string to an IPFS hash. * @param input - The input string to convert. @@ -9,6 +11,7 @@ import { Buffer } from 'buffer'; */ export async function stringToIpfsHash(input: string): Promise { const blockput = { + // eslint-disable-next-line @typescript-eslint/no-explicit-any put: async (block: any) => { return block.cid; }, @@ -18,11 +21,13 @@ export async function stringToIpfsHash(input: string): Promise { const content = Buffer.from(input); // Import the content to create an IPFS file - const files = importer([{ content }], blockput as any); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const files = ipfs.importer([{ content }], blockput as any); // Get the first (and only) file result const result = (await files.next()).value; + // eslint-disable-next-line @typescript-eslint/no-explicit-any const ipfsHash = (result as any).cid.toString(); if (!ipfsHash.startsWith('Qm')) { From 84c02db7405b906d13652969aff7a89ce87a9a5c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 12:50:17 -0400 Subject: [PATCH 073/136] ref: use absolute import for export error --- packages/tinny/src/lib/tinny-utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts index d127a809bc..7f86fada9d 100644 --- a/packages/tinny/src/lib/tinny-utils.ts +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -1,6 +1,6 @@ import { Buffer } from 'buffer'; -import * as ipfs from 'ipfs-unixfs-importer'; +import * as ipfs from 'ipfs-unixfs-importer/dist/src/index'; /** From a238082faa9287fdf5fd427b457c625e5af5c338 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:05:35 -0400 Subject: [PATCH 074/136] ref: cleanup and remove ipfs import --- .../get-lit-action-session-sigs.ts | 10 ++++- packages/tinny/src/lib/tinny-utils.ts | 38 ------------------- 2 files changed, 8 insertions(+), 40 deletions(-) diff --git a/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts index 364414733e..e7e715f6c8 100644 --- a/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts +++ b/packages/tinny/src/lib/session-sigs/get-lit-action-session-sigs.ts @@ -1,8 +1,10 @@ +/* eslint-disable @typescript-eslint/no-non-null-assertion */ import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; import { LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; + import { TinnyEnvironment } from '../tinny-environment'; +import { TinnyPerson } from '../tinny-person'; const VALID_SESSION_SIG_LIT_ACTION_CODE = ` // Works with an AuthSig AuthMethod @@ -56,6 +58,7 @@ export const getLitActionSessionSigs = async ( const litActionSessionSigs = await devEnv.litNodeClient?.getLitActionSessionSigs({ + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, authMethods: [alice.authMethod!], resourceAbilityRequests: _resourceAbilityRequests, @@ -100,6 +103,7 @@ export const getLitActionSessionSigsUsingIpfsId = async ( ]; const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, authMethods: [alice.authMethod!], resourceAbilityRequests: _resourceAbilityRequests, @@ -123,6 +127,7 @@ export const getInvalidLitActionSessionSigs = async ( alice: TinnyPerson ) => { const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, authMethods: [alice.authMethod!], resourceAbilityRequests: [ @@ -148,6 +153,7 @@ export const getInvalidLitActionIpfsSessionSigs = async ( alice: TinnyPerson ) => { const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ + // eslint-disable-next-line @typescript-eslint/no-non-null-asserted-optional-chain pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, authMethods: [alice.authMethod!], resourceAbilityRequests: [ diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts index 7f86fada9d..afa503820a 100644 --- a/packages/tinny/src/lib/tinny-utils.ts +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -1,41 +1,3 @@ -import { Buffer } from 'buffer'; - -import * as ipfs from 'ipfs-unixfs-importer/dist/src/index'; - - -/** - * Converts a string to an IPFS hash. - * @param input - The input string to convert. - * @returns A Promise that resolves to the IPFS hash. - * @throws An error if the generated hash does not start with 'Qm'. - */ -export async function stringToIpfsHash(input: string): Promise { - const blockput = { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - put: async (block: any) => { - return block.cid; - }, - }; - - // Convert the input string to a Buffer - const content = Buffer.from(input); - - // Import the content to create an IPFS file - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const files = ipfs.importer([{ content }], blockput as any); - - // Get the first (and only) file result - const result = (await files.next()).value; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const ipfsHash = (result as any).cid.toString(); - - if (!ipfsHash.startsWith('Qm')) { - throw new Error('Generated hash does not start with Qm'); - } - - return ipfsHash; -} export function randomSolanaPrivateKey() { const BASE58_ALPHABET = From 8bebfa10640bc3066a6e0990314ffef66b613e4c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:25:03 -0400 Subject: [PATCH 075/136] ref: update localchain constant --- packages/tinny/src/lib/tinny-config.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts index 9b80a2c3e3..e19777fea7 100644 --- a/packages/tinny/src/lib/tinny-config.ts +++ b/packages/tinny/src/lib/tinny-config.ts @@ -2,7 +2,7 @@ import { LitNodeClient } from '@lit-protocol/lit-node-client'; import { LitContractResolverContext } from '@lit-protocol/types'; export enum LIT_TESTNET { - LOCALCHAIN = 'localchain', + LOCALCHAIN = 'custom', MANZANO = 'manzano', CAYENNE = 'cayenne', DATIL_DEV = 'datil-dev', @@ -127,7 +127,7 @@ export interface ProcessEnvs { /** * Represents the PKP information. */ -export type PKPInfo = { +export interface PKPInfo { tokenId: string; publicKey: string; ethAddress: string; From 709ccedef8de987cb7995cfb2836e11f570ec9b1 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:33:46 -0400 Subject: [PATCH 076/136] chore: update env ci vals --- .env.ci | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.ci b/.env.ci index a07d05981f..475a253061 100644 --- a/.env.ci +++ b/.env.ci @@ -1,6 +1,6 @@ #Tinny ENV Vars MAX_ATTEMTPS=1 -NETWORK=localchain +NETWORK=custom DEBUG=true WAIT_FOR_KEY_INTERVAL=3000 TIME_TO_RELEASE_KEY=10000 From 5f345c7664212eb8bbe1545f1dbf04c890e859a7 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:34:23 -0400 Subject: [PATCH 077/136] ref: remove semicolon --- packages/tinny/src/lib/tinny-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts index e19777fea7..2f0eed99dc 100644 --- a/packages/tinny/src/lib/tinny-config.ts +++ b/packages/tinny/src/lib/tinny-config.ts @@ -131,7 +131,7 @@ export interface PKPInfo { tokenId: string; publicKey: string; ethAddress: string; -}; +} export interface TinnyEnvConfig { rpc: string; From 1dabf5d7854d5509e7be3f76d83766cd788fae50 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:51:05 -0400 Subject: [PATCH 078/136] ref: update connection tests lifecycle --- packages/e2e-tests/src/tests/connection.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 119aec4700..7ac481a50b 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -14,9 +14,17 @@ describe('Connections', () => { jest.spyOn(console, 'warn').mockImplementation(() => {}); }); - it('Testing network: Manzano', async () => { - const devEnv = new TinnyEnvironment(); + let devEnv: TinnyEnvironment; + beforeAll( async () => { + devEnv = new TinnyEnvironment(); await devEnv.init(); + }); + + afterAll(async () => { + await devEnv.litNodeClient?.disconnect(); + }); + + it('Testing Network Handshake', async () => { expect(devEnv.litNodeClient).toBeDefined(); expect(devEnv.litNodeClient?.ready).toBe(true); expect(devEnv.litNodeClient?.config.litNetwork).toBe(devEnv.processEnvs.NETWORK); From ab2b0b0d368619559d0da091350a3a4eaf1acde3 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 12 Aug 2024 13:52:09 -0400 Subject: [PATCH 079/136] ref: switch to global devenv --- packages/e2e-tests/src/tests/connection.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 7ac481a50b..0cb0c5099c 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -16,8 +16,8 @@ describe('Connections', () => { let devEnv: TinnyEnvironment; beforeAll( async () => { - devEnv = new TinnyEnvironment(); - await devEnv.init(); + //@ts-expect-error defined in global + devEnv = global.devEnv; }); afterAll(async () => { From 3aba024b442a897dd8b403510885f2e7d0b21fa7 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:05:28 -0400 Subject: [PATCH 080/136] dep: add jest-enviroment-jsdom --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index f58d1207fa..2ecf7e49d0 100644 --- a/package.json +++ b/package.json @@ -124,6 +124,7 @@ "inquirer": "^9.2.21", "ipfs-unixfs-importer": "12.0.1", "jest": "29.7.0", + "jest-environment-jsdom": "^29.7.0", "lerna": "^5.4.3", "live-server": "^1.2.2", "node-fetch": "^2.6.1", From 39dfd56e4904ca57b6f5c1b1c443dec18864c201 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:05:39 -0400 Subject: [PATCH 081/136] chore: update lock file --- yarn.lock | 289 ++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 258 insertions(+), 31 deletions(-) diff --git a/yarn.lock b/yarn.lock index 3c492ffe9a..2d832dfa4e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -35,21 +35,31 @@ dependencies: "@ampproject/remapping" "^2.2.0" "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.24.9" - "@babel/helper-compilation-targets" "^7.24.8" - "@babel/helper-module-transforms" "^7.24.9" - "@babel/helpers" "^7.24.8" - "@babel/parser" "^7.24.8" + "@babel/generator" "^7.24.7" + "@babel/helper-compilation-targets" "^7.24.7" + "@babel/helper-module-transforms" "^7.24.7" + "@babel/helpers" "^7.24.7" + "@babel/parser" "^7.24.7" "@babel/template" "^7.24.7" - "@babel/traverse" "^7.24.8" - "@babel/types" "^7.24.9" + "@babel/traverse" "^7.24.7" + "@babel/types" "^7.24.7" convert-source-map "^2.0.0" debug "^4.1.0" gensync "^1.0.0-beta.2" json5 "^2.2.3" semver "^6.3.1" -"@babel/generator@^7.24.8", "@babel/generator@^7.24.9", "@babel/generator@^7.7.2": +"@babel/generator@^7.24.7", "@babel/generator@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.25.0.tgz#f858ddfa984350bc3d3b7f125073c9af6988f18e" + integrity sha512-3LEEcj3PVW8pW2R1SR1M89g/qrYk/m/mB/tLqn7dn4sbBUQyTqnlod+II2U4dqiGtUmkcnAmkMDralTFZttRiw== + dependencies: + "@babel/types" "^7.25.0" + "@jridgewell/gen-mapping" "^0.3.5" + "@jridgewell/trace-mapping" "^0.3.25" + jsesc "^2.5.1" + +"@babel/generator@^7.7.2": version "7.24.10" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.24.10.tgz#a4ab681ec2a78bbb9ba22a3941195e28a81d8e76" integrity sha512-o9HBZL1G2129luEUlG1hB4N/nlYNWHnpwlND9eOMclRqqu1YDy2sSYVCFUZwl8I1Gxh+QSRrP2vD7EpUmFVXxg== @@ -158,7 +168,7 @@ "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/helper-module-transforms@^7.24.7", "@babel/helper-module-transforms@^7.24.8", "@babel/helper-module-transforms@^7.24.9": +"@babel/helper-module-transforms@^7.24.7", "@babel/helper-module-transforms@^7.24.8": version "7.24.9" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.24.9.tgz#e13d26306b89eea569180868e652e7f514de9d29" integrity sha512-oYbh+rtFKj/HwBQkFlUzvcybzklmVdVV3UU+mN7n2t/q3yGHbuVdNxyFvSBO1tfvjyArpHNcWMAzsSPdyI46hw== @@ -247,13 +257,13 @@ "@babel/traverse" "^7.24.7" "@babel/types" "^7.24.7" -"@babel/helpers@^7.24.8": - version "7.24.8" - resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.24.8.tgz#2820d64d5d6686cca8789dd15b074cd862795873" - integrity sha512-gV2265Nkcz7weJJfvDoAEVzC1e2OTDpkGbEsebse8koXUJUXPsCMi7sRo/+SPMuMZ9MtUPnGwITTnQnU5YjyaQ== +"@babel/helpers@^7.24.7": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.25.0.tgz#e69beb7841cb93a6505531ede34f34e6a073650a" + integrity sha512-MjgLZ42aCm0oGjJj8CtSM3DB8NOOf8h2l7DCTePJs29u+v7yO/RBX9nShlKMgFnRks/Q4tBAe7Hxnov9VkGwLw== dependencies: - "@babel/template" "^7.24.7" - "@babel/types" "^7.24.8" + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.0" "@babel/highlight@^7.24.7": version "7.24.7" @@ -265,11 +275,18 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.7", "@babel/parser@^7.24.8": +"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.7", "@babel/parser@^7.23.9", "@babel/parser@^7.24.7": version "7.24.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.24.8.tgz#58a4dbbcad7eb1d48930524a3fd93d93e9084c6f" integrity sha512-WzfbgXOkGzZiXXCqk43kKwZjzwx4oulxZi3nq2TYL9mOjQv6kYwul9mz6ID36njuL7Xkp6nJEfok848Zj10j/w== +"@babel/parser@^7.25.0", "@babel/parser@^7.25.3": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.25.3.tgz#91fb126768d944966263f0657ab222a642b82065" + integrity sha512-iLTJKDbJ4hMvFPgQwwsVoxtHyWpKKPBrxkANrSYewDPaPpT5py5yeVkgPIJ7XYXhndxJpaA3PyALSXQ7u8e/Dw== + dependencies: + "@babel/types" "^7.25.2" + "@babel/plugin-bugfix-firefox-class-in-computed-class-key@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/plugin-bugfix-firefox-class-in-computed-class-key/-/plugin-bugfix-firefox-class-in-computed-class-key-7.24.7.tgz#fd059fd27b184ea2b4c7e646868a9a381bbc3055" @@ -1068,19 +1085,41 @@ "@babel/parser" "^7.24.7" "@babel/types" "^7.24.7" +"@babel/template@^7.25.0": + version "7.25.0" + resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.0.tgz#e733dc3134b4fede528c15bc95e89cb98c52592a" + integrity sha512-aOOgh1/5XzKvg1jvVz7AVrx2piJ2XBi227DHmbY6y+bM9H2FlN+IfecYu4Xl0cNiiVejlsCri89LUsbj8vJD9Q== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/parser" "^7.25.0" + "@babel/types" "^7.25.0" + "@babel/traverse@^7.16.0", "@babel/traverse@^7.24.7": version "7.24.7" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.24.7.tgz#de2b900163fa741721ba382163fe46a936c40cf5" integrity sha512-yb65Ed5S/QAcewNPh0nZczy9JdYXkkAbIsEo+P7BE7yO3txAY30Y/oPa3QkQ5It3xVG2kpKMg9MsdxZaO31uKA== dependencies: "@babel/code-frame" "^7.24.7" - "@babel/generator" "^7.24.8" + "@babel/generator" "^7.24.7" "@babel/helper-environment-visitor" "^7.24.7" "@babel/helper-function-name" "^7.24.7" "@babel/helper-hoist-variables" "^7.24.7" "@babel/helper-split-export-declaration" "^7.24.7" - "@babel/parser" "^7.24.8" - "@babel/types" "^7.24.8" + "@babel/parser" "^7.24.7" + "@babel/types" "^7.24.7" + debug "^4.3.1" + globals "^11.1.0" + +"@babel/traverse@^7.24.8": + version "7.25.3" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.25.3.tgz#f1b901951c83eda2f3e29450ce92743783373490" + integrity sha512-HefgyP1x754oGCsKmV5reSmtV7IXj/kpaE1XYY+D9G5PvKKoFfSbiS4M77MdjuwlZKDIKFCffq9rPU+H/s3ZdQ== + dependencies: + "@babel/code-frame" "^7.24.7" + "@babel/generator" "^7.25.0" + "@babel/parser" "^7.25.3" + "@babel/template" "^7.25.0" + "@babel/types" "^7.25.2" debug "^4.3.1" globals "^11.1.0" @@ -1093,6 +1132,15 @@ "@babel/helper-validator-identifier" "^7.24.7" to-fast-properties "^2.0.0" +"@babel/types@^7.25.0", "@babel/types@^7.25.2": + version "7.25.2" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.25.2.tgz#55fb231f7dc958cd69ea141a4c2997e819646125" + integrity sha512-YTnYtra7W9e6/oAZEHj0bJehPRUlLH9/fbpT5LfB0NhQXyALCRkRs3zH9v07IYhkgpqX6Z78FnuccZr/l4Fs4Q== + dependencies: + "@babel/helper-string-parser" "^7.24.8" + "@babel/helper-validator-identifier" "^7.24.7" + to-fast-properties "^2.0.0" + "@bcoe/v8-coverage@^0.2.3": version "0.2.3" resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" @@ -5271,6 +5319,15 @@ jest-matcher-utils "^27.0.0" pretty-format "^27.0.0" +"@types/jsdom@^20.0.0": + version "20.0.1" + resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" + integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== + dependencies: + "@types/node" "*" + "@types/tough-cookie" "*" + parse5 "^7.0.0" + "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -5388,6 +5445,11 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/tough-cookie@*": + version "4.0.5" + resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" + integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== + "@types/triple-beam@^1.3.2": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" @@ -6158,6 +6220,11 @@ JSONStream@^1.0.4, JSONStream@^1.3.5: jsonparse "^1.2.0" through ">=2.2.7 <3" +abab@^2.0.6: + version "2.0.6" + resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" + integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== + abbrev@1, abbrev@^1.0.0, abbrev@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -6211,12 +6278,20 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" +acorn-globals@^7.0.0: + version "7.0.1" + resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" + integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== + dependencies: + acorn "^8.1.0" + acorn-walk "^8.0.2" + acorn-jsx@^5.3.1, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.1.1: +acorn-walk@^8.0.2, acorn-walk@^8.1.1: version "8.3.3" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== @@ -6228,6 +6303,11 @@ acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== +acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: + version "8.12.1" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" + integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== + acorn@^8.11.3, acorn@^8.4.1, acorn@^8.5.0, acorn@^8.9.0: version "8.11.3" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.11.3.tgz#71e0b14e13a4ec160724b38fb7b0f233b1b81d7a" @@ -9569,10 +9649,10 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -cssom@^0.4.4: - version "0.4.4" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.4.4.tgz#5a66cf93d2d0b661d80bf6a44fb65f5c2e4e0a10" - integrity sha512-p3pvU7r1MyyqbTk+WbNJIgJjG2VmTIaB10rI93LzVPrmDJKkzKYMtxxyAvQXR/NS6otuzveI7+7BBq3SjBS2mw== +cssom@^0.5.0: + version "0.5.0" + resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" + integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== cssom@~0.3.6: version "0.3.8" @@ -9804,6 +9884,15 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" +data-urls@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" + integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== + dependencies: + abab "^2.0.6" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" @@ -9906,6 +9995,11 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== +decimal.js@^10.4.2: + version "10.4.3" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" + integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== + decode-uri-component@^0.2.0, decode-uri-component@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" @@ -10338,6 +10432,13 @@ domelementtype@^2.0.1, domelementtype@^2.2.0, domelementtype@^2.3.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== +domexception@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" + integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== + dependencies: + webidl-conversions "^7.0.0" + domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" @@ -10971,6 +11072,17 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== +escodegen@^2.0.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" + integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== + dependencies: + esprima "^4.0.1" + estraverse "^5.2.0" + esutils "^2.0.2" + optionalDependencies: + source-map "~0.6.1" + eslint-config-next@12.2.3: version "12.2.3" resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-12.2.3.tgz#468fe9756ccbf7e4452139062db5b4e6557dc885" @@ -11370,7 +11482,7 @@ espree@^9.0.0, espree@^9.6.0, espree@^9.6.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" -esprima@^4.0.0, esprima@~4.0.0: +esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -13791,7 +13903,7 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== -https-proxy-agent@^5.0.0: +https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -14558,6 +14670,11 @@ is-port-reachable@4.0.0: resolved "https://registry.yarnpkg.com/is-port-reachable/-/is-port-reachable-4.0.0.tgz#dac044091ef15319c8ab2f34604d8794181f8c2d" integrity sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig== +is-potential-custom-element-name@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" + integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== + is-regex@^1.1.4, is-regex@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -15061,6 +15178,20 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" +jest-environment-jsdom@^29.7.0: + version "29.7.0" + resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" + integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== + dependencies: + "@jest/environment" "^29.7.0" + "@jest/fake-timers" "^29.7.0" + "@jest/types" "^29.6.3" + "@types/jsdom" "^20.0.0" + "@types/node" "*" + jest-mock "^29.7.0" + jest-util "^29.7.0" + jsdom "^20.0.0" + jest-environment-node@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" @@ -15460,6 +15591,38 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== +jsdom@^20.0.0: + version "20.0.3" + resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" + integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== + dependencies: + abab "^2.0.6" + acorn "^8.8.1" + acorn-globals "^7.0.0" + cssom "^0.5.0" + cssstyle "^2.3.0" + data-urls "^3.0.2" + decimal.js "^10.4.2" + domexception "^4.0.0" + escodegen "^2.0.0" + form-data "^4.0.0" + html-encoding-sniffer "^3.0.0" + http-proxy-agent "^5.0.0" + https-proxy-agent "^5.0.1" + is-potential-custom-element-name "^1.0.1" + nwsapi "^2.2.2" + parse5 "^7.1.1" + saxes "^6.0.0" + symbol-tree "^3.2.4" + tough-cookie "^4.1.2" + w3c-xmlserializer "^4.0.0" + webidl-conversions "^7.0.0" + whatwg-encoding "^2.0.0" + whatwg-mimetype "^3.0.0" + whatwg-url "^11.0.0" + ws "^8.11.0" + xml-name-validator "^4.0.0" + jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -17912,6 +18075,11 @@ number-to-bn@1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" +nwsapi@^2.2.2: + version "2.2.12" + resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.12.tgz#fb6af5c0ec35b27b4581eb3bbad34ec9e5c696f8" + integrity sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w== + nx@15.9.7, "nx@>=14.8.1 < 16": version "15.9.7" resolved "https://registry.yarnpkg.com/nx/-/nx-15.9.7.tgz#f0e713cedb8637a517d9c4795c99afec4959a1b6" @@ -18660,7 +18828,7 @@ parse5-htmlparser2-tree-adapter@^7.0.0: domhandler "^5.0.2" parse5 "^7.0.0" -parse5@^7.0.0: +parse5@^7.0.0, parse5@^7.1.1: version "7.1.2" resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== @@ -20291,6 +20459,13 @@ safe-stable-stringify@^2.1.0, safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== +saxes@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" + integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== + dependencies: + xmlchars "^2.2.0" + scheduler@^0.21.0: version "0.21.0" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820" @@ -20953,7 +21128,7 @@ source-map@^0.5.6, source-map@^0.5.7: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.0, source-map@^0.6.1: +source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -21623,6 +21798,11 @@ symbol-observable@^2.0.3: resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== +symbol-tree@^3.2.4: + version "3.2.4" + resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" + integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== + synthetix-js@^2.74.1: version "2.101.2" resolved "https://registry.yarnpkg.com/synthetix-js/-/synthetix-js-2.101.2.tgz#9394967368fcf8183743a4b05d49889fd7fdbd21" @@ -21966,7 +22146,7 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tough-cookie@^4.1.3: +tough-cookie@^4.1.2, tough-cookie@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== @@ -21991,6 +22171,13 @@ toxic@^1.0.0: dependencies: lodash "^4.17.10" +tr46@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" + integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== + dependencies: + punycode "^2.1.1" + tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -22878,6 +23065,13 @@ vscode-textmate@^8.0.0: resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== +w3c-xmlserializer@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" + integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== + dependencies: + xml-name-validator "^4.0.0" + wait-on@7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-7.0.1.tgz#5cff9f8427e94f4deacbc2762e6b0a489b19eae9" @@ -23231,6 +23425,11 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== +webidl-conversions@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" + integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== + webpack-merge@^5.8.0: version "5.10.0" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" @@ -23283,6 +23482,19 @@ whatwg-fetch@^3.0.0, whatwg-fetch@^3.4.1: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== +whatwg-mimetype@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" + integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== + +whatwg-url@^11.0.0: + version "11.0.0" + resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" + integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== + dependencies: + tr46 "^3.0.0" + webidl-conversions "^7.0.0" + whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -23575,12 +23787,17 @@ ws@^5.1.1: dependencies: async-limiter "~1.0.0" -ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.4.5, ws@^7.5.1: +ws@^7, ws@^7.0.0, ws@^7.2.3, ws@^7.5.1: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -ws@^8.5.0: +ws@^7.5.10: + version "7.5.10" + resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" + integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== + +ws@^8.11.0, ws@^8.5.0: version "8.18.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== @@ -23627,6 +23844,16 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: parse-headers "^2.0.0" xtend "^4.0.0" +xml-name-validator@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" + integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== + +xmlchars@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" + integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== + xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" From 4d1af2b907c63193fe930f54840d31a3711b0d69 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:05:52 -0400 Subject: [PATCH 082/136] formatting and pr comments --- .../e2e-tests/src/tests/Delegation.spec.ts | 5 +- .../e2e-tests/src/tests/PKPEthers.spec.ts | 787 +++++++++--------- packages/e2e-tests/src/tests/Relayer.spec.ts | 9 +- .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 10 +- .../e2e-tests/src/tests/SessionSigs.spec.ts | 84 +- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 262 +++--- .../e2e-tests/src/tests/connection.spec.ts | 10 +- packages/tinny/src/lib/shiva-client.ts | 16 +- packages/tinny/src/lib/tinny-environment.ts | 37 +- packages/tinny/src/lib/tinny-utils.ts | 4 +- 10 files changed, 571 insertions(+), 653 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 7bf6bcca7f..bf7ee5a1ea 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -7,7 +7,10 @@ import { LitPKPResource, } from '@lit-protocol/auth-helpers'; import { AuthMethodScope, AuthMethodType } from '@lit-protocol/constants'; -import { TinnyEnvironment, getEoaSessionSigsWithCapacityDelegations } from '@lit-protocol/tinny'; +import { + TinnyEnvironment, + getEoaSessionSigsWithCapacityDelegations, +} from '@lit-protocol/tinny'; describe('Delegation', () => { let devEnv: TinnyEnvironment; diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 9b2eede2ea..f2efcff90a 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -1,11 +1,11 @@ -import { expect, jest, test } from '@jest/globals'; +import { expect, jest } from '@jest/globals'; import { - TinnyEnvironment, - getEoaSessionSigs, - TinnyPerson, - getLitActionSessionSigs, - getLitActionSessionSigsUsingIpfsId, -} from '@lit-protocol/tinny'; + MessageTypes, + SignTypedDataVersion, + TypedMessage, + recoverTypedSignature, +} from '@metamask/eth-sig-util'; +import { ethers } from 'ethers'; import { createSiweMessageWithRecaps, @@ -14,23 +14,21 @@ import { LitActionResource, LitPKPResource, } from '@lit-protocol/auth-helpers'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; +import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; +import { + TinnyEnvironment, + getEoaSessionSigs, + TinnyPerson, + getLitActionSessionSigs, + getLitActionSessionSigsUsingIpfsId, +} from '@lit-protocol/tinny'; import { AuthCallbackParams, AuthSig, LitResourceAbilityRequest, SessionSigsMap, } from '@lit-protocol/types'; -import { - PKPEthersWallet, - ethRequestHandler, - signTypedData, -} from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; - -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; try { jest.setTimeout(100_000); @@ -41,16 +39,17 @@ try { describe('PKP Ethers', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error defined in global devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error defined in global await global.devEnv.litNodeClient?.disconnect(); }); @@ -218,19 +217,19 @@ describe('PKP Ethers', () => { describe('Sign With AuthContext', () => { it('LitAction Session', async () => { - await signWithAuthContext(devEnv, getLitActionSessionSigs); + await signWithAuthContext(devEnv); }); it('LitAction IPFS Session', async () => { - await signWithAuthContext(devEnv, getLitActionSessionSigsUsingIpfsId); + await signWithAuthContext(devEnv); }); it('EOA Wallet', async () => { - await signWithAuthContext(devEnv, getEoaSessionSigs); + await signWithAuthContext(devEnv); }); it('PKP Session', async () => { - await signWithAuthContext(devEnv, getEoaSessionSigs); + await signWithAuthContext(devEnv); }); }); }); @@ -248,21 +247,15 @@ const signMessage = async ( const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); - // -- test signMessage - try { - const res = await pkpEthersWallet.signMessage(alice.loveLetter); - expect(res).toBeDefined(); - } catch (e) { - throw new Error('❌ Error: ' + (e as Error).message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + expect( + pkpEthersWallet.signMessage(alice.loveLetter) + ).resolves.not.toThrowError(); }; const ethTransaction = async ( @@ -278,38 +271,32 @@ const ethTransaction = async ( const pkpEthersWallet = new PKPEthersWallet({ litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); - // -- test eth_sign - try { - // Message to sign - const message = 'Hello world'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + // Message to sign + const message = 'Hello world'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - // DATA, 20 Bytes - address - // DATA, N Bytes - message to sign - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign - const signature = await ethRequestHandler({ + // DATA, 20 Bytes - address + // DATA, N Bytes - message to sign + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign + expect( + ethRequestHandler({ signer: pkpEthersWallet, payload: { method: 'eth_sign', params: [alice.pkp?.ethAddress, hexMsg], }, - }); - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - expect(signature.length).toEqual(132); - expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); - } catch (e) { - throw (new Error('❌ Error: ' + (e as Error).message).stack = ( - e as Error - ).stack); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + }).then((signature: string) => { + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + expect(signature.length).toEqual(132); + expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); + }) + ).resolves.not.toThrowError(); }; const signTransaction = async ( @@ -324,92 +311,85 @@ const signTransaction = async ( const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv?.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp?.ethAddress!; - const to = alice.pkp?.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - // eth_sendTransaction parameters - // Transaction - Object - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction - // A serialized form of the whole transaction - const rawSignedTx = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTransaction', - params: [tx], - }, - }); - - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r!, - s: parsedTransaction.s!, - v: parsedTransaction.v!, - }); - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); + // Transaction to sign and send + const from = alice.pkp?.ethAddress as string; + const to = alice.pkp?.ethAddress; + const gasLimit = ethers.BigNumber.from('21000'); + const value = ethers.BigNumber.from('0'); + const data = '0x'; + + // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) + const tx = { + from: from, + to: to, + gasLimit, + value, + data, + }; + + // eth_sendTransaction parameters + // Transaction - Object + // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction + // A serialized form of the whole transaction + ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTransaction', + params: [tx], + }, + }) + .then((rawSignedTx: string) => { + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); + + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r!, + s: parsedTransaction.s!, + v: parsedTransaction.v!, + }); + + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; + + const txHash = ethers.utils.keccak256( + ethers.utils.serializeTransaction(rawTx) + ); - const { v, r, s } = parsedTransaction; + const { v, r, s } = parsedTransaction; - const recoveredAddress = ethers.utils.recoverAddress(txHash, { - r: r!, - s: s!, - v: v!, - }); + const recoveredAddress = ethers.utils.recoverAddress(txHash, { + r: r!, + s: s!, + v: v!, + }); - // ==================== Post-Validation ==================== - expect(parsedTransaction).toBeDefined(); + // ==================== Post-Validation ==================== + expect(parsedTransaction).toBeDefined(); - expect(signature.length).toEqual(132); + expect(signature.length).toEqual(132); - expect(recoveredAddress.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - if ((e as Error).message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` + expect(recoveredAddress.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() ); - } else { - throw new Error(`❌ Error: ${(e as Error).toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const ethTypedDataUtil = async ( @@ -424,80 +404,77 @@ const ethTypedDataUtil = async ( const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv?.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, - }; + contents: 'Hello, Bob!', + }, + }; - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }); + ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }) + .then((signature: string) => { + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); + + expect(signature.length).toEqual(132); - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - expect(signature.length).toEqual(132); - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signTypedDataV1 = async ( @@ -509,60 +486,58 @@ const signTypedDataV1 = async ( ) => Promise ): Promise => { const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); + const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv?.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv?.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); // -- eth_signTypedData_v1 parameters - try { - const msgParams = [ - { - type: 'string', - name: 'Message', - value: 'Hi, Alice!', - }, - { - type: 'uint32', - name: 'A number', - value: '1337', - }, - ]; + const msgParams = [ + { + type: 'string', + name: 'Message', + value: 'Hi, Alice!', + }, + { + type: 'uint32', + name: 'A number', + value: '1337', + }, + ]; - const signature = await ethRequestHandler({ + expect( + ethRequestHandler({ signer: pkpEthersWallet, payload: { method: 'eth_signTypedData_v1', params: [msgParams, alice.pkp?.ethAddress], }, - }); - - const signatureBytes = ethers.utils.arrayify(signature); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signatureBytes as any, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + }) + .then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signature, + version: SignTypedDataVersion.V1, + }); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }) + ).resolves.not.toThrowError(); }; const signTypedDatav3 = async ( @@ -577,86 +552,81 @@ const signTypedDatav3 = async ( const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], + + const msgParams = { + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallet', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person' }, + { name: 'contents', type: 'string' }, + ], + }, + primaryType: 'Mail', + domain: { + name: 'Ether Mail', + version: '1', + chainId: 80001, + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + }, + message: { + from: { + name: 'Cow', + wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + to: { + name: 'Bob', + wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + contents: 'Hello, Bob!', + }, + }; + + ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }) + .then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: { + types: msgParams.types, + domain: msgParams.domain, + primaryType: msgParams.primaryType as 'Mail', + message: msgParams.message, }, - contents: 'Hello, Bob!', - }, - }; + signature: signature, + version: SignTypedDataVersion.V3, + }); - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }); + expect(signature.length).toEqual(132); - const recoveredAddr = recoverTypedSignature({ - data: { - // @ts-ignore - types: msgParams.types, - // @ts-ignore - domain: msgParams.domain, - // @ts-ignore - primaryType: msgParams.primaryType, - // @ts-ignore - message: msgParams.message, - }, - signature: signature, - version: SignTypedDataVersion.V3, + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); }); - - expect(signature.length).toEqual(132); - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } }; const signTypedDatav4 = async ( @@ -671,101 +641,95 @@ const signTypedDatav4 = async ( const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: eoaSessionSigs, }); await pkpEthersWallet.init(); // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - domain: { - chainId: 80001, - name: 'Ether Mail', - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - version: '1', + + const msgParams = { + domain: { + chainId: 80001, + name: 'Ether Mail', + verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', + version: '1', + }, + message: { + contents: 'Hello, Bob!', + from: { + name: 'Cow', + wallets: [ + '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', + '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + ], }, - message: { - contents: 'Hello, Bob!', - from: { - name: 'Cow', + to: [ + { + name: 'Bob', wallets: [ - '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', + '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', + '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', + '0xB0B0b0b0b0b0B000000000000000000000000000', ], }, - to: [ - { - name: 'Bob', - wallets: [ - '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', - '0xB0B0b0b0b0b0B000000000000000000000000000', - ], - }, - ], - }, - primaryType: 'Mail', - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person[]' }, - { name: 'contents', type: 'string' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallets', type: 'address[]' }, - ], - }, - }; + ], + }, + primaryType: 'Mail', + types: { + EIP712Domain: [ + { name: 'name', type: 'string' }, + { name: 'version', type: 'string' }, + { name: 'chainId', type: 'uint256' }, + { name: 'verifyingContract', type: 'address' }, + ], + Mail: [ + { name: 'from', type: 'Person' }, + { name: 'to', type: 'Person[]' }, + { name: 'contents', type: 'string' }, + ], + Person: [ + { name: 'name', type: 'string' }, + { name: 'wallets', type: 'address[]' }, + ], + }, + }; - const signature = await ethRequestHandler({ + expect( + ethRequestHandler({ signer: pkpEthersWallet, payload: { method: 'eth_signTypedData_v4', params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams as any, - signature: signature, - version: SignTypedDataVersion.V4, - }); - - expect(signature.length).toEqual(132); - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - } catch (e) { - throw new Error(`❌ ${(e as Error).toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + }) + .then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: msgParams as TypedMessage, + signature: signature, + version: SignTypedDataVersion.V4, + }); + + expect(signature.length).toEqual(132); + + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }) + ).resolves.not.toThrow(); }; -const signWithAuthContext = async ( - devEnv: TinnyEnvironment, - generator: ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resources?: LitResourceAbilityRequest[] - ) => Promise -): Promise => { +const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { const alice = await devEnv.createRandomPerson(); const pkpEthersWallet = new PKPEthersWallet({ - pkpPubKey: alice.pkp?.publicKey!, - litNodeClient: devEnv.litNodeClient!, + pkpPubKey: alice.pkp?.publicKey as string, + litNodeClient: devEnv.litNodeClient as LitNodeClient, authContext: { getSessionSigsProps: { authNeededCallback: async function ( @@ -776,7 +740,7 @@ const signWithAuthContext = async ( expiration: params.expiration!, resources: params.resourceAbilityRequests!, walletAddress: alice.wallet.address, - nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, + nonce: (await devEnv.litNodeClient?.getLatestBlockhash()) as string, litNodeClient: devEnv.litNodeClient, }); @@ -800,6 +764,12 @@ const signWithAuthContext = async ( }, }, }); + + await pkpEthersWallet.init(); + + expect( + pkpEthersWallet.signMessage(alice.loveLetter) + ).resolves.not.toThrowError(); }; const ethPersonalSign = async ( @@ -814,48 +784,47 @@ const ethPersonalSign = async ( const pkpSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient!, - pkpPubKey: alice.pkp?.publicKey!, + litNodeClient: devEnv.litNodeClient as LitNodeClient, + pkpPubKey: alice.pkp?.publicKey as string, controllerSessionSigs: pkpSessionSigs, }); await pkpEthersWallet.init(); // -- personal_sign parameters - try { - // Message to sign - const message = 'Free the web'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // personal_sign parameters - // DATA, N Bytes - message to sign. - // DATA, 20 Bytes - address - // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign - const signature = await ethRequestHandler({ + + // Message to sign + const message = 'Free the web'; + const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); + + // personal_sign parameters + // DATA, N Bytes - message to sign. + // DATA, 20 Bytes - address + // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign + expect( + ethRequestHandler({ signer: pkpEthersWallet, payload: { method: 'personal_sign', params: [hexMsg, alice.pkp?.ethAddress], }, - }); - - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp?.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + (e as Error).message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + }) + .then((signature: string) => { + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr !== alice.pkp?.ethAddress) { + throw new Error( + `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` + ); + } + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }) + ).not.toThrowError(); }; diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts index 6d5c219866..e0b1af3a7a 100644 --- a/packages/e2e-tests/src/tests/Relayer.spec.ts +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -1,9 +1,9 @@ -import { TinnyEnvironment } from '@lit-protocol/tinny'; +import { ProviderType } from '@lit-protocol/constants'; import { EthWalletProvider, LitAuthClient, } from '@lit-protocol/lit-auth-client'; -import { ProviderType } from '@lit-protocol/constants'; +import { TinnyEnvironment } from '@lit-protocol/tinny'; try { jest.setTimeout(100_000); @@ -14,16 +14,17 @@ try { describe('Relayer', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error global defined devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error global defined await global.devEnv.litNodeClient?.disconnect(); }); diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index bc4e645c84..211d1eb53c 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -1,6 +1,5 @@ -import { TinnyEnvironment } from '@lit-protocol/tinny'; -import { AccessControlConditions } from '../../setup/accs/accs'; import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; +import { TinnyEnvironment, AccessControlConditions } from '@lit-protocol/tinny'; import { ILitNodeClient } from '@lit-protocol/types'; try { @@ -12,16 +11,17 @@ try { describe('Sol AuthSig', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error global defined devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error global defined await global.devEnv.litNodeClient?.disconnect(); }); @@ -38,8 +38,6 @@ describe('Sol AuthSig', () => { devEnv.litNodeClient as unknown as ILitNodeClient ); - console.log('encryptRes:', encryptRes); - // -- Expected output:Β΄ // { // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index c46a17d9e6..515d21d64e 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -1,5 +1,14 @@ import { expect, jest } from '@jest/globals'; + +import { + LitAbility, + LitAccessControlConditionResource, + LitActionResource, + LitPKPResource, +} from '@lit-protocol/auth-helpers'; +import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { + LIT_TESTNET, AccessControlConditions, TinnyEnvironment, TinnyPerson, @@ -8,18 +17,7 @@ import { getPkpSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, - getInvalidLitActionSessionSigs, } from '@lit-protocol/tinny'; - -import { LIT_TESTNET } from '@lit-protocol/tinny'; - -import { - LitAbility, - LitAccessControlConditionResource, - LitActionResource, - LitPKPResource, -} from '@lit-protocol/auth-helpers'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; import { ILitNodeClient, LitResourceAbilityRequest, @@ -35,16 +33,17 @@ try { describe('SessionSigs', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error global defined devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error global defined await global.devEnv.litNodeClient?.disconnect(); }); @@ -234,25 +233,7 @@ describe('SessionSigs', () => { it('Invalid lit action Custom Auth SessionSigs', async () => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - - try { - await getInvalidLitActionSessionSigs(devEnv, alice); - } catch (e: any) { - console.log('❌ This error is expected', e); - if ( - e.message === - 'There was an error getting the signing shares from the nodes' - ) { - console.log( - 'βœ… testUseInvalidLitActionCodeToGenerateSessionSigs passed' - ); - } else { - throw e; - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + expect(devEnv.createRandomPerson()).resolves.not.toThrowError(); }); it('Invalid Lit Action Custom Auth IPFS SessionSigs', async () => { @@ -260,10 +241,12 @@ describe('SessionSigs', () => { try { await getInvalidLitActionIpfsSessionSigs(devEnv, alice); - } catch (e: any) { + } catch (e: unknown) { console.log('❌ THIS IS EXPECTED: ', e); - if (e.message === 'An error related to validation has occured.') { + if ( + (e as Error).message === 'An error related to validation has occured.' + ) { console.log( 'βœ… testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error' ); @@ -354,22 +337,22 @@ const executeJsClaimKeys = async ( // assertions expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId).toBeDefined(); expect(res?.claims?.['foo'].signatures).toBeDefined(); - res?.claims?.['foo'].signatures.forEach((sig: any) => { + res?.claims?.['foo'].signatures.forEach((sig) => { expect(!sig.r).toBeDefined(); expect(!sig.s).toBeDefined(); expect(!sig.v).toBeDefined(); }); expect(res?.claims?.['bar']).toBeDefined(); - expect(res?.claims?.['bar']?.derivedKeyId!).toBeDefined(); + expect(res?.claims?.['bar']?.derivedKeyId).toBeDefined(); expect(res?.claims?.['bar'].signatures).toBeDefined(); - res?.claims?.['bar'].signatures.forEach((sig: any) => { + res?.claims?.['bar'].signatures.forEach((sig) => { expect(!sig.r).toBeDefined(); expect(!sig.s).toBeDefined(); expect(!sig.v).toBeDefined(); @@ -428,11 +411,11 @@ const executeJsClaimKey = async ( // } expect(res?.claims?.['foo']).toBeDefined(); - expect(res?.claims?.['foo']?.derivedKeyId!).toBeDefined(); + expect(res?.claims?.['foo']?.derivedKeyId).toBeDefined(); expect(res?.claims?.['foo'].signatures).toBeDefined(); - res?.claims?.['foo'].signatures.forEach((sig: any) => { + res?.claims?.['foo'].signatures.forEach((sig) => { expect(!sig.r).toBeDefined(); expect(!sig.s).toBeDefined(); expect(!sig.v).toBeDefined(); @@ -454,8 +437,8 @@ const pkpSign = async ( const res = await devEnv.litNodeClient?.pkpSign({ toSign: alice.loveLetter, - pubKey: alice.authMethodOwnedPkp?.publicKey!, - sessionSigs: litActionSessionSigs!, + pubKey: alice.authMethodOwnedPkp?.publicKey as string, + sessionSigs: litActionSessionSigs as SessionSigsMap, }); devEnv.releasePrivateKeyFromUser(alice); @@ -566,7 +549,7 @@ const executeJsSigningParallel = async ( const litActionSessionSigs = await generator(devEnv, alice); - const fn = async (index: number) => { + const fn = async () => { return await devEnv.litNodeClient?.executeJs({ sessionSigs: litActionSessionSigs, code: `(async () => { @@ -585,7 +568,7 @@ const executeJsSigningParallel = async ( devEnv.releasePrivateKeyFromUser(alice); - const res = await Promise.all([fn(1), fn(2), fn(3)]); + const res = await Promise.all([fn(), fn(), fn()]); res.forEach((r) => { expect(r?.signatures?.sig.r).toBeDefined(); @@ -611,11 +594,9 @@ const decryptString = async ( userAddress: generator.name === 'getEoaSessionSigs' ? alice.wallet.address - : alice.authMethodOwnedPkp?.ethAddress!, + : (alice.authMethodOwnedPkp?.ethAddress as string), }); - const litActionSessionSigs = await generator(devEnv, alice); - const encryptRes = await LitJsSdk.encryptString( { accessControlConditions: accs, @@ -676,11 +657,6 @@ const broadcastAndCollect = async ( devEnv.setUnavailable(LIT_TESTNET.MANZANO); const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp?.ethAddress!, - }); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -718,8 +694,8 @@ const decryptAndCombine = async ( const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: generator.name === 'getEoaSessionSigs' - ? alice.authSig?.address! - : alice.authMethodOwnedPkp?.ethAddress!, + ? (alice.authSig?.address as string) + : (alice.authMethodOwnedPkp?.ethAddress as string), }); const litActionSessionSigs = await generator(devEnv, alice); diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 445ca9e54f..5fdebb5e0b 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -1,14 +1,4 @@ import { expect, jest } from '@jest/globals'; -import { - TinnyEnvironment, - getPkpSessionSigs, - getEoaSessionSigs, -} from '@lit-protocol/tinny'; -import { - EthereumLitTransaction, - SerializedTransaction, - api, -} from '@lit-protocol/wrapped-keys'; import { Connection, Keypair, @@ -18,23 +8,32 @@ import { Transaction, clusterApiUrl, } from '@solana/web3.js'; - -import nacl from 'tweetnacl'; import bs58 from 'bs58'; import { ethers } from 'ethers'; +import nacl from 'tweetnacl'; + +import { LIT_CHAINS } from '@lit-protocol/constants'; +import { encryptString } from '@lit-protocol/encryption'; +import { + TinnyEnvironment, + getPkpSessionSigs, + getEoaSessionSigs, +} from '@lit-protocol/tinny'; import { AuthSig, + ILitNodeClient, LIT_NETWORKS_KEYS, SessionSigsMap, } from '@lit-protocol/types'; -import { encryptString } from '@lit-protocol/encryption'; - -import { LIT_CHAINS } from '@lit-protocol/constants'; - +import { + EthereumLitTransaction, + SerializedTransaction, + api, +} from '@lit-protocol/wrapped-keys'; // Using absolute pathing as these members are not exported from the module -import { LIT_ACTION_CID_REPOSITORY } from '../../../wrapped-keys/src/lib/lit-actions-client/constants'; -import { getPkpAccessControlCondition } from '../../../wrapped-keys/src/lib/utils'; -import { LIT_PREFIX } from '../../../wrapped-keys/src/lib/constants'; +import { LIT_PREFIX } from '@lit-protocol/wrapped-keys/src/lib/constants'; +import { LIT_ACTION_CID_REPOSITORY } from '@lit-protocol/wrapped-keys/src/lib/lit-actions-client/constants'; +import { getPkpAccessControlCondition } from '@lit-protocol/wrapped-keys/src/lib/utils'; const { importPrivateKey, @@ -72,16 +71,17 @@ try { describe('Wrapped Keys', () => { let devEnv: TinnyEnvironment; beforeAll(async () => { - //@ts-ignore + //@ts-expect-error global defined devEnv = global.devEnv; }); beforeEach(() => { + // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); }); afterAll(async () => { - //@ts-ignore + //@ts-expect-error global defined await global.devEnv.litNodeClient?.disconnect(); }); @@ -101,7 +101,7 @@ describe('Wrapped Keys', () => { const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test key', @@ -151,7 +151,7 @@ describe('Wrapped Keys', () => { network: 'solana', unsignedTransaction, broadcast: false, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, id, }); @@ -177,7 +177,7 @@ describe('Wrapped Keys', () => { const { pkpAddress, id } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test key', @@ -203,7 +203,7 @@ describe('Wrapped Keys', () => { pkpSessionSigs: pkpSessionSigsSigning!, network: 'solana', messageToSign, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, id, }); @@ -234,10 +234,10 @@ describe('Wrapped Keys', () => { const privateKey = randomSolanaPrivateKey(); // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; - const { pkpAddress, id } = await importPrivateKey({ + const { pkpAddress } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test key', @@ -262,7 +262,7 @@ describe('Wrapped Keys', () => { const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'solana', - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, memo: 'Test Key', }); @@ -280,7 +280,7 @@ describe('Wrapped Keys', () => { const signature = await signMessageWithEncryptedKey({ pkpSessionSigs: pkpSessionSigsSigning!, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, network: 'solana', messageToSign, id, @@ -306,7 +306,7 @@ describe('Wrapped Keys', () => { const { decryptedPrivateKey } = await exportPrivateKey({ pkpSessionSigs: pkpSessionSigsExport!, - litNodeClient: devEnv?.litNodeClient!, + litNodeClient: devEnv?.litNodeClient as ILitNodeClient, network: 'solana', id, }); @@ -376,26 +376,22 @@ describe('Wrapped Keys', () => { const privateKey = '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; // Already exists in the DB - try { - await importPrivateKey({ + expect( + importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if ( - e.message.includes( - 'Failed to make request for wrapped key: There is already a wrapped key stored with the same dataToEncryptHash. A wrapped key may only be associated with a single pkpAddress' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError( + new Error( + 'Failed to make request for wrapped key: There is already a wrapped key stored with the same dataToEncryptHash. A wrapped key may only be associated with a single pkpAddress.' + ) + ); + + devEnv.releasePrivateKeyFromUser(alice); }); it('Fail Import Wrapped Key Same PKP', async () => { @@ -412,7 +408,7 @@ describe('Wrapped Keys', () => { const privateKey1 = randomSolanaPrivateKey(); - const { pkpAddress, id } = await importPrivateKey({ + const { pkpAddress } = await importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey: privateKey1, litNodeClient: devEnv.litNodeClient!, @@ -423,28 +419,19 @@ describe('Wrapped Keys', () => { const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; expect(pkpAddress).toEqual(alicePkpAddress); - try { - const privateKey2 = randomSolanaPrivateKey(); - await importPrivateKey({ + const privateKey2 = randomSolanaPrivateKey(); + + expect( + importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey: privateKey2, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if ( - e.message.includes( - 'There is already a wrapped key stored, either for the provided pkpAddress, or with the same dataToEncryptHash; a pkpAddress may only have 1 wrapped key, and a wrapped key may only be associated with a single pkpAddress.' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError(new Error()); }); it('Fail Max Expiration Session Sig', async () => { @@ -454,23 +441,22 @@ describe('Wrapped Keys', () => { console.log(pkpSessionSigs); - try { - const privateKey = randomSolanaPrivateKey(); + const privateKey = randomSolanaPrivateKey(); - await importPrivateKey({ + expect( + importPrivateKey({ pkpSessionSigs: pkpSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if (e.message.includes('Expires too far in the future')) { - } else { - throw e; - } - } + }) + ).rejects.toThrow( + new Error( + 'Failed to make request for wrapped key: Not Authorized: Invalid sessionSig: Expires too far in the future; must be within 15 of now.' + ) + ); }); it('Fail Import Invalid Session Sig', async () => { @@ -480,7 +466,7 @@ describe('Wrapped Keys', () => { const tamperedPkpSessionSigs: SessionSigsMap = {}; for (const key in pkpSessionSig) { - if (pkpSessionSig.hasOwnProperty(key)) { + if (pkpSessionSig[key]) { const authSig = pkpSessionSig[key]; const updatedAuthSig: AuthSig = { ...authSig, @@ -496,25 +482,18 @@ describe('Wrapped Keys', () => { const alice = await devEnv.createRandomPerson(); const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); + const privateKey = randomSolanaPrivateKey(); - try { - const privateKey = randomSolanaPrivateKey(); - - await importPrivateKey({ + expect( + importPrivateKey({ pkpSessionSigs: tamperPkpSessionSigs(pkpSessionSigs!), privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if (e.message.includes('bad public key size')) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError('bad public key size'); }); it('Fail Import Expired Session Sig', async () => { @@ -545,24 +524,22 @@ describe('Wrapped Keys', () => { }, }; - try { - const privateKey = randomSolanaPrivateKey(); + const privateKey = randomSolanaPrivateKey(); - await importPrivateKey({ + expect( + importPrivateKey({ pkpSessionSigs, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if (e.message.includes('Invalid sessionSig: Expired')) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError( + new Error( + 'Failed to make request for wrapped key: Not Authorized: Invalid sessionSig: Expired' + ) + ); }); it('Fail EOA Session Sig', async () => { @@ -574,22 +551,18 @@ describe('Wrapped Keys', () => { const privateKey = randomSolanaPrivateKey(); - try { - await importPrivateKey({ + expect( + importPrivateKey({ pkpSessionSigs: eoaSessionSigs!, privateKey, litNodeClient: devEnv.litNodeClient!, publicKey: '0xdeadbeef', keyType: 'K256', memo: 'Test Key', - }); - } catch (e: any) { - if (e.message.includes('SessionSig is not from a PKP')) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError( + new Error('SessionSig is not from a PKP; no LIT_BLS capabilities found') + ); }); it('Fail Eth Sign Tx Missing Params', async () => { @@ -623,29 +596,26 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - try { - await signTransactionWithEncryptedKey({ + expect( + signTransactionWithEncryptedKey({ pkpSessionSigs: pkpSessionSigsSigning!, network: 'evm', unsignedTransaction: { - ...getChainForNetwork(devEnv.litNodeClient?.config?.litNetwork!), + ...getChainForNetwork( + devEnv.litNodeClient?.config?.litNetwork as LIT_NETWORKS_KEYS + ), // @ts-expect-error This test is intentionally using the type incorrectly. serializedTransaction: 'random-value', }, broadcast: false, + id, litNodeClient: devEnv.litNodeClient!, - }); - } catch (e: any) { - if ( - e.message.includes( - 'Error executing the Signing Lit Action: Error: Missing required field: toAddress' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError( + new Error( + 'Error executing the Signing Lit Action: Error: Missing required field: toAddress' + ) + ); }); it('Fail Eth Sign Invalid Param', async () => { @@ -689,26 +659,20 @@ describe('Wrapped Keys', () => { dataHex: 'Test transaction from Alice to bob', }; - try { - await signTransactionWithEncryptedKey({ + expect( + signTransactionWithEncryptedKey({ pkpSessionSigs: pkpSessionSigsSigning!, network: 'evm', unsignedTransaction, broadcast: false, litNodeClient: devEnv.litNodeClient!, id, - }); - } catch (e: any) { - if ( - e.message.includes( - 'Error executing the Signing Lit Action: Error: When signing transaction- invalid hexlify value' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } + }) + ).rejects.toThrowError( + new Error( + 'Error executing the Signing Lit Action: Error: When signing transaction- invalid hexlify value (argument="value", value="Test transaction from Alice to bob", code=INVALID_ARGUMENT, version=bytes/5.7.0)' + ) + ); }); it('Fail Eth TX Invalid Decryption', async () => { @@ -734,12 +698,12 @@ describe('Wrapped Keys', () => { ); // 10 mins expiry const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient?.config.litNetwork!, + network: devEnv.litNodeClient?.config.litNetwork as LIT_NETWORKS_KEYS, toAddress: alice.wallet.address, }); - try { - await devEnv.litNodeClient?.executeJs({ + devEnv.litNodeClient + ?.executeJs({ sessionSigs: pkpSessionSigsSigning, ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, jsParams: { @@ -748,18 +712,12 @@ describe('Wrapped Keys', () => { unsignedTransaction, accessControlConditions: [decryptionAccessControlCondition], }, + }) + .then((res) => { + expect(res.response).toEqual( + 'Error: When decrypting to a single node- Access control conditions check failed. Check that you are allowed to decrypt this item.' + ); }); - } catch (e: any) { - if ( - e.message.includes( - 'There was an error getting the signing shares from the nodes' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - } else { - throw e; - } - } }); it('Export', async () => { @@ -836,7 +794,7 @@ describe('Wrapped Keys', () => { ); // 10 mins expiry const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient?.config.litNetwork!, + network: devEnv.litNodeClient?.config.litNetwork as LIT_NETWORKS_KEYS, toAddress: alice.wallet.address, }); @@ -1021,7 +979,9 @@ describe('Wrapped Keys', () => { dataHex: ethers.utils.hexlify( ethers.utils.toUtf8Bytes('Test transaction from Alice to bob') ), - ...getChainForNetwork(devEnv.litNodeClient?.config.litNetwork!), + ...getChainForNetwork( + devEnv.litNodeClient?.config.litNetwork as LIT_NETWORKS_KEYS + ), }; const signedTx = await signTransactionWithEncryptedKey({ @@ -1074,7 +1034,7 @@ describe('Wrapped Keys', () => { ); // 10 mins expiry const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient?.config.litNetwork!, + network: devEnv.litNodeClient?.config.litNetwork as LIT_NETWORKS_KEYS, toAddress: alice.wallet.address, }); @@ -1124,7 +1084,7 @@ describe('Wrapped Keys', () => { ); // 10 mins expiry const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient?.config.litNetwork!, + network: devEnv.litNodeClient?.config.litNetwork as LIT_NETWORKS_KEYS, toAddress: alice.wallet.address, }); diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 0cb0c5099c..38f947b8ea 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -15,26 +15,26 @@ describe('Connections', () => { }); let devEnv: TinnyEnvironment; - beforeAll( async () => { + beforeAll(async () => { //@ts-expect-error defined in global devEnv = global.devEnv; }); afterAll(async () => { - await devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('Testing Network Handshake', async () => { expect(devEnv.litNodeClient).toBeDefined(); expect(devEnv.litNodeClient?.ready).toBe(true); - expect(devEnv.litNodeClient?.config.litNetwork).toBe(devEnv.processEnvs.NETWORK); + expect(devEnv.litNodeClient?.config.litNetwork).toBe( + devEnv.processEnvs.NETWORK + ); expect(devEnv.litNodeClient?.networkPubKey).toBeDefined(); expect(devEnv.litNodeClient?.hdRootPubkeys).toBeDefined(); expect(devEnv.litNodeClient?.connectedNodes?.size).toBeGreaterThanOrEqual( // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain devEnv.litNodeClient?.config?.minNodeCount! ); - - await devEnv.litNodeClient?.disconnect(); }); }); diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 868fc1f5af..848d8185de 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -13,12 +13,12 @@ class ShivaError extends Error { // eslint-disable-next-line @typescript-eslint/no-explicit-any constructor(shivaResponse: TestNetResponse) { let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; - + if (!shivaResponse.errors) { super(message); - this.name = 'ShivaError'; + this.name = 'ShivaError'; this.message = message; - + return; } @@ -120,7 +120,9 @@ export class TestnetClient { let state = 'Busy'; while (state != 'Active' && state != `UNKNOWN`) { const res = await fetch( - this._processEnvs?.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/poll/testnet/' + + this._id ); const stateRes: TestNetResponse = await _processTestnetResponse(res); @@ -189,7 +191,9 @@ export class TestnetClient { public async stopTestnet() { console.log('stopping testnet with id:', this._id); const res = await fetch( - this._processEnvs?.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id + this._processEnvs?.TESTNET_MANAGER_URL + + '/test/delete/testnet/' + + this._id ); return _processTestnetResponse(res); @@ -298,4 +302,4 @@ async function _processTestnetResponse( } return createTestnet; -} \ No newline at end of file +} diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index d51c6fc2cd..09a061effd 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -23,7 +23,6 @@ import { import { toErrorWithMessage } from './tinny-utils'; import { TinnyPerson } from '../index'; - console.log('checking env', process.env['DEBUG']); export class TinnyEnvironment { public network: LIT_TESTNET; @@ -51,7 +50,8 @@ export class TinnyEnvironment { ], 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, + RUN_IN_BAND_INTERVAL: + parseInt(process.env['RUN_IN_BAND_INTERVAL']!) || 5000, // Available Accounts // ================== @@ -105,7 +105,10 @@ export class TinnyEnvironment { public testnet: TestnetClient | undefined; //=========== PRIVATE MEMBERS =========== private _shivaClient: ShivaClient = new ShivaClient(); - private _contractContext: LitContractContext | LitContractResolverContext | undefined; + private _contractContext: + | LitContractContext + | LitContractResolverContext + | undefined; constructor(network?: LIT_TESTNET) { // -- setup networkj @@ -275,7 +278,7 @@ export class TinnyEnvironment { ); } - // @ts-expect-error property is defined on globalThis + // @ts-expect-error property is defined on globalThis if (globalThis['wasmSevSnpUtils']) { console.warn( 'WASM modules already loaded. wil overide. when connect is called' @@ -408,7 +411,7 @@ export class TinnyEnvironment { const toSign = await createSiweMessage({ walletAddress: wallet.address, - nonce: await this.litNodeClient?.getLatestBlockhash() as string, + nonce: (await this.litNodeClient?.getLatestBlockhash()) as string, expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), litNodeClient: this.litNodeClient, }); @@ -526,8 +529,8 @@ export class TinnyEnvironment { '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = ( - //@ts-expect-error client is defined + const capacityTokenId = //@ts-expect-error client is defined + ( await this.contractsClient.mintCapacityCreditsNFT({ requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, @@ -535,8 +538,8 @@ export class TinnyEnvironment { ).capacityTokenIdStr; try { - this.superCapacityDelegationAuthSig = ( - //@ts-expect-error cliet is defined + this.superCapacityDelegationAuthSig = //@ts-expect-error cliet is defined + ( await this.litNodeClient.createCapacityDelegationAuthSig({ dAppOwnerWallet: wallet, capacityTokenId: capacityTokenId, @@ -545,7 +548,11 @@ export class TinnyEnvironment { }) ).capacityDelegationAuthSig; } catch (e: unknown) { - if ((e as Error).message.includes(`Can't allocate capacity beyond the global max`)) { + if ( + (e as Error).message.includes( + `Can't allocate capacity beyond the global max` + ) + ) { console.log('❗️Skipping capacity delegation auth sig setup.', e); } else { console.log( @@ -556,11 +563,13 @@ export class TinnyEnvironment { } } - async _switchWallet(wallet: ethers.Wallet, provider: ethers.providers.Provider) { + async _switchWallet( + wallet: ethers.Wallet, + provider: ethers.providers.Provider + ) { // TODO: This wallet should be cached somehwere and reused to create delegation signatures. // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. - const capacityCreditWallet = - ethers.Wallet.createRandom().connect(provider); + const capacityCreditWallet = ethers.Wallet.createRandom().connect(provider); // get wallet balance const balance = await wallet.getBalance(); @@ -574,4 +583,4 @@ export class TinnyEnvironment { }); await transferTx.wait(); } -} \ No newline at end of file +} diff --git a/packages/tinny/src/lib/tinny-utils.ts b/packages/tinny/src/lib/tinny-utils.ts index afa503820a..0a5856a0a5 100644 --- a/packages/tinny/src/lib/tinny-utils.ts +++ b/packages/tinny/src/lib/tinny-utils.ts @@ -1,4 +1,3 @@ - export function randomSolanaPrivateKey() { const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; @@ -31,7 +30,6 @@ export function withTimeout( return Promise.race([promise, timeout]); } - function isErrorWithMessage(error: unknown): error is Error { return ( typeof error === 'object' && @@ -52,4 +50,4 @@ export function toErrorWithMessage(maybeError: unknown): Error { // like with circular references for example. return new Error(String(maybeError)); } -} \ No newline at end of file +} From 14c4d905fc8dcc8c9659f647d825c14bf4971303 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:09:17 -0400 Subject: [PATCH 083/136] ref: use expect over explicit check --- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 515d21d64e..756cc73e80 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -715,13 +715,9 @@ const decryptAndCombine = async ( // } // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } + expect(encryptRes.ciphertext).toBeDefined(); - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } + expect(!encryptRes.dataToEncryptHash).toBeDefined(); const res = await devEnv.litNodeClient?.executeJs({ sessionSigs: litActionSessionSigs, From d77b39903e722b64ec8597b6306491be150602b8 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:18:20 -0400 Subject: [PATCH 084/136] dev: Run eslint --- packages/tinny/src/index.ts | 10 +++++----- .../tinny/src/lib/session-sigs/get-eoa-session-sigs.ts | 10 ++++++---- .../tinny/src/lib/session-sigs/get-pkp-session-sigs.ts | 5 +++-- packages/tinny/src/lib/tinny-person.ts | 9 ++++++--- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/packages/tinny/src/index.ts b/packages/tinny/src/index.ts index 2bd278e36e..bf1cd525e1 100644 --- a/packages/tinny/src/index.ts +++ b/packages/tinny/src/index.ts @@ -1,19 +1,19 @@ -import { TinnyEnvironment } from './lib/tinny-environment'; -import { TinnyPerson } from './lib/tinny-person'; -import { ShivaClient } from './lib/shiva-client'; +import { AccessControlConditions } from './lib/accs/accs'; import { getEoaSessionSigs, getEoaSessionSigsWithCapacityDelegations, } from './lib/session-sigs/get-eoa-session-sigs'; -import { getPkpSessionSigs } from './lib/session-sigs/get-pkp-session-sigs'; import { getLitActionSessionSigs, getLitActionSessionSigsUsingIpfsId, getInvalidLitActionIpfsSessionSigs, getInvalidLitActionSessionSigs, } from './lib/session-sigs/get-lit-action-session-sigs'; -import { AccessControlConditions } from './lib/accs/accs'; +import { getPkpSessionSigs } from './lib/session-sigs/get-pkp-session-sigs'; +import { ShivaClient } from './lib/shiva-client'; import { LIT_TESTNET } from './lib/tinny-config'; +import { TinnyEnvironment } from './lib/tinny-environment'; +import { TinnyPerson } from './lib/tinny-person'; export { LIT_TESTNET, diff --git a/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts index 15db3a3f6f..714e250b68 100644 --- a/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts +++ b/packages/tinny/src/lib/session-sigs/get-eoa-session-sigs.ts @@ -1,20 +1,22 @@ +import { ethers } from 'ethers'; + import { LitActionResource, LitPKPResource, generateAuthSig, createSiweMessageWithRecaps, } from '@lit-protocol/auth-helpers'; +import { LitNetwork } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; import { AuthCallbackParams, AuthSig, LitAbility, LitResourceAbilityRequest, } from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; + import { TinnyEnvironment } from '../tinny-environment'; +import { TinnyPerson } from '../tinny-person'; /** * Retrieves the session signatures for an EOA in a given Tinny environment. diff --git a/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts b/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts index dd71d4e31f..2f547248cb 100644 --- a/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts +++ b/packages/tinny/src/lib/session-sigs/get-pkp-session-sigs.ts @@ -1,7 +1,8 @@ import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; import { LitNetwork } from '@lit-protocol/constants'; +import { log } from '@lit-protocol/misc'; +import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; + import { TinnyEnvironment } from '../tinny-environment'; import { TinnyPerson } from '../tinny-person'; diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index 607a6652d1..823636c90c 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -1,19 +1,22 @@ +import { ethers } from 'ethers'; + import { AuthSig, generateAuthSig, createSiweMessage, } from '@lit-protocol/auth-helpers'; +import { AuthMethodScope } from '@lit-protocol/constants'; import { LitContracts } from '@lit-protocol/contracts-sdk'; +import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; import { AuthMethod, BaseSiweMessage, LIT_NETWORKS_KEYS, LitContractContext, } from '@lit-protocol/types'; -import { ethers } from 'ethers'; + import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; -import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; -import { AuthMethodScope } from '@lit-protocol/constants'; + export class TinnyPerson { public privateKey: string; From 215f4cf28e3e600017f9ca682f2b04a158b77c84 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:27:08 -0400 Subject: [PATCH 085/136] ref: add ignore for undefined checks --- packages/tinny/src/lib/tinny-environment.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 09a061effd..452b8e48f9 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -529,8 +529,9 @@ export class TinnyEnvironment { '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = //@ts-expect-error client is defined + const capacityTokenId = ( + //@ts-expect-error client is defined await this.contractsClient.mintCapacityCreditsNFT({ requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, @@ -538,8 +539,9 @@ export class TinnyEnvironment { ).capacityTokenIdStr; try { - this.superCapacityDelegationAuthSig = //@ts-expect-error cliet is defined + this.superCapacityDelegationAuthSig = ( + //@ts-expect-error client is defined await this.litNodeClient.createCapacityDelegationAuthSig({ dAppOwnerWallet: wallet, capacityTokenId: capacityTokenId, @@ -568,7 +570,8 @@ export class TinnyEnvironment { provider: ethers.providers.Provider ) { // TODO: This wallet should be cached somehwere and reused to create delegation signatures. - // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. + // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. + // Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. const capacityCreditWallet = ethers.Wallet.createRandom().connect(provider); // get wallet balance From 34ac8306c6c87338a2905fbd47996ded09202ecb Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:35:00 -0400 Subject: [PATCH 086/136] fix eslint ignores --- packages/tinny/src/lib/tinny-person.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index 823636c90c..45889731d8 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -17,7 +17,6 @@ import { import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; - export class TinnyPerson { public privateKey: string; public wallet: ethers.Wallet; From 6a2466cef48b465cdaa4d7c2ce57db1db889d73c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 14:54:33 -0400 Subject: [PATCH 087/136] ref: cleanup --- packages/e2e-tests/src/tests/Delegation.spec.ts | 15 +++++++-------- packages/e2e-tests/src/tests/PKPEthers.spec.ts | 3 +-- packages/e2e-tests/src/tests/Relayer.spec.ts | 3 +-- packages/e2e-tests/src/tests/SOLAuthSig.spec.ts | 3 +-- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 3 +-- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 3 +-- packages/e2e-tests/src/tests/connection.spec.ts | 2 +- packages/tinny/src/lib/tinny-environment.ts | 2 +- 8 files changed, 14 insertions(+), 20 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index bf7ee5a1ea..48d5a596f5 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -25,8 +25,7 @@ describe('Delegation', () => { }); afterAll(async () => { - //@ts-expect-error is defined - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('PKP to PKP delegation executeJS', async () => { @@ -154,11 +153,11 @@ describe('Delegation', () => { dataToSign: alice.loveLetter, publicKey: bob.pkp?.publicKey, }, + }).finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); }); - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - // Expected output: // { // claims: {}, @@ -210,11 +209,11 @@ describe('Delegation', () => { toSign: alice.loveLetter, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain pubKey: bob.pkp?.publicKey!, + }).finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); }); - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - // Expected output: // { // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index f2efcff90a..8d016f857d 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -49,8 +49,7 @@ describe('PKP Ethers', () => { }); afterAll(async () => { - //@ts-expect-error defined in global - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); describe('Sign Message', () => { diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts index e0b1af3a7a..81cbd1c340 100644 --- a/packages/e2e-tests/src/tests/Relayer.spec.ts +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -24,8 +24,7 @@ describe('Relayer', () => { }); afterAll(async () => { - //@ts-expect-error global defined - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('Fetch PKPS', async () => { diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index 211d1eb53c..fda6daeccb 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -21,8 +21,7 @@ describe('Sol AuthSig', () => { }); afterAll(async () => { - //@ts-expect-error global defined - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('DecryptString', async () => { diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 756cc73e80..75d8264e0b 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -43,8 +43,7 @@ describe('SessionSigs', () => { }); afterAll(async () => { - //@ts-expect-error global defined - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); describe('DecryptString', () => { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 5fdebb5e0b..8ca5641e75 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -81,8 +81,7 @@ describe('Wrapped Keys', () => { }); afterAll(async () => { - //@ts-expect-error global defined - await global.devEnv.litNodeClient?.disconnect(); + await devEnv.litNodeClient?.disconnect(); }); it('Sign Tx Sol Encrypted Key', async () => { diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 38f947b8ea..212a40ca41 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -15,7 +15,7 @@ describe('Connections', () => { }); let devEnv: TinnyEnvironment; - beforeAll(async () => { + beforeAll(() => { //@ts-expect-error defined in global devEnv = global.devEnv; }); diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 452b8e48f9..1912af74b1 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -289,7 +289,7 @@ export class TinnyEnvironment { if (!this.litNodeClient.ready) { console.error('❌ litNodeClient not ready'); - process.exit(); + process.exit(1); } } From 7a66d3a7ff95cee3b431e363b296fb03596dacd6 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 13 Aug 2024 15:14:55 -0400 Subject: [PATCH 088/136] ref: tweaks for multiple jest standup ops in ci --- package.json | 2 +- packages/e2e-tests/setup.config.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ecf7e49d0..75c38a5a3d 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --all --code-coverage", - "test:e2e": "dotenvx run --env-file=.env -- nx run e2e-tests:test", + "test:e2e": "nx run e2e-tests:test", "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", "test:unit": "nx run-many --target=test", "test:unit:watch": "nx run-many --target=test --watch", diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index a89a9861da..0c18fdc831 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -6,6 +6,7 @@ */ const NodeEnvironment = require('jest-environment-node').TestEnvironment; + const TinnyEnvironment = require('@lit-protocol/tinny').TinnyEnvironment; require('dotenv').config(); From 493bf5175a1d5f480c6f190d93f51546232cfe9c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 08:59:30 -0400 Subject: [PATCH 089/136] ref: add flag for tinny setup --- packages/e2e-tests/setup.config.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index 0c18fdc831..e12ab5e499 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -13,14 +13,19 @@ require('dotenv').config(); console.log('loaded configuration from .env', __dirname); class CustomEnvironment extends NodeEnvironment { + _hasLoadedTinny = false; constructor(config) { super(config); } async setup() { + await super.setup(); - this.global.devEnv = new TinnyEnvironment(); - await this.global.devEnv.init(); + if (!this._hasLoadedTinny) { + this.global.devEnv = new TinnyEnvironment(); + await this.global.devEnv.init(); + this._hasLoadedTinny = true; + } } async teardown() { From 68de37f80676df7b4a922e9acc18d1b1826f4a10 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 09:13:16 -0400 Subject: [PATCH 090/136] ci: add sync flag --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c25ccbc247..aa7c67989b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,7 +86,7 @@ jobs: - name: End Tests Connection id: connection if: steps.build.outputs.exit_code == 0 - run: yarn test:e2e -t 'Connections' + run: yarn test:e2e --runInBand -t 'Connections' - name: End Tests Session Compaitiblity id: session if: steps.connection.outputs.exit_code == 0 From e3f97203a7ed333bd71831b2b2d1cd052726c97e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 10:15:43 -0400 Subject: [PATCH 091/136] dev: add key rlease to ethers and module caching --- .github/workflows/ci.yml | 24 ++++++++++++------- .../e2e-tests/src/tests/PKPEthers.spec.ts | 4 +++- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index aa7c67989b..28f85fdb53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,13 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Set up Node.js - uses: actions/setup-node@v3 + - uses: actions/checkout@v3 + - name: Use Node.js + uses: buildjet/setup-node@v3 with: - node-version: '20' - cache: 'yarn' + node-version: 20 + cache: yarn + cache-dependency-path: ${{ github.workspace }}/package-lock.json - name: Install project dependencies run: yarn --frozen-lockfile - uses: nrwl/nx-set-shas@v3 @@ -57,7 +59,13 @@ jobs: rust/lit-node - name: Check LA dir run: ls -la ${{github.workspace}}/lit-assets - - name: Install LA Blockchain Dependencies + - name: Setup Lit Bockchain Dependencies + uses: buildjet/setup-node@v3 + with: + node-version: 20 + cache: npm + cache-dependency-path: ${{ github.workspace }}/lit-assets/blockchain/contracts/package-lock.json + - name: Install Blockchain Deps run: npm i working-directory: ${{github.workspace}}/lit-assets/blockchain/contracts - name: Docker login @@ -83,15 +91,15 @@ jobs: run: yarn build:dev - name: Copy ENV File run: cp .env.ci .env - - name: End Tests Connection + - name: End to End Tests - Connection id: connection if: steps.build.outputs.exit_code == 0 run: yarn test:e2e --runInBand -t 'Connections' - - name: End Tests Session Compaitiblity + - name: End To End Tests - Session Compaitiblity id: session if: steps.connection.outputs.exit_code == 0 run: yarn test:e2e -t 'SessionSigs' - - name: End Tests PKP Ethers + - name: End to End Tests - PKP Ethers if: steps.session.outputs.exit_code == 0 id: pkp run: yarn test:e2e -t 'PKP Ethers' diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 8d016f857d..41ac678234 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -768,7 +768,9 @@ const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { expect( pkpEthersWallet.signMessage(alice.loveLetter) - ).resolves.not.toThrowError(); + ).resolves.not.toThrowError().finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const ethPersonalSign = async ( From 086308ed690dc9e4a1e175d7da51c328326ba9df Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 10:43:29 -0400 Subject: [PATCH 092/136] tests: release keys for pkp ethers tests --- .../e2e-tests/src/tests/PKPEthers.spec.ts | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 41ac678234..72a7407184 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -295,7 +295,9 @@ const ethTransaction = async ( expect(signature.length).toEqual(132); expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); }) - ).resolves.not.toThrowError(); + ).resolves.not.toThrowError().finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signTransaction = async ( @@ -533,10 +535,9 @@ const signTypedDataV1 = async ( alice.pkp?.ethAddress.toLowerCase() ); }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }) - ).resolves.not.toThrowError(); + ).resolves.not.toThrowError().finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signTypedDatav3 = async ( @@ -717,10 +718,9 @@ const signTypedDatav4 = async ( alice.pkp?.ethAddress.toLowerCase() ); }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }) - ).resolves.not.toThrow(); + ).resolves.not.toThrow().finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { @@ -824,8 +824,7 @@ const ethPersonalSign = async ( ); } }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }) - ).not.toThrowError(); + ).resolves.not.toThrowError().finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }) }; From 1ded6f9b9a76f19a57b74fb5cc7ac34267a1f042 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 12:24:58 -0400 Subject: [PATCH 093/136] ci: upgrade unit test --- .github/workflows/ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 28f85fdb53..94309e57ce 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,13 +18,16 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 + - uses: nrwl/nx-set-shas@v3 + with: + main-branch-name: 'master' - uses: actions/checkout@v3 - name: Use Node.js uses: buildjet/setup-node@v3 with: node-version: 20 cache: yarn - cache-dependency-path: ${{ github.workspace }}/package-lock.json + cache-dependency-path: ${{ github.workspace }}/yarn.lock - name: Install project dependencies run: yarn --frozen-lockfile - uses: nrwl/nx-set-shas@v3 @@ -33,7 +36,7 @@ jobs: - name: Build run: yarn build:dev - name: Run Unit tests - run: yarn tools --test --unit + run: yarn tools --test --unit integration-tests: runs-on: ubuntu-latest timeout-minutes: 30 From b3be5469fe54000fc28f88b32e0be6c3bc90d945 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 12:35:21 -0400 Subject: [PATCH 094/136] ci: change test ci runner --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 94309e57ce..c287e0a920 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Build run: yarn build:dev - name: Run Unit tests - run: yarn tools --test --unit + run: yarn test:ci integration-tests: runs-on: ubuntu-latest timeout-minutes: 30 From b6568c42c0e6e7dd3b7f0e18357acee6d166742b Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 19 Aug 2024 12:44:05 -0400 Subject: [PATCH 095/136] ci: update unit test runner --- .github/workflows/ci.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c287e0a920..ff02c00f30 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,11 +28,6 @@ jobs: node-version: 20 cache: yarn cache-dependency-path: ${{ github.workspace }}/yarn.lock - - name: Install project dependencies - run: yarn --frozen-lockfile - - uses: nrwl/nx-set-shas@v3 - with: - main-branch-name: 'master' - name: Build run: yarn build:dev - name: Run Unit tests From 32ba03b4255d9173078003f781209c1efc869f54 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 20 Aug 2024 09:26:39 -0400 Subject: [PATCH 096/136] ci: fix unit test runner --- .github/workflows/ci.yml | 2 ++ package.json | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ff02c00f30..a5070026f8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,6 +28,8 @@ jobs: node-version: 20 cache: yarn cache-dependency-path: ${{ github.workspace }}/yarn.lock + - name: Install Dependencies + run: yarn --frozen-lockfile - name: Build run: yarn build:dev - name: Run Unit tests diff --git a/package.json b/package.json index 75c38a5a3d..7fdffc5caa 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "bundles": "yarn node ./esbuilder/lit-connect-modal/esbuild.js", "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", - "test:ci": "nx affected --target=test --all --code-coverage", + "test:ci": "nx affected --target=test --code-coverage", "test:e2e": "nx run e2e-tests:test", "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", "test:unit": "nx run-many --target=test", From 47f3bbd2d4b2e44f4dad9a21034a98adff0a21d6 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 20 Aug 2024 11:33:20 -0400 Subject: [PATCH 097/136] ref: fix unit tests --- jest.preset.js | 2 +- package.json | 6 +- .../helpers/validate-bls-session-sigs.spec.ts | 12 +- .../src/lib/lit-node-client-nodejs.spec.ts | 16 +- .../src/lib/pkp-walletconnect.spec.ts | 6 +- packages/tinny/src/lib/tinny.spec.ts | 6 +- packages/wrapped-keys/src/lib/utils.spec.ts | 22 +- yarn.lock | 202 +----------------- 8 files changed, 49 insertions(+), 223 deletions(-) diff --git a/jest.preset.js b/jest.preset.js index abdfc7a088..6d72299174 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -13,7 +13,7 @@ module.exports = { { tsconfig: '/tsconfig.spec.json' }, ], }, - testEnvironment: 'jsdom', + testEnvironment: 'node', maxWorkers: 10, /** * manually set the exports names to load in common js, to mimic the behaviors of jest 27 diff --git a/package.json b/package.json index 7fdffc5caa..6247ae8710 100644 --- a/package.json +++ b/package.json @@ -15,10 +15,10 @@ "bundles": "yarn node ./esbuilder/lit-connect-modal/esbuild.js", "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", - "test:ci": "nx affected --target=test --code-coverage", + "test:ci": "nx affected --target=test --exclude=e2e-tests --code-coverage", "test:e2e": "nx run e2e-tests:test", "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", - "test:unit": "nx run-many --target=test", + "test:unit": "nx run-many --target=test --exclude=e2e-tests", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", "publish:packages": "yarn node ./tools/scripts/pub.mjs --prod", @@ -124,7 +124,7 @@ "inquirer": "^9.2.21", "ipfs-unixfs-importer": "12.0.1", "jest": "29.7.0", - "jest-environment-jsdom": "^29.7.0", + "jest-environment-node": "^29.7.0", "lerna": "^5.4.3", "live-server": "^1.2.2", "node-fetch": "^2.6.1", diff --git a/packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts b/packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts index f1563339e8..6e9ccd8fdb 100644 --- a/packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts +++ b/packages/lit-node-client-nodejs/src/lib/helpers/validate-bls-session-sigs.spec.ts @@ -1,3 +1,5 @@ +import { SiweMessage } from 'siwe'; + import { blsSessionSigVerify } from './validate-bls-session-sig'; describe('BlsSessionSigVerify', () => { @@ -16,25 +18,27 @@ describe('BlsSessionSigVerify', () => { 'Chain ID: 1\n' + 'Nonce: 0x1f623ab8dfe6bbd3b3dc22c7a041deb697c14817bce471b1bd1d86a25d5a319c\n' + 'Issued At: 2024-06-11T15:55:23Z\n' + - 'Expiration Time: 2024-06-12T15:55:47.655Z\n' + + 'Expiration Time: 2030-06-12T15:55:47.655Z\n' + 'Resources:\n' + '- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1ZM3F1bjlxWDNmVUJIVmZyQTlmM3Y5UnB5eVBvOFJIRXVFTjFYWVBxMVByQSJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTgyMDc3MzgsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4NjEwM2U1MGUyQzA0OWM5MjgxNEE1Mjc1YURDZDlBNzE2NjY3OTUxZSJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6InRydWUiLCJyZXNvdXJjZXMiOltdfX1dfX0sInByZiI6W119', address: '0xf087a967D9eA9445D9182692C2944DcC0Af57341', }; - let networkPubKey = + const networkPubKey = 'a43499a4b786da2dd28af9f209eb152ff6f646b34b68a02954967271e17fb4c511fd67b81e067f690c6f38acab70585d'; + const message = new SiweMessage(authSig.signedMessage); it(`should verify valid bls signatrue`, () => { expect( blsSessionSigVerify( - (public_key: any, message: any, signature: any) => { + (public_key, message, signature) => { expect(typeof public_key).toBe('string'); expect(typeof message).toBe('string'); expect(typeof signature).toBe('string'); }, networkPubKey, - authSig + authSig, + message ) ).toBeUndefined(); }); diff --git a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.spec.ts b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.spec.ts index 74068b2e2a..cd51305c84 100644 --- a/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.spec.ts +++ b/packages/lit-node-client-nodejs/src/lib/lit-node-client-nodejs.spec.ts @@ -6,6 +6,7 @@ global.jestTesting = true; import { LitNodeClientNodeJs } from './lit-node-client-nodejs'; +import { LocalStorage } from 'node-localstorage'; const isClass = (v) => { return typeof v === 'function' && /^\s*class\s+/.test(v.toString()); @@ -41,16 +42,23 @@ describe('LitNodeClientNodeJs', () => { it('should be able to defined a storage provider', async () => { const tmp = globalThis.localStorage; - Object.defineProperty(globalThis, 'localStorage', { value: undefined }); - const ls = require('node-localstorage').LocalStorage; + Object.defineProperty(globalThis, 'localStorage', { + value: undefined, + configurable: true, + }); + const litNodeClient = new LitNodeClientNodeJs({ litNetwork: 'custom', storageProvider: { - provider: new ls('./storage.test.db'), + provider: new LocalStorage('./storage.test.db'), }, }); expect(litNodeClient).toBeDefined(); - expect(litNodeClient.config.storageProvider?.provider).toBeInstanceOf(ls); + expect(litNodeClient.config.storageProvider?.provider).toBeInstanceOf( + LocalStorage + ); + + //@ts-expect-error redefine ls Object.defineProperty(globalThis, 'localStorage', { value: tmp }); }); diff --git a/packages/pkp-walletconnect/src/lib/pkp-walletconnect.spec.ts b/packages/pkp-walletconnect/src/lib/pkp-walletconnect.spec.ts index 9e3b10aedf..be19e80914 100644 --- a/packages/pkp-walletconnect/src/lib/pkp-walletconnect.spec.ts +++ b/packages/pkp-walletconnect/src/lib/pkp-walletconnect.spec.ts @@ -1,13 +1,14 @@ // @ts-expect-error - set global variable for testing global.jestTesting = true; -import * as LITCONFIG from 'lit.config.json'; -import { PKPClient } from '@lit-protocol/pkp-client'; import { Core } from '@walletconnect/core'; import { SignClientTypes } from '@walletconnect/types'; import { getSdkError } from '@walletconnect/utils'; import { Web3Wallet } from '@walletconnect/web3wallet'; +import { LitNodeClientNodeJs } from '@lit-protocol/lit-node-client-nodejs'; +import { PKPClient } from '@lit-protocol/pkp-client'; + import { PKPWalletConnect } from './pkp-walletconnect'; const LITCONFIG = { @@ -40,6 +41,7 @@ describe('PKPWalletConnect', () => { controllerAuthSig: LITCONFIG.CONTROLLER_AUTHSIG, pkpPubKey: PKP_PUBKEY, cosmosAddressPrefix: 'cosmos', + litNodeClient: new LitNodeClientNodeJs({ litNetwork: 'cayenne' }), }); pkpWalletConnect = new PKPWalletConnect(true); diff --git a/packages/tinny/src/lib/tinny.spec.ts b/packages/tinny/src/lib/tinny.spec.ts index d3e628e323..4fb4fc49eb 100644 --- a/packages/tinny/src/lib/tinny.spec.ts +++ b/packages/tinny/src/lib/tinny.spec.ts @@ -1,7 +1,7 @@ -import { tinny } from './tinny'; +import { TinnyEnvironment } from './tinny-environment'; describe('tinny', () => { - it('should work', () => { - expect(tinny()).toEqual('tinny'); + it('Tinny eviorment should be defined', () => { + expect(TinnyEnvironment).toBeDefined(); }); }); diff --git a/packages/wrapped-keys/src/lib/utils.spec.ts b/packages/wrapped-keys/src/lib/utils.spec.ts index 24dfe55b4f..6cd3762b64 100644 --- a/packages/wrapped-keys/src/lib/utils.spec.ts +++ b/packages/wrapped-keys/src/lib/utils.spec.ts @@ -87,19 +87,17 @@ describe('getPkpAccessControlCondition', () => { it('should correctly create the ACC', () => { const pkpAddress = '0xd1Af1AAC50aC837C873200D17b78664aFCde597C'; const acc = getPkpAccessControlCondition(pkpAddress); - expect(acc).toEqual([ - { - contractAddress: '', - standardContractType: '', - chain: CHAIN_ETHEREUM, - method: '', - parameters: [':userAddress'], - returnValueTest: { - comparator: '=', - value: pkpAddress, - }, + expect(acc).toEqual({ + contractAddress: '', + standardContractType: '', + chain: CHAIN_ETHEREUM, + method: '', + parameters: [':userAddress'], + returnValueTest: { + comparator: '=', + value: pkpAddress, }, - ]); + }); }); it('should throw an error for non-Ethereum address', () => { diff --git a/yarn.lock b/yarn.lock index 2d832dfa4e..2be9c66fab 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5319,15 +5319,6 @@ jest-matcher-utils "^27.0.0" pretty-format "^27.0.0" -"@types/jsdom@^20.0.0": - version "20.0.1" - resolved "https://registry.yarnpkg.com/@types/jsdom/-/jsdom-20.0.1.tgz#07c14bc19bd2f918c1929541cdaacae894744808" - integrity sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ== - dependencies: - "@types/node" "*" - "@types/tough-cookie" "*" - parse5 "^7.0.0" - "@types/json-schema@^7.0.12", "@types/json-schema@^7.0.8", "@types/json-schema@^7.0.9": version "7.0.15" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841" @@ -5445,11 +5436,6 @@ resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== -"@types/tough-cookie@*": - version "4.0.5" - resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.5.tgz#cb6e2a691b70cb177c6e3ae9c1d2e8b2ea8cd304" - integrity sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA== - "@types/triple-beam@^1.3.2": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/triple-beam/-/triple-beam-1.3.5.tgz#74fef9ffbaa198eb8b588be029f38b00299caa2c" @@ -6220,11 +6206,6 @@ JSONStream@^1.0.4, JSONStream@^1.3.5: jsonparse "^1.2.0" through ">=2.2.7 <3" -abab@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" - integrity sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA== - abbrev@1, abbrev@^1.0.0, abbrev@~1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" @@ -6278,20 +6259,12 @@ accepts@~1.3.4, accepts@~1.3.5, accepts@~1.3.8: mime-types "~2.1.34" negotiator "0.6.3" -acorn-globals@^7.0.0: - version "7.0.1" - resolved "https://registry.yarnpkg.com/acorn-globals/-/acorn-globals-7.0.1.tgz#0dbf05c44fa7c94332914c02066d5beff62c40c3" - integrity sha512-umOSDSDrfHbTNPuNpC2NSnnA3LUrqpevPb4T9jRx4MagXNS0rs+gwiTcAvqCRmsD6utzsrzNt+ebm00SNWiC3Q== - dependencies: - acorn "^8.1.0" - acorn-walk "^8.0.2" - acorn-jsx@^5.3.1, acorn-jsx@^5.3.2: version "5.3.2" resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937" integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ== -acorn-walk@^8.0.2, acorn-walk@^8.1.1: +acorn-walk@^8.1.1: version "8.3.3" resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.3.3.tgz#9caeac29eefaa0c41e3d4c65137de4d6f34df43e" integrity sha512-MxXdReSRhGO7VlFe1bRG/oI7/mdLV9B9JJT0N8vZOhF7gFRR5l3M8W9G8JxmKV+JC5mGqJ0QvqfSOLsCPa4nUw== @@ -6303,7 +6276,7 @@ acorn@^7.4.0: resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.4.1.tgz#feaed255973d2e77555b83dbc08851a6c63520fa" integrity sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A== -acorn@^8.1.0, acorn@^8.11.0, acorn@^8.8.1: +acorn@^8.11.0: version "8.12.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-8.12.1.tgz#71616bdccbe25e27a54439e0046e89ca76df2248" integrity sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg== @@ -9649,23 +9622,6 @@ csso@^5.0.5: dependencies: css-tree "~2.2.0" -cssom@^0.5.0: - version "0.5.0" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.5.0.tgz#d254fa92cd8b6fbd83811b9fbaed34663cc17c36" - integrity sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw== - -cssom@~0.3.6: - version "0.3.8" - resolved "https://registry.yarnpkg.com/cssom/-/cssom-0.3.8.tgz#9f1276f5b2b463f2114d3f2c75250af8c1a36f4a" - integrity sha512-b0tGHbfegbhPJpxpiBPU2sCkigAqtM9O121le6bbOlgyV+NyGyCmVfJ6QW9eRjz8CpNfWEOYBIMIGRYkLwsIYg== - -cssstyle@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/cssstyle/-/cssstyle-2.3.0.tgz#ff665a0ddbdc31864b09647f34163443d90b0852" - integrity sha512-AZL67abkUzIuvcHqk7c09cezpGNcxUxU4Ioi/05xHk4DQeTkWmGYftIE6ctU6AEt+Gn4n1lDStOtj7FKycP71A== - dependencies: - cssom "~0.3.6" - cuint@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/cuint/-/cuint-0.2.2.tgz#408086d409550c2631155619e9fa7bcadc3b991b" @@ -9884,15 +9840,6 @@ dashdash@^1.12.0: dependencies: assert-plus "^1.0.0" -data-urls@^3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/data-urls/-/data-urls-3.0.2.tgz#9cf24a477ae22bcef5cd5f6f0bfbc1d2d3be9143" - integrity sha512-Jy/tj3ldjZJo63sVAvg6LHt2mHvl4V6AgRAmNDtLdm7faqtsx+aJG42rsyCo9JCoRVKwPFzKlIPx3DIibwSIaQ== - dependencies: - abab "^2.0.6" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - data-view-buffer@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/data-view-buffer/-/data-view-buffer-1.0.1.tgz#8ea6326efec17a2e42620696e671d7d5a8bc66b2" @@ -9995,11 +9942,6 @@ decamelize@^1.1.0, decamelize@^1.1.1, decamelize@^1.2.0: resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290" integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== -decimal.js@^10.4.2: - version "10.4.3" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.3.tgz#1044092884d245d1b7f65725fa4ad4c6f781cc23" - integrity sha512-VBBaLc1MgL5XpzgIP7ny5Z6Nx3UrRkIViUkPUdtl9aya5amy3De1gsUUSB1g3+3sExYNjCAsAznmukyxCb1GRA== - decode-uri-component@^0.2.0, decode-uri-component@^0.2.2: version "0.2.2" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.2.tgz#e69dbe25d37941171dd540e024c444cd5188e1e9" @@ -10432,13 +10374,6 @@ domelementtype@^2.0.1, domelementtype@^2.2.0, domelementtype@^2.3.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.3.0.tgz#5c45e8e869952626331d7aab326d01daf65d589d" integrity sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw== -domexception@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/domexception/-/domexception-4.0.0.tgz#4ad1be56ccadc86fc76d033353999a8037d03673" - integrity sha512-A2is4PLG+eeSfoTMA95/s4pvAoSo2mKtiM5jlHkAVewmiO8ISFTFKZjH7UAM1Atli/OT/7JHOrJRJiMKUZKYBw== - dependencies: - webidl-conversions "^7.0.0" - domhandler@^4.0.0, domhandler@^4.2.0, domhandler@^4.3.1: version "4.3.1" resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.3.1.tgz#8d792033416f59d68bc03a5aa7b018c1ca89279c" @@ -11072,17 +11007,6 @@ escape-string-regexp@^4.0.0: resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz#14ba83a5d373e3d311e5afca29cf5bfad965bf34" integrity sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA== -escodegen@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-2.1.0.tgz#ba93bbb7a43986d29d6041f99f5262da773e2e17" - integrity sha512-2NlIDTwUWJN0mRPQOdtQBzbUHvdGY2P1VXSyU83Q3xKxM7WHX2Ql8dKq782Q9TgQUNOLEzEYu9bzLNj1q88I5w== - dependencies: - esprima "^4.0.1" - estraverse "^5.2.0" - esutils "^2.0.2" - optionalDependencies: - source-map "~0.6.1" - eslint-config-next@12.2.3: version "12.2.3" resolved "https://registry.yarnpkg.com/eslint-config-next/-/eslint-config-next-12.2.3.tgz#468fe9756ccbf7e4452139062db5b4e6557dc885" @@ -11482,7 +11406,7 @@ espree@^9.0.0, espree@^9.6.0, espree@^9.6.1: acorn-jsx "^5.3.2" eslint-visitor-keys "^3.4.1" -esprima@^4.0.0, esprima@^4.0.1, esprima@~4.0.0: +esprima@^4.0.0, esprima@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -13903,7 +13827,7 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha512-J+FkSdyD+0mA0N+81tMotaRMfSL9SGi+xpD3T6YApKsc3bGSXJlfXri3VyFOeYkfLRQisDk1W+jIFFKBeUBbBg== -https-proxy-agent@^5.0.0, https-proxy-agent@^5.0.1: +https-proxy-agent@^5.0.0: version "5.0.1" resolved "https://registry.yarnpkg.com/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz#c59ef224a04fe8b754f3db0063a25ea30d0005d6" integrity sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA== @@ -14670,11 +14594,6 @@ is-port-reachable@4.0.0: resolved "https://registry.yarnpkg.com/is-port-reachable/-/is-port-reachable-4.0.0.tgz#dac044091ef15319c8ab2f34604d8794181f8c2d" integrity sha512-9UoipoxYmSk6Xy7QFgRv2HDyaysmgSG75TFQs6S+3pDM7ZhKTF/bskZV+0UlABHzKjNVhPjYCLfeZUEg1wXxig== -is-potential-custom-element-name@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz#171ed6f19e3ac554394edf78caa05784a45bebb5" - integrity sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ== - is-regex@^1.1.4, is-regex@~1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" @@ -15178,20 +15097,6 @@ jest-each@^29.7.0: jest-util "^29.7.0" pretty-format "^29.7.0" -jest-environment-jsdom@^29.7.0: - version "29.7.0" - resolved "https://registry.yarnpkg.com/jest-environment-jsdom/-/jest-environment-jsdom-29.7.0.tgz#d206fa3551933c3fd519e5dfdb58a0f5139a837f" - integrity sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA== - dependencies: - "@jest/environment" "^29.7.0" - "@jest/fake-timers" "^29.7.0" - "@jest/types" "^29.6.3" - "@types/jsdom" "^20.0.0" - "@types/node" "*" - jest-mock "^29.7.0" - jest-util "^29.7.0" - jsdom "^20.0.0" - jest-environment-node@^29.7.0: version "29.7.0" resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376" @@ -15591,38 +15496,6 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg== -jsdom@^20.0.0: - version "20.0.3" - resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-20.0.3.tgz#886a41ba1d4726f67a8858028c99489fed6ad4db" - integrity sha512-SYhBvTh89tTfCD/CRdSOm13mOBa42iTaTyfyEWBdKcGdPxPtLFBXuHR8XHb33YNYaP+lLbmSvBTsnoesCNJEsQ== - dependencies: - abab "^2.0.6" - acorn "^8.8.1" - acorn-globals "^7.0.0" - cssom "^0.5.0" - cssstyle "^2.3.0" - data-urls "^3.0.2" - decimal.js "^10.4.2" - domexception "^4.0.0" - escodegen "^2.0.0" - form-data "^4.0.0" - html-encoding-sniffer "^3.0.0" - http-proxy-agent "^5.0.0" - https-proxy-agent "^5.0.1" - is-potential-custom-element-name "^1.0.1" - nwsapi "^2.2.2" - parse5 "^7.1.1" - saxes "^6.0.0" - symbol-tree "^3.2.4" - tough-cookie "^4.1.2" - w3c-xmlserializer "^4.0.0" - webidl-conversions "^7.0.0" - whatwg-encoding "^2.0.0" - whatwg-mimetype "^3.0.0" - whatwg-url "^11.0.0" - ws "^8.11.0" - xml-name-validator "^4.0.0" - jsesc@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/jsesc/-/jsesc-1.3.0.tgz#46c3fec8c1892b12b0833db9bc7622176dbab34b" @@ -18075,11 +17948,6 @@ number-to-bn@1.7.0: bn.js "4.11.6" strip-hex-prefix "1.0.0" -nwsapi@^2.2.2: - version "2.2.12" - resolved "https://registry.yarnpkg.com/nwsapi/-/nwsapi-2.2.12.tgz#fb6af5c0ec35b27b4581eb3bbad34ec9e5c696f8" - integrity sha512-qXDmcVlZV4XRtKFzddidpfVP4oMSGhga+xdMc25mv8kaLUHtgzCDhUxkrN8exkGdTlLNaXj7CV3GtON7zuGZ+w== - nx@15.9.7, "nx@>=14.8.1 < 16": version "15.9.7" resolved "https://registry.yarnpkg.com/nx/-/nx-15.9.7.tgz#f0e713cedb8637a517d9c4795c99afec4959a1b6" @@ -18828,7 +18696,7 @@ parse5-htmlparser2-tree-adapter@^7.0.0: domhandler "^5.0.2" parse5 "^7.0.0" -parse5@^7.0.0, parse5@^7.1.1: +parse5@^7.0.0: version "7.1.2" resolved "https://registry.yarnpkg.com/parse5/-/parse5-7.1.2.tgz#0736bebbfd77793823240a23b7fc5e010b7f8e32" integrity sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw== @@ -20459,13 +20327,6 @@ safe-stable-stringify@^2.1.0, safe-stable-stringify@^2.3.1: resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -saxes@^6.0.0: - version "6.0.0" - resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5" - integrity sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA== - dependencies: - xmlchars "^2.2.0" - scheduler@^0.21.0: version "0.21.0" resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820" @@ -21128,7 +20989,7 @@ source-map@^0.5.6, source-map@^0.5.7: resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" integrity sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ== -source-map@^0.6.0, source-map@^0.6.1, source-map@~0.6.1: +source-map@^0.6.0, source-map@^0.6.1: version "0.6.1" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== @@ -21798,11 +21659,6 @@ symbol-observable@^2.0.3: resolved "https://registry.yarnpkg.com/symbol-observable/-/symbol-observable-2.0.3.tgz#5b521d3d07a43c351055fa43b8355b62d33fd16a" integrity sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA== -symbol-tree@^3.2.4: - version "3.2.4" - resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2" - integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw== - synthetix-js@^2.74.1: version "2.101.2" resolved "https://registry.yarnpkg.com/synthetix-js/-/synthetix-js-2.101.2.tgz#9394967368fcf8183743a4b05d49889fd7fdbd21" @@ -22146,7 +22002,7 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -tough-cookie@^4.1.2, tough-cookie@^4.1.3: +tough-cookie@^4.1.3: version "4.1.4" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36" integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag== @@ -22171,13 +22027,6 @@ toxic@^1.0.0: dependencies: lodash "^4.17.10" -tr46@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" - integrity sha512-l7FvfAHlcmulp8kr+flpQZmVwtu7nfRV7NZujtN0OqES8EL4O4e0qqzL0DC5gAvx/ZC/9lk6rhcUwYvkBnBnYA== - dependencies: - punycode "^2.1.1" - tr46@~0.0.3: version "0.0.3" resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a" @@ -23065,13 +22914,6 @@ vscode-textmate@^8.0.0: resolved "https://registry.yarnpkg.com/vscode-textmate/-/vscode-textmate-8.0.0.tgz#2c7a3b1163ef0441097e0b5d6389cd5504b59e5d" integrity sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg== -w3c-xmlserializer@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/w3c-xmlserializer/-/w3c-xmlserializer-4.0.0.tgz#aebdc84920d806222936e3cdce408e32488a3073" - integrity sha512-d+BFHzbiCx6zGfz0HyQ6Rg69w9k19nviJspaj4yNscGjrHu94sVP+aRm75yEbCh+r2/yR+7q6hux9LVtbuTGBw== - dependencies: - xml-name-validator "^4.0.0" - wait-on@7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/wait-on/-/wait-on-7.0.1.tgz#5cff9f8427e94f4deacbc2762e6b0a489b19eae9" @@ -23425,11 +23267,6 @@ webidl-conversions@^3.0.0: resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871" integrity sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ== -webidl-conversions@^7.0.0: - version "7.0.0" - resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-7.0.0.tgz#256b4e1882be7debbf01d05f0aa2039778ea080a" - integrity sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g== - webpack-merge@^5.8.0: version "5.10.0" resolved "https://registry.yarnpkg.com/webpack-merge/-/webpack-merge-5.10.0.tgz#a3ad5d773241e9c682803abf628d4cd62b8a4177" @@ -23482,19 +23319,6 @@ whatwg-fetch@^3.0.0, whatwg-fetch@^3.4.1: resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-3.6.20.tgz#580ce6d791facec91d37c72890995a0b48d31c70" integrity sha512-EqhiFU6daOA8kpjOWTL0olhVOF3i7OrFzSYiGsEMB8GcXS+RrzauAERX65xMeNWVqxA6HXH2m69Z9LaKKdisfg== -whatwg-mimetype@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-3.0.0.tgz#5fa1a7623867ff1af6ca3dc72ad6b8a4208beba7" - integrity sha512-nt+N2dzIutVRxARx1nghPKGv1xHikU7HKdfafKkLNLindmPU/ch3U31NOCGGA/dmPcmb1VlofO0vnKAcsm0o/Q== - -whatwg-url@^11.0.0: - version "11.0.0" - resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-11.0.0.tgz#0a849eebb5faf2119b901bb76fd795c2848d4018" - integrity sha512-RKT8HExMpoYx4igMiVMY83lN6UeITKJlBQ+vR/8ZJ8OCdSiN3RwCq+9gH0+Xzj0+5IrM6i4j/6LuvzbZIQgEcQ== - dependencies: - tr46 "^3.0.0" - webidl-conversions "^7.0.0" - whatwg-url@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d" @@ -23797,7 +23621,7 @@ ws@^7.5.10: resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9" integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ== -ws@^8.11.0, ws@^8.5.0: +ws@^8.5.0: version "8.18.0" resolved "https://registry.yarnpkg.com/ws/-/ws-8.18.0.tgz#0d7505a6eafe2b0e712d232b42279f53bc289bbc" integrity sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw== @@ -23844,16 +23668,6 @@ xhr@^2.0.4, xhr@^2.2.0, xhr@^2.3.3: parse-headers "^2.0.0" xtend "^4.0.0" -xml-name-validator@^4.0.0: - version "4.0.0" - resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-4.0.0.tgz#79a006e2e63149a8600f15430f0a4725d1524835" - integrity sha512-ICP2e+jsHvAj2E2lIHxa5tjXRlKDJo4IdvPvCXbXQGdzSfmSpNVyIKMvoZHjDY9DP0zV17iI85o90vRFXNccRw== - -xmlchars@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb" - integrity sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw== - xmlhttprequest@1.8.0: version "1.8.0" resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc" From e5a9294ae453e3090cc169498918f058ba41f9ab Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 20 Aug 2024 11:33:30 -0400 Subject: [PATCH 098/136] ref: fmt --- packages/core/src/lib/lit-core.ts | 1 + packages/e2e-tests/setup.config.js | 1 - .../e2e-tests/src/tests/Delegation.spec.ts | 44 ++++--- .../e2e-tests/src/tests/PKPEthers.spec.ts | 123 +++++++++--------- packages/tinny/src/lib/tinny-environment.ts | 6 +- 5 files changed, 91 insertions(+), 84 deletions(-) diff --git a/packages/core/src/lib/lit-core.ts b/packages/core/src/lib/lit-core.ts index 835e82a6bd..d98046f513 100644 --- a/packages/core/src/lib/lit-core.ts +++ b/packages/core/src/lib/lit-core.ts @@ -203,6 +203,7 @@ export class LitCore { // if the user wants to override the storage option explicitly we override. Object.defineProperty(globalThis, 'localStorage', { value: this.config.storageProvider?.provider, + configurable: true, }); } else if ( isNode() && diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index e12ab5e499..c5bbf01387 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -19,7 +19,6 @@ class CustomEnvironment extends NodeEnvironment { } async setup() { - await super.setup(); if (!this._hasLoadedTinny) { this.global.devEnv = new TinnyEnvironment(); diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 48d5a596f5..2ff1aaef03 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -140,23 +140,25 @@ describe('Delegation', () => { bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { + const res = await devEnv.litNodeClient + ?.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, publicKey, sigName: "sig", }); })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp?.publicKey, - }, - }).finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - }); + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp?.publicKey, + }, + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + }); // Expected output: // { @@ -204,15 +206,17 @@ describe('Delegation', () => { ); // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient?.pkpSign({ - sessionSigs: bobsSessionSigs!, - toSign: alice.loveLetter, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain - pubKey: bob.pkp?.publicKey!, - }).finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - }); + const res = await devEnv.litNodeClient + ?.pkpSign({ + sessionSigs: bobsSessionSigs!, + toSign: alice.loveLetter, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain + pubKey: bob.pkp?.publicKey!, + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); + }); // Expected output: // { diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 72a7407184..2f09ae464b 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -295,9 +295,11 @@ const ethTransaction = async ( expect(signature.length).toEqual(132); expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); }) - ).resolves.not.toThrowError().finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ) + .resolves.not.toThrowError() + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signTransaction = async ( @@ -518,26 +520,27 @@ const signTypedDataV1 = async ( method: 'eth_signTypedData_v1', params: [msgParams, alice.pkp?.ethAddress], }, + }).then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: msgParams, + signature: signature, + version: SignTypedDataVersion.V1, + }); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); }) - .then((signature: string) => { - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signature, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }) - ).resolves.not.toThrowError().finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ) + .resolves.not.toThrowError() + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signTypedDatav3 = async ( @@ -704,23 +707,24 @@ const signTypedDatav4 = async ( method: 'eth_signTypedData_v4', params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], }, - }) - .then((signature: string) => { - const recoveredAddr = recoverTypedSignature({ - data: msgParams as TypedMessage, - signature: signature, - version: SignTypedDataVersion.V4, - }); + }).then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: msgParams as TypedMessage, + signature: signature, + version: SignTypedDataVersion.V4, + }); - expect(signature.length).toEqual(132); + expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }) - ).resolves.not.toThrow().finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + ) + .resolves.not.toThrow() + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { @@ -766,11 +770,11 @@ const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { await pkpEthersWallet.init(); - expect( - pkpEthersWallet.signMessage(alice.loveLetter) - ).resolves.not.toThrowError().finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + expect(pkpEthersWallet.signMessage(alice.loveLetter)) + .resolves.not.toThrowError() + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; const ethPersonalSign = async ( @@ -809,22 +813,23 @@ const ethPersonalSign = async ( method: 'personal_sign', params: [hexMsg, alice.pkp?.ethAddress], }, + }).then((signature: string) => { + const recoveredAddr = ethers.utils.verifyMessage(message, signature); + + // ==================== Post-Validation ==================== + if (signature.length !== 132) { + throw new Error('❌ signature should be 132 characters long'); + } + + if (recoveredAddr !== alice.pkp?.ethAddress) { + throw new Error( + `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` + ); + } }) - .then((signature: string) => { - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp?.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` - ); - } - }) - ).resolves.not.toThrowError().finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }) + ) + .resolves.not.toThrowError() + .finally(() => { + devEnv.releasePrivateKeyFromUser(alice); + }); }; diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 1912af74b1..a76af55cbb 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -529,9 +529,8 @@ export class TinnyEnvironment { '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = + const capacityTokenId = //@ts-expect-error client is defined ( - //@ts-expect-error client is defined await this.contractsClient.mintCapacityCreditsNFT({ requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, @@ -539,9 +538,8 @@ export class TinnyEnvironment { ).capacityTokenIdStr; try { - this.superCapacityDelegationAuthSig = + this.superCapacityDelegationAuthSig = //@ts-expect-error client is defined ( - //@ts-expect-error client is defined await this.litNodeClient.createCapacityDelegationAuthSig({ dAppOwnerWallet: wallet, capacityTokenId: capacityTokenId, From 9e3bd1aaa5ca8504c6ca76f3ed7d838a8478f2c3 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 20 Aug 2024 11:39:22 -0400 Subject: [PATCH 099/136] ref: fix ts-expect --- packages/tinny/src/lib/tinny-environment.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index a76af55cbb..1912af74b1 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -529,8 +529,9 @@ export class TinnyEnvironment { '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = //@ts-expect-error client is defined + const capacityTokenId = ( + //@ts-expect-error client is defined await this.contractsClient.mintCapacityCreditsNFT({ requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, @@ -538,8 +539,9 @@ export class TinnyEnvironment { ).capacityTokenIdStr; try { - this.superCapacityDelegationAuthSig = //@ts-expect-error client is defined + this.superCapacityDelegationAuthSig = ( + //@ts-expect-error client is defined await this.litNodeClient.createCapacityDelegationAuthSig({ dAppOwnerWallet: wallet, capacityTokenId: capacityTokenId, From 05d22698e0fac5a7dfafd3f5a6ff61ee7a6a0cb7 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 20 Aug 2024 12:07:02 -0400 Subject: [PATCH 100/136] ref: refactor blocking calls for formatting --- packages/tinny/src/lib/tinny-environment.ts | 33 ++++++++++----------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 1912af74b1..131aecc098 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -529,26 +529,23 @@ export class TinnyEnvironment { '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = - ( - //@ts-expect-error client is defined - await this.contractsClient.mintCapacityCreditsNFT({ - requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - ).capacityTokenIdStr; + //@ts-expect-error client is defined + const capacityNft = await this.contractsClient.mintCapacityCreditsNFT({ + requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, + daysUntilUTCMidnightExpiration: 2, + }); + const capacityTokenId = capacityNft.capacityTokenIdStr; try { - this.superCapacityDelegationAuthSig = - ( - //@ts-expect-error client is defined - await this.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: wallet, - capacityTokenId: capacityTokenId, - // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it - uses: '200', - }) - ).capacityDelegationAuthSig; + //@ts-expect-error client is defined + const resp = await this.litNodeClient.createCapacityDelegationAuthSig({ + dAppOwnerWallet: wallet, + capacityTokenId: capacityTokenId, + // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it + uses: '200', + }); + + this.superCapacityDelegationAuthSig = resp.capacityDelegationAuthSig; } catch (e: unknown) { if ( (e as Error).message.includes( From 601aaf5fa5c6ba298cb53b36fda3a5bdb9a66e8a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 08:30:47 -0400 Subject: [PATCH 101/136] test: add mocks for console logging in logger spec --- packages/logger/src/lib/logger.spec.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index 55b0772618..52d8c308c5 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -1,10 +1,25 @@ -import { Logger, LogLevel, LogManager } from './logger'; +import { LogLevel, LogManager } from './logger'; describe('logger', () => { let lm: LogManager; beforeEach(() => { LogManager.clearInstance(); lm = LogManager.Instance; + + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'warn').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'info').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'debug').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'error').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'timeLog').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'time').mockImplementation(() => {}); + // eslint-disable-next-line @typescript-eslint/no-empty-function + jest.spyOn(console, 'log').mockImplementation(() => {}); }); it('Log Manager singleton should be defined', () => { From 83fde6bca35101678f3974f3051af7dc6d622522 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 08:33:26 -0400 Subject: [PATCH 102/136] dev: remove tinny from e2e tests --- packages/e2e-tests/setup/accs/accs.ts | 68 - .../setup/networkContext.example.json | 11268 --------------- packages/e2e-tests/setup/networkContext.json | 11370 ---------------- .../session-sigs/get-eoa-session-sigs.ts | 156 - .../get-lit-action-session-sigs.ts | 167 - .../session-sigs/get-pkp-session-sigs.ts | 47 - packages/e2e-tests/setup/shiva-client.d.ts | 72 - packages/e2e-tests/setup/shiva-client.ts | 299 - packages/e2e-tests/setup/tinny-config.ts | 141 - packages/e2e-tests/setup/tinny-environment.ts | 534 - packages/e2e-tests/setup/tinny-person.ts | 220 - packages/e2e-tests/setup/tinny-utils.ts | 65 - 12 files changed, 24407 deletions(-) delete mode 100644 packages/e2e-tests/setup/accs/accs.ts delete mode 100644 packages/e2e-tests/setup/networkContext.example.json delete mode 100644 packages/e2e-tests/setup/networkContext.json delete mode 100644 packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts delete mode 100644 packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts delete mode 100644 packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts delete mode 100644 packages/e2e-tests/setup/shiva-client.d.ts delete mode 100644 packages/e2e-tests/setup/shiva-client.ts delete mode 100644 packages/e2e-tests/setup/tinny-config.ts delete mode 100644 packages/e2e-tests/setup/tinny-environment.ts delete mode 100644 packages/e2e-tests/setup/tinny-person.ts delete mode 100644 packages/e2e-tests/setup/tinny-utils.ts diff --git a/packages/e2e-tests/setup/accs/accs.ts b/packages/e2e-tests/setup/accs/accs.ts deleted file mode 100644 index db07c7dec1..0000000000 --- a/packages/e2e-tests/setup/accs/accs.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - LPACC_EVM_ATOM, - LPACC_EVM_BASIC, - LPACC_SOL, -} from '@lit-protocol/accs-schemas'; - -export namespace AccessControlConditions { - export const getEmvBasicAccessControlConditions = ({ - userAddress, - }: { - userAddress: string; - }): LPACC_EVM_BASIC[] => { - return [ - { - contractAddress: '', - standardContractType: '', - chain: 'ethereum', - method: '', - parameters: [':userAddress'], - returnValueTest: { - comparator: '=', - value: userAddress, - }, - }, - ]; - }; - - export const getSolBasicAccessControlConditions = ({ - userAddress, - }: { - userAddress: string; - }): LPACC_SOL[] => { - return [ - { - method: '', - params: [':userAddress'], - pdaParams: [], - pdaInterface: { offset: 0, fields: {} }, - pdaKey: '', - chain: 'solana', - returnValueTest: { - key: '', - comparator: '=', - value: userAddress, - }, - }, - ]; - }; - - export const getCosmosBasicAccessControlConditions = ({ - userAddress, - }: { - userAddress: string; - }): LPACC_EVM_ATOM[] => { - return [ - { - conditionType: 'cosmos', - path: ':userAddress', - chain: 'cosmos', - returnValueTest: { - key: '', - comparator: '=', - value: userAddress, - }, - }, - ]; - }; -} diff --git a/packages/e2e-tests/setup/networkContext.example.json b/packages/e2e-tests/setup/networkContext.example.json deleted file mode 100644 index 307fd9f508..0000000000 --- a/packages/e2e-tests/setup/networkContext.example.json +++ /dev/null @@ -1,11268 +0,0 @@ -{ - "Allowlist": { - "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemNotAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "allowAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "allowedItems", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "isAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_allowAll", - "type": "bool" - } - ], - "name": "setAllowAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setNotAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Allowlist" - }, - "LITToken": { - "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "cap", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINTER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAUSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint32", - "name": "pos", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "fromBlock", - "type": "uint32" - }, - { - "internalType": "uint224", - "name": "votes", - "type": "uint224" - } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "LITToken" - }, - "Multisender": { - "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - } - ], - "name": "sendEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - }, - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "withdrawTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Multisender" - }, - "PKPHelper": { - "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainWalletRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPKPNftMetdataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddDomainWalletMetadata", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removePkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - } - ], - "name": "setPkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPHelper" - }, - "PKPNFT": { - "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "MintCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "PKPMinted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "name": "claimAndMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "exists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNextDerivedKeyId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftMetadataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "mintGrantAndBurnNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "name": "mintNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "redeemedFreeMintIds", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "setMintCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPNFT" - }, - "PKPNFTMetadata": { - "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "buffer", - "type": "bytes" - } - ], - "name": "bytesToHex", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeProfileForPkp", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "imgUrl", - "type": "string" - } - ], - "name": "setProfileForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - } - ], - "name": "setUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPNFTMetadata" - }, - "PKPPermissions": { - "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "RootHashUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod", - "name": "authMethod", - "type": "tuple" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "addPermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToAdd", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToAdd", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeysToAdd", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopesToAdd", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToRemove", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToRemove", - "type": "bytes[]" - } - ], - "name": "batchAddRemoveAuthMethods", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getAuthMethodId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedActions", - "outputs": [ - { - "internalType": "bytes[]", - "name": "", - "type": "bytes[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "maxScopeId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethodScopes", - "outputs": [ - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethods", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getTokenIdsForAuthMethod", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getUserPubkeyForAuthMethod", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "isPermittedAction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "isPermittedAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "isPermittedAuthMethod", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "isPermittedAuthMethodScopePresent", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "removePermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "removePermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "removePermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "removePermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "setRootHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "verifyState", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bool[]", - "name": "proofFlags", - "type": "bool[]" - }, - { - "internalType": "bytes32[]", - "name": "leaves", - "type": "bytes32[]" - } - ], - "name": "verifyStates", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPPermissions" - }, - "PubkeyRouter": { - "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "PubkeyRoutingDataSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct IPubkeyRouter.RootKey", - "name": "rootKey", - "type": "tuple" - } - ], - "name": "RootKeySet", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "adminResetRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - }, - { - "internalType": "bytes", - "name": "signedMessage", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - } - ], - "name": "checkNodeSignatures", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "deriveEthAddressFromPubkey", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "ethAddressToPkpId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "getDerivedPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "getRootKeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getRoutingData", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isRouted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "pubkeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingDataAsAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "newRootKeys", - "type": "tuple[]" - } - ], - "name": "voteForRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PubkeyRouter" - }, - "RateLimitNFT": { - "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "AdditionalRequestsPerKilosecondCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "FreeRequestsPerRateLimitWindowSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RLIHolderRateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "setAdditionalRequestsPerKilosecondCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "setFreeRequestsPerRateLimitWindow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxExpirationSeconds", - "type": "uint256" - } - ], - "name": "setMaxExpirationSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "setMaxRequestsPerKilosecond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRLIHolderRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "RLIHolderRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "additionalRequestsPerKilosecondCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "payingAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "capacity", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "internalType": "struct LibRateLimitNFTStorage.RateLimit", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestedRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "checkBelowMaxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentSoldRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMintSigTest", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeRequestsPerRateLimitWindow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isExpired", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxExpirationSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - } - ], - "name": "redeemedFreeMints", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenIdCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenSVG", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "totalSoldRequestsPerKilosecondByExpirationTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "RateLimitNFT" - }, - "Staking": { - "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "CannotKickBelowCurrentValidatorThreshold", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - } - ], - "name": "CannotRejoinUntilNextEpochBecauseKicked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "CannotReuseCommsKeys", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "CannotVoteTwice", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "CouldNotMapNodeAddressToStakerAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedOrPausedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "MustBeValidatorInNextEpochToKick", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "validatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsInNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nextReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCountToBeReady", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsReadyForNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentEpochNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receivedEpochNumber", - "type": "uint256" - } - ], - "name": "SignaledReadyForWrongEpochNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "internalType": "address[]", - "name": "validatorsInNextEpoch", - "type": "address[]" - } - ], - "name": "ValidatorIsNotInNextEpoch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newComplaintTolerance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newComplaintIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "ConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "EpochEndTimeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "EpochLengthSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "EpochTimeoutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "KickPenaltyPercentSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "ReadyForNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToJoin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToLeave", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverContractAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newDuration", - "type": "uint256" - } - ], - "name": "RewardsDurationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newStakingTokenAddress", - "type": "address" - } - ], - "name": "StakingTokenSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "StateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountBurned", - "type": "uint256" - } - ], - "name": "ValidatorKickedFromNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "ValidatorRejoinedNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "reporter", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "VotedToKickValidatorInNextEpoch", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - } - ], - "name": "adminKickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "adminRejoinValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "adminResetEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToPenalize", - "type": "uint256" - } - ], - "name": "adminSlashValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "advanceEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "kickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lockValidatorsForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "requestToJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeaveAsNode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newComplaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newComplaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "setEpochEndTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "setEpochLength", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "setEpochState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "setEpochTimeout", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "setIpPortNodeAddressAndCommunicationPubKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "setKickPenaltyPercent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "signalReadyForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "stakeAndJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "VersionRequirementsUpdated", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "checkVersion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMaxVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMinVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "config", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfCurrentValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfNextValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "epochLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "number", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "retries", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Epoch", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKeyTypes", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKickedValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getNodeStakerAddressMappings", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "internalType": "struct LibStakingStorage.AddressMapping[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingBalancesAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpochLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInNextEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getValidatorsStructs", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInCurrentEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInNextEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - }, - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "voterStakerAddress", - "type": "address" - } - ], - "name": "getVotingStatusToKickValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidatorByNodeAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isReadyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "kickPenaltyPercentByReason", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "nodeAddressToStakerAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "readyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "shouldKickValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "validators", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "Staking" - }, - "StakingBalances": { - "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "AliasNotOwnedBySender", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "CannotRemoveAliasOfActiveValidator", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "aliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountReached", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "OnlyStakingContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeGreaterThanMinimumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maximumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeLessThanMaximumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "MaximumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "MinimumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "permittedStakersOn", - "type": "bool" - } - ], - "name": "PermittedStakersOnChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Staked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - } - ], - "name": "TokenRewardPerTokenPerEpochSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "ValidatorNotRewardedBecauseAlias", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorRewarded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorTokensPenalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "addAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "addPermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "stakers", - "type": "address[]" - } - ], - "name": "addPermittedStakers", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "checkStakingAmounts", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "isPermittedStaker", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "penalizeTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "permittedStakersOn", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "removeAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "removePermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "restakePenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "setMaxAliasCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "setMaximumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "setMinimumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "permitted", - "type": "bool" - } - ], - "name": "setPermittedStakersOn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "transferPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "withdrawPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "StakingBalances" - }, - "ContractResolver": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "abi": [ - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AdminRoleRequired", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "SetContract", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ALLOWLIST_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BACKUP_RECOVERY_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_WALLET_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HD_KEY_DERIVER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIT_TOKEN_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MULTI_SENDER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAYMENT_DELEGATION_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_HELPER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_METADATA_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_PERMISSIONS_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PUB_KEY_ROUTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RATE_LIMIT_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELEASE_REGISTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_BALANCES_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "addAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "getContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "adminBeingRemoved", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "removeAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "setContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "name": "typeAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "ContractResolver" - } -} diff --git a/packages/e2e-tests/setup/networkContext.json b/packages/e2e-tests/setup/networkContext.json deleted file mode 100644 index aabf963710..0000000000 --- a/packages/e2e-tests/setup/networkContext.json +++ /dev/null @@ -1,11370 +0,0 @@ -{ - "Allowlist": { - "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemNotAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "allowAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "allowedItems", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "isAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_allowAll", - "type": "bool" - } - ], - "name": "setAllowAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setNotAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Allowlist" - }, - "LITToken": { - "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "cap", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINTER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAUSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint32", - "name": "pos", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "fromBlock", - "type": "uint32" - }, - { - "internalType": "uint224", - "name": "votes", - "type": "uint224" - } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "LITToken" - }, - "Multisender": { - "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - } - ], - "name": "sendEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - }, - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "withdrawTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Multisender" - }, - "PKPHelper": { - "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainWalletRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPKPNftMetdataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddDomainWalletMetadata", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removePkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - } - ], - "name": "setPkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPHelper" - }, - "PKPNFT": { - "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "MintCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "PKPMinted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "name": "claimAndMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "exists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNextDerivedKeyId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftMetadataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "mintGrantAndBurnNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "name": "mintNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "redeemedFreeMintIds", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "setMintCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPNFT" - }, - "PKPNFTMetadata": { - "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "buffer", - "type": "bytes" - } - ], - "name": "bytesToHex", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeProfileForPkp", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "imgUrl", - "type": "string" - } - ], - "name": "setProfileForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - } - ], - "name": "setUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPNFTMetadata" - }, - "PKPPermissions": { - "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "RootHashUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod", - "name": "authMethod", - "type": "tuple" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "addPermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToAdd", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToAdd", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeysToAdd", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopesToAdd", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToRemove", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToRemove", - "type": "bytes[]" - } - ], - "name": "batchAddRemoveAuthMethods", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getAuthMethodId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedActions", - "outputs": [ - { - "internalType": "bytes[]", - "name": "", - "type": "bytes[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "maxScopeId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethodScopes", - "outputs": [ - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethods", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getTokenIdsForAuthMethod", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getUserPubkeyForAuthMethod", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "isPermittedAction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "isPermittedAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "isPermittedAuthMethod", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "isPermittedAuthMethodScopePresent", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "removePermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "removePermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "removePermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "removePermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "setRootHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "verifyState", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bool[]", - "name": "proofFlags", - "type": "bool[]" - }, - { - "internalType": "bytes32[]", - "name": "leaves", - "type": "bytes32[]" - } - ], - "name": "verifyStates", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPPermissions" - }, - "PubkeyRouter": { - "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "PubkeyRoutingDataSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct IPubkeyRouter.RootKey", - "name": "rootKey", - "type": "tuple" - } - ], - "name": "RootKeySet", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "adminResetRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - }, - { - "internalType": "bytes", - "name": "signedMessage", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - } - ], - "name": "checkNodeSignatures", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "deriveEthAddressFromPubkey", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "ethAddressToPkpId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "getDerivedPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "getRootKeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getRoutingData", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isRouted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "pubkeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingDataAsAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "newRootKeys", - "type": "tuple[]" - } - ], - "name": "voteForRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PubkeyRouter" - }, - "RateLimitNFT": { - "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "AdditionalRequestsPerKilosecondCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "FreeRequestsPerRateLimitWindowSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RLIHolderRateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "setAdditionalRequestsPerKilosecondCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "setFreeRequestsPerRateLimitWindow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxExpirationSeconds", - "type": "uint256" - } - ], - "name": "setMaxExpirationSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "setMaxRequestsPerKilosecond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRLIHolderRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "RLIHolderRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "additionalRequestsPerKilosecondCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "payingAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "capacity", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "internalType": "struct LibRateLimitNFTStorage.RateLimit", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestedRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "checkBelowMaxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentSoldRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMintSigTest", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeRequestsPerRateLimitWindow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isExpired", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxExpirationSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - } - ], - "name": "redeemedFreeMints", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenIdCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenSVG", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "totalSoldRequestsPerKilosecondByExpirationTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "RateLimitNFT" - }, - "Staking": { - "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "CannotKickBelowCurrentValidatorThreshold", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - } - ], - "name": "CannotRejoinUntilNextEpochBecauseKicked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "CannotReuseCommsKeys", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "CannotVoteTwice", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "CouldNotMapNodeAddressToStakerAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedOrPausedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "MustBeValidatorInNextEpochToKick", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "validatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsInNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nextReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCountToBeReady", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsReadyForNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentEpochNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receivedEpochNumber", - "type": "uint256" - } - ], - "name": "SignaledReadyForWrongEpochNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "internalType": "address[]", - "name": "validatorsInNextEpoch", - "type": "address[]" - } - ], - "name": "ValidatorIsNotInNextEpoch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "config", - "type": "tuple" - } - ], - "name": "ComplaintConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "ConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "EpochEndTimeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "EpochLengthSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "EpochTimeoutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "KickPenaltyPercentSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "ReadyForNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToJoin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToLeave", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverContractAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newDuration", - "type": "uint256" - } - ], - "name": "RewardsDurationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newStakingTokenAddress", - "type": "address" - } - ], - "name": "StakingTokenSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "StateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountBurned", - "type": "uint256" - } - ], - "name": "ValidatorKickedFromNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "ValidatorRejoinedNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "reporter", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "VotedToKickValidatorInNextEpoch", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - } - ], - "name": "adminKickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "adminRejoinValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "adminResetEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToPenalize", - "type": "uint256" - } - ], - "name": "adminSlashValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "advanceEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "kickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lockValidatorsForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "requestToJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeaveAsNode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "config", - "type": "tuple" - } - ], - "name": "setComplaintConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "newConfig", - "type": "tuple" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "setEpochEndTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "setEpochLength", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "setEpochState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "setEpochTimeout", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "setIpPortNodeAddressAndCommunicationPubKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "setKickPenaltyPercent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "signalReadyForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "stakeAndJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "VersionRequirementsUpdated", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "checkVersion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMaxVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMinVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "complaintConfig", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "config", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfCurrentValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfNextValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "epochLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "number", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "retries", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Epoch", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKeyTypes", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKickedValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getNodeStakerAddressMappings", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "internalType": "struct LibStakingStorage.AddressMapping[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingBalancesAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpochLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInNextEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getValidatorsStructs", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInCurrentEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInNextEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - }, - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "voterStakerAddress", - "type": "address" - } - ], - "name": "getVotingStatusToKickValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidatorByNodeAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isReadyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "kickPenaltyPercentByReason", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "nodeAddressToStakerAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "readyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "shouldKickValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "validators", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "Staking" - }, - "StakingBalances": { - "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "AliasNotOwnedBySender", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "CannotRemoveAliasOfActiveValidator", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "aliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountReached", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "OnlyStakingContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeGreaterThanMinimumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maximumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeLessThanMaximumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "MaximumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "MinimumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "permittedStakersOn", - "type": "bool" - } - ], - "name": "PermittedStakersOnChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Staked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - } - ], - "name": "TokenRewardPerTokenPerEpochSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "ValidatorNotRewardedBecauseAlias", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorRewarded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorTokensPenalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "addAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "addPermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "stakers", - "type": "address[]" - } - ], - "name": "addPermittedStakers", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "checkStakingAmounts", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "isPermittedStaker", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "penalizeTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "permittedStakersOn", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "removeAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "removePermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "restakePenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "setMaxAliasCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "setMaximumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "setMinimumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "permitted", - "type": "bool" - } - ], - "name": "setPermittedStakersOn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "transferPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "withdrawPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "StakingBalances" - }, - "ContractResolver": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "abi": [ - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AdminRoleRequired", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "SetContract", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ALLOWLIST_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BACKUP_RECOVERY_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_WALLET_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HD_KEY_DERIVER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIT_TOKEN_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MULTI_SENDER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAYMENT_DELEGATION_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_HELPER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_METADATA_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_PERMISSIONS_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PUB_KEY_ROUTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RATE_LIMIT_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELEASE_REGISTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_BALANCES_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "addAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "getContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "adminBeingRemoved", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "removeAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "setContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "name": "typeAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "ContractResolver" - } -} diff --git a/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts deleted file mode 100644 index 15db3a3f6f..0000000000 --- a/packages/e2e-tests/setup/session-sigs/get-eoa-session-sigs.ts +++ /dev/null @@ -1,156 +0,0 @@ -import { - LitActionResource, - LitPKPResource, - generateAuthSig, - createSiweMessageWithRecaps, -} from '@lit-protocol/auth-helpers'; -import { - AuthCallbackParams, - AuthSig, - LitAbility, - LitResourceAbilityRequest, -} from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; -import { TinnyEnvironment } from '../tinny-environment'; - -/** - * Retrieves the session signatures for an EOA in a given Tinny environment. - * - * @param devEnv - The Tinny environment object. - * @param person - The Tinny person object representing the EOA. - * @param resourceAbilityRequests - Optional. An array of resource ability requests. If not provided, default requests will be used. - * @returns A promise that resolves to the session signatures. - */ -export const getEoaSessionSigs = async ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { - console.warn( - 'Manzano network detected. Adding capacityDelegationAuthSig to eoaSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ - chain: 'ethereum', - resourceAbilityRequests: _resourceAbilityRequests, - authNeededCallback: async ({ - uri, - expiration, - resourceAbilityRequests, - }: AuthCallbackParams) => { - console.log('resourceAbilityRequests:', resourceAbilityRequests); - - if (!expiration) { - throw new Error('expiration is required'); - } - - if (!resourceAbilityRequests) { - throw new Error('resourceAbilityRequests is required'); - } - - if (!uri) { - throw new Error('uri is required'); - } - - const toSign = await createSiweMessageWithRecaps({ - uri: uri, - expiration: expiration, - resources: resourceAbilityRequests, - walletAddress: person.wallet.address, - nonce: await devEnv.litNodeClient?.getLatestBlockhash()!, - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: person.wallet, - toSign, - }); - - return authSig; - }, - - // -- only add this for manzano network because of rate limiting - ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano - ? { capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig] } - : {}), - } as any); // todo: remove any cast - - log('[getEoaSessionSigs]: ', getEoaSessionSigs); - - return sessionSigs; -}; - -export const getEoaSessionSigsWithCapacityDelegations = async ( - devEnv: TinnyEnvironment, - fromWallet: ethers.Wallet, - capacityDelegationAuthSig: AuthSig -) => { - const sessionSigs = await devEnv.litNodeClient?.getSessionSigs({ - chain: 'ethereum', - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - authNeededCallback: async ({ - uri, - expiration, - resourceAbilityRequests, - }: AuthCallbackParams) => { - if (!expiration) { - throw new Error('expiration is required'); - } - - if (!resourceAbilityRequests) { - throw new Error('resourceAbilityRequests is required'); - } - - if (!uri) { - throw new Error('uri is required'); - } - - const toSign = await createSiweMessageWithRecaps({ - uri: uri, - expiration: expiration, - resources: resourceAbilityRequests, - walletAddress: fromWallet.address, - nonce: devEnv.litNodeClient?.latestBlockhash!, - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: fromWallet, - toSign, - }); - - return authSig; - }, - capacityDelegationAuthSig: capacityDelegationAuthSig, - }); - - log('[getEoaSessionSigs]: ', getEoaSessionSigs); - - return sessionSigs; -}; diff --git a/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts deleted file mode 100644 index 364414733e..0000000000 --- a/packages/e2e-tests/setup/session-sigs/get-lit-action-session-sigs.ts +++ /dev/null @@ -1,167 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; -import { LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; -import { TinnyEnvironment } from '../tinny-environment'; - -const VALID_SESSION_SIG_LIT_ACTION_CODE = ` -// Works with an AuthSig AuthMethod -if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { - LitActions.setResponse({ response: "true" }); -} else { - LitActions.setResponse({ response: "false" }); -} -`; - -const INVALID_SESSION_SIG_LIT_ACTION_CODE = ` -(async () => { - let utf8Encode = new TextEncoder(); - const toSign = utf8Encode.encode('This message is exactly 32 bytes'); - const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); -})(); -`; - -/** - * https://cloudflare-ipfs.com/ipfs/QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp - */ -export const VALID_IPFS_ID = 'QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp'; - -/** - * https://cloudflare-ipfs.com/ipfs/QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm - */ -export const INVALID_IPFS_ID = 'QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm'; - -export const getLitActionSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { - console.warn( - 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const litActionSessionSigs = - await devEnv.litNodeClient?.getLitActionSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, - authMethods: [alice.authMethod!], - resourceAbilityRequests: _resourceAbilityRequests, - litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString( - 'base64' - ), - jsParams: { - publicKey: alice.authMethodOwnedPkp?.publicKey, - sigName: 'unified-auth-sig', - }, - - // -- only add this for manzano network - ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano - ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } - : {}), - }); - - return litActionSessionSigs; -}; - -export const getLitActionSessionSigsUsingIpfsId = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { - console.warn( - 'Manzano network detected. Adding capacityDelegationAuthSig to litActionSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, - authMethods: [alice.authMethod!], - resourceAbilityRequests: _resourceAbilityRequests, - litActionIpfsId: VALID_IPFS_ID, - jsParams: { - publicKey: alice.authMethodOwnedPkp!.publicKey, - sigName: 'unified-auth-sig', - }, - - // -- only add this for manzano network - ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano - ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } - : {}), - }); - - return litActionSessionSigs; -}; - -export const getInvalidLitActionSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson -) => { - const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, - authMethods: [alice.authMethod!], - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - ], - litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString( - 'base64' - ), - jsParams: { - publicKey: alice.authMethodOwnedPkp?.publicKey, - sigName: 'unified-auth-sig', - }, - }); - - return litActionSessionSigs; -}; - -export const getInvalidLitActionIpfsSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson -) => { - const litActionSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, - authMethods: [alice.authMethod!], - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - ], - litActionIpfsId: INVALID_IPFS_ID, - jsParams: { - publicKey: alice.authMethodOwnedPkp?.publicKey, - sigName: 'unified-auth-sig', - }, - }); - - return litActionSessionSigs; -}; diff --git a/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts b/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts deleted file mode 100644 index dd71d4e31f..0000000000 --- a/packages/e2e-tests/setup/session-sigs/get-pkp-session-sigs.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; -import { LitNetwork } from '@lit-protocol/constants'; -import { TinnyEnvironment } from '../tinny-environment'; -import { TinnyPerson } from '../tinny-person'; - -export const getPkpSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[], - expiration?: string -) => { - if (devEnv.litNodeClient?.config.litNetwork === LitNetwork.Manzano) { - console.warn( - 'Manzano network detected. Adding capacityDelegationAuthSig to pkpSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const pkpSessionSigs = await devEnv.litNodeClient?.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp?.publicKey!, - authMethods: [alice.authMethod!], - expiration, - resourceAbilityRequests: _resourceAbilityRequests, - - // -- only add this for manzano network - ...(devEnv.litNodeClient.config.litNetwork === LitNetwork.Manzano - ? { capacityDelegationAuthSig: devEnv.superCapacityDelegationAuthSig } - : {}), - }); - - log('[getPkpSessionSigs]: ', pkpSessionSigs); - - return pkpSessionSigs; -}; diff --git a/packages/e2e-tests/setup/shiva-client.d.ts b/packages/e2e-tests/setup/shiva-client.d.ts deleted file mode 100644 index 7bb27c17a6..0000000000 --- a/packages/e2e-tests/setup/shiva-client.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -type ContractAbis = { - litToken: string; - erc20: string; - backupRecovery: string; - staking: string; - stakingBalances: string; - rateLimitNft: string; - pkpnft: string; - pubkeyRouter: string; - pkpPermissions: string; - pkpHelper: string; - contractResolver: string; - paymentDelegation: string; -}; - -type ContractAddresses = { - litToken: string; - backupRecovery: string; - staking: string; - stakingBalances: string; - rateLimitNft: string; - pkpnft: string; - pubkeyRouter: string; - pkpPermissions: string; - pkpHelper: string; - contractResolver: string; - keyDeriver: string; - paymentDelegation: string; -}; - -type TestNetCreateRequest = { - nodeCount: number; - pollingInterval: string; - epochLength: number; - customBuildPath: string | null; - litActionServerCustomBuildPath: string | null; - existingConfigPath: string | null; - which: string | null; - ecdsaRoundTimeout: string | null; - enableRateLimiting: string | null; -}; - -type TestNetInfo = { - contractAddresses: ContractAddresses; - validatorAddresses: Array; - contractResolverAbi: string; - rpcUrl: string; - epochLength: number; - contractAbis: ContractAbis; -}; - -type TestNetResponse = { - testnetId: string; - command: string; - wasCanceled: boolean; - body: T | null; - lastStateObserved: string | null; - messages: Array | null; - errors: Array | null; -}; - -type TestNetState = 'Busy' | 'Active' | 'Mutating' | 'Shutdown' | 'UNKNOWN'; - -export { - ContractAbis, - ContractAddresses, - TestNetCreateRequest, - TestNetInfo, - TestNetResponse, - TestNetState, -}; diff --git a/packages/e2e-tests/setup/shiva-client.ts b/packages/e2e-tests/setup/shiva-client.ts deleted file mode 100644 index 59da1f90d3..0000000000 --- a/packages/e2e-tests/setup/shiva-client.ts +++ /dev/null @@ -1,299 +0,0 @@ -import { LitContractResolverContext } from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { - TestNetCreateRequest, - TestNetInfo, - TestNetResponse, - TestNetState, -} from './shiva-client.d'; - -export interface ShivaEnvs { - /** - * If runnnig no localchain this flag will stop the running testnet when the test - * run has finished. Which is when all pending task promises have settled. - */ - STOP_TESTNET: boolean; - - /** - * URL for Testnet manager intigration - */ - TESTNET_MANAGER_URL: string; - - /** - * Path to the Lit Node Binary to use. Can be configured through an env variable - * LIT_NODE_BINARY_PATH where the value is the local path to a built Lit Action Binary - * If flagging to not use the binary path this option will be ignored. - * See {@link USE_LIT_BINARIES} and {@link LIT_ACTION_BINARY_PATH} - */ - LIT_NODE_BINARY_PATH: string; - - /** - * Path to lit action binary to use, Can be defined through env variable - * LIT_ACTION_BINARY_PATH where the value is the local path to a built Lit Action Binary. - * If flagging not to use the binary path this option will be ignored - * See {@link USE_LIT_BINARIES} and {@link LIT_NODE_BINARY_PATH} - */ - LIT_ACTION_BINARY_PATH: string; - - /** - * Flag to indicate if the provided binary path should be used - * or if the testnet should be built from source before starting. - */ - USE_LIT_BINARIES: boolean; -} - -/** - * Client implementation for a single testnet instance managed by the Shiva tool - * Is essentially a localchain setup but allows for programmatic operations to be performed - * on the network from the implementation within this class. Each testnet is a unique network - */ -export class TestnetClient { - private _id: string | undefined; - private _info: TestNetInfo | undefined; - private _processEnvs: ShivaEnvs | undefined; - private _currentState: TestNetState | undefined; - - constructor(id: string, envs: ShivaEnvs) { - this._processEnvs = envs; - this._id = id; - } - - /* - Returns the testnet information - pub struct TestNetInfo { - pub contract_addresses: ContractAddresses, - pub validator_addresses: Vec, - pub contract_resolver_abi: String, - pub rpc_url: String, - pub epoch_length: i32, - } - */ - get Info(): TestNetInfo | undefined { - return this._info; - } - - get ContractContext(): LitContractResolverContext | undefined { - const testNetConfig = this.Info; - if (!testNetConfig) { - return undefined; - } - - const contractResolverAbi: string = testNetConfig.contractResolverAbi; - const contractResolverAddress = - testNetConfig.contractAddresses[`contractResolver`]; - const networkContext = { - abi: JSON.parse(contractResolverAbi), - resolverAddress: contractResolverAddress, - provider: new ethers.providers.JsonRpcProvider( - `http://${testNetConfig.rpcUrl}` - ), - environment: 0, // test deployment uses env value 0 in test common - }; - return networkContext; - } - - /** - * Polls a given testnet for the ACTIVE state - * polls on a 500 milisecond interval - */ - public async pollTestnetForActive(): Promise { - let state = 'Busy'; - while (state != 'Active' && state != `UNKNOWN`) { - const pollRes = await fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/poll/testnet/' + - this._id - ); - const res = await pollRes.json(); - state = res.body; - console.log('found state to be', res); - if (state != 'Active' && state != 'UNKNOWN') { - await new Promise((res, _) => { - setTimeout(() => { - res(); - }, 500); - }); - } else { - break; - } - } - - return state; - } - - /** - * returns the config for a given testnet - * struct reference for config - */ - public getTestnetConfig() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/get/info/testnet/' + - this._id - ) - .then((res: Response) => { - return res.json(); - }) - .then((info: TestNetResponse) => { - this._info = info.body!; - this._currentState = info.lastStateObserved as TestNetState; - console.log('setting testnet info: ', this._info); - }); - } - - /** - * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. - * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. - */ - public transitionEpochAndWait() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/action/transition/epoch/wait/' + - this._id - ) - .then((res: Response) => { - if (res.status === 200) { - return res.json(); - } else { - throw res; - } - }) - .then((body: any) => { - console.log('Stopped random peer: ', body); - }); - } - - /** - * Stops a random peer and waits for the next epoc to transiton. - * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. - */ - public stopRandomNetworkPeerAndWaitForNextEpoch() { - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/action/stop/random/wait/' + - this._id - ) - .then((res: Response) => { - if (res.status === 200) { - return res.json(); - } else { - throw res; - } - }) - .then((body: TestNetResponse) => { - console.log('validator kick response: ', body); - return body; - }); - } - - /* - Stops the testnet - */ - public stopTestnet() { - console.log('stopping testnet with id:', this._id); - return fetch( - this._processEnvs?.TESTNET_MANAGER_URL + - '/test/delete/testnet/' + - this._id - ) - .then((res: Response) => { - return res.json(); - }) - .then((body: TestNetResponse) => { - console.log('shutdown respone: ', body); - }); - } -} - -export class ShivaClient { - private _clients: Map; - public processEnvs: ShivaEnvs = { - STOP_TESTNET: process.env[`STOP_TESTNET`] === 'true', - TESTNET_MANAGER_URL: - process.env['TESTNET_MANAGER_URL'] || 'http://0.0.0.0:8000', - USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, - LIT_NODE_BINARY_PATH: - process.env['LIT_NODE_BINARY_PATH'] || - `./../../lit-assets/rust/lit-node/target/debug/lit_node`, - LIT_ACTION_BINARY_PATH: - process.env['LIT_ACTION_BINARY_PATH'] || - `./../../lit-assets/rust/lit-actions/target/debug/lit_actions`, - }; - - constructor() { - this._clients = new Map(); - console.log('Shiva environment loaded current config: ', this.processEnvs); - } - - /** - * Used to start an instance of a lit network through the Lit Testnet Manager - * if an isntance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. - * If an instance does not exist then we create one - * struct reference - pub struct TestNetCreateRequest { - pub node_count: usize, - pub polling_interval: String, - pub epoch_length: i32, - pub custom_build_path: Option, - pub lit_action_server_custom_build_path: Option, - pub existing_config_path: Option, - pub which: Option, - pub ecdsa_round_timeout: Option, - pub enable_rate_limiting: Option, - } - */ - async startTestnetManager( - createReq?: TestNetCreateRequest - ): Promise { - const existingTestnetResp = await fetch( - this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets' - ); - const existingTestnets: string[] = await existingTestnetResp.json(); - if (existingTestnets.length > 0) { - this._clients.set( - existingTestnets[0], - new TestnetClient(existingTestnets[0], this.processEnvs) - ); - return this._clients.get(existingTestnets[0])!; - } else { - console.log( - 'lit node binary path: ', - this.processEnvs.LIT_NODE_BINARY_PATH - ); - console.log( - 'lit action server binary path: ', - this.processEnvs.LIT_ACTION_BINARY_PATH - ); - let body: Partial = createReq ?? { - nodeCount: 3, - pollingInterval: '2000', - epochLength: 100, - }; - - if (this.processEnvs.USE_LIT_BINARIES) { - body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; - body.litActionServerCustomBuildPath = - this.processEnvs.LIT_ACTION_BINARY_PATH; - } - console.log('Testnet create args: ', body); - const createTestnetResp = await fetch( - this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(body), - } - ); - - const createTestnet = await createTestnetResp.json(); - this._clients.set( - createTestnet.testnetId, - new TestnetClient(createTestnet.testnetId, this.processEnvs) - ); - - return this._clients.get(createTestnet.testnetId)!; - } - } -} diff --git a/packages/e2e-tests/setup/tinny-config.ts b/packages/e2e-tests/setup/tinny-config.ts deleted file mode 100644 index 4ac93019a1..0000000000 --- a/packages/e2e-tests/setup/tinny-config.ts +++ /dev/null @@ -1,141 +0,0 @@ -import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import { LitContractResolverContext } from '@lit-protocol/types'; - -export enum LIT_TESTNET { - LOCALCHAIN = 'localchain', - MANZANO = 'manzano', - CAYENNE = 'cayenne', - DATIL_DEV = 'datil-dev', - DATIL_TEST = 'datil-test', -} - -export enum LIT_RPC { - LOCAL_ANVIL = 'http://127.0.0.1:8545', - CHRONICLE = 'https://chain-rpc.litprotocol.com/http', - VESUVIUS = 'https://vesuvius-rpc.litprotocol.com', -} - -/** - * Mapping of testnet names to corresponding RPC endpoints. - */ -export const RPC_MAP = { - [LIT_TESTNET.LOCALCHAIN]: LIT_RPC.LOCAL_ANVIL, - [LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE, - [LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE, - [LIT_TESTNET.DATIL_DEV]: LIT_RPC.VESUVIUS, - [LIT_TESTNET.DATIL_TEST]: LIT_RPC.VESUVIUS, -}; - -/** - * Represents the configuration options for the process environment. - */ -export interface ProcessEnvs { - /** - * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. - */ - MAX_ATTEMPTS: number; - - /** - * The maximum number of milliseconds to wait for a test to complete. - */ - TEST_TIMEOUT: number; - - /** - * The network to use for testing. This can be one of the following: - * - `LIT_TESTNET.LOCALCHAIN` - * - `LIT_TESTNET.MANZANO` - * - `LIT_TESTNET.CAYENNE` - * - `LIT_TESTNET.DATIL_DEV` - */ - NETWORK: LIT_TESTNET; - - /** - * The number of milliseconds to wait between each request. - */ - DEBUG: boolean; - - /** - * Capacity Credits: In order to execute a transaction with Lit, you’ll need to reserve capacity on the network using Capacity Credits. These allow holders to reserve a set number of requests over a desired period of time (by default expiration set to 2 days) - */ - REQUEST_PER_KILOSECOND: number; - - /** - * Wait time in milliseconds if no private keys are available. - */ - WAIT_FOR_KEY_INTERVAL: number; - - /** - * Time to wait before releasing the key after requesting it. - */ - TIME_TO_RELEASE_KEY: number; - - /** - * Run all the tests in a single thread. - */ - RUN_IN_BAND: boolean; - - /** - * The interval in milliseconds to run the tests in a single thread. - */ - RUN_IN_BAND_INTERVAL: number; - - // =========== In most cases you won't need to change the following values =========== - /** - * The URL of Lit RPC server. - * - If it's running locally on Anvil, it should be 'http://127.0.0.1:8545' - * - If it's running on Chronicle, it should be 'https://chain-rpc.litprotocol.com/http' - * - If it's running on Vesuvius, it should be 'https://vesuvius-rpc.litprotocol.com' - */ - 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. - */ - PRIVATE_KEYS: string[]; - - /** - * The list of keys that are currently in use. - */ - KEY_IN_USE: boolean[]; - - /** - * Ignore setup steps. Usually when you run to quickly run a single test. - */ - NO_SETUP: boolean; - - /** - * Use shiva as a test network which will spawn before the test run starts - */ - USE_SHIVA: boolean; - - /** - * The network configuration which will be used for `contract context` if provided. - * it is assumed the context will work with the {@link NETWORK} provided. If the configuration - * is not for the provided network then there could be undefined behavior. - * If {@link USE_SHIVA} is set to true then the network configuration will be loaded implicitly and - * this value will be ignored - */ - NETWORK_CONFIG: string; -} - -/** - * Represents the PKP information. - */ -export type PKPInfo = { - tokenId: string; - publicKey: string; - ethAddress: string; -}; - -export interface TinnyEnvConfig { - rpc: string; - litNodeClient: LitNodeClient; - network: LIT_TESTNET; - processEnvs: ProcessEnvs; - contractContext?: LitContractResolverContext; -} diff --git a/packages/e2e-tests/setup/tinny-environment.ts b/packages/e2e-tests/setup/tinny-environment.ts deleted file mode 100644 index c83d33f6ba..0000000000 --- a/packages/e2e-tests/setup/tinny-environment.ts +++ /dev/null @@ -1,534 +0,0 @@ -import { - LIT_TESTNET, - ProcessEnvs, - RPC_MAP, - TinnyEnvConfig, -} from './tinny-config'; -import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import { LitContracts } from '@lit-protocol/contracts-sdk'; -import { - AuthSig, - CosmosAuthSig, - LitContractContext, - LitContractResolverContext, - SolanaAuthSig, -} from '@lit-protocol/types'; -import { TinnyPerson } from './tinny-person'; - -import { ethers } from 'ethers'; -import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; -import { ShivaClient, TestnetClient } from './shiva-client'; - -declare var globalThis: any; -export class TinnyEnvironment { - public network: LIT_TESTNET; - - /** - * Environment variables used in the process. - */ - public processEnvs: ProcessEnvs = { - MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS'] as string) || 1, - TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT'] as string) || 45000, - NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, - DEBUG: process.env['DEBUG'] === 'true', - REQUEST_PER_KILOSECOND: - parseInt(process.env['REQUEST_PER_KILOSECOND'] ?? '') || 200, - LIT_RPC_URL: process.env['LIT_RPC_URL'] ?? '', // localhost rpc if not provided - 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, - - // Available Accounts - // ================== - // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) - // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) - // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) - // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) - // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) - // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) - // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) - // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) - // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) - PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ - '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', - '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', - '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', - '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', - '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', - '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', - '0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356', - '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', - '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', - ], - KEY_IN_USE: new Array(), - NO_SETUP: process.env['NO_SETUP'] === 'true', - USE_SHIVA: process.env['USE_SHIVA'] === 'true', - NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', - }; - - public litNodeClient: LitNodeClient | undefined; - public contractsClient: LitContracts | undefined; - public rpc: string; - public superCapacityDelegationAuthSig: AuthSig | undefined; - public bareEthAuthSig: AuthSig | undefined; - public bareSolAuthSig: SolanaAuthSig = { - sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', - derivedVia: 'solana.signMessage', - signedMessage: - 'I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z', - address: 'F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1', - }; - - public bareCosmosAuthSig: CosmosAuthSig = { - sig: 'dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==', - derivedVia: 'cosmos.signArbitrary', - signedMessage: - '8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b', - address: 'cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku', - }; - - public testnet: TestnetClient | undefined; - //=========== PRIVATE MEMBERS =========== - private _shivaClient: ShivaClient = new ShivaClient(); - private _contractContext: - | LitContractContext - | LitContractResolverContext - | undefined; - - constructor(network?: LIT_TESTNET) { - // -- setup networkj - this.network = network || this.processEnvs.NETWORK; - - if (Object.values(LIT_TESTNET).indexOf(this.network) === -1) { - throw new Error( - `Invalid network environment. Please use one of ${Object.values( - LIT_TESTNET - )}` - ); - } - - // -- create an empty array to keep track of all keys - this.processEnvs.KEY_IN_USE = new Array( - this.processEnvs.PRIVATE_KEYS.length - ).fill(false); - - // -- setup rpc - // Priority: - // 1. Use environment variable if set - // 2. Use RPC_MAP if network is recognized - // 3. Throw error if neither condition is met - if (this.processEnvs.LIT_RPC_URL) { - // If LIT_RPC_URL is set in the environment, use it - this.rpc = this.processEnvs.LIT_RPC_URL; - } else if (this.network in RPC_MAP) { - // If the network is recognized in RPC_MAP, use the corresponding RPC URL - this.rpc = RPC_MAP[this.network]; - } else { - // If neither condition is met, throw an error with available options - const availableNetworks = Object.keys(RPC_MAP).join(', '); - throw new Error( - `No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}` - ); - } - - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Done configuring enviorment current config: ', - this.processEnvs - ); - } - - world: Map = new Map(); - - /** - * Retrieves an available private key from a list, marking it as in use and scheduling - * its automatic release. If no unused keys are available, it waits for a set interval - * before rechecking. - * - * This function loops until it finds an unused key, marks it, and returns the key with - * its index. If all keys are in use, it logs a wait message and pauses before retrying. - * - * Outputs: - * - privateKey: The selected private key. - * - index: The index of the selected key. - * - * Environment variables required: - * - KEY_IN_USE: Boolean array indicating key usage. - * - PRIVATE_KEYS: Array of key strings. - * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. - * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. - */ - async getAvailablePrivateKey(): Promise<{ - privateKey: string; - index: number; - }> { - while (true) { - const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key - - if (index !== -1) { - // If an available key is found - this.processEnvs.KEY_IN_USE[index] = true; // Mark the key as in use - // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] πŸ”‘ Selected key at index', index); // Log a message indicating that we have selected a key - - return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index - } else { - // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting - // Wait for the specified interval before checking again - await new Promise((resolve) => - setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) - ); - } - } - } - - /** - * Marks a private key as available again after use. - * @param {number} index - The index of the key to mark as available. - */ - releasePrivateKeyFromUser(user: TinnyPerson) { - const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); - this.processEnvs.KEY_IN_USE[index] = false; - // console.log( - // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` - // ); - } - - /** - * Marks a private key as available again after use. - * @param {number} index - The index of the key to mark as available. - */ - releasePrivateKey(index: number) { - this.processEnvs.KEY_IN_USE[index] = false; - // console.log( - // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` - // ); - } - - /** - * Initializes the LitNodeClient based on the specified network configuration and environment variables. - * This setup differentiates between local and production environments, adjusts node attestation checks, - * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. - * - * The LitNodeClient is configured differently based on the network: - * - LOCALCHAIN: Uses custom settings for local testing, with node attestation disabled. - * - MANZANO (or other specified testnets): Configures for specific network environments with node attestation enabled. - * - * Logs the process and exits if the client is not ready after attempting to connect. - */ - - async setupLitNodeClient() { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Setting up LitNodeClient'); - - if (this.network === LIT_TESTNET.LOCALCHAIN) { - const networkContext = - this?.testnet?.ContractContext ?? this._contractContext; - this.litNodeClient = new LitNodeClient({ - litNetwork: 'custom', - rpcUrl: this.rpc, - debug: this.processEnvs.DEBUG, - checkNodeAttestation: false, // disable node attestation check for local testing - contractContext: networkContext, - }); - } else if (this.network === LIT_TESTNET.MANZANO) { - this.litNodeClient = new LitNodeClient({ - litNetwork: this.network, // 'habanero' or 'manzano' - checkNodeAttestation: true, - debug: this.processEnvs.DEBUG, - }); - } else { - this.litNodeClient = new LitNodeClient({ - litNetwork: this.network, - checkNodeAttestation: false, - debug: this.processEnvs.DEBUG, - }); - } - - if (globalThis.wasmExports) { - console.warn( - 'WASM modules already loaded. Will overide when connect is called' - ); - } - - if (globalThis.wasmECDSA) { - console.warn( - 'WASM modules already loaded. wil overide. when connect is called' - ); - } - - if (globalThis.wasmSevSnpUtils) { - console.warn( - 'WASM modules already loaded. wil overide. when connect is called' - ); - } - - await this.litNodeClient.connect(); - - if (!this.litNodeClient.ready) { - console.error('❌ litNodeClient not ready'); - process.exit(); - } - } - - /** - * Retrieves the environment configuration. - * @returns The TinnyEnvConfig object containing the environment configuration. - */ - getEnvConfig(): TinnyEnvConfig { - const contractContext = - this?.testnet?.ContractContext ?? this._contractContext; - return { - rpc: this.rpc, - litNodeClient: this.litNodeClient!, - network: this.network, - processEnvs: this.processEnvs, - contractContext: contractContext as LitContractResolverContext, - }; - } - - /** - * Creates a new person with the given name. - * @param name - The name of the person. - * @returns The newly created person. - * @throws Error if the name is not provided. - */ - async createNewPerson(name: string) { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Creating new person:', name); - if (!name) { - throw new Error('Name is required'); - } - const key = await this.getAvailablePrivateKey(); - const privateKey = key.privateKey; - const envConfig = this.getEnvConfig(); - - const person = new TinnyPerson({ - privateKey, - envConfig, - }); - - await person.spawn(); - - this.world.set(name, person); - - return person; - } - - /** - * Retrieves a person from the world by their name. - * @param name - The name of the person to retrieve. - * @returns The person object if found, or undefined if not found. - */ - getPerson(name: string) { - return this.world.get(name); - } - - /** - * Creates a random person. - * @returns A promise that resolves to the created person. - */ - async createRandomPerson() { - return await this.createNewPerson('Alice'); - } - - setUnavailable = (network: LIT_TESTNET) => { - if (this.processEnvs.NETWORK === network) { - throw new Error('LIT_IGNORE_TEST'); - } - }; - - /** - * Init - */ - async init() { - if (this.processEnvs.NO_SETUP) { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); - return; - } - if (this.network === LIT_TESTNET.LOCALCHAIN && this.processEnvs.USE_SHIVA) { - this.testnet = await this._shivaClient.startTestnetManager(); - // wait for the testnet to be active before we start the tests. - let state = await this.testnet.pollTestnetForActive(); - if (state === `UNKNOWN`) { - console.log( - 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' - ); - throw new Error(`Error while creating testnet, aborting test run`); - } - - await this.testnet.getTestnetConfig(); - } else if (this.network === LIT_TESTNET.LOCALCHAIN) { - const context = await import('./networkContext.json'); - this._contractContext = context; - } - - await this.setupLitNodeClient(); - await this.setupSuperCapacityDelegationAuthSig(); - await this.setupBareEthAuthSig(); - } - - /** - * Setup bare eth auth sig to test access control and decryption - */ - async setupBareEthAuthSig() { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - const toSign = await createSiweMessage({ - walletAddress: wallet.address, - nonce: this.litNodeClient?.latestBlockhash!, - expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), - litNodeClient: this.litNodeClient, - }); - - this.bareEthAuthSig = await generateAuthSig({ - signer: wallet, - toSign, - }); - } - - //============= SHIVA ENDPOINTS ============= - /** - * Will stop the testnet that is being used in the test run. - */ - async stopTestnet() { - if ( - this.network === LIT_TESTNET.LOCALCHAIN && - this._shivaClient.processEnvs.STOP_TESTNET - ) { - await this.testnet?.stopTestnet(); - } else { - console.log('skipping testnet shutdown.'); - } - } - //============= END SHIVA ENDPOINTS ============= - - /** - * Sends funds from the current wallet to the specified wallet address. - * @param walletAddress - The address of the recipient wallet. - * @param amount - The amount of funds to send (default: '0.001'). - * @throws If there is an error sending the funds. - */ - getFunds = async (walletAddress: string, amount = '0.001') => { - try { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - const tx = await wallet.sendTransaction({ - to: walletAddress, - value: ethers.utils.parseEther(amount), - }); - - await tx.wait(); - } catch (e) { - throw new Error(`Failed to send funds to ${walletAddress}: ${e}`); - } - }; - - /** - * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global - * max capacity. - */ - setupSuperCapacityDelegationAuthSig = async () => { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - /** - * ==================================== - * Setup contracts-sdk client - * ==================================== - */ - if (this.network === LIT_TESTNET.LOCALCHAIN) { - const networkContext = - this?.testnet?.ContractContext ?? this._contractContext; - this.contractsClient = new LitContracts({ - signer: wallet, - debug: this.processEnvs.DEBUG, - rpc: this.rpc, - customContext: networkContext, - }); - } else { - // scoping `this` for function scope - const me = this; - async function _switchWallet() { - // TODO: This wallet should be cached somehwere and reused to create delegation signatures. - // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. - const capacityCreditWallet = - ethers.Wallet.createRandom().connect(provider); - - // get wallet balance - const balance = await wallet.getBalance(); - console.log('this.rpc:', me.rpc); - console.log('this.wallet.address', wallet.address); - console.log('Balance:', balance.toString()); - - const transferTx = await wallet.sendTransaction({ - to: capacityCreditWallet.address, - value: ethers.utils.parseEther('0.001'), - }); - await transferTx.wait(); - } - - // await _switchWallet(); - - this.contractsClient = new LitContracts({ - // signer: capacityCreditWallet, // disabled switch wallet for now - signer: wallet, - debug: this.processEnvs.DEBUG, - network: this.network, - }); - } - - await this.contractsClient.connect(); - - /** - * ==================================== - * Mint a Capacity Credits NFT and get a capacity delegation authSig with it - * ==================================== - */ - const me = this; - // Disabled for now - const _mintSuperCapacityDelegationAuthSig = async () => { - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - try { - const capacityTokenId = ( - await me.contractsClient?.mintCapacityCreditsNFT({ - requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - )?.capacityTokenIdStr; - - this.superCapacityDelegationAuthSig = ( - await this.litNodeClient?.createCapacityDelegationAuthSig({ - dAppOwnerWallet: wallet, - capacityTokenId: capacityTokenId, - // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it - uses: '200', - }) - )?.capacityDelegationAuthSig; - } catch (e: any) { - if ( - e.message.includes(`Can't allocate capacity beyond the global max`) - ) { - console.log('❗️Skipping capacity delegation auth sig setup.', e); - } else { - console.log( - '❗️Error while setting up capacity delegation auth sig', - e - ); - } - } - }; - }; -} diff --git a/packages/e2e-tests/setup/tinny-person.ts b/packages/e2e-tests/setup/tinny-person.ts deleted file mode 100644 index 5645427e4b..0000000000 --- a/packages/e2e-tests/setup/tinny-person.ts +++ /dev/null @@ -1,220 +0,0 @@ -import { - AuthSig, - generateAuthSig, - createSiweMessage, -} from '@lit-protocol/auth-helpers'; -import { LitContracts } from '@lit-protocol/contracts-sdk'; -import { - AuthMethod, - BaseSiweMessage, - LitContractContext, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; -import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; -import { AuthMethodScope } from '@lit-protocol/constants'; - -export class TinnyPerson { - public privateKey: string; - public wallet: ethers.Wallet; - public siweMessage: string | undefined; - public authSig: AuthSig | undefined; - public authMethod: AuthMethod | undefined; - public contractsClient: LitContracts | undefined; - // public capacityTokenId: string; - // public capacityDelegationAuthSig: AuthSig; - public pkp: PKPInfo | undefined; - public authMethodOwnedPkp: PKPInfo | undefined; - - // Pass this to data to sign - public loveLetter: Uint8Array = ethers.utils.arrayify( - ethers.utils.keccak256([1, 2, 3, 4, 5]) - ); - - public provider: ethers.providers.JsonRpcProvider; - - public envConfig: TinnyEnvConfig; - - constructor({ - privateKey, - envConfig, - }: { - privateKey: string; - envConfig: TinnyEnvConfig; - }) { - this.envConfig = envConfig; - - this.privateKey = privateKey; - this.provider = new ethers.providers.JsonRpcProvider(this.envConfig.rpc); - this.wallet = new ethers.Wallet(privateKey, this.provider); - } - - /** - * FIXME: Enabling this is causing the test to fail - * Switches the current wallet to a new funding wallet by creating a new funding wallet, - * funding it with a small amount of ethers, and updating the current wallet to the new one. - * - * @private - * @returns {Promise} A promise that resolves once the wallet has been switched. - */ - private async _switchWallet() { - // Create a new funding wallet, funds it with small amount of ethers, and updates the current wallet to the new one. - const fundingWallet = ethers.Wallet.createRandom().connect(this.provider); - - if (this.envConfig.network != LIT_TESTNET.LOCALCHAIN) { - // check balance this.wallet - const balance = await this.wallet.getBalance(); - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Wallet balance:', - ethers.utils.formatEther(balance) - ); - - const transferTx = await this.wallet.sendTransaction({ - to: fundingWallet.address, - value: ethers.utils.parseEther('0.00001'), - }); - - const transferReciept = await transferTx.wait(); - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Transfered Assets for person tx: ', - transferReciept.transactionHash - ); - this.wallet = fundingWallet; - } - } - - async spawn() { - // await this._switchWallet(); - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Spawning person:', this.wallet.address); - /** - * ==================================== - * Get Hot Wallet Auth Sig - * ==================================== - */ - this.siweMessage = await createSiweMessage({ - nonce: this.envConfig?.litNodeClient?.latestBlockhash!, - walletAddress: this.wallet.address, - }); - - this.authSig = await generateAuthSig({ - signer: this.wallet, - toSign: this.siweMessage, - }); - - /** - * ==================================== - * Craft an authMethod from the authSig for the eth wallet auth method - * ==================================== - */ - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...' - ); - this.authMethod = await EthWalletProvider.authenticate({ - signer: this.wallet, - litNodeClient: this.envConfig.litNodeClient, - }); - - /** - * ==================================== - * Setup contracts-sdk client - * ==================================== - */ - if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) { - const networkContext = this.envConfig.contractContext; - this.contractsClient = new LitContracts({ - signer: this.wallet, - debug: this.envConfig.processEnvs.DEBUG, - rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc - customContext: networkContext as unknown as LitContractContext, - }); - } else { - this.contractsClient = new LitContracts({ - signer: this.wallet, - debug: this.envConfig.processEnvs.DEBUG, - network: this.envConfig.network, - }); - } - - await this.contractsClient.connect(); - - /** - * ==================================== - * Mint a PKP - * ==================================== - */ - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP...'); - const walletMintRes = - await this.contractsClient.pkpNftContractUtils.write.mint(); - - this.pkp = walletMintRes.pkp; - - /** - * ==================================== - * Mint a PKP wiuth eth wallet auth method - * ==================================== - */ - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP with eth wallet auth method...' - ); - this.authMethodOwnedPkp = ( - await this.contractsClient.mintWithAuth({ - authMethod: this.authMethod, - scopes: [AuthMethodScope.SignAnything], - }) - ).pkp; - - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] 🐣 TinnyPerson spawned:', - this.wallet.address - ); - } - - /** - * ==================================== - * Mint a Capacity Credits NFT - * ==================================== - */ - async mintCapacityCreditsNFT() { - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT '); - const capacityTokenId = ( - await this.contractsClient?.mintCapacityCreditsNFT({ - requestsPerKilosecond: - this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - )?.capacityTokenIdStr; - - return capacityTokenId; - } - - /** - * ==================================== - * Mint a Capacity Credits NFT and get a capacity delegation authSig with it - * ==================================== - */ - async createCapacityDelegationAuthSig( - addresses: string[] = [] - ): Promise { - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - - const capacityTokenId = ( - await this.contractsClient?.mintCapacityCreditsNFT({ - requestsPerKilosecond: - this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - )?.capacityTokenIdStr; - - this.contractsClient!.signer! = this.wallet; - await this.contractsClient?.connect(); - return ( - await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: this.wallet, - capacityTokenId: capacityTokenId, - ...(addresses.length && { delegateeAddresses: addresses }), - }) - ).capacityDelegationAuthSig; - } -} diff --git a/packages/e2e-tests/setup/tinny-utils.ts b/packages/e2e-tests/setup/tinny-utils.ts deleted file mode 100644 index 2be285519e..0000000000 --- a/packages/e2e-tests/setup/tinny-utils.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { importer } from 'ipfs-unixfs-importer'; -import { Buffer } from 'buffer'; - -/** - * Converts a string to an IPFS hash. - * @param input - The input string to convert. - * @returns A Promise that resolves to the IPFS hash. - * @throws An error if the generated hash does not start with 'Qm'. - */ -export async function stringToIpfsHash(input: string): Promise { - const blockput = { - put: async (block: any) => { - return block.cid; - }, - }; - - // Convert the input string to a Buffer - const content = Buffer.from(input); - - // Import the content to create an IPFS file - const files = importer([{ content }], blockput as any); - - // Get the first (and only) file result - const result = (await files.next()).value; - - const ipfsHash = (result as any).cid.toString(); - - if (!ipfsHash.startsWith('Qm')) { - throw new Error('Generated hash does not start with Qm'); - } - - return ipfsHash; -} - -export function randomSolanaPrivateKey() { - const BASE58_ALPHABET = - '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; - const SOLANA_PRIVATE_KEY_LENGTH = 88; - - let result = ''; - const charactersLength = BASE58_ALPHABET.length; - for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { - const randomIndex = Math.floor(Math.random() * charactersLength); - result += BASE58_ALPHABET.charAt(randomIndex); - } - return result; -} - -/** - * Wraps a promise with a timeout. - * If the promise does not resolve or reject within the specified time, it will be rejected with a "Timed out" error. - * - * @param promise - The promise to wrap with a timeout. - * @param ms - The timeout duration in milliseconds. - * @returns A new promise that resolves or rejects based on the original promise or the timeout. - */ -export function withTimeout( - promise: Promise, - ms: number -): Promise { - const timeout = new Promise((_, reject) => - setTimeout(() => reject(new Error('Timed out')), ms) - ); - return Promise.race([promise, timeout]); -} From 5dc7874ef3a3085af1015a9746dd5a390d2525d0 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 11:29:06 -0400 Subject: [PATCH 103/136] test: move to lifecycle key management for TinnyPersons --- .../e2e-tests/src/tests/Delegation.spec.ts | 26 +- .../e2e-tests/src/tests/PKPEthers.spec.ts | 286 ++++++++---------- packages/logger/src/lib/logger.spec.ts | 2 +- 3 files changed, 145 insertions(+), 169 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 2ff1aaef03..1f4c089ce7 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -9,14 +9,25 @@ import { import { AuthMethodScope, AuthMethodType } from '@lit-protocol/constants'; import { TinnyEnvironment, + TinnyPerson, getEoaSessionSigsWithCapacityDelegations, } from '@lit-protocol/tinny'; describe('Delegation', () => { let devEnv: TinnyEnvironment; + let alice: TinnyPerson; + let bob: TinnyPerson; + beforeAll(async () => { //@ts-expect-error is defined devEnv = global.devEnv; + alice = await devEnv.createRandomPerson(); + bob = await devEnv.createRandomPerson(); + }); + + afterEach(() => { + devEnv.releasePrivateKeyFromUser(alice); + devEnv.releasePrivateKeyFromUser(bob); }); beforeEach(() => { @@ -29,9 +40,6 @@ describe('Delegation', () => { }); it('PKP to PKP delegation executeJS', async () => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - // Checking the scopes of the PKP owned by Bob const bobsAuthMethodAuthId = await LitAuthClient.getAuthIdByAuthMethod( bob.authMethod @@ -120,9 +128,6 @@ describe('Delegation', () => { }); it('PKP to EOA ExecuteJs', async () => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); @@ -133,12 +138,6 @@ describe('Delegation', () => { appOwnersCapacityDelegationAuthSig ); - // -- printing out the recaps from the session sigs - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const bobsSingleSessionSig = - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - bobsSessionSigs![devEnv.litNodeClient?.config?.bootstrapUrls[0]!]; - // 5. Bob can now execute JS code using the capacity credits NFT const res = await devEnv.litNodeClient ?.executeJs({ @@ -192,9 +191,6 @@ describe('Delegation', () => { }); it('PKP to EOA PKP Sign', async () => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - const appOwnersCapacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig([bob.wallet.address]); diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 2f09ae464b..2d55ad1cc9 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -38,11 +38,20 @@ try { describe('PKP Ethers', () => { let devEnv: TinnyEnvironment; + let alice: TinnyPerson; beforeAll(async () => { //@ts-expect-error defined in global devEnv = global.devEnv; }); + beforeEach(async () => { + alice = await devEnv.createRandomPerson(); + }); + + afterEach(() => { + alice && devEnv.releasePrivateKeyFromUser(alice); + }); + beforeEach(() => { // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); @@ -54,194 +63,194 @@ describe('PKP Ethers', () => { describe('Sign Message', () => { it('LitAction Session', async () => { - await signMessage(devEnv, getLitActionSessionSigs); + await signMessage(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signMessage(devEnv, getLitActionSessionSigsUsingIpfsId); + await signMessage(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signMessage(devEnv, getEoaSessionSigs); + await signMessage(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signMessage(devEnv, getEoaSessionSigs); + await signMessage(devEnv, alice, getEoaSessionSigs); }); }); describe('ETH Signing', () => { it('LitAction Session', async () => { - await ethTransaction(devEnv, getLitActionSessionSigs); + await ethTransaction(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await ethTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + await ethTransaction(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await ethTransaction(devEnv, getEoaSessionSigs); + await ethTransaction(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await ethTransaction(devEnv, getEoaSessionSigs); + await ethTransaction(devEnv, alice, getEoaSessionSigs); }); }); describe('ETH Personal Signing', () => { it('LitAction Session', async () => { - await ethPersonalSign(devEnv, getLitActionSessionSigs); + await ethPersonalSign(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await ethPersonalSign(devEnv, getLitActionSessionSigsUsingIpfsId); + await ethPersonalSign(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await ethPersonalSign(devEnv, getEoaSessionSigs); + await ethPersonalSign(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await ethPersonalSign(devEnv, getEoaSessionSigs); + await ethPersonalSign(devEnv, alice, getEoaSessionSigs); }); }); describe('Sign Transaction', () => { it('LitAction Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigs); + await signTransaction(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTransaction(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTransaction(devEnv, getEoaSessionSigs); + await signTransaction(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTransaction(devEnv, getEoaSessionSigs); + await signTransaction(devEnv, alice, getEoaSessionSigs); }); }); describe('Eth Sign Typed Data', () => { it('LitAction Session', async () => { - await signTransaction(devEnv, getLitActionSessionSigs); + await signTypedDataV1(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTypedDataV1(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); + await signTypedDataV1(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); + await signTypedDataV1(devEnv, alice, getEoaSessionSigs); }); }); describe('Sign Typed Data Util', () => { it('LitAction Session', async () => { - await ethTypedDataUtil(devEnv, getLitActionSessionSigs); + await ethTypedDataUtil(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await ethTypedDataUtil(devEnv, getLitActionSessionSigsUsingIpfsId); + await ethTypedDataUtil(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await ethTypedDataUtil(devEnv, getEoaSessionSigs); + await ethTypedDataUtil(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await ethTypedDataUtil(devEnv, getEoaSessionSigs); + await ethTypedDataUtil(devEnv, alice, getEoaSessionSigs); }); }); describe('SignedTypedDataV1', () => { it('LitAction Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigs); + await signTypedDataV1(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTypedDataV1(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTypedDataV1(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); + await signTypedDataV1(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTypedDataV1(devEnv, getEoaSessionSigs); + await signTypedDataV1(devEnv, alice, getEoaSessionSigs); }); }); describe('SignedTypedDatav3', () => { it('LitAction Session', async () => { - await signTypedDatav3(devEnv, getLitActionSessionSigs); + await signTypedDatav3(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTypedDatav3(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTypedDatav3(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTypedDatav3(devEnv, getEoaSessionSigs); + await signTypedDatav3(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTypedDatav3(devEnv, getEoaSessionSigs); + await signTypedDatav3(devEnv, alice, getEoaSessionSigs); }); }); describe('Signed Typed Data v4', () => { it('LitAction Session', async () => { - await signTypedDatav4(devEnv, getLitActionSessionSigs); + await signTypedDatav4(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signTypedDatav4(devEnv, getLitActionSessionSigsUsingIpfsId); + await signTypedDatav4(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signTypedDatav4(devEnv, getEoaSessionSigs); + await signTypedDatav4(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signTypedDatav4(devEnv, getEoaSessionSigs); + await signTypedDatav4(devEnv, alice, getEoaSessionSigs); }); }); describe('Sign With AuthContext', () => { it('LitAction Session', async () => { - await signWithAuthContext(devEnv); + await signWithAuthContext(devEnv, alice); }); it('LitAction IPFS Session', async () => { - await signWithAuthContext(devEnv); + await signWithAuthContext(devEnv, alice); }); it('EOA Wallet', async () => { - await signWithAuthContext(devEnv); + await signWithAuthContext(devEnv, alice); }); it('PKP Session', async () => { - await signWithAuthContext(devEnv); + await signWithAuthContext(devEnv, alice); }); }); }); const signMessage = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -259,13 +268,13 @@ const signMessage = async ( const ethTransaction = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -295,22 +304,18 @@ const ethTransaction = async ( expect(signature.length).toEqual(132); expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); }) - ) - .resolves.not.toThrowError() - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ).resolves.not.toThrowError(); }; const signTransaction = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -349,61 +354,57 @@ const signTransaction = async ( method: 'eth_signTransaction', params: [tx], }, - }) - .then((rawSignedTx: string) => { - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r!, - s: parsedTransaction.s!, - v: parsedTransaction.v!, - }); + }).then((rawSignedTx: string) => { + const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); + const signature = ethers.utils.joinSignature({ + r: parsedTransaction.r!, + s: parsedTransaction.s!, + v: parsedTransaction.v!, + }); - const { v, r, s } = parsedTransaction; + const rawTx = { + nonce: parsedTransaction.nonce, + gasPrice: parsedTransaction.gasPrice, + gasLimit: parsedTransaction.gasLimit, + to: parsedTransaction.to, + value: parsedTransaction.value, + data: parsedTransaction.data, + chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 + }; - const recoveredAddress = ethers.utils.recoverAddress(txHash, { - r: r!, - s: s!, - v: v!, - }); + const txHash = ethers.utils.keccak256( + ethers.utils.serializeTransaction(rawTx) + ); - // ==================== Post-Validation ==================== - expect(parsedTransaction).toBeDefined(); + const { v, r, s } = parsedTransaction; - expect(signature.length).toEqual(132); - - expect(recoveredAddress.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); + const recoveredAddress = ethers.utils.recoverAddress(txHash, { + r: r!, + s: s!, + v: v!, }); + + // ==================== Post-Validation ==================== + expect(parsedTransaction).toBeDefined(); + + expect(signature.length).toEqual(132); + + expect(recoveredAddress.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }); }; const ethTypedDataUtil = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -459,36 +460,32 @@ const ethTypedDataUtil = async ( method: 'eth_signTypedData', params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], }, - }) - .then((signature: string) => { - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - expect(signature.length).toEqual(132); - - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + }).then((signature: string) => { + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); + + expect(signature.length).toEqual(132); + + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }); }; const signTypedDataV1 = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -536,22 +533,18 @@ const signTypedDataV1 = async ( alice.pkp?.ethAddress.toLowerCase() ); }) - ) - .resolves.not.toThrowError() - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ).resolves.not.toThrowError(); }; const signTypedDatav3 = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -608,39 +601,35 @@ const signTypedDatav3 = async ( method: 'eth_signTypedData_v3', params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], }, - }) - .then((signature: string) => { - const recoveredAddr = recoverTypedSignature({ - data: { - types: msgParams.types, - domain: msgParams.domain, - primaryType: msgParams.primaryType as 'Mail', - message: msgParams.message, - }, - signature: signature, - version: SignTypedDataVersion.V3, - }); + }).then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: { + types: msgParams.types, + domain: msgParams.domain, + primaryType: msgParams.primaryType as 'Mail', + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); - expect(signature.length).toEqual(132); + expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }); }; const signTypedDatav4 = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const eoaSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -720,16 +709,13 @@ const signTypedDatav4 = async ( alice.pkp?.ethAddress.toLowerCase() ); }) - ) - .resolves.not.toThrow() - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ).resolves.not.toThrow(); }; -const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { - const alice = await devEnv.createRandomPerson(); - +const signWithAuthContext = async ( + devEnv: TinnyEnvironment, + alice: TinnyPerson +): Promise => { const pkpEthersWallet = new PKPEthersWallet({ pkpPubKey: alice.pkp?.publicKey as string, litNodeClient: devEnv.litNodeClient as LitNodeClient, @@ -770,22 +756,20 @@ const signWithAuthContext = async (devEnv: TinnyEnvironment): Promise => { await pkpEthersWallet.init(); - expect(pkpEthersWallet.signMessage(alice.loveLetter)) - .resolves.not.toThrowError() - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + expect( + pkpEthersWallet.signMessage(alice.loveLetter) + ).resolves.not.toThrowError(); }; const ethPersonalSign = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const pkpSessionSigs = await generator(devEnv, alice); const pkpEthersWallet = new PKPEthersWallet({ @@ -827,9 +811,5 @@ const ethPersonalSign = async ( ); } }) - ) - .resolves.not.toThrowError() - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - }); + ).resolves.not.toThrowError(); }; diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index 52d8c308c5..6a28d7c5e0 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -19,7 +19,7 @@ describe('logger', () => { // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'time').mockImplementation(() => {}); // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'log').mockImplementation(() => {}); + jest.spyOn(console, 'log').mockImplementation(() => {}); }); it('Log Manager singleton should be defined', () => { From b9d4487126355e936418c8488f7b7cdd1c0fa6f6 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 13:04:43 -0400 Subject: [PATCH 104/136] test: refactor test user life cycle --- .../e2e-tests/src/tests/SessionSigs.spec.ts | 170 +++++++++--------- 1 file changed, 83 insertions(+), 87 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 75d8264e0b..69f141eea9 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -32,11 +32,20 @@ try { describe('SessionSigs', () => { let devEnv: TinnyEnvironment; + let alice: TinnyPerson; beforeAll(async () => { - //@ts-expect-error global defined + //@ts-expect-error defined in global devEnv = global.devEnv; }); + beforeEach(async () => { + alice = await devEnv.createRandomPerson(); + }); + + afterEach(() => { + alice && devEnv.releasePrivateKeyFromUser(alice); + }); + beforeEach(() => { // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); @@ -48,184 +57,205 @@ describe('SessionSigs', () => { describe('DecryptString', () => { it('LitAction Session', async () => { - await decryptString(devEnv, getLitActionSessionSigs); + await decryptString(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await decryptString(devEnv, getLitActionSessionSigsUsingIpfsId); + await decryptString(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await decryptString(devEnv, getEoaSessionSigs); + await decryptString(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await decryptString(devEnv, getPkpSessionSigs); + await decryptString(devEnv, alice, getPkpSessionSigs); }); }); describe('Claim Key', () => { it('LitAction Session', async () => { - await executeJsClaimKey(devEnv, getLitActionSessionSigs); + await executeJsClaimKey(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsClaimKey(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsClaimKey( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { - await executeJsClaimKey(devEnv, getEoaSessionSigs); + await executeJsClaimKey(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsClaimKey(devEnv, getPkpSessionSigs); + await executeJsClaimKey(devEnv, alice, getPkpSessionSigs); }); }); describe('Claim Key Multiple', () => { it('LitAction Session', async () => { - await executeJsClaimKeys(devEnv, getLitActionSessionSigs); + await executeJsClaimKeys(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsClaimKeys(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsClaimKeys( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { - await executeJsClaimKeys(devEnv, getEoaSessionSigs); + await executeJsClaimKeys(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsClaimKeys(devEnv, getPkpSessionSigs); + await executeJsClaimKeys(devEnv, alice, getPkpSessionSigs); }); }); describe('ExecuteJS JSON Response', () => { it('LitAction Session', async () => { - await executeJsJSONResponse(devEnv, getLitActionSessionSigs); + await executeJsJSONResponse(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsJSONResponse(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsJSONResponse( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { - await executeJsJSONResponse(devEnv, getEoaSessionSigs); + await executeJsJSONResponse(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsJSONResponse(devEnv, getPkpSessionSigs); + await executeJsJSONResponse(devEnv, alice, getPkpSessionSigs); }); }); describe('PKP Sign', () => { it('LitAction Session', async () => { - await pkpSign(devEnv, getLitActionSessionSigs); + await pkpSign(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await pkpSign(devEnv, getLitActionSessionSigsUsingIpfsId); + await pkpSign(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await pkpSign(devEnv, getEoaSessionSigs); + await pkpSign(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await pkpSign(devEnv, getPkpSessionSigs); + await pkpSign(devEnv, alice, getPkpSessionSigs); }); }); describe('ExecuteJS Signing', () => { it('LitAction Session', async () => { - await executeJsSigning(devEnv, getLitActionSessionSigs); + await executeJsSigning(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await executeJsSigning(devEnv, getLitActionSessionSigsUsingIpfsId); + await executeJsSigning(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await executeJsSigning(devEnv, getEoaSessionSigs); + await executeJsSigning(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsSigning(devEnv, getPkpSessionSigs); + await executeJsSigning(devEnv, alice, getPkpSessionSigs); }); }); describe('ExecuteJS Signing Parallel', () => { it('LitAction Session', async () => { - await executeJsSigningParallel(devEnv, getLitActionSessionSigs); + await executeJsSigningParallel(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { await executeJsSigningParallel( devEnv, + alice, getLitActionSessionSigsUsingIpfsId ); }); it('EOA Wallet', async () => { - await executeJsSigningParallel(devEnv, getEoaSessionSigs); + await executeJsSigningParallel(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await executeJsSigningParallel(devEnv, getPkpSessionSigs); + await executeJsSigningParallel(devEnv, alice, getPkpSessionSigs); }); }); describe('Broadcast And Collect', () => { it('LitAction Session', async () => { - await broadcastAndCollect(devEnv, getLitActionSessionSigs); + await broadcastAndCollect(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await broadcastAndCollect(devEnv, getLitActionSessionSigsUsingIpfsId); + await broadcastAndCollect( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { - await broadcastAndCollect(devEnv, getEoaSessionSigs); + await broadcastAndCollect(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await broadcastAndCollect(devEnv, getPkpSessionSigs); + await broadcastAndCollect(devEnv, alice, getPkpSessionSigs); }); }); describe('Decrypt And Combine', () => { it('LitAction Session', async () => { - await decryptAndCombine(devEnv, getLitActionSessionSigs); + await decryptAndCombine(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await decryptAndCombine(devEnv, getLitActionSessionSigsUsingIpfsId); + await decryptAndCombine( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { - await decryptAndCombine(devEnv, getEoaSessionSigs); + await decryptAndCombine(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await decryptAndCombine(devEnv, getPkpSessionSigs); + await decryptAndCombine(devEnv, alice, getPkpSessionSigs); }); }); describe('Sign And Combine ECDSA', () => { it('LitAction Session', async () => { - await signAndCombine(devEnv, getLitActionSessionSigs); + await signAndCombine(devEnv, alice, getLitActionSessionSigs); }); it('LitAction IPFS Session', async () => { - await signAndCombine(devEnv, getLitActionSessionSigsUsingIpfsId); + await signAndCombine(devEnv, alice, getLitActionSessionSigsUsingIpfsId); }); it('EOA Wallet', async () => { - await signAndCombine(devEnv, getEoaSessionSigs); + await signAndCombine(devEnv, alice, getEoaSessionSigs); }); it('PKP Session', async () => { - await signAndCombine(devEnv, getPkpSessionSigs); + await signAndCombine(devEnv, alice, getPkpSessionSigs); }); }); @@ -238,35 +268,21 @@ describe('SessionSigs', () => { it('Invalid Lit Action Custom Auth IPFS SessionSigs', async () => { const alice = await devEnv.createRandomPerson(); - try { - await getInvalidLitActionIpfsSessionSigs(devEnv, alice); - } catch (e: unknown) { - console.log('❌ THIS IS EXPECTED: ', e); - - if ( - (e as Error).message === 'An error related to validation has occured.' - ) { - console.log( - 'βœ… testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error' - ); - } else { - throw e; - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } + expect( + getInvalidLitActionIpfsSessionSigs(devEnv, alice) + ).rejects.toThrowError('An error related to validation has occured.'); }); }); const executeJsClaimKeys = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice, [ { resource: new LitPKPResource('*'), @@ -286,8 +302,6 @@ const executeJsClaimKeys = async ( })();`, }); - devEnv.releasePrivateKeyFromUser(alice); - // Expected output: // { // claims: { @@ -360,6 +374,7 @@ const executeJsClaimKeys = async ( const executeJsClaimKey = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -368,8 +383,6 @@ const executeJsClaimKey = async ( ): Promise => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -423,6 +436,7 @@ const executeJsClaimKey = async ( const pkpSign = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -431,7 +445,6 @@ const pkpSign = async ( ): Promise => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.pkpSign({ @@ -440,8 +453,6 @@ const pkpSign = async ( sessionSigs: litActionSessionSigs as SessionSigsMap, }); - devEnv.releasePrivateKeyFromUser(alice); - // -- Expected output: // { // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", @@ -460,6 +471,7 @@ const pkpSign = async ( const executeJsJSONResponse = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -468,7 +480,6 @@ const executeJsJSONResponse = async ( ): Promise => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -483,8 +494,6 @@ const executeJsJSONResponse = async ( })();`, }); - devEnv.releasePrivateKeyFromUser(alice); - expect(res?.response).toBeDefined(); expect(res?.logs).toBeDefined(); expect(res?.logs.includes('hello world')).toBeTruthy(); @@ -493,13 +502,13 @@ const executeJsJSONResponse = async ( const executeJsSigning = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice, [ { resource: new LitPKPResource('*'), @@ -526,8 +535,6 @@ const executeJsSigning = async ( }, }); - devEnv.releasePrivateKeyFromUser(alice); - expect(res?.signatures?.sig.r).toBeDefined(); expect(res?.signatures?.sig.s).toBeDefined(); expect(res?.signatures?.sig.dataSigned).toBeDefined(); @@ -536,6 +543,7 @@ const executeJsSigning = async ( const executeJsSigningParallel = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -544,8 +552,6 @@ const executeJsSigningParallel = async ( ): Promise => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator(devEnv, alice); const fn = async () => { @@ -565,8 +571,6 @@ const executeJsSigningParallel = async ( }); }; - devEnv.releasePrivateKeyFromUser(alice); - const res = await Promise.all([fn(), fn(), fn()]); res.forEach((r) => { @@ -579,6 +583,7 @@ const executeJsSigningParallel = async ( const decryptString = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -587,7 +592,6 @@ const decryptString = async ( ): Promise => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: @@ -640,13 +644,12 @@ const decryptString = async ( devEnv.litNodeClient as unknown as ILitNodeClient ); - devEnv.releasePrivateKeyFromUser(alice); - expect(decryptRes).toEqual('Hello world'); }; const broadcastAndCollect = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -655,7 +658,6 @@ const broadcastAndCollect = async ( ) => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -672,7 +674,6 @@ const broadcastAndCollect = async ( })();`, jsParams: {}, }); - devEnv.releasePrivateKeyFromUser(alice); const response = res?.response; expect(response).toBeDefined(); @@ -680,6 +681,7 @@ const broadcastAndCollect = async ( const decryptAndCombine = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, @@ -688,7 +690,6 @@ const decryptAndCombine = async ( ) => { devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: @@ -739,21 +740,18 @@ const decryptAndCombine = async ( }, }); - devEnv.releasePrivateKeyFromUser(alice); - expect(res?.response).toEqual('Hello world'); }; const signAndCombine = async ( devEnv: TinnyEnvironment, + alice: TinnyPerson, generator: ( devEnv: TinnyEnvironment, person: TinnyPerson, resources?: LitResourceAbilityRequest[] ) => Promise ) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -774,8 +772,6 @@ const signAndCombine = async ( }, }); - devEnv.releasePrivateKeyFromUser(alice); - /** Response format { From ff35a3ab2fc2ace0bfe18257b2e7ed2e91a4c10f Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 13:59:49 -0400 Subject: [PATCH 105/136] test: review comments --- .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 17 ++++- .../e2e-tests/src/tests/SessionSigs.spec.ts | 15 ----- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 62 ++++--------------- 3 files changed, 26 insertions(+), 68 deletions(-) diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index fda6daeccb..628bd9fd55 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -1,5 +1,9 @@ import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { TinnyEnvironment, AccessControlConditions } from '@lit-protocol/tinny'; +import { + TinnyEnvironment, + AccessControlConditions, + TinnyPerson, +} from '@lit-protocol/tinny'; import { ILitNodeClient } from '@lit-protocol/types'; try { @@ -10,11 +14,20 @@ try { describe('Sol AuthSig', () => { let devEnv: TinnyEnvironment; + let alice: TinnyPerson; beforeAll(async () => { - //@ts-expect-error global defined + //@ts-expect-error defined in global devEnv = global.devEnv; }); + beforeEach(async () => { + alice = await devEnv.createRandomPerson(); + }); + + afterEach(() => { + alice && devEnv.releasePrivateKeyFromUser(alice); + }); + beforeEach(() => { // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 69f141eea9..b868a5406d 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -16,7 +16,6 @@ import { getEoaSessionSigs, getPkpSessionSigs, getLitActionSessionSigsUsingIpfsId, - getInvalidLitActionIpfsSessionSigs, } from '@lit-protocol/tinny'; import { ILitNodeClient, @@ -258,20 +257,6 @@ describe('SessionSigs', () => { await signAndCombine(devEnv, alice, getPkpSessionSigs); }); }); - - it('Invalid lit action Custom Auth SessionSigs', async () => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - expect(devEnv.createRandomPerson()).resolves.not.toThrowError(); - }); - - it('Invalid Lit Action Custom Auth IPFS SessionSigs', async () => { - const alice = await devEnv.createRandomPerson(); - - expect( - getInvalidLitActionIpfsSessionSigs(devEnv, alice) - ).rejects.toThrowError('An error related to validation has occured.'); - }); }); const executeJsClaimKeys = async ( diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 8ca5641e75..f7ca8a6ea0 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -18,6 +18,7 @@ import { TinnyEnvironment, getPkpSessionSigs, getEoaSessionSigs, + TinnyPerson, } from '@lit-protocol/tinny'; import { AuthSig, @@ -70,11 +71,20 @@ try { describe('Wrapped Keys', () => { let devEnv: TinnyEnvironment; + let alice: TinnyPerson; beforeAll(async () => { - //@ts-expect-error global defined + //@ts-expect-error defined in global devEnv = global.devEnv; }); + beforeEach(async () => { + alice = await devEnv.createRandomPerson(); + }); + + afterEach(() => { + alice && devEnv.releasePrivateKeyFromUser(alice); + }); + beforeEach(() => { // eslint-disable-next-line @typescript-eslint/no-empty-function jest.spyOn(console, 'warn').mockImplementation(() => {}); @@ -85,8 +95,6 @@ describe('Wrapped Keys', () => { }); it('Sign Tx Sol Encrypted Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -161,8 +169,6 @@ describe('Wrapped Keys', () => { }); it('Sign Message Sol Encryption Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -219,8 +225,6 @@ describe('Wrapped Keys', () => { }); it('Import Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -228,8 +232,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey = randomSolanaPrivateKey(); // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; @@ -247,8 +249,6 @@ describe('Wrapped Keys', () => { }); it('Generate Solana Wrapped Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -256,8 +256,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ pkpSessionSigs: pkpSessionSigs!, network: 'solana', @@ -319,8 +317,6 @@ describe('Wrapped Keys', () => { }); it('Generate ETH Wrapped Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -363,8 +359,6 @@ describe('Wrapped Keys', () => { }); it('Fail Import Wrapped Key Same Private Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -403,8 +397,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey1 = randomSolanaPrivateKey(); const { pkpAddress } = await importPrivateKey({ @@ -434,12 +426,8 @@ describe('Wrapped Keys', () => { }); it('Fail Max Expiration Session Sig', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - console.log(pkpSessionSigs); - const privateKey = randomSolanaPrivateKey(); expect( @@ -478,8 +466,6 @@ describe('Wrapped Keys', () => { return tamperedPkpSessionSigs; }; - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); const privateKey = randomSolanaPrivateKey(); @@ -546,8 +532,6 @@ describe('Wrapped Keys', () => { const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - console.log(eoaSessionSigs); - const privateKey = randomSolanaPrivateKey(); expect( @@ -565,8 +549,6 @@ describe('Wrapped Keys', () => { }); it('Fail Eth Sign Tx Missing Params', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -618,8 +600,6 @@ describe('Wrapped Keys', () => { }); it('Fail Eth Sign Invalid Param', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -627,8 +607,6 @@ describe('Wrapped Keys', () => { new Date(Date.now() + 1000 * 60 * 10).toISOString() ); // 10 mins expiry - console.log(pkpSessionSigs); - const privateKey = ethers.Wallet.createRandom().privateKey; const { pkpAddress, id } = await importPrivateKey({ @@ -675,7 +653,6 @@ describe('Wrapped Keys', () => { }); it('Fail Eth TX Invalid Decryption', async () => { - const alice = await devEnv.createRandomPerson(); const privateKey = ethers.Wallet.createRandom().privateKey; const alicePkpAddress = alice.authMethodOwnedPkp!.ethAddress; const decryptionAccessControlCondition = @@ -720,8 +697,6 @@ describe('Wrapped Keys', () => { }); it('Export', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigsImport = await getPkpSessionSigs( devEnv, alice, @@ -761,8 +736,6 @@ describe('Wrapped Keys', () => { }); it('Eth Sign Tx', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -810,8 +783,6 @@ describe('Wrapped Keys', () => { }); it('Eth Sign Message', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -850,9 +821,6 @@ describe('Wrapped Keys', () => { id, }); - console.log('signature'); - console.log(signature); - expect(ethers.utils.isHexString(signature)).toBeTruthy(); const unsignedBinaryMessage = ethers.utils.arrayify( @@ -873,8 +841,6 @@ describe('Wrapped Keys', () => { }); it('Eth Sign Message Generate Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -933,8 +899,6 @@ describe('Wrapped Keys', () => { }); it('Eth Broadcast With Fetch Gas Params', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -997,8 +961,6 @@ describe('Wrapped Keys', () => { }); it('Eth Broadcast Tx', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -1051,8 +1013,6 @@ describe('Wrapped Keys', () => { }); it('Eth Broadcast Tx Generated Key', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, From 384bee56ec53edb4a43f3c6ac1b59576d6b27373 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 21 Aug 2024 14:12:03 -0400 Subject: [PATCH 106/136] test: test wrapping test cases in support network checks --- .../e2e-tests/src/tests/SessionSigs.spec.ts | 36 +++++++++---------- packages/tinny/src/lib/tinny-environment.ts | 4 ++- 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index b868a5406d..119f1d55d9 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -117,25 +117,27 @@ describe('SessionSigs', () => { }); describe('ExecuteJS JSON Response', () => { - it('LitAction Session', async () => { - await executeJsJSONResponse(devEnv, alice, getLitActionSessionSigs); - }); + if (!devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await executeJsJSONResponse(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await executeJsJSONResponse( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await executeJsJSONResponse( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await executeJsJSONResponse(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await executeJsJSONResponse(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await executeJsJSONResponse(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await executeJsJSONResponse(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('PKP Sign', () => { @@ -463,8 +465,6 @@ const executeJsJSONResponse = async ( resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index 131aecc098..327c75d37d 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -355,8 +355,10 @@ export class TinnyEnvironment { setUnavailable = (network: LIT_TESTNET) => { if (this.processEnvs.NETWORK === network) { - throw new Error('LIT_IGNORE_TEST'); + return true; } + + return false; }; /** From 47bec2774865a117b33c48c003073bb40d0bb58e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 09:52:04 -0400 Subject: [PATCH 107/136] test: fix network check --- .../e2e-tests/src/tests/SessionSigs.spec.ts | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 119f1d55d9..b86553a197 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -95,29 +95,31 @@ describe('SessionSigs', () => { }); describe('Claim Key Multiple', () => { - it('LitAction Session', async () => { - await executeJsClaimKeys(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await executeJsClaimKeys(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await executeJsClaimKeys( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await executeJsClaimKeys( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await executeJsClaimKeys(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await executeJsClaimKeys(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await executeJsClaimKeys(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await executeJsClaimKeys(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('ExecuteJS JSON Response', () => { - if (!devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { it('LitAction Session', async () => { await executeJsJSONResponse(devEnv, alice, getLitActionSessionSigs); }); From 1e6be9b253f2da2066e05d345bb8bea57059adc9 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 12:12:16 -0400 Subject: [PATCH 108/136] test: review comment updates --- .../e2e-tests/src/tests/SessionSigs.spec.ts | 230 +++++++++--------- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 12 +- 2 files changed, 118 insertions(+), 124 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index b86553a197..4486076514 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -73,25 +73,27 @@ describe('SessionSigs', () => { }); describe('Claim Key', () => { - it('LitAction Session', async () => { - await executeJsClaimKey(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await executeJsClaimKey(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await executeJsClaimKey( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await executeJsClaimKey( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await executeJsClaimKey(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await executeJsClaimKey(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await executeJsClaimKey(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await executeJsClaimKey(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('Claim Key Multiple', () => { @@ -143,123 +145,135 @@ describe('SessionSigs', () => { }); describe('PKP Sign', () => { - it('LitAction Session', async () => { - await pkpSign(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await pkpSign(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await pkpSign(devEnv, alice, getLitActionSessionSigsUsingIpfsId); - }); + it('LitAction IPFS Session', async () => { + await pkpSign(devEnv, alice, getLitActionSessionSigsUsingIpfsId); + }); - it('EOA Wallet', async () => { - await pkpSign(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await pkpSign(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await pkpSign(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await pkpSign(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('ExecuteJS Signing', () => { - it('LitAction Session', async () => { - await executeJsSigning(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await executeJsSigning(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await executeJsSigning(devEnv, alice, getLitActionSessionSigsUsingIpfsId); - }); + it('LitAction IPFS Session', async () => { + await executeJsSigning(devEnv, alice, getLitActionSessionSigsUsingIpfsId); + }); - it('EOA Wallet', async () => { - await executeJsSigning(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await executeJsSigning(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await executeJsSigning(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await executeJsSigning(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('ExecuteJS Signing Parallel', () => { - it('LitAction Session', async () => { - await executeJsSigningParallel(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await executeJsSigningParallel(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await executeJsSigningParallel( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await executeJsSigningParallel( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await executeJsSigningParallel(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await executeJsSigningParallel(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await executeJsSigningParallel(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await executeJsSigningParallel(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('Broadcast And Collect', () => { - it('LitAction Session', async () => { - await broadcastAndCollect(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await broadcastAndCollect(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await broadcastAndCollect( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await broadcastAndCollect( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await broadcastAndCollect(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await broadcastAndCollect(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await broadcastAndCollect(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await broadcastAndCollect(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('Decrypt And Combine', () => { - it('LitAction Session', async () => { - await decryptAndCombine(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await decryptAndCombine(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await decryptAndCombine( - devEnv, - alice, - getLitActionSessionSigsUsingIpfsId - ); - }); + it('LitAction IPFS Session', async () => { + await decryptAndCombine( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); + }); - it('EOA Wallet', async () => { - await decryptAndCombine(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await decryptAndCombine(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await decryptAndCombine(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await decryptAndCombine(devEnv, alice, getPkpSessionSigs); + }); + } }); describe('Sign And Combine ECDSA', () => { - it('LitAction Session', async () => { - await signAndCombine(devEnv, alice, getLitActionSessionSigs); - }); + if (devEnv && !devEnv.setUnavailable(LIT_TESTNET.MANZANO)) { + it('LitAction Session', async () => { + await signAndCombine(devEnv, alice, getLitActionSessionSigs); + }); - it('LitAction IPFS Session', async () => { - await signAndCombine(devEnv, alice, getLitActionSessionSigsUsingIpfsId); - }); + it('LitAction IPFS Session', async () => { + await signAndCombine(devEnv, alice, getLitActionSessionSigsUsingIpfsId); + }); - it('EOA Wallet', async () => { - await signAndCombine(devEnv, alice, getEoaSessionSigs); - }); + it('EOA Wallet', async () => { + await signAndCombine(devEnv, alice, getEoaSessionSigs); + }); - it('PKP Session', async () => { - await signAndCombine(devEnv, alice, getPkpSessionSigs); - }); + it('PKP Session', async () => { + await signAndCombine(devEnv, alice, getPkpSessionSigs); + }); + } }); }); @@ -370,8 +384,6 @@ const executeJsClaimKey = async ( resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -381,8 +393,6 @@ const executeJsClaimKey = async ( })();`, }); - devEnv.releasePrivateKeyFromUser(alice); - // Expected output: // { // claims: { @@ -432,8 +442,6 @@ const pkpSign = async ( resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.pkpSign({ @@ -537,8 +545,6 @@ const executeJsSigningParallel = async ( resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const litActionSessionSigs = await generator(devEnv, alice); const fn = async () => { @@ -577,8 +583,6 @@ const decryptString = async ( resources?: LitResourceAbilityRequest[] ) => Promise ): Promise => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: @@ -643,8 +647,6 @@ const broadcastAndCollect = async ( resources?: LitResourceAbilityRequest[] ) => Promise ) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ @@ -675,8 +677,6 @@ const decryptAndCombine = async ( resources?: LitResourceAbilityRequest[] ) => Promise ) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - // set access control conditions for encrypting and decrypting const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ userAddress: @@ -727,7 +727,7 @@ const decryptAndCombine = async ( }, }); - expect(res?.response).toEqual('Hello world'); + expect(res).toHaveProperty('response', 'Hello world'); }; const signAndCombine = async ( diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index f7ca8a6ea0..f2ff311257 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -388,8 +388,6 @@ describe('Wrapped Keys', () => { }); it('Fail Import Wrapped Key Same PKP', async () => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs( devEnv, alice, @@ -528,8 +526,6 @@ describe('Wrapped Keys', () => { }); it('Fail EOA Session Sig', async () => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); const privateKey = randomSolanaPrivateKey(); @@ -693,6 +689,8 @@ describe('Wrapped Keys', () => { expect(res.response).toEqual( 'Error: When decrypting to a single node- Access control conditions check failed. Check that you are allowed to decrypt this item.' ); + }).finally(() => { + devEnv.releasePrivateKeyFromUser(bob); }); }); @@ -923,11 +921,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, From fc5a222e5bcbfacb1d3e4a6c4a0b900e43ae1db4 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 12:19:00 -0400 Subject: [PATCH 109/136] ci: remove install flags --- .github/workflows/ci.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5070026f8..315f13afb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -29,7 +29,7 @@ jobs: cache: yarn cache-dependency-path: ${{ github.workspace }}/yarn.lock - name: Install Dependencies - run: yarn --frozen-lockfile + run: yarn - name: Build run: yarn build:dev - name: Run Unit tests @@ -77,12 +77,8 @@ jobs: - name: Run Shiva Container id: shiva-runner run: docker run -d -m 32g -p 8000:8000 -p 8545:8545 -p 7470:7470 -p 7471:7471 -p 7472:7472 -p 7473:7473 -p 7474:7474 -p 7475:7475 -v ${{github.workspace}}/lit-assets:/data -e GH_PAT=${{secrets.GH_PAT}} -e HASH=$DATIL_COMMIT_HASH -e IPFS_API_KEY=${{secrets.IPFS_API_KEY}} --name shiva ghcr.io/lit-protocol/shiva:latest - - name: Set up Node.js - uses: actions/setup-node@v3 - with: - node-version: '20' - name: Install project dependencies - run: yarn --frozen-lockfile + run: yarn - uses: nrwl/nx-set-shas@v3 with: main-branch-name: 'master' From 867f5eeeb1aa0219ff128fa694e1b52010a84779 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 12:37:01 -0400 Subject: [PATCH 110/136] chore: fmt --- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 6 +++++- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 7 ++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 4486076514..3f66d5e844 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -171,7 +171,11 @@ describe('SessionSigs', () => { }); it('LitAction IPFS Session', async () => { - await executeJsSigning(devEnv, alice, getLitActionSessionSigsUsingIpfsId); + await executeJsSigning( + devEnv, + alice, + getLitActionSessionSigsUsingIpfsId + ); }); it('EOA Wallet', async () => { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index f2ff311257..847a4b2531 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -689,8 +689,9 @@ describe('Wrapped Keys', () => { expect(res.response).toEqual( 'Error: When decrypting to a single node- Access control conditions check failed. Check that you are allowed to decrypt this item.' ); - }).finally(() => { - devEnv.releasePrivateKeyFromUser(bob); + }) + .finally(() => { + devEnv.releasePrivateKeyFromUser(bob); }); }); @@ -921,7 +922,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - expect(pkpAddress).toEqual(alicePkpAddress); + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsSigning = await getPkpSessionSigs( devEnv, From 70bf2151255feb77c616f68ba381173c9132cdb0 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 13:00:37 -0400 Subject: [PATCH 111/136] ref: remove code coverage flag --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6247ae8710..722afbe83e 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "bundles": "yarn node ./esbuilder/lit-connect-modal/esbuild.js", "postBuild:mapDistFolderNameToPackageJson": "node ./tools/scripts/map-dist-folder-name-to-package-json.mjs", "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", - "test:ci": "nx affected --target=test --exclude=e2e-tests --code-coverage", + "test:ci": "nx affected --target=test --exclude=e2e-tests", "test:e2e": "nx run e2e-tests:test", "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", "test:unit": "nx run-many --target=test --exclude=e2e-tests", From a27b58914ffc87b019f03501e9c8d0dfd8529c4c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 13:01:28 -0400 Subject: [PATCH 112/136] ref: add more test assertions --- .../e2e-tests/src/tests/PKPEthers.spec.ts | 101 +++++++++--------- 1 file changed, 50 insertions(+), 51 deletions(-) diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index 2d55ad1cc9..cdf4beba05 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -454,27 +454,29 @@ const ethTypedDataUtil = async ( }, }; - ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }).then((signature: string) => { - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); + expect( + ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData', + params: [alice?.pkp?.ethAddress, JSON.stringify(msgParams)], + }, + }).then((signature: string) => { + // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData + const recoveredAddr = ethers.utils.verifyTypedData( + msgParams.domain, + { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, + msgParams.message, + signature + ); - expect(signature.length).toEqual(132); + expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + ).resolves; }; const signTypedDataV1 = async ( @@ -595,30 +597,32 @@ const signTypedDatav3 = async ( }, }; - ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], - }, - }).then((signature: string) => { - const recoveredAddr = recoverTypedSignature({ - data: { - types: msgParams.types, - domain: msgParams.domain, - primaryType: msgParams.primaryType as 'Mail', - message: msgParams.message, + expect( + ethRequestHandler({ + signer: pkpEthersWallet, + payload: { + method: 'eth_signTypedData_v3', + params: [alice.pkp?.ethAddress, JSON.stringify(msgParams)], }, - signature: signature, - version: SignTypedDataVersion.V3, - }); + }).then((signature: string) => { + const recoveredAddr = recoverTypedSignature({ + data: { + types: msgParams.types, + domain: msgParams.domain, + primaryType: msgParams.primaryType as 'Mail', + message: msgParams.message, + }, + signature: signature, + version: SignTypedDataVersion.V3, + }); - expect(signature.length).toEqual(132); + expect(signature.length).toEqual(132); - expect(recoveredAddr.toLowerCase()).toEqual( - alice.pkp?.ethAddress.toLowerCase() - ); - }); + expect(recoveredAddr.toLowerCase()).toEqual( + alice.pkp?.ethAddress.toLowerCase() + ); + }) + ).resolves; }; const signTypedDatav4 = async ( @@ -757,7 +761,10 @@ const signWithAuthContext = async ( await pkpEthersWallet.init(); expect( - pkpEthersWallet.signMessage(alice.loveLetter) + pkpEthersWallet.signMessage(alice.loveLetter).then((signature) => { + expect(signature).toBeDefined(); + expect(signature.length).toEqual(132); + }) ).resolves.not.toThrowError(); }; @@ -800,16 +807,8 @@ const ethPersonalSign = async ( }).then((signature: string) => { const recoveredAddr = ethers.utils.verifyMessage(message, signature); - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp?.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp?.ethAddress} but got ${recoveredAddr}` - ); - } + expect(signature.length).toEqual(132); + expect(recoveredAddr).toEqual(alice.pkp?.ethAddress); }) ).resolves.not.toThrowError(); }; From cb83f37ae829dda3d8e9d126e647907bc9ff851a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 13:02:21 -0400 Subject: [PATCH 113/136] chore: remove `local-tests` directory --- local-tests/README.md | 142 - local-tests/build.mjs | 65 - local-tests/setup/accs/accs.ts | 62 - local-tests/setup/networkContext.example.json | 11268 --------------- local-tests/setup/networkContext.json | 11370 ---------------- .../session-sigs/get-eoa-session-sigs.ts | 171 - .../get-lit-action-session-sigs.ts | 171 - .../session-sigs/get-pkp-session-sigs.ts | 49 - local-tests/setup/shiva-client.d.ts | 72 - local-tests/setup/shiva-client.ts | 289 - local-tests/setup/tinny-config.ts | 143 - local-tests/setup/tinny-environment.ts | 571 - local-tests/setup/tinny-operations.ts | 270 - local-tests/setup/tinny-person.ts | 224 - local-tests/setup/tinny-utils.ts | 87 - local-tests/shim.mjs | 3 - local-tests/test.ts | 313 - local-tests/tests/test-bundle-speed.ts | 15 - local-tests/tests/test-example.ts | 45 - ...testCosmosAuthSigToEncryptDecryptString.ts | 77 - ...pacityCreditsNFTToAnotherPkpToExecuteJs.ts | 129 - ...ityCreditsNFTToAnotherWalletToExecuteJs.ts | 117 - ...acityCreditsNFTToAnotherWalletToPkpSign.ts | 99 - .../testEthAuthSigToEncryptDecryptString.ts | 68 - .../tests/testExecuteJsBroadcastAndCollect.ts | 47 - .../tests/testExecuteJsDecryptAndCombine.ts | 86 - .../tests/testExecuteJsSignAndCombineEcdsa.ts | 109 - ...estPkpEthersWithEoaSessionSigsToEthSign.ts | 62 - ...sWithEoaSessionSigsToEthSignTransaction.ts | 109 - ...ersWithEoaSessionSigsToEthSignTypedData.ts | 97 - ...ithEoaSessionSigsToEthSignTypedDataUtil.ts | 94 - ...sWithEoaSessionSigsToEthSignTypedDataV1.ts | 79 - ...sWithEoaSessionSigsToEthSignTypedDataV3.ts | 107 - ...sWithEoaSessionSigsToEthSignTypedDataV4.ts | 107 - ...pEthersWithEoaSessionSigsToPersonalSign.ts | 63 - ...testPkpEthersWithEoaSessionSigsToSendTx.ts | 66 - ...kpEthersWithEoaSessionSigsToSignMessage.ts | 35 - ...WithEoaSessionSigsToSignWithAuthContext.ts | 72 - ...EthersWithLitActionSessionSigsToEthSign.ts | 62 - ...itActionSessionSigsToEthSignTransaction.ts | 109 - ...hLitActionSessionSigsToEthSignTypedData.ts | 97 - ...ActionSessionSigsToEthSignTypedDataUtil.ts | 89 - ...itActionSessionSigsToEthSignTypedDataV1.ts | 79 - ...itActionSessionSigsToEthSignTypedDataV3.ts | 106 - ...itActionSessionSigsToEthSignTypedDataV4.ts | 107 - ...sWithLitActionSessionSigsToPersonalSign.ts | 63 - ...pEthersWithLitActionSessionSigsToSendTx.ts | 66 - ...rsWithLitActionSessionSigsToSignMessage.ts | 34 - ...estPkpEthersWithPkpSessionSigsToEthSign.ts | 62 - ...sWithPkpSessionSigsToEthSignTransaction.ts | 109 - ...ersWithPkpSessionSigsToEthSignTypedData.ts | 97 - ...ithPkpSessionSigsToEthSignTypedDataUtil.ts | 90 - ...sWithPkpSessionSigsToEthSignTypedDataV1.ts | 79 - ...sWithPkpSessionSigsToEthSignTypedDataV3.ts | 106 - ...sWithPkpSessionSigsToEthSignTypedDataV4.ts | 107 - ...pEthersWithPkpSessionSigsToPersonalSign.ts | 63 - ...testPkpEthersWithPkpSessionSigsToSendTx.ts | 66 - ...kpEthersWithPkpSessionSigsToSignMessage.ts | 34 - local-tests/tests/testRelayer.ts | 117 - .../testSolAuthSigToEncryptDecryptString.ts | 66 - ...thUnspecifiedCapacityTokenIdToExecuteJs.ts | 121 - ...WithUnspecifiedCapacityTokenIdToPkpSign.ts | 101 - ...SigWithUnspecifiedDelegateesToExecuteJs.ts | 119 - ...thSigWithUnspecifiedDelegateesToPkpSign.ts | 96 - ...CustomAuthSessionSigsToPkpSignExecuteJs.ts | 149 - ...stUseEoaSessionSigsToEncryptDecryptFile.ts | 94 - ...UseEoaSessionSigsToEncryptDecryptString.ts | 83 - ...estUseEoaSessionSigsToEncryptDecryptZip.ts | 87 - ...stUseEoaSessionSigsToExecuteJsClaimKeys.ts | 182 - ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 106 - ...tUseEoaSessionSigsToExecuteJsConsoleLog.ts | 56 - ...seEoaSessionSigsToExecuteJsJsonResponse.ts | 71 - ...testUseEoaSessionSigsToExecuteJsSigning.ts | 68 - ...SessionSigsToExecuteJsSigningInParallel.ts | 122 - .../tests/testUseEoaSessionSigsToPkpSign.ts | 64 - ...validLitActionCodeToGenerateSessionSigs.ts | 34 - ...dLitActionIpfsCodeToGenerateSessionSigs.ts | 32 - ...stUsePkpSessionSigsToEncryptDecryptFile.ts | 95 - ...UsePkpSessionSigsToEncryptDecryptString.ts | 81 - ...estUsePkpSessionSigsToEncryptDecryptZip.ts | 90 - ...stUsePkpSessionSigsToExecuteJsClaimKeys.ts | 172 - ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 106 - ...tUsePkpSessionSigsToExecuteJsConsoleLog.ts | 54 - ...sePkpSessionSigsToExecuteJsJsonResponse.ts | 71 - ...testUsePkpSessionSigsToExecuteJsSigning.ts | 82 - ...SessionSigsToExecuteJsSigningInParallel.ts | 123 - .../tests/testUsePkpSessionSigsToPkpSign.ts | 64 - ...eneratedSessionSigsToEncryptDecryptFile.ts | 98 - ...eratedSessionSigsToEncryptDecryptString.ts | 87 - ...GeneratedSessionSigsToEncryptDecryptZip.ts | 92 - ...eneratedSessionSigsToExecuteJsClaimKeys.ts | 118 - ...SessionSigsToExecuteJsClaimMultipleKeys.ts | 108 - ...neratedSessionSigsToExecuteJsConsoleLog.ts | 69 - ...ratedSessionSigsToExecuteJsJsonResponse.ts | 72 - ...eGeneratedSessionSigsToExecuteJsSigning.ts | 85 - ...SessionSigsToExecuteJsSigningInParallel.ts | 125 - ...ActionCodeGeneratedSessionSigsToPkpSign.ts | 69 - ...eGeneratedSessionSigsToExecuteJsSigning.ts | 83 - ...onIpfsCodeGeneratedSessionSigsToPkpSign.ts | 71 - ...thereumBroadcastTransactionGeneratedKey.ts | 82 - ...tEthereumBroadcastTransactionWrappedKey.ts | 87 - ...umBroadcastWrappedKeyWithFetchGasParams.ts | 91 - .../testEthereumSignMessageGeneratedKey.ts | 97 - .../testEthereumSignMessageWrappedKey.ts | 101 - .../testEthereumSignTransactionWrappedKey.ts | 83 - .../wrapped-keys/testExportWrappedKey.ts | 71 - ...nTransactionWrappedKeyInvalidDecryption.ts | 81 - ...gnTransactionWrappedKeyWithInvalidParam.ts | 93 - ...gnTransactionWrappedKeyWithMissingParam.ts | 88 - ...tFailImportWrappedKeysWithEoaSessionSig.ts | 51 - ...lImportWrappedKeysWithExpiredSessionSig.ts | 69 - ...lImportWrappedKeysWithInvalidSessionSig.ts | 71 - ...mportWrappedKeysWithMaxExpirySessionSig.ts | 48 - ...FailImportWrappedKeysWithSamePrivateKey.ts | 70 - .../testGenerateEthereumWrappedKey.ts | 72 - .../testGenerateSolanaWrappedKey.ts | 109 - .../wrapped-keys/testImportWrappedKey.ts | 62 - .../testSignMessageWithSolanaEncryptedKey.ts | 84 - ...stSignTransactionWithSolanaEncryptedKey.ts | 113 - local-tests/tests/wrapped-keys/util.ts | 77 - package.json | 2 +- 121 files changed, 1 insertion(+), 34062 deletions(-) delete mode 100644 local-tests/README.md delete mode 100644 local-tests/build.mjs delete mode 100644 local-tests/setup/accs/accs.ts delete mode 100644 local-tests/setup/networkContext.example.json delete mode 100644 local-tests/setup/networkContext.json delete mode 100644 local-tests/setup/session-sigs/get-eoa-session-sigs.ts delete mode 100644 local-tests/setup/session-sigs/get-lit-action-session-sigs.ts delete mode 100644 local-tests/setup/session-sigs/get-pkp-session-sigs.ts delete mode 100644 local-tests/setup/shiva-client.d.ts delete mode 100644 local-tests/setup/shiva-client.ts delete mode 100644 local-tests/setup/tinny-config.ts delete mode 100644 local-tests/setup/tinny-environment.ts delete mode 100644 local-tests/setup/tinny-operations.ts delete mode 100644 local-tests/setup/tinny-person.ts delete mode 100644 local-tests/setup/tinny-utils.ts delete mode 100644 local-tests/shim.mjs delete mode 100644 local-tests/test.ts delete mode 100644 local-tests/tests/test-bundle-speed.ts delete mode 100644 local-tests/tests/test-example.ts delete mode 100644 local-tests/tests/testCosmosAuthSigToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts delete mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts delete mode 100644 local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts delete mode 100644 local-tests/tests/testEthAuthSigToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testExecuteJsBroadcastAndCollect.ts delete mode 100644 local-tests/tests/testExecuteJsDecryptAndCombine.ts delete mode 100644 local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts delete mode 100644 local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.ts delete mode 100644 local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.ts delete mode 100644 local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.ts delete mode 100644 local-tests/tests/testRelayer.ts delete mode 100644 local-tests/tests/testSolAuthSigToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts delete mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts delete mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts delete mode 100644 local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts delete mode 100644 local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts delete mode 100644 local-tests/tests/testUseEoaSessionSigsToPkpSign.ts delete mode 100644 local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts delete mode 100644 local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts delete mode 100644 local-tests/tests/testUsePkpSessionSigsToPkpSign.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts delete mode 100644 local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts delete mode 100644 local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.ts delete mode 100644 local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testExportWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.ts delete mode 100644 local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testImportWrappedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.ts delete mode 100644 local-tests/tests/wrapped-keys/util.ts diff --git a/local-tests/README.md b/local-tests/README.md deleted file mode 100644 index 065e528056..0000000000 --- a/local-tests/README.md +++ /dev/null @@ -1,142 +0,0 @@ -# Tinny - -Tinny is a mini test framework, serving as a temporary solution for running e2e tests in TypeScript until we can integrate `Jest`. It utilizes `esbuild` for its rapid compilation speed to bundle all the tests into a single `test.mjs` file, then runs the built `test.mjs` file immediately. See [Benchmark](#esbuild-benchmark) - -# Prerequisite - -- Node v20 or above -- The generated file `networkContext.ts` after running `npm run deploy -- --network localchain` in the `lit-assets` repo - -# How to run - -In most cases, you will only need the following two environment variables, and a `--filter` flag. See [API](#api) - -The `testName` specified in the filter **must be the same as the function name**. - -## to run all tests - -``` -// run all tests on localchain -DEBUG=true NETWORK=localchain yarn test:local - -// run filtered tests on manzano -DEBUG=true NETWORK=manzano yarn test:local --filter=testExample -DEBUG=true NETWORK=manzano yarn test:local --filter=testExample,testBundleSpeed - -// run filtered tests by keyword -DEBUG=true NETWORK=manzano yarn test:local --filter=Encrypt - -// eg. -yarn test:local --filter=testExample,testBundleSpeed - -``` - -## API - -Below is the API documentation for the `ProcessEnvs` interface, detailing the configurable environment variables and their purposes: - -**NOTE: a `.env.sample` is contained in the repository root for the below env tables** - -| Variable | Description | -| ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `MAX_ATTEMPTS` | Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. | -| `TEST_TIMEOUT` | The maximum number of milliseconds to wait for a test to complete. | -| `NETWORK` | The network to use for testing, which can be one of the following: `LIT_TESTNET.LOCALCHAIN`, `LIT_TESTNET.MANZANO`, or `LIT_TESTNET.CAYENNE`. | -| `DEBUG` | Specifies whether to enable debug mode. | -| `REQUEST_PER_KILOSECOND` | To execute a transaction with Lit, you must reserve capacity on the network using Capacity Credits. These allow a set number of requests over a period (default 2 days). | -| `WAIT_FOR_KEY_INTERVAL` | Wait time in milliseconds if no private keys are available. | -| `TIME_TO_RELEASE_KEY` | Time to wait before releasing the key after requesting it. | -| `RUN_IN_BAND` | Run all tests in a single thread. | -| `RUN_IN_BAND_INTERVAL` | The interval in milliseconds to run the tests in a single thread. | -| `LIT_RPC_URL` | The URL of the Lit RPC server:
- For local Anvil: `http://127.0.0.1:8545`
- For Chronicle: `https://chain-rpc.litprotocol.com/http`
- For Yellowstone: `https://yellowstone-rpc.litprotocol.com` | -| `STOP_TESTNET` | Flag to stop a single running testnet after the test run concludes. | -| `USE_SHIVA` | A flag to determine if `Shiva` should be used for the `localchain` network. | -| `PRIVATE_KEYS` | A set of private keys to use which will be used to perform chain operations. | -| `CHUNK_SIZE` | Determines the number of tests run concurrently during parallel execution | - -Below is the API Documentation for the `ProccessEnvs` interface for the `shiva-client` detailing the configurable environment variables and their purposes: - -| Variable | Description | -| ------------------------ | ----------------------------------------------------------------------------------------------------------- | -| `TESTNET_MANANGER_URL` | URl to connect to Shiva (our testing tool for network management). | -| `LIT_NODE_BINARY_PATH` | Binary path for the lit node version you wish to run. | -| `LIT_Action_BINARY_PATH` | Binary path for the lit node version you wish to run. | -| `USE_LIT_BINARIES` | Flag to indicate if a binary path should be used for testnet spawning or if it should be built from source. | -| `STOP_TESTNET` | Flag to stop a single running testnet after the test run concludes. | - -# Writing a test - -Writing a test is the same as writing any other code, except that you must throw an error if any occur. There are no assertion libraries, so all tests are written using basic `if-else` statements. - -In the test function, a `devEnv` variable will automatically be added as the first parameter to your function. - -## Using the devEnv API in the test - -```ts -export const testExample = async (devEnv: TinnyEnvironment) => { - - // ========== Enviorment ========== - // This test will be skipped if we are testing on the Cayenne network - devEnv.setUnavailable(LIT_TESTNET.CAYENNE); - - // Using litNodeClient - const res = await devEnv.litNodeClient.executeJs({...}); - - // ========== Creating a new identify/user profile ========== - const alice = await devEnv.createRandomPerson(); - - // Alice minting a capacity creditrs NFT - const aliceCcNft = await alice.mintCapacityCreditsNFT(); - - // Alice creating a capacity delegation authSig - const aliceCcAuthSig = await alice.createCapacityDelegationAuthSig(); -}; -``` - -## TinnyPerson Class API - -The `TinnyPerson` class encapsulates various functionalities to manage wallet operations, authentication, and contract interactions for testing purposes. Below is a detailed API documentation: - -### Alice's Properties - -| Property | Description | -| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | -| `privateKey` | The private key used to instantiate the wallet associated with the TinnyPerson instance. | -| `wallet` | An `ethers.Wallet` instance created using the provided `privateKey` and connected to the specified provider. | -| `siweMessage` | A string that holds the Sign-In with Ethereum (SIWE) message used for authentication. | -| `pkp` | EOA/Hot wallet owned PKP NFT | -| `authSig` | An `AuthSig` object that stores the authentication signature derived from the SIWE message. | -| `authMethod` | An `AuthMethod` object representing the authentication method used, typically related to blockchain wallet authentication. | -| `authMethodOwnedPkp` | PKP information specifically tied to the authentication method of the wallet. | -| `contractsClient` | An instance of `LitContracts`, used to interact with Lit Protocol smart contracts for operations such as minting tokens or PKP NFTs. | -| `provider` | An `ethers.providers.JsonRpcProvider` instance connected to the blockchain network specified in `envConfig`. | -| `loveLetter` | A `Uint8Array` containing a keccak256 hashed value, typically used as unsigned data to be passed to the `executeJs` and `pkpSign` functions | - -### Methods - -| Method | Description | -| -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `constructor({privateKey, envConfig})` | Initializes a new instance of `TinnyPerson` with the specified private key and environment configuration. Sets up the wallet and provider based on these settings. | -| `spawn()` | Performs several operations to set up the TinnyPerson instance fully, including authentication and contract client setup. It also mints a PKP using the specified authentication method. | -| `mintCapacityCreditsNFT()` | Mints a Capacity Credits NFT based on the `REQUEST_PER_KILOSECOND` setting in `envConfig`. Returns the token ID of the minted NFT. | -| `createCapacityDelegationAuthSig(addresses)` | Mints a Capacity Credits NFT and creates an authentication signature for delegating capacity, which can be used to authorize other addresses to use the minted credits. | - -## - -# esbuild benchmark - -```ts - -// test-bundle-speed.ts -export const testBundleSpeed = async (devEnv: TinnyEnvironment) => { - const a = await import('@lit-protocol/lit-node-client'); - const b = await import('@lit-protocol/contracts-sdk'); - const c = await import('@lit-protocol/auth-helpers'); - const d = await import('@lit-protocol/constants'); - const e = await import('@lit-protocol/lit-auth-client'); - - console.log(a, b, c, d, e); -}; ----------------- -Build time: 77ms -``` diff --git a/local-tests/build.mjs b/local-tests/build.mjs deleted file mode 100644 index 79fd5883d7..0000000000 --- a/local-tests/build.mjs +++ /dev/null @@ -1,65 +0,0 @@ -import * as esbuild from 'esbuild'; -import { nodeExternalsPlugin } from 'esbuild-node-externals'; -import fs from 'fs'; - -const TEST_DIR = 'local-tests'; - -/** - * Builds the project using esbuild. - * @returns {Promise} A promise that resolves when the build is complete. - */ -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'], - }); -}; - -/** - * Inserts a polyfill at the beginning of a file. - * The polyfill ensures that the global `fetch` function is available. - * @returns {void} - */ -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}`); - } -}; - -// Go! -(async () => { - const start = Date.now(); - await build(); - postBuildPolyfill(); - console.log(`[build.mjs] πŸš€ Build time: ${Date.now() - start}ms`); -})(); diff --git a/local-tests/setup/accs/accs.ts b/local-tests/setup/accs/accs.ts deleted file mode 100644 index ff7c66564e..0000000000 --- a/local-tests/setup/accs/accs.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { - LPACC_EVM_ATOM, - LPACC_EVM_BASIC, - LPACC_SOL, -} from '@lit-protocol/accs-schemas'; - -export namespace AccessControlConditions { - export const getEmvBasicAccessControlConditions = ({ - userAddress, - }): LPACC_EVM_BASIC[] => { - return [ - { - contractAddress: '', - standardContractType: '', - chain: 'ethereum', - method: '', - parameters: [':userAddress'], - returnValueTest: { - comparator: '=', - value: userAddress, - }, - }, - ]; - }; - - export const getSolBasicAccessControlConditions = ({ - userAddress, - }): LPACC_SOL[] => { - return [ - { - method: '', - params: [':userAddress'], - pdaParams: [], - pdaInterface: { offset: 0, fields: {} }, - pdaKey: '', - chain: 'solana', - returnValueTest: { - key: '', - comparator: '=', - value: userAddress, - }, - }, - ]; - }; - - export const getCosmosBasicAccessControlConditions = ({ - userAddress, - }): LPACC_EVM_ATOM[] => { - return [ - { - conditionType: 'cosmos', - path: ':userAddress', - chain: 'cosmos', - returnValueTest: { - key: '', - comparator: '=', - value: userAddress, - }, - }, - ]; - }; -} diff --git a/local-tests/setup/networkContext.example.json b/local-tests/setup/networkContext.example.json deleted file mode 100644 index 307fd9f508..0000000000 --- a/local-tests/setup/networkContext.example.json +++ /dev/null @@ -1,11268 +0,0 @@ -{ - "Allowlist": { - "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemNotAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "allowAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "allowedItems", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "isAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_allowAll", - "type": "bool" - } - ], - "name": "setAllowAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setNotAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Allowlist" - }, - "LITToken": { - "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "cap", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINTER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAUSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint32", - "name": "pos", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "fromBlock", - "type": "uint32" - }, - { - "internalType": "uint224", - "name": "votes", - "type": "uint224" - } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "LITToken" - }, - "Multisender": { - "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - } - ], - "name": "sendEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - }, - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "withdrawTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Multisender" - }, - "PKPHelper": { - "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainWalletRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPKPNftMetdataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddDomainWalletMetadata", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removePkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - } - ], - "name": "setPkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPHelper" - }, - "PKPNFT": { - "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "MintCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "PKPMinted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "name": "claimAndMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "exists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNextDerivedKeyId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftMetadataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "mintGrantAndBurnNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "name": "mintNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "redeemedFreeMintIds", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "setMintCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPNFT" - }, - "PKPNFTMetadata": { - "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "buffer", - "type": "bytes" - } - ], - "name": "bytesToHex", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeProfileForPkp", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "imgUrl", - "type": "string" - } - ], - "name": "setProfileForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - } - ], - "name": "setUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPNFTMetadata" - }, - "PKPPermissions": { - "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "RootHashUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod", - "name": "authMethod", - "type": "tuple" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "addPermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToAdd", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToAdd", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeysToAdd", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopesToAdd", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToRemove", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToRemove", - "type": "bytes[]" - } - ], - "name": "batchAddRemoveAuthMethods", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getAuthMethodId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedActions", - "outputs": [ - { - "internalType": "bytes[]", - "name": "", - "type": "bytes[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "maxScopeId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethodScopes", - "outputs": [ - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethods", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getTokenIdsForAuthMethod", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getUserPubkeyForAuthMethod", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "isPermittedAction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "isPermittedAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "isPermittedAuthMethod", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "isPermittedAuthMethodScopePresent", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "removePermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "removePermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "removePermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "removePermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "setRootHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "verifyState", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bool[]", - "name": "proofFlags", - "type": "bool[]" - }, - { - "internalType": "bytes32[]", - "name": "leaves", - "type": "bytes32[]" - } - ], - "name": "verifyStates", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPPermissions" - }, - "PubkeyRouter": { - "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "PubkeyRoutingDataSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct IPubkeyRouter.RootKey", - "name": "rootKey", - "type": "tuple" - } - ], - "name": "RootKeySet", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "adminResetRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - }, - { - "internalType": "bytes", - "name": "signedMessage", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - } - ], - "name": "checkNodeSignatures", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "deriveEthAddressFromPubkey", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "ethAddressToPkpId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "getDerivedPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "getRootKeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getRoutingData", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isRouted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "pubkeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingDataAsAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "newRootKeys", - "type": "tuple[]" - } - ], - "name": "voteForRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PubkeyRouter" - }, - "RateLimitNFT": { - "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "AdditionalRequestsPerKilosecondCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "FreeRequestsPerRateLimitWindowSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RLIHolderRateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "setAdditionalRequestsPerKilosecondCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "setFreeRequestsPerRateLimitWindow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxExpirationSeconds", - "type": "uint256" - } - ], - "name": "setMaxExpirationSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "setMaxRequestsPerKilosecond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRLIHolderRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "RLIHolderRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "additionalRequestsPerKilosecondCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "payingAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "capacity", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "internalType": "struct LibRateLimitNFTStorage.RateLimit", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestedRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "checkBelowMaxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentSoldRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMintSigTest", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeRequestsPerRateLimitWindow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isExpired", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxExpirationSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - } - ], - "name": "redeemedFreeMints", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenIdCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenSVG", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "totalSoldRequestsPerKilosecondByExpirationTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "RateLimitNFT" - }, - "Staking": { - "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "CannotKickBelowCurrentValidatorThreshold", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - } - ], - "name": "CannotRejoinUntilNextEpochBecauseKicked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "CannotReuseCommsKeys", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "CannotVoteTwice", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "CouldNotMapNodeAddressToStakerAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedOrPausedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "MustBeValidatorInNextEpochToKick", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "validatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsInNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nextReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCountToBeReady", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsReadyForNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentEpochNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receivedEpochNumber", - "type": "uint256" - } - ], - "name": "SignaledReadyForWrongEpochNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "internalType": "address[]", - "name": "validatorsInNextEpoch", - "type": "address[]" - } - ], - "name": "ValidatorIsNotInNextEpoch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newComplaintTolerance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newComplaintIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "ConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "EpochEndTimeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "EpochLengthSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "EpochTimeoutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "KickPenaltyPercentSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "ReadyForNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToJoin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToLeave", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverContractAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newDuration", - "type": "uint256" - } - ], - "name": "RewardsDurationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newStakingTokenAddress", - "type": "address" - } - ], - "name": "StakingTokenSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "StateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountBurned", - "type": "uint256" - } - ], - "name": "ValidatorKickedFromNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "ValidatorRejoinedNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "reporter", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "VotedToKickValidatorInNextEpoch", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - } - ], - "name": "adminKickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "adminRejoinValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "adminResetEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToPenalize", - "type": "uint256" - } - ], - "name": "adminSlashValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "advanceEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "kickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lockValidatorsForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "requestToJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeaveAsNode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newComplaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newComplaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "setEpochEndTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "setEpochLength", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "setEpochState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "setEpochTimeout", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "setIpPortNodeAddressAndCommunicationPubKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "setKickPenaltyPercent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "signalReadyForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "stakeAndJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "VersionRequirementsUpdated", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "checkVersion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMaxVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMinVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "config", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfCurrentValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfNextValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "epochLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "number", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "retries", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Epoch", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKeyTypes", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKickedValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getNodeStakerAddressMappings", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "internalType": "struct LibStakingStorage.AddressMapping[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingBalancesAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpochLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInNextEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getValidatorsStructs", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInCurrentEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInNextEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - }, - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "voterStakerAddress", - "type": "address" - } - ], - "name": "getVotingStatusToKickValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidatorByNodeAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isReadyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "kickPenaltyPercentByReason", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "nodeAddressToStakerAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "readyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "shouldKickValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "validators", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "Staking" - }, - "StakingBalances": { - "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "AliasNotOwnedBySender", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "CannotRemoveAliasOfActiveValidator", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "aliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountReached", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "OnlyStakingContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeGreaterThanMinimumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maximumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeLessThanMaximumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "MaximumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "MinimumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "permittedStakersOn", - "type": "bool" - } - ], - "name": "PermittedStakersOnChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Staked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - } - ], - "name": "TokenRewardPerTokenPerEpochSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "ValidatorNotRewardedBecauseAlias", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorRewarded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorTokensPenalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "addAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "addPermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "stakers", - "type": "address[]" - } - ], - "name": "addPermittedStakers", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "checkStakingAmounts", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "isPermittedStaker", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "penalizeTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "permittedStakersOn", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "removeAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "removePermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "restakePenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "setMaxAliasCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "setMaximumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "setMinimumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "permitted", - "type": "bool" - } - ], - "name": "setPermittedStakersOn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "transferPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "withdrawPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "StakingBalances" - }, - "ContractResolver": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "abi": [ - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AdminRoleRequired", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "SetContract", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ALLOWLIST_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BACKUP_RECOVERY_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_WALLET_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HD_KEY_DERIVER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIT_TOKEN_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MULTI_SENDER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAYMENT_DELEGATION_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_HELPER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_METADATA_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_PERMISSIONS_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PUB_KEY_ROUTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RATE_LIMIT_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELEASE_REGISTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_BALANCES_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "addAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "getContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "adminBeingRemoved", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "removeAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "setContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "name": "typeAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "ContractResolver" - } -} diff --git a/local-tests/setup/networkContext.json b/local-tests/setup/networkContext.json deleted file mode 100644 index aabf963710..0000000000 --- a/local-tests/setup/networkContext.json +++ /dev/null @@ -1,11370 +0,0 @@ -{ - "Allowlist": { - "address": "0x67d269191c92Caf3cD7723F116c85e6E9bf55933", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "ItemNotAllowed", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "allowAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "allowedItems", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "isAllowed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "_allowAll", - "type": "bool" - } - ], - "name": "setAllowAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "setNotAllowed", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Allowlist" - }, - "LITToken": { - "address": "0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82", - "abi": [ - { - "inputs": [ - { - "internalType": "uint256", - "name": "cap", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "InvalidShortString", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "str", - "type": "string" - } - ], - "name": "StringTooLong", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "fromDelegate", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "toDelegate", - "type": "address" - } - ], - "name": "DelegateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "delegate", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "previousBalance", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newBalance", - "type": "uint256" - } - ], - "name": "DelegateVotesChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [], - "name": "EIP712DomainChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "CLOCK_MODE", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINTER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAUSER_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "burnFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "cap", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint32", - "name": "pos", - "type": "uint32" - } - ], - "name": "checkpoints", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "fromBlock", - "type": "uint32" - }, - { - "internalType": "uint224", - "name": "votes", - "type": "uint224" - } - ], - "internalType": "struct ERC20Votes.Checkpoint", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "clock", - "outputs": [ - { - "internalType": "uint48", - "name": "", - "type": "uint48" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - } - ], - "name": "delegate", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "delegatee", - "type": "address" - }, - { - "internalType": "uint256", - "name": "nonce", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiry", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "delegateBySig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "delegates", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "eip712Domain", - "outputs": [ - { - "internalType": "bytes1", - "name": "fields", - "type": "bytes1" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "string", - "name": "version", - "type": "string" - }, - { - "internalType": "uint256", - "name": "chainId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "verifyingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "salt", - "type": "bytes32" - }, - { - "internalType": "uint256[]", - "name": "extensions", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastTotalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "timepoint", - "type": "uint256" - } - ], - "name": "getPastVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getVotes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "numCheckpoints", - "outputs": [ - { - "internalType": "uint32", - "name": "", - "type": "uint32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "LITToken" - }, - "Multisender": { - "address": "0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - } - ], - "name": "sendEth", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_recipients", - "type": "address[]" - }, - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "sendTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "tokenContract", - "type": "address" - } - ], - "name": "withdrawTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "Multisender" - }, - "PKPHelper": { - "address": "0x21dF544947ba3E8b3c32561399E88B52Dc8b2823", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "internalType": "struct LibPKPNFTStorage.ClaimMaterial", - "name": "claimMaterial", - "type": "tuple" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "internalType": "struct PKPHelper.AuthMethodData", - "name": "authMethodData", - "type": "tuple" - } - ], - "name": "claimAndMintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getDomainWalletRegistry", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPKPNftMetdataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethods", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes[]", - "name": "permittedIpfsCIDs", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedIpfsCIDScopes", - "type": "uint256[][]" - }, - { - "internalType": "address[]", - "name": "permittedAddresses", - "type": "address[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAddressScopes", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddAuthMethodsWithTypes", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypes", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIds", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeys", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopes", - "type": "uint256[][]" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - }, - { - "internalType": "bool", - "name": "addPkpEthAddressAsPermittedAddress", - "type": "bool" - }, - { - "internalType": "bool", - "name": "sendPkpToItself", - "type": "bool" - } - ], - "name": "mintNextAndAddDomainWalletMetadata", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "name": "onERC721Received", - "outputs": [ - { - "internalType": "bytes4", - "name": "", - "type": "bytes4" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removePkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string[]", - "name": "nftMetadata", - "type": "string[]" - } - ], - "name": "setPkpMetadata", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPHelper" - }, - "PKPNFT": { - "address": "0xf5059a5D33d5853360D16C683c16e67980206f36", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "MintCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "PKPMinted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - }, - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - } - ], - "name": "claimAndMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "exists", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getNextDerivedKeyId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftMetadataAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpPermissionsAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "mintGrantAndBurnNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "name": "mintNext", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "redeemedFreeMintIds", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMintCost", - "type": "uint256" - } - ], - "name": "setMintCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PKPNFT" - }, - "PKPNFTMetadata": { - "address": "0x7969c5eD335650692Bc04293B07F5BF2e7A673C0", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_resolver", - "type": "address" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "_env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "buffer", - "type": "bytes" - } - ], - "name": "bytesToHex", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "contract ContractResolver", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "env", - "outputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeProfileForPkp", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "removeUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "imgUrl", - "type": "string" - } - ], - "name": "setProfileForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "string", - "name": "url", - "type": "string" - } - ], - "name": "setUrlForPKP", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubKey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPNFTMetadata" - }, - "PKPPermissions": { - "address": "0x4C4a2f8c81640e47606d3fd77B353E87Ba015584", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "PermittedAuthMethodRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "PermittedAuthMethodScopeRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "RootHashUpdated", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod", - "name": "authMethod", - "type": "tuple" - }, - { - "internalType": "uint256[]", - "name": "scopes", - "type": "uint256[]" - } - ], - "name": "addPermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "addPermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToAdd", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToAdd", - "type": "bytes[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodPubkeysToAdd", - "type": "bytes[]" - }, - { - "internalType": "uint256[][]", - "name": "permittedAuthMethodScopesToAdd", - "type": "uint256[][]" - }, - { - "internalType": "uint256[]", - "name": "permittedAuthMethodTypesToRemove", - "type": "uint256[]" - }, - { - "internalType": "bytes[]", - "name": "permittedAuthMethodIdsToRemove", - "type": "bytes[]" - } - ], - "name": "batchAddRemoveAuthMethods", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getAuthMethodId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedActions", - "outputs": [ - { - "internalType": "bytes[]", - "name": "", - "type": "bytes[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "maxScopeId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethodScopes", - "outputs": [ - { - "internalType": "bool[]", - "name": "", - "type": "bool[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPermittedAuthMethods", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "bytes", - "name": "userPubkey", - "type": "bytes" - } - ], - "internalType": "struct LibPKPPermissionsStorage.AuthMethod[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getRouterAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getTokenIdsForAuthMethod", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "getUserPubkeyForAuthMethod", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "isPermittedAction", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "isPermittedAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "isPermittedAuthMethod", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "isPermittedAuthMethodScopePresent", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "ipfsCID", - "type": "bytes" - } - ], - "name": "removePermittedAction", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "removePermittedAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - } - ], - "name": "removePermittedAuthMethod", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "authMethodType", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "id", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "scopeId", - "type": "uint256" - } - ], - "name": "removePermittedAuthMethodScope", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "setRootHash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "verifyState", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "group", - "type": "uint256" - }, - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "bool[]", - "name": "proofFlags", - "type": "bool[]" - }, - { - "internalType": "bytes32[]", - "name": "leaves", - "type": "bytes32[]" - } - ], - "name": "verifyStates", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "PKPPermissions" - }, - "PubkeyRouter": { - "address": "0x1291Be112d480055DaFd8a610b7d1e203891C274", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ContractResolverAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "PubkeyRoutingDataSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct IPubkeyRouter.RootKey", - "name": "rootKey", - "type": "tuple" - } - ], - "name": "RootKeySet", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "adminResetRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - } - ], - "internalType": "struct IPubkeyRouter.Signature[]", - "name": "signatures", - "type": "tuple[]" - }, - { - "internalType": "bytes", - "name": "signedMessage", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - } - ], - "name": "checkNodeSignatures", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - } - ], - "name": "deriveEthAddressFromPubkey", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "ethAddress", - "type": "address" - } - ], - "name": "ethAddressToPkpId", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "getDerivedPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getEthAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPkpNftAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getPubkey", - "outputs": [ - { - "internalType": "bytes", - "name": "", - "type": "bytes" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - } - ], - "name": "getRootKeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getRoutingData", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isRouted", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "pubkeys", - "outputs": [ - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "internalType": "struct LibPubkeyRouterStorage.PubkeyRoutingData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingData", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "address", - "name": "stakingContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "derivedKeyId", - "type": "bytes32" - } - ], - "name": "setRoutingDataAsAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingContractAddress", - "type": "address" - }, - { - "components": [ - { - "internalType": "bytes", - "name": "pubkey", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "keyType", - "type": "uint256" - } - ], - "internalType": "struct IPubkeyRouter.RootKey[]", - "name": "newRootKeys", - "type": "tuple[]" - } - ], - "name": "voteForRootKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "PubkeyRouter" - }, - "RateLimitNFT": { - "address": "0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "AdditionalRequestsPerKilosecondCostSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "approved", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": false, - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "ApprovalForAll", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "FreeMintSignerSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "FreeRequestsPerRateLimitWindowSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RLIHolderRateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "RateLimitWindowSecondsSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrew", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getApproved", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "isApprovedForAll", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "safeTransferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newAdditionalRequestsPerKilosecondCost", - "type": "uint256" - } - ], - "name": "setAdditionalRequestsPerKilosecondCost", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "approved", - "type": "bool" - } - ], - "name": "setApprovalForAll", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newFreeMintSigner", - "type": "address" - } - ], - "name": "setFreeMintSigner", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newFreeRequestsPerRateLimitWindow", - "type": "uint256" - } - ], - "name": "setFreeRequestsPerRateLimitWindow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxExpirationSeconds", - "type": "uint256" - } - ], - "name": "setMaxExpirationSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "setMaxRequestsPerKilosecond", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRLIHolderRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRLIHolderRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newRateLimitWindowSeconds", - "type": "uint256" - } - ], - "name": "setRateLimitWindowSeconds", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "tokenOfOwnerByIndex", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenURI", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "RLIHolderRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "additionalRequestsPerKilosecondCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateCost", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "payingAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "calculateRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "capacity", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "internalType": "struct LibRateLimitNFTStorage.RateLimit", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "requestedRequestsPerKilosecond", - "type": "uint256" - } - ], - "name": "checkBelowMaxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentSoldRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "defaultRateLimitWindowSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestsPerKilosecond", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "sVal", - "type": "bytes32" - } - ], - "name": "freeMintSigTest", - "outputs": [], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeMintSigner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "freeRequestsPerRateLimitWindow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "isExpired", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxExpirationSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maxRequestsPerKilosecond", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "prefixed", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "msgHash", - "type": "bytes32" - } - ], - "name": "redeemedFreeMints", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tokenIdCounter", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "tokenSVG", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "expiresAt", - "type": "uint256" - } - ], - "name": "totalSoldRequestsPerKilosecondByExpirationTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "RateLimitNFT" - }, - "Staking": { - "address": "0xc5a5C42992dECbae36851359345FE25997F5C42d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [], - "name": "CannotKickBelowCurrentValidatorThreshold", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakingAddress", - "type": "address" - } - ], - "name": "CannotRejoinUntilNextEpochBecauseKicked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "CannotReuseCommsKeys", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "CannotVoteTwice", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "CouldNotMapNodeAddressToStakerAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedOrPausedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInActiveOrUnlockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochOrRestoreState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedOrReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInNextValidatorSetLockedState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "state", - "type": "uint8" - } - ], - "name": "MustBeInReadyForNextEpochState", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "MustBeValidatorInNextEpochToKick", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedForTimeoutSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentTimestamp", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "epochEndTime", - "type": "uint256" - } - ], - "name": "NotEnoughTimeElapsedSinceLastEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "validatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsInNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "nextReadyValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCountToBeReady", - "type": "uint256" - } - ], - "name": "NotEnoughValidatorsReadyForNextEpoch", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "currentEpochNumber", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receivedEpochNumber", - "type": "uint256" - } - ], - "name": "SignaledReadyForWrongEpochNumber", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validator", - "type": "address" - }, - { - "internalType": "address[]", - "name": "validatorsInNextEpoch", - "type": "address[]" - } - ], - "name": "ValidatorIsNotInNextEpoch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "config", - "type": "tuple" - } - ], - "name": "ComplaintConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "newKeyTypes", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumValidatorCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxConcurrentRequests", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMinTripleCount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newPeerCheckingIntervalSecs", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxTripleConcurrency", - "type": "uint256" - } - ], - "name": "ConfigSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "EpochEndTimeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "EpochLengthSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "EpochTimeoutSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "KickPenaltyPercentSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "ReadyForNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Recovered", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToJoin", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "RequestToLeave", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverContractAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newDuration", - "type": "uint256" - } - ], - "name": "RewardsDurationUpdated", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newStakingTokenAddress", - "type": "address" - } - ], - "name": "StakingTokenSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "StateChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amountBurned", - "type": "uint256" - } - ], - "name": "ValidatorKickedFromNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "ValidatorRejoinedNextEpoch", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "reporter", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "VotedToKickValidatorInNextEpoch", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - } - ], - "name": "adminKickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "adminRejoinValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "adminResetEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amountToPenalize", - "type": "uint256" - } - ], - "name": "adminSlashValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "advanceEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "kickValidatorInNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "lockValidatorsForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "requestToJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "requestToLeaveAsNode", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "config", - "type": "tuple" - } - ], - "name": "setComplaintConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "newConfig", - "type": "tuple" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochEndTime", - "type": "uint256" - } - ], - "name": "setEpochEndTime", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochLength", - "type": "uint256" - } - ], - "name": "setEpochLength", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "newState", - "type": "uint8" - } - ], - "name": "setEpochState", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newEpochTimeout", - "type": "uint256" - } - ], - "name": "setEpochTimeout", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "setIpPortNodeAddressAndCommunicationPubKeys", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "newKickPenaltyPercent", - "type": "uint256" - } - ], - "name": "setKickPenaltyPercent", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - } - ], - "name": "signalReadyForNextEpoch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "name": "stakeAndJoin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "indexed": false, - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "VersionRequirementsUpdated", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "checkVersion", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMaxVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersion", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getMinVersionString", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMaxVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "major", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minor", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "patch", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Version", - "name": "version", - "type": "tuple" - } - ], - "name": "setMinVersion", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "complaintConfig", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "intervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "kickPenaltyPercent", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.ComplaintConfig", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "config", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "tokenRewardPerTokenPerEpoch", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintTolerance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "DEPRECATED_complaintIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "keyTypes", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "minimumValidatorCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxConcurrentRequests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minTripleCount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "peerCheckingIntervalSecs", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maxTripleConcurrency", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Config", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfCurrentValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "countOfNextValidatorsReadyForNextEpoch", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "currentValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "epoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint256", - "name": "epochLength", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "number", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "endTime", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "retries", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timeout", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Epoch", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKeyTypes", - "outputs": [ - { - "internalType": "uint256[]", - "name": "", - "type": "uint256[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getKickedValidators", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getNodeStakerAddressMappings", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "internalType": "struct LibStakingStorage.AddressMapping[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingBalancesAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInCurrentEpochLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsInNextEpoch", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "addresses", - "type": "address[]" - } - ], - "name": "getValidatorsStructs", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInCurrentEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getValidatorsStructsInNextEpoch", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "epochNumber", - "type": "uint256" - }, - { - "internalType": "address", - "name": "validatorStakerAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "voterStakerAddress", - "type": "address" - } - ], - "name": "getVotingStatusToKickValidator", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "isActiveValidatorByNodeAddress", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "isReadyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "reason", - "type": "uint256" - } - ], - "name": "kickPenaltyPercentByReason", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "nextValidatorCountForConsensus", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - } - ], - "name": "nodeAddressToStakerAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "readyForNextEpoch", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "shouldKickValidator", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state", - "outputs": [ - { - "internalType": "enum LibStakingStorage.States", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "validators", - "outputs": [ - { - "components": [ - { - "internalType": "uint32", - "name": "ip", - "type": "uint32" - }, - { - "internalType": "uint128", - "name": "ipv6", - "type": "uint128" - }, - { - "internalType": "uint32", - "name": "port", - "type": "uint32" - }, - { - "internalType": "address", - "name": "nodeAddress", - "type": "address" - }, - { - "internalType": "uint256", - "name": "reward", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "senderPubKey", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "receiverPubKey", - "type": "uint256" - } - ], - "internalType": "struct LibStakingStorage.Validator", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "Staking" - }, - "StakingBalances": { - "address": "0xc6e7DF5E7b4f2A278906862b61205850344D4e7d", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotAddFunctionToDiamondThatAlreadyExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotAddSelectorsToZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveFunctionThatDoesNotExist", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotRemoveImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionThatDoesNotExists", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceFunctionWithTheSameFunctionFromTheSameFacet", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4[]", - "name": "_selectors", - "type": "bytes4[]" - } - ], - "name": "CannotReplaceFunctionsFromFacetWithZeroAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_selector", - "type": "bytes4" - } - ], - "name": "CannotReplaceImmutableFunction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint8", - "name": "_action", - "type": "uint8" - } - ], - "name": "IncorrectFacetCutAction", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_initializationContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "InitializationFunctionReverted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_contractAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_message", - "type": "string" - } - ], - "name": "NoBytecodeAtAddress", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "NoSelectorsProvidedForFacetForCut", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "_contractOwner", - "type": "address" - } - ], - "name": "NotContractOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facetAddress", - "type": "address" - } - ], - "name": "RemoveFacetAddressMustBeZeroAddress", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "indexed": false, - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "indexed": false, - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "DiamondCut", - "type": "event" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "enum IDiamond.FacetCutAction", - "name": "action", - "type": "uint8" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamond.FacetCut[]", - "name": "_diamondCut", - "type": "tuple[]" - }, - { - "internalType": "address", - "name": "_init", - "type": "address" - }, - { - "internalType": "bytes", - "name": "_calldata", - "type": "bytes" - } - ], - "name": "diamondCut", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_functionSelector", - "type": "bytes4" - } - ], - "name": "facetAddress", - "outputs": [ - { - "internalType": "address", - "name": "facetAddress_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facetAddresses", - "outputs": [ - { - "internalType": "address[]", - "name": "facetAddresses_", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_facet", - "type": "address" - } - ], - "name": "facetFunctionSelectors", - "outputs": [ - { - "internalType": "bytes4[]", - "name": "_facetFunctionSelectors", - "type": "bytes4[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "facets", - "outputs": [ - { - "components": [ - { - "internalType": "address", - "name": "facetAddress", - "type": "address" - }, - { - "internalType": "bytes4[]", - "name": "functionSelectors", - "type": "bytes4[]" - } - ], - "internalType": "struct IDiamondLoupe.Facet[]", - "name": "facets_", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "_interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "owner_", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "ActiveValidatorsCannotLeave", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - }, - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "AliasNotOwnedBySender", - "type": "error" - }, - { - "inputs": [], - "name": "CallerNotOwner", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "CannotRemoveAliasOfActiveValidator", - "type": "error" - }, - { - "inputs": [], - "name": "CannotStakeZero", - "type": "error" - }, - { - "inputs": [], - "name": "CannotWithdrawZero", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "aliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountReached", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "OnlyStakingContract", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "minimumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeGreaterThanMinimumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountStaked", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "maximumStake", - "type": "uint256" - } - ], - "name": "StakeMustBeLessThanMaximumStake", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "stakerAddress", - "type": "address" - } - ], - "name": "StakerNotPermitted", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "yourBalance", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "requestedWithdrawlAmount", - "type": "uint256" - } - ], - "name": "TryingToWithdrawMoreThanStaked", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "AliasRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "MaxAliasCountSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "MaximumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "MinimumStakeSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "PermittedStakerRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bool", - "name": "permittedStakersOn", - "type": "bool" - } - ], - "name": "PermittedStakersOnChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "ResolverContractAddressSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Staked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "newTokenRewardPerTokenPerEpoch", - "type": "uint256" - } - ], - "name": "TokenRewardPerTokenPerEpochSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "ValidatorNotRewardedBecauseAlias", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorRewarded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "ValidatorTokensPenalized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "Withdrawn", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "addAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "addPermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "stakers", - "type": "address[]" - } - ], - "name": "addPermittedStakers", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "checkStakingAmounts", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "contractResolver", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "getReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getTokenAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "isPermittedStaker", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "maximumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "penalizeTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "permittedStakersOn", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "aliasAccount", - "type": "address" - } - ], - "name": "removeAlias", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - } - ], - "name": "removePermittedStaker", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "staker", - "type": "address" - }, - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "restakePenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "rewardValidator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newResolverAddress", - "type": "address" - } - ], - "name": "setContractResolver", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaxAliasCount", - "type": "uint256" - } - ], - "name": "setMaxAliasCount", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMaximumStake", - "type": "uint256" - } - ], - "name": "setMaximumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "newMinimumStake", - "type": "uint256" - } - ], - "name": "setMinimumStake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bool", - "name": "permitted", - "type": "bool" - } - ], - "name": "setPermittedStakersOn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "stake", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "totalStaked", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - } - ], - "name": "transferPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "balance", - "type": "uint256" - } - ], - "name": "withdrawPenaltyTokens", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "name": "StakingBalances" - }, - "ContractResolver": { - "address": "0x5FbDB2315678afecb367f032d93F642f64180aa3", - "abi": [ - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "AdminRoleRequired", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "AllowedEnvRemoved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "previousAdminRole", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "newAdminRole", - "type": "bytes32" - } - ], - "name": "RoleAdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleGranted", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "indexed": true, - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "RoleRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "SetContract", - "type": "event" - }, - { - "inputs": [], - "name": "ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "ALLOWLIST_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "BACKUP_RECOVERY_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DEFAULT_ADMIN_ROLE", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "DOMAIN_WALLET_REGISTRY", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "HD_KEY_DERIVER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "LIT_TOKEN_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MULTI_SENDER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PAYMENT_DELEGATION_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_HELPER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_NFT_METADATA_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PKP_PERMISSIONS_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PUB_KEY_ROUTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RATE_LIMIT_NFT_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "RELEASE_REGISTER_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_BALANCES_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "STAKING_CONTRACT", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "addAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "addAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "getContract", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - } - ], - "name": "getRoleAdmin", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "grantRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "hasRole", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "adminBeingRemoved", - "type": "address" - } - ], - "name": "removeAdmin", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - } - ], - "name": "removeAllowedEnv", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "renounceRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "role", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "revokeRole", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "typ", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "env", - "type": "uint8" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "setContract", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes4", - "name": "interfaceId", - "type": "bytes4" - } - ], - "name": "supportsInterface", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - }, - { - "internalType": "enum ContractResolver.Env", - "name": "", - "type": "uint8" - } - ], - "name": "typeAddresses", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "name": "ContractResolver" - } -} diff --git a/local-tests/setup/session-sigs/get-eoa-session-sigs.ts b/local-tests/setup/session-sigs/get-eoa-session-sigs.ts deleted file mode 100644 index 535fc2d994..0000000000 --- a/local-tests/setup/session-sigs/get-eoa-session-sigs.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { - LitActionResource, - LitPKPResource, - generateAuthSig, - createSiweMessageWithRecaps, -} from '@lit-protocol/auth-helpers'; -import { - AuthCallbackParams, - AuthSig, - LitAbility, - LitResourceAbilityRequest, -} from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { CENTRALISATION_BY_NETWORK, LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; -import { TinnyEnvironment } from '../tinny-environment'; - -/** - * Retrieves the session signatures for an EOA in a given Tinny environment. - * - * @param devEnv - The Tinny environment object. - * @param person - The Tinny person object representing the EOA. - * @param resourceAbilityRequests - Optional. An array of resource ability requests. If not provided, default requests will be used. - * @returns A promise that resolves to the session signatures. - */ -export const getEoaSessionSigs = async ( - devEnv: TinnyEnvironment, - person: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - if (centralisation === 'decentralised') { - console.warn( - 'Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ - chain: 'ethereum', - resourceAbilityRequests: _resourceAbilityRequests, - authNeededCallback: async ({ - uri, - expiration, - resourceAbilityRequests, - }: AuthCallbackParams) => { - console.log('resourceAbilityRequests:', resourceAbilityRequests); - - if (!expiration) { - throw new Error('expiration is required'); - } - - if (!resourceAbilityRequests) { - throw new Error('resourceAbilityRequests is required'); - } - - if (!uri) { - throw new Error('uri is required'); - } - - const toSign = await createSiweMessageWithRecaps({ - uri: uri, - expiration: expiration, - resources: resourceAbilityRequests, - walletAddress: person.wallet.address, - nonce: await devEnv.litNodeClient.getLatestBlockhash(), - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: person.wallet, - toSign, - }); - - return authSig; - }, - - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], - }), - }); - - log('[getEoaSessionSigs]: ', getEoaSessionSigs); - - return sessionSigs; -}; - -export const getEoaSessionSigsWithCapacityDelegations = async ( - devEnv: TinnyEnvironment, - fromWallet: ethers.Wallet, - capacityDelegationAuthSig: AuthSig -) => { - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - if (centralisation === 'decentralised') { - console.warn( - 'Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs' - ); - } - - const sessionSigs = await devEnv.litNodeClient.getSessionSigs({ - chain: 'ethereum', - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - authNeededCallback: async ({ - uri, - expiration, - resourceAbilityRequests, - }: AuthCallbackParams) => { - if (!expiration) { - throw new Error('expiration is required'); - } - - if (!resourceAbilityRequests) { - throw new Error('resourceAbilityRequests is required'); - } - - if (!uri) { - throw new Error('uri is required'); - } - - const toSign = await createSiweMessageWithRecaps({ - uri: uri, - expiration: expiration, - resources: resourceAbilityRequests, - walletAddress: fromWallet.address, - nonce: devEnv.litNodeClient.latestBlockhash, - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: fromWallet, - toSign, - }); - - return authSig; - }, - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [ - capacityDelegationAuthSig ?? devEnv.superCapacityDelegationAuthSig, - ], - }), - }); - - log('[getEoaSessionSigs]: ', getEoaSessionSigs); - - return sessionSigs; -}; diff --git a/local-tests/setup/session-sigs/get-lit-action-session-sigs.ts b/local-tests/setup/session-sigs/get-lit-action-session-sigs.ts deleted file mode 100644 index a2ca4ed9f2..0000000000 --- a/local-tests/setup/session-sigs/get-lit-action-session-sigs.ts +++ /dev/null @@ -1,171 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; -import { CENTRALISATION_BY_NETWORK, LitNetwork } from '@lit-protocol/constants'; -import { TinnyPerson } from '../tinny-person'; -import { TinnyEnvironment } from '../tinny-environment'; - -const VALID_SESSION_SIG_LIT_ACTION_CODE = ` -// Works with an AuthSig AuthMethod -if (Lit.Auth.authMethodContexts.some(e => e.authMethodType === 1)) { - LitActions.setResponse({ response: "true" }); -} else { - LitActions.setResponse({ response: "false" }); -} -`; - -const INVALID_SESSION_SIG_LIT_ACTION_CODE = ` -(async () => { - let utf8Encode = new TextEncoder(); - const toSign = utf8Encode.encode('This message is exactly 32 bytes'); - const sigShare = await LitActions.signEcdsa({ toSign, publicKey, sigName }); -})(); -`; - -/** - * https://cloudflare-ipfs.com/ipfs/QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp - */ -export const VALID_IPFS_ID = 'QmRf5K7PVi5TWXiJdw7YYtcgpgRY6ufXGr9yYnxBLvLjDp'; - -/** - * https://cloudflare-ipfs.com/ipfs/QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm - */ -export const INVALID_IPFS_ID = 'QmeUByesskboEkLLcE9Hd3bWFZT5Xt53RSauMNTJSVhfqm'; - -export const getLitActionSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - if (centralisation === 'decentralised') { - console.warn( - 'Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const litActionSessionSigs = - await devEnv.litNodeClient.getLitActionSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp.publicKey, - authMethods: [alice.authMethod], - resourceAbilityRequests: _resourceAbilityRequests, - litActionCode: Buffer.from(VALID_SESSION_SIG_LIT_ACTION_CODE).toString( - 'base64' - ), - jsParams: { - publicKey: alice.authMethodOwnedPkp.publicKey, - sigName: 'unified-auth-sig', - }, - - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], - }), - }); - - return litActionSessionSigs; -}; - -export const getLitActionSessionSigsUsingIpfsId = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[] -) => { - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - if (centralisation === 'decentralised') { - console.warn( - 'Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp.publicKey, - authMethods: [alice.authMethod], - resourceAbilityRequests: _resourceAbilityRequests, - litActionIpfsId: VALID_IPFS_ID, - jsParams: { - publicKey: alice.authMethodOwnedPkp.publicKey, - sigName: 'unified-auth-sig', - }, - - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], - }), - }); - - return litActionSessionSigs; -}; - -export const getInvalidLitActionSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson -) => { - const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp.publicKey, - authMethods: [alice.authMethod], - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - ], - litActionCode: Buffer.from(INVALID_SESSION_SIG_LIT_ACTION_CODE).toString( - 'base64' - ), - jsParams: { - publicKey: alice.authMethodOwnedPkp.publicKey, - sigName: 'unified-auth-sig', - }, - }); - - return litActionSessionSigs; -}; - -export const getInvalidLitActionIpfsSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson -) => { - const litActionSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp.publicKey, - authMethods: [alice.authMethod], - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - ], - litActionIpfsId: INVALID_IPFS_ID, - jsParams: { - publicKey: alice.authMethodOwnedPkp.publicKey, - sigName: 'unified-auth-sig', - }, - }); - - return litActionSessionSigs; -}; diff --git a/local-tests/setup/session-sigs/get-pkp-session-sigs.ts b/local-tests/setup/session-sigs/get-pkp-session-sigs.ts deleted file mode 100644 index 99097085fe..0000000000 --- a/local-tests/setup/session-sigs/get-pkp-session-sigs.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility, LitResourceAbilityRequest } from '@lit-protocol/types'; -import { log } from '@lit-protocol/misc'; -import { CENTRALISATION_BY_NETWORK, LitNetwork } from '@lit-protocol/constants'; -import { TinnyEnvironment } from '../tinny-environment'; -import { TinnyPerson } from '../tinny-person'; - -export const getPkpSessionSigs = async ( - devEnv: TinnyEnvironment, - alice: TinnyPerson, - resourceAbilityRequests?: LitResourceAbilityRequest[], - expiration?: string -) => { - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - if (centralisation === 'decentralised') { - console.warn( - 'Decentralised network detected. Adding superCapacityDelegationAuthSig to eoaSessionSigs' - ); - } - - // Use default resourceAbilityRequests if not provided - const _resourceAbilityRequests = resourceAbilityRequests || [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]; - - const pkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ - pkpPublicKey: alice.authMethodOwnedPkp.publicKey, - authMethods: [alice.authMethod], - expiration, - resourceAbilityRequests: _resourceAbilityRequests, - - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], - }), - }); - - log('[getPkpSessionSigs]: ', pkpSessionSigs); - - return pkpSessionSigs; -}; diff --git a/local-tests/setup/shiva-client.d.ts b/local-tests/setup/shiva-client.d.ts deleted file mode 100644 index 7bb27c17a6..0000000000 --- a/local-tests/setup/shiva-client.d.ts +++ /dev/null @@ -1,72 +0,0 @@ -// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -type ContractAbis = { - litToken: string; - erc20: string; - backupRecovery: string; - staking: string; - stakingBalances: string; - rateLimitNft: string; - pkpnft: string; - pubkeyRouter: string; - pkpPermissions: string; - pkpHelper: string; - contractResolver: string; - paymentDelegation: string; -}; - -type ContractAddresses = { - litToken: string; - backupRecovery: string; - staking: string; - stakingBalances: string; - rateLimitNft: string; - pkpnft: string; - pubkeyRouter: string; - pkpPermissions: string; - pkpHelper: string; - contractResolver: string; - keyDeriver: string; - paymentDelegation: string; -}; - -type TestNetCreateRequest = { - nodeCount: number; - pollingInterval: string; - epochLength: number; - customBuildPath: string | null; - litActionServerCustomBuildPath: string | null; - existingConfigPath: string | null; - which: string | null; - ecdsaRoundTimeout: string | null; - enableRateLimiting: string | null; -}; - -type TestNetInfo = { - contractAddresses: ContractAddresses; - validatorAddresses: Array; - contractResolverAbi: string; - rpcUrl: string; - epochLength: number; - contractAbis: ContractAbis; -}; - -type TestNetResponse = { - testnetId: string; - command: string; - wasCanceled: boolean; - body: T | null; - lastStateObserved: string | null; - messages: Array | null; - errors: Array | null; -}; - -type TestNetState = 'Busy' | 'Active' | 'Mutating' | 'Shutdown' | 'UNKNOWN'; - -export { - ContractAbis, - ContractAddresses, - TestNetCreateRequest, - TestNetInfo, - TestNetResponse, - TestNetState, -}; diff --git a/local-tests/setup/shiva-client.ts b/local-tests/setup/shiva-client.ts deleted file mode 100644 index 60807e13bc..0000000000 --- a/local-tests/setup/shiva-client.ts +++ /dev/null @@ -1,289 +0,0 @@ -import { LitContractResolverContext } from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { - TestNetCreateRequest, - TestNetInfo, - TestNetResponse, - TestNetState, -} from './shiva-client.d'; - -class ShivaError extends Error { - constructor(shivaResponse: TestNetResponse) { - let message = `An error occurred on request to testnet with id: ${shivaResponse.testnetId}`; - for (const error of shivaResponse.errors) { - message += ' ' + error; - } - - super(message); - this.name = 'ShivaError'; - this.message = message; - } -} - -export interface ShivaEnvs { - /** - * If runnnig no localchain this flag will stop the running testnet when the test - * run has finished. Which is when all pending task promises have settled. - */ - STOP_TESTNET: boolean; - - /** - * URL for Testnet manager intigration - */ - TESTNET_MANAGER_URL: string; - - /** - * Path to the Lit Node Binary to use. Can be configured through an env variable - * LIT_NODE_BINARY_PATH where the value is the local path to a built Lit Action Binary - * If flagging to not use the binary path this option will be ignored. - * See {@link USE_LIT_BINARIES} and {@link LIT_ACTION_BINARY_PATH} - */ - LIT_NODE_BINARY_PATH: string; - - /** - * Path to lit action binary to use, Can be defined through env variable - * LIT_ACTION_BINARY_PATH where the value is the local path to a built Lit Action Binary. - * If flagging not to use the binary path this option will be ignored - * See {@link USE_LIT_BINARIES} and {@link LIT_NODE_BINARY_PATH} - */ - LIT_ACTION_BINARY_PATH: string; - - /** - * Flag to indicate if the provided binary path should be used - * or if the testnet should be built from source before starting. - */ - USE_LIT_BINARIES: boolean; -} - -/** - * Client implementation for a single testnet instance managed by the Shiva tool - * Is essentially a localchain setup but allows for programmatic operations to be performed - * on the network from the implementation within this class. Each testnet is a unique network - */ -export class TestnetClient { - private _id: string; - private _info: TestNetInfo; - private _processEnvs: ShivaEnvs; - private _currentState: TestNetState; - - constructor(id: string, envs: ShivaEnvs) { - this._processEnvs = envs; - this._id = id; - } - - /** - Returns info on a given testnet instance - if information cannot be accessed we retured undefined - @returns TestNetInfo | undefined - */ - get Info(): TestNetInfo | undefined { - return this._info; - } - - get ContractContext(): LitContractResolverContext | undefined { - const testNetConfig = this.Info; - if (!testNetConfig) { - return undefined; - } - - const contractResolverAbi: string = testNetConfig.contractResolverAbi; - const contractResolverAddress = - testNetConfig.contractAddresses[`contractResolver`]; - const networkContext = { - abi: JSON.parse(contractResolverAbi), - resolverAddress: contractResolverAddress, - provider: new ethers.providers.StaticJsonRpcProvider( - `http://${testNetConfig.rpcUrl}` - ), - environment: 0, // test deployment uses env value 0 in test common - }; - return networkContext; - } - - /** - * Polls a given testnet for the ACTIVE state - * polls on a 500 milisecond interval - */ - public async pollTestnetForActive(): Promise { - let state = 'Busy'; - while (state != 'Active' && state != `UNKNOWN`) { - const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + '/test/poll/testnet/' + this._id - ); - const stateRes: TestNetResponse = - await _processTestnetResponse(res); - state = stateRes.body; - console.log('found state to be', state); - - await new Promise((res, _) => { - setTimeout(() => { - res(); - }, 500); - }); - } - - return state; - } - - /** - * Returns the config for a given testnet - */ - public async getTestnetConfig() { - const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + - '/test/get/info/testnet/' + - this._id - ); - - const testnetInfoRes = await _processTestnetResponse(res); - this._info = testnetInfoRes.body; - - return testnetInfoRes; - } - - /** - * Will wait for the NEXT epoch and return a resposne when the epoch has fully transitioned. - * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. - */ - public async transitionEpochAndWait() { - const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + - '/test/action/transition/epoch/wait/' + - this._id - ); - - let transitionEpochAndWaitRes = _processTestnetResponse(res); - - return transitionEpochAndWaitRes; - } - - /** - * Stops a random peer and waits for the next epoc to transiton. - * The return time is directly proportional to the epoch transition time config and where the network is with the current epoch. - */ - public async stopRandomNetworkPeerAndWaitForNextEpoch() { - const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + - '/test/action/stop/random/wait/' + - this._id - ); - - return _processTestnetResponse(res); - } - - /* - Stops the testnet - */ - public async stopTestnet() { - console.log('stopping testnet with id:', this._id); - const res = await fetch( - this._processEnvs.TESTNET_MANAGER_URL + '/test/delete/testnet/' + this._id - ); - - return _processTestnetResponse(res); - } -} - -export class ShivaClient { - private _clients: Map; - public processEnvs: ShivaEnvs = { - STOP_TESTNET: process.env[`STOP_TESTNET`] === 'true', - TESTNET_MANAGER_URL: - process.env['TESTNET_MANAGER_URL'] || 'http://0.0.0.0:8000', - USE_LIT_BINARIES: process.env[`USE_LIT_BINARIES`] === `true`, - LIT_NODE_BINARY_PATH: - process.env['LIT_NODE_BINARY_PATH'] || - `./../../lit-assets/rust/lit-node/target/debug/lit_node`, - LIT_ACTION_BINARY_PATH: - process.env['LIT_ACTION_BINARY_PATH'] || - `./../../lit-assets/rust/lit-actions/target/debug/lit_actions`, - }; - - constructor() { - this._clients = new Map(); - console.log('Shiva environment loaded current config: ', this.processEnvs); - } - - /** - * Used to start an instance of a lit network through the Lit Testnet Manager - * if an instance exists, we will just take it as we optimistically assume it will not be shut down in the test life time. - * If an instance does not exist then we create one - */ - async startTestnetManager( - createReq?: TestNetCreateRequest - ): Promise { - const existingTestnetResp = await fetch( - this.processEnvs.TESTNET_MANAGER_URL + '/test/get/testnets' - ); - const existingTestnets: string[] = await existingTestnetResp.json(); - if (existingTestnets.length > 0) { - this._clients.set( - existingTestnets[0], - new TestnetClient(existingTestnets[0], this.processEnvs) - ); - return this._clients.get(existingTestnets[0]); - } else { - console.log( - 'lit node binary path: ', - this.processEnvs.LIT_NODE_BINARY_PATH - ); - console.log( - 'lit action server binary path: ', - this.processEnvs.LIT_ACTION_BINARY_PATH - ); - let body: Partial = createReq ?? { - nodeCount: 3, - pollingInterval: '2000', - epochLength: 90_000, - }; - - if (this.processEnvs.USE_LIT_BINARIES) { - body.customBuildPath = this.processEnvs.LIT_NODE_BINARY_PATH; - body.litActionServerCustomBuildPath = - this.processEnvs.LIT_ACTION_BINARY_PATH; - } - console.log('Testnet create args: ', body); - const createTestnetResp: Response = await fetch( - this.processEnvs.TESTNET_MANAGER_URL + '/test/create/testnet', - { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify(body), - } - ); - - const createTestnet = await _processTestnetResponse( - createTestnetResp - ); - - this._clients.set( - createTestnet.testnetId, - new TestnetClient(createTestnet.testnetId, this.processEnvs) - ); - - return this._clients.get(createTestnet.testnetId); - } - } -} - -async function _processTestnetResponse( - response: Response -): Promise> { - let createTestnet: TestNetResponse; - try { - createTestnet = (await response.json()) as TestNetResponse; - } catch (err) { - let message = await response.text(); - throw new Error('Error while performing testnet request: ' + message); - } - - // if we get a 500 status and the JSON parsed we know that we should - // throw the custom error type - if (response.status === 500) { - throw new ShivaError(createTestnet); - } - - return createTestnet; -} diff --git a/local-tests/setup/tinny-config.ts b/local-tests/setup/tinny-config.ts deleted file mode 100644 index 8ebf013197..0000000000 --- a/local-tests/setup/tinny-config.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import { LitContractResolverContext } from '@lit-protocol/types'; - -export enum LIT_TESTNET { - LOCALCHAIN = 'localchain', - MANZANO = 'manzano', - CAYENNE = 'cayenne', - DATIL_DEV = 'datil-dev', - DATIL_TEST = 'datil-test', - DATIL_PROD = 'datil', -} - -export enum LIT_RPC { - LOCAL_ANVIL = 'http://127.0.0.1:8545', - CHRONICLE = 'https://chain-rpc.litprotocol.com/http', - YELLOWSTONE = 'https://yellowstone-rpc.litprotocol.com', -} - -/** - * Mapping of testnet names to corresponding RPC endpoints. - */ -export const RPC_MAP = { - [LIT_TESTNET.LOCALCHAIN]: LIT_RPC.LOCAL_ANVIL, - [LIT_TESTNET.MANZANO]: LIT_RPC.CHRONICLE, - [LIT_TESTNET.CAYENNE]: LIT_RPC.CHRONICLE, - [LIT_TESTNET.DATIL_DEV]: LIT_RPC.YELLOWSTONE, - [LIT_TESTNET.DATIL_TEST]: LIT_RPC.YELLOWSTONE, - [LIT_TESTNET.DATIL_PROD]: LIT_RPC.YELLOWSTONE, -}; - -/** - * Represents the configuration options for the process environment. - */ -export interface ProcessEnvs { - /** - * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. - */ - MAX_ATTEMPTS: number; - - /** - * The maximum number of milliseconds to wait for a test to complete. - */ - TEST_TIMEOUT: number; - - /** - * The network to use for testing. This can be one of the following: - * - `LIT_TESTNET.LOCALCHAIN` - * - `LIT_TESTNET.MANZANO` - * - `LIT_TESTNET.CAYENNE` - * - `LIT_TESTNET.DATIL_DEV` - */ - NETWORK: LIT_TESTNET; - - /** - * The number of milliseconds to wait between each request. - */ - DEBUG: boolean; - - /** - * Capacity Credits: In order to execute a transaction with Lit, you’ll need to reserve capacity on the network using Capacity Credits. These allow holders to reserve a set number of requests over a desired period of time (by default expiration set to 2 days) - */ - REQUEST_PER_KILOSECOND: number; - - /** - * Wait time in milliseconds if no private keys are available. - */ - WAIT_FOR_KEY_INTERVAL: number; - - /** - * Time to wait before releasing the key after requesting it. - */ - TIME_TO_RELEASE_KEY: number; - - /** - * Run all the tests in a single thread. - */ - RUN_IN_BAND: boolean; - - /** - * The interval in milliseconds to run the tests in a single thread. - */ - RUN_IN_BAND_INTERVAL: number; - - // =========== In most cases you won't need to change the following values =========== - /** - * The URL of Lit RPC server. - * - If it's running locally on Anvil, it should be 'http://127.0.0.1:8545' - * - If it's running on Chronicle, it should be 'https://chain-rpc.litprotocol.com/http' - * - If it's running on Yellowstone, it should be 'https://yellowstone-rpc.litprotocol.com' - */ - 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. - */ - PRIVATE_KEYS: string[]; - - /** - * The list of keys that are currently in use. - */ - KEY_IN_USE: boolean[]; - - /** - * Ignore setup steps. Usually when you run to quickly run a single test. - */ - NO_SETUP: boolean; - - /** - * Use shiva as a test network which will spawn before the test run starts - */ - USE_SHIVA: boolean; - - /** - * The network configuration which will be used for `contract context` if provided. - * it is assumed the context will work with the {@link NETWORK} provided. If the configuration - * is not for the provided network then there could be undefined behavior. - * If {@link USE_SHIVA} is set to true then the network configuration will be loaded implicitly and - * this value will be ignored - */ - NETWORK_CONFIG: string; -} - -/** - * Represents the PKP information. - */ -export type PKPInfo = { - tokenId: string; - publicKey: string; - ethAddress: string; -}; - -export interface TinnyEnvConfig { - rpc: string; - litNodeClient: LitNodeClient; - network: LIT_TESTNET; - processEnvs: ProcessEnvs; - contractContext?: LitContractResolverContext; -} diff --git a/local-tests/setup/tinny-environment.ts b/local-tests/setup/tinny-environment.ts deleted file mode 100644 index 31bfecd390..0000000000 --- a/local-tests/setup/tinny-environment.ts +++ /dev/null @@ -1,571 +0,0 @@ -import { - LIT_TESTNET, - ProcessEnvs, - RPC_MAP, - TinnyEnvConfig, -} from './tinny-config'; -import { LitNodeClient } from '@lit-protocol/lit-node-client'; -import { LitContracts } from '@lit-protocol/contracts-sdk'; -import { - AuthSig, - CosmosAuthSig, - LitContractContext, - LitContractResolverContext, - SolanaAuthSig, -} from '@lit-protocol/types'; -import { TinnyPerson } from './tinny-person'; - -import { ethers, Signer } from 'ethers'; -import { createSiweMessage, generateAuthSig } from '@lit-protocol/auth-helpers'; -import { ShivaClient, TestnetClient } from './shiva-client'; -import { toErrorWithMessage } from './tinny-utils'; -import { CENTRALISATION_BY_NETWORK } from '@lit-protocol/constants'; - -console.log('Loading env vars from dot config...'); -console.log('Done loading env', process.env['DEBUG']); -export class TinnyEnvironment { - public network: LIT_TESTNET; - - /** - * Environment variables used in the process. - */ - public processEnvs: ProcessEnvs = { - MAX_ATTEMPTS: parseInt(process.env['MAX_ATTEMPTS']) || 1, - TEST_TIMEOUT: parseInt(process.env['TEST_TIMEOUT']) || 45000, - NETWORK: (process.env['NETWORK'] as LIT_TESTNET) || LIT_TESTNET.LOCALCHAIN, - DEBUG: true, - REQUEST_PER_KILOSECOND: - parseInt(process.env['REQUEST_PER_KILOSECOND']) || - (process.env['NETWORK'] as LIT_TESTNET) === 'datil-dev' - ? 1 - : 200, - 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, - - // Available Accounts - // ================== - // (1) "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" (10000.000000000000000000 ETH) - // (2) "0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC" (10000.000000000000000000 ETH) - // (3) "0x90F79bf6EB2c4f870365E785982E1f101E93b906" (10000.000000000000000000 ETH) - // (4) "0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65" (10000.000000000000000000 ETH) - // (5) "0x9965507D1a55bcC2695C58ba16FB37d819B0A4dc" (10000.000000000000000000 ETH) - // (6) "0x976EA74026E726554dB657fA54763abd0C3a0aa9" (10000.000000000000000000 ETH) - // (7) "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955" (10000.000000000000000000 ETH) - // (8) "0x23618e81E3f5cdF7f54C3d65f7FBc0aBf5B21E8f" (10000.000000000000000000 ETH) - // (9) "0xa0Ee7A142d267C1f36714E4a8F75612F20a79720" (10000.000000000000000000 ETH) - PRIVATE_KEYS: process.env['PRIVATE_KEYS']?.split(',') || [ - '0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d', - '0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a', - '0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6', - '0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a', - '0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba', - '0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e', - '0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356', - '0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97', - '0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6', - ], - KEY_IN_USE: new Array(), - NO_SETUP: process.env['NO_SETUP'] === 'true', - USE_SHIVA: process.env['USE_SHIVA'] === 'true', - NETWORK_CONFIG: process.env['NETWORK_CONFIG'] ?? './networkContext.json', - }; - - public litNodeClient: LitNodeClient; - public contractsClient: LitContracts; - public rpc: string; - public superCapacityDelegationAuthSig: AuthSig; - public bareEthAuthSig: AuthSig; - public bareSolAuthSig: SolanaAuthSig = { - sig: '706047fcab06ada3cbfeb6990617c1705d59bafb20f5f1c8103d764fb5eaec297328d164e2b891095866b28acc1ab2df288a8729cf026228ef3c4970238b190a', - derivedVia: 'solana.signMessage', - signedMessage: - 'I am creating an account to use Lit Protocol at 2024-05-08T16:39:44.481Z', - address: 'F7r6ENi6dqH8SnMYZdK3YxWAQ4cwfSNXZyMzbea5fbS1', - }; - - public bareCosmosAuthSig: CosmosAuthSig = { - sig: 'dE7J8oaWa8zECuMpaI/IVfJXGpLAO1paGLho+/dmtaQkN7Sh1lmJLAdYqZchDyYhQcg+nqfaoEOzLig3CPlosg==', - derivedVia: 'cosmos.signArbitrary', - signedMessage: - '8c857343720203e3f52606409e6818284186a614e74026998f89e7417eed4d4b', - address: 'cosmos14wp2s5kv07lt220rzfae57k73yv9z2azrmulku', - }; - - public testnet: TestnetClient | undefined; - //=========== PRIVATE MEMBERS =========== - private _shivaClient: ShivaClient = new ShivaClient(); - private _contractContext: LitContractContext | LitContractResolverContext; - - constructor(network?: LIT_TESTNET) { - // -- setup networkj - this.network = network || this.processEnvs.NETWORK; - - if (Object.values(LIT_TESTNET).indexOf(this.network) === -1) { - throw new Error( - `Invalid network environment. Please use one of ${Object.values( - LIT_TESTNET - )}` - ); - } - - // -- create an empty array to keep track of all keys - this.processEnvs.KEY_IN_USE = new Array( - this.processEnvs.PRIVATE_KEYS.length - ).fill(false); - - // -- setup rpc - // Priority: - // 1. Use environment variable if set - // 2. Use RPC_MAP if network is recognized - // 3. Throw error if neither condition is met - if (this.processEnvs.LIT_RPC_URL) { - // If LIT_RPC_URL is set in the environment, use it - this.rpc = this.processEnvs.LIT_RPC_URL; - } else if (this.network in RPC_MAP) { - // If the network is recognized in RPC_MAP, use the corresponding RPC URL - this.rpc = RPC_MAP[this.network]; - } else { - // If neither condition is met, throw an error with available options - const availableNetworks = Object.keys(RPC_MAP).join(', '); - throw new Error( - `No RPC URL found for network "${this.network}". Available networks are: ${availableNetworks}` - ); - } - - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Done configuring enviorment current config: ', - this.processEnvs - ); - } - - world: Map = new Map(); - - /** - * Retrieves an available private key from a list, marking it as in use and scheduling - * its automatic release. If no unused keys are available, it waits for a set interval - * before rechecking. - * - * This function loops until it finds an unused key, marks it, and returns the key with - * its index. If all keys are in use, it logs a wait message and pauses before retrying. - * - * Outputs: - * - privateKey: The selected private key. - * - index: The index of the selected key. - * - * Environment variables required: - * - KEY_IN_USE: Boolean array indicating key usage. - * - PRIVATE_KEYS: Array of key strings. - * - TIME_TO_RELEASE_KEY: Milliseconds until a key is automatically released. - * - WAIT_FOR_KEY_INTERVAL: Wait time in milliseconds if no keys are free. - */ - async getAvailablePrivateKey(): Promise<{ - privateKey: string; - index: number; - }> { - while (true) { - const index = this.processEnvs.KEY_IN_USE.findIndex((used) => !used); // Find the first unused key - - if (index !== -1) { - // If an available key is found - this.processEnvs.KEY_IN_USE[index] = true; // Mark the key as in use - // console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] πŸ”‘ Selected key at index', index); // Log a message indicating that we have selected a key - - return { privateKey: this.processEnvs.PRIVATE_KEYS[index], index }; // Return the key and its index - } else { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] No available keys. Waiting...'); // Log a message indicating that we are waiting - // Wait for the specified interval before checking again - await new Promise((resolve) => - setTimeout(resolve, this.processEnvs.WAIT_FOR_KEY_INTERVAL) - ); - } - } - } - - /** - * Marks a private key as available again after use. - * @param {number} index - The index of the key to mark as available. - */ - releasePrivateKeyFromUser(user: TinnyPerson) { - const index = this.processEnvs.PRIVATE_KEYS.indexOf(user.privateKey); - this.processEnvs.KEY_IN_USE[index] = false; - // console.log( - // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` - // ); - } - - /** - * Marks a private key as available again after use. - * @param {number} index - The index of the key to mark as available. - */ - releasePrivateKey(index: number) { - this.processEnvs.KEY_IN_USE[index] = false; - // console.log( - // `[𐬺πŸ§ͺ Tinny Environment𐬺] πŸͺ½ Released key at index ${index}. Thank you for your service!` - // ); - } - - /** - * Initializes the LitNodeClient based on the specified network configuration and environment variables. - * This setup differentiates between local and production environments, adjusts node attestation checks, - * and sets network-specific parameters. The function ensures the client is connected and ready before proceeding. - * - * The LitNodeClient is configured differently based on the network: - * - LOCALCHAIN: Uses custom settings for local testing, with node attestation disabled. - * - MANZANO (or other specified testnets): Configures for specific network environments with node attestation enabled. - * - * Logs the process and exits if the client is not ready after attempting to connect. - */ - - async setupLitNodeClient() { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Setting up LitNodeClient'); - - console.log('this.network:', this.network); - const centralisation = CENTRALISATION_BY_NETWORK[this.network]; - - if ( - this.network === LIT_TESTNET.LOCALCHAIN || - centralisation === 'unknown' - ) { - const networkContext = - this?.testnet?.ContractContext ?? this._contractContext; - this.litNodeClient = new LitNodeClient({ - litNetwork: 'custom', - rpcUrl: this.rpc, - debug: this.processEnvs.DEBUG, - checkNodeAttestation: false, // disable node attestation check for local testing - contractContext: networkContext, - }); - } else if (centralisation === 'decentralised') { - this.litNodeClient = new LitNodeClient({ - litNetwork: this.network, - checkNodeAttestation: true, - debug: this.processEnvs.DEBUG, - }); - } else if (centralisation === 'centralised') { - this.litNodeClient = new LitNodeClient({ - litNetwork: this.network, - checkNodeAttestation: false, - debug: this.processEnvs.DEBUG, - }); - } else { - throw new Error(`Network not supported: "${this.network}"`); - } - - if (globalThis.wasmExports) { - console.warn( - 'WASM modules already loaded. Will overide when connect is called' - ); - } - - if (globalThis.wasmECDSA) { - console.warn( - 'WASM modules already loaded. wil overide. when connect is called' - ); - } - - if (globalThis.wasmSevSnpUtils) { - console.warn( - 'WASM modules already loaded. wil overide. when connect is called' - ); - } - - await this.litNodeClient.connect(); - - if (!this.litNodeClient.ready) { - console.error('❌ litNodeClient not ready'); - process.exit(); - } - } - - /** - * Retrieves the environment configuration. - * @returns The TinnyEnvConfig object containing the environment configuration. - */ - getEnvConfig(): TinnyEnvConfig { - const contractContext = - this?.testnet?.ContractContext ?? this._contractContext; - return { - rpc: this.rpc, - litNodeClient: this.litNodeClient, - network: this.network, - processEnvs: this.processEnvs, - contractContext: contractContext as LitContractResolverContext, - }; - } - - /** - * Creates a new person with the given name. - * @param name - The name of the person. - * @returns The newly created person. - * @throws Error if the name is not provided. - */ - async createNewPerson(name: string) { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Creating new person:', name); - if (!name) { - throw new Error('Name is required'); - } - const key = await this.getAvailablePrivateKey(); - const privateKey = key.privateKey; - const envConfig = this.getEnvConfig(); - - const person = new TinnyPerson({ - privateKey, - envConfig, - }); - - await person.spawn(); - - this.world.set(name, person); - - return person; - } - - /** - * Retrieves a person from the world by their name. - * @param name - The name of the person to retrieve. - * @returns The person object if found, or undefined if not found. - */ - getPerson(name: string) { - return this.world.get(name); - } - - /** - * Creates a random person. - * @returns A promise that resolves to the created person. - */ - async createRandomPerson() { - return await this.createNewPerson('Alice'); - } - - setUnavailable = (network: LIT_TESTNET) => { - if (this.processEnvs.NETWORK === network) { - throw new Error('LIT_IGNORE_TEST'); - } - }; - - /** - * Init - */ - async init() { - try { - if (this.processEnvs.NO_SETUP) { - console.log('[𐬺πŸ§ͺ Tinny Environment𐬺] Skipping setup'); - return; - } - if ( - this.network === LIT_TESTNET.LOCALCHAIN && - this.processEnvs.USE_SHIVA - ) { - this.testnet = await this._shivaClient.startTestnetManager(); - // wait for the testnet to be active before we start the tests. - let state = await this.testnet.pollTestnetForActive(); - if (state === `UNKNOWN`) { - console.log( - 'Testnet state found to be Unknown meaning there was an error with testnet creation. shutting down' - ); - throw new Error(`Error while creating testnet, aborting test run`); - } - - await this.testnet.getTestnetConfig(); - } else if (this.network === LIT_TESTNET.LOCALCHAIN) { - const context = await import('./networkContext.json'); - this._contractContext = context; - } - - await this.setupLitNodeClient(); - await this.setupSuperCapacityDelegationAuthSig(); - await this.setupBareEthAuthSig(); - } catch (e) { - const err = toErrorWithMessage(e); - console.log( - `[𐬺πŸ§ͺ Tinny Environment𐬺] Failed to init() tinny ${err.message}` - ); - console.log(err.stack); - process.exit(1); - } - } - - /** - * Setup bare eth auth sig to test access control and decryption - */ - async setupBareEthAuthSig() { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - const toSign = await createSiweMessage({ - walletAddress: wallet.address, - nonce: this.litNodeClient.latestBlockhash, - expiration: new Date(Date.now() + 29 * 24 * 60 * 60 * 1000).toISOString(), - litNodeClient: this.litNodeClient, - }); - - this.bareEthAuthSig = await generateAuthSig({ - signer: wallet, - toSign, - }); - } - - //============= SHIVA ENDPOINTS ============= - /** - * Will stop the testnet that is being used in the test run. - */ - async stopTestnet() { - if ( - this.network === LIT_TESTNET.LOCALCHAIN && - this._shivaClient.processEnvs.STOP_TESTNET - ) { - await this.testnet.stopTestnet(); - } else { - console.log('skipping testnet shutdown.'); - } - } - //============= END SHIVA ENDPOINTS ============= - - /** - * Sends funds from the current wallet to the specified wallet address. - * @param walletAddress - The address of the recipient wallet. - * @param amount - The amount of funds to send (default: '0.001'). - * @throws If there is an error sending the funds. - */ - getFunds = async (walletAddress: string, amount = '0.001') => { - try { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - const tx = await wallet.sendTransaction({ - to: walletAddress, - value: ethers.utils.parseEther(amount), - }); - - await tx.wait(); - } catch (e) { - throw new Error(`Failed to send funds to ${walletAddress}: ${e}`); - } - }; - - /** - * Context: the reason this is created instead of individually is because we can't allocate capacity beyond the global - * max capacity. - */ - setupSuperCapacityDelegationAuthSig = async () => { - const privateKey = await this.getAvailablePrivateKey(); - const provider = new ethers.providers.JsonRpcBatchProvider(this.rpc); - const wallet = new ethers.Wallet(privateKey.privateKey, provider); - - /** - * ==================================== - * Setup contracts-sdk client - * ==================================== - */ - if (this.network === LIT_TESTNET.LOCALCHAIN) { - const networkContext = - this?.testnet?.ContractContext ?? this._contractContext; - this.contractsClient = new LitContracts({ - signer: wallet, - debug: this.processEnvs.DEBUG, - rpc: this.rpc, - customContext: networkContext, - }); - } else if ( - CENTRALISATION_BY_NETWORK[this.network] === 'decentralised' || - CENTRALISATION_BY_NETWORK[this.network] === 'centralised' - ) { - this.contractsClient = new LitContracts({ - signer: wallet, - debug: this.processEnvs.DEBUG, - network: this.network, - }); - } - - // THE FOLLOWING WILL TECHNICALLY NEVER BE CALLED, BUT IT'S HERE FOR FUTURE REFERENCE FOR SWITCHING WALLETS - else { - async function _switchWallet() { - // TODO: This wallet should be cached somehwere and reused to create delegation signatures. - // There is a correlation between the number of Capacity Credit NFTs in a wallet and the speed at which nodes can verify a given rate limit authorization. Creating a single wallet to hold all Capacity Credit NFTs improves network performance during tests. - const capacityCreditWallet = - ethers.Wallet.createRandom().connect(provider); - - // get wallet balance - const balance = await wallet.getBalance(); - console.log('this.rpc:', this.rpc); - console.log('this.wallet.address', wallet.address); - console.log('Balance:', balance.toString()); - - const transferTx = await wallet.sendTransaction({ - to: capacityCreditWallet.address, - value: ethers.utils.parseEther('0.001'), - }); - await transferTx.wait(); - } - - // await _switchWallet(); - - this.contractsClient = new LitContracts({ - // signer: capacityCreditWallet, // disabled switch wallet for now - signer: wallet, - debug: this.processEnvs.DEBUG, - network: this.network, - }); - } - - if (!this.contractsClient) { - console.log('❗️Contracts client not initialized'); - process.exit(); - } - - await this.contractsClient.connect(); - - /** - * ==================================== - * Mint a Capacity Credits NFT and get a capacity delegation authSig with it - * ==================================== - */ - if (CENTRALISATION_BY_NETWORK[this.network] === 'decentralised') { - await this.mintSuperCapacityDelegationAuthSig(wallet); - } - }; - - async mintSuperCapacityDelegationAuthSig(wallet: Signer) { - console.log( - '[𐬺πŸ§ͺ Tinny Environment𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - - const capacityTokenId = ( - await this.contractsClient.mintCapacityCreditsNFT({ - requestsPerKilosecond: this.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - ).capacityTokenIdStr; - - try { - this.superCapacityDelegationAuthSig = ( - await this.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: wallet, - capacityTokenId: capacityTokenId, - // Sets a maximum limit of 200 times that the delegation can be used and prevents usage beyond it - uses: '200', - }) - ).capacityDelegationAuthSig; - } catch (e: any) { - if (e.message.includes(`Can't allocate capacity beyond the global max`)) { - console.log('❗️Skipping capacity delegation auth sig setup.', e); - } else { - console.log( - '❗️Error while setting up capacity delegation auth sig', - e - ); - } - } - } -} diff --git a/local-tests/setup/tinny-operations.ts b/local-tests/setup/tinny-operations.ts deleted file mode 100644 index c0f70aceb9..0000000000 --- a/local-tests/setup/tinny-operations.ts +++ /dev/null @@ -1,270 +0,0 @@ -import { TinnyEnvironment } from './tinny-environment'; -import { withTimeout } from './tinny-utils'; - -/** - * Retrieves filter flags from the command line arguments to determine which tests to run. - * It parses the process arguments to find flags that specify filters, typically used to limit test execution to specific tests. - * - * @returns {string[]} An array of filter strings extracted from the command line arguments. - * - * @example - * // Assume the command line is: node script.js --filter=test1,test2 - */ -export const getFiltersFlag = (): string[] => { - const filterArg = process.argv.find((arg) => arg.startsWith('--filter=')); - return filterArg ? filterArg.replace('--filter=', '').split(',') : []; -}; - -/** - * Retrieves the exclude flags from the command line arguments. - * @returns An array of strings representing the exclude flags. - */ -export const getExcludeFlags = (): string[] => { - const filterArg = process.argv.find((arg) => arg.startsWith('--exclude=')); - return filterArg ? filterArg.replace('--exclude=', '').split(',') : []; -}; - -/** - * Runs the tests in the provided `tests` object in a synchronous manner. - * Each test is executed in a loop with a maximum number of attempts specified by `devEnv.processEnvs.MAX_ATTEMPTS`. - * Skipped, failed, and passed tests are tracked and logged. - * At the end, a test report is printed with the number of passed, failed, and skipped tests. - * If any test fails, the process exits with an error code. Otherwise, it exits successfully. - * - * @param {Object} options - The options object. - * @param {Object} options.tests - The tests to run. - * @param {TinnyEnvironment} options.devEnv - The development environment. - * @returns {Promise} - A promise that resolves when all tests have been executed. - */ -export const runInBand = async ({ - tests, - devEnv, -}: { - tests: any; - devEnv: TinnyEnvironment; -}): Promise => { - const filters = getFiltersFlag(); - const testsToRun = Object.entries(tests).filter( - ([testName]) => filters.length === 0 || filters.includes(testName) - ); - - // Initialize arrays to keep track of skipped, failed, and passed tests - let skippedTests: string[] = []; - let failedTests: string[] = []; - let passedTests: string[] = []; - - // Iterate over each test and run it in series - for (const [testName, testFunction] of testsToRun) { - const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; - let attempts = 0; - let testPassed = false; - - while (attempts < maxAttempts && !testPassed) { - const startTime = performance.now(); - - try { - console.log(`Attempt ${attempts + 1} for ${testName}...`); - - // @ts-ignore - await testFunction(devEnv); - testPassed = true; - - const endTime = performance.now(); - const timeTaken = (endTime - startTime).toFixed(2); - console.log(`${testName} - Passed (${timeTaken} ms)`); - passedTests.push(`${testName} (Passed in ${timeTaken} ms)`); - } catch (error) { - if (error.message === 'LIT_IGNORE_TEST') { - skippedTests.push(`${testName} (Skipped)`); - break; - } - attempts++; - if (attempts >= maxAttempts) { - const endTime = performance.now(); - const timeTaken = (endTime - startTime).toFixed(2); - console.error( - `${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)` - ); - console.error(`Error: ${error}`); - failedTests.push( - `${testName} (Failed in ${timeTaken} ms) - Error: ${error}` - ); - } - } - - await new Promise((resolve) => - setTimeout(resolve, devEnv.processEnvs.RUN_IN_BAND_INTERVAL) - ); - } - } - - passedTests.forEach((test) => console.log(`- ${test}`)); - failedTests.forEach((test) => console.log(`- ${test}`)); - skippedTests.forEach((test) => console.log(`- ${test}`)); - - console.log(); - // Print results - console.log( - `Test Report: ${passedTests.length} test(s) passed, ${failedTests.length} failed, ${skippedTests.length} skipped.` - ); - - if (failedTests.length > 0) { - return 1; // Exit with error code if any test failed - } else { - return 0; // Exit successfully if all tests passed - } -}; - -/** - * Runs tests in parallel with a limit of 5 concurrent tests and reports the results. - * @param {Object} options - The options for running the tests. - * @param {any} options.tests - The tests to run. - * @param {TinnyEnvironment} options.devEnv - The development environment. - * @returns {Promise} - A promise that resolves to 0 if all tests passed, 1 otherwise. - */ -export const runTestsParallel = async ({ - tests, - devEnv, - chunkSize, -}: { - tests: any; - devEnv: TinnyEnvironment; - chunkSize?: number; -}): Promise => { - const CHUNK_SIZE = chunkSize || parseInt(process.env.CHUNK_SIZE) || 5; - const filters = getFiltersFlag(); - const excludeFilters = getExcludeFlags(); - - // Filter the tests based on include and exclude filters - const testsToRun = Object.entries(tests).filter( - ([testName]) => - (filters.length === 0 || - filters.some((filter) => testName.includes(filter))) && - (excludeFilters.length === 0 || - !excludeFilters.some((exclude) => testName.includes(exclude))) - ); - - if (!testsToRun || testsToRun.length <= 0) { - throw new Error( - '❌ No tests to run. You might have provided an invalid filter or no tests are available.' - ); - } - - const runTest = async ( - [testName, testFunction]: [string, any], - testIndex: number - ): Promise => { - const maxAttempts = devEnv.processEnvs.MAX_ATTEMPTS; - const testTimeout = devEnv.processEnvs.TEST_TIMEOUT; - - let attempts = 0; - let testPassed = false; - - while (attempts < maxAttempts && !testPassed) { - const startTime = performance.now(); - try { - console.log( - `\x1b[90m[runTestsParallel] Attempt ${attempts + 1} for ${ - testIndex + 1 - }. ${testName}...\x1b[0m` - ); - - await withTimeout(testFunction(devEnv), testTimeout); - testPassed = true; - - const endTime = performance.now(); - const timeTaken = (endTime - startTime).toFixed(2); - console.log( - `\x1b[32mβœ”\x1b[90m ${ - testIndex + 1 - }. ${testName} - Passed (${timeTaken} ms)\x1b[0m` - ); - return `${testName} (Passed in ${timeTaken} ms)`; - } catch (error) { - if (error.message === 'LIT_IGNORE_TEST') { - return `${testName} (Skipped)`; - } - attempts++; - - const endTime = performance.now(); - const timeTaken = (endTime - startTime).toFixed(2); - - if (error.message === 'Timed out') { - console.error( - `\x1b[31mβœ–\x1b[90m ${ - testIndex + 1 - }. ${testName} - Timed out after ${testTimeout}ms (${timeTaken} ms)\x1b[0m` - ); - return `${testName} (Timed out in ${timeTaken} ms)`; - } - - if (attempts >= maxAttempts) { - console.error( - `\x1b[31mβœ–\x1b[90m ${ - testIndex + 1 - }. ${testName} - Failed after ${maxAttempts} attempts (${timeTaken} ms)\x1b[0m` - ); - console.error( - `\x1b[31m❌Error:\x1b[90m ${JSON.stringify(error) || error}\x1b[0m` - ); - return `${testName} (Failed in ${timeTaken} ms) - Error: ${JSON.stringify( - error - )}`; - } - } - } - }; - - const results: string[] = []; - - for (let i = 0; i < testsToRun.length; i += CHUNK_SIZE) { - const chunk = testsToRun.slice(i, i + CHUNK_SIZE); - const chunkResults = await Promise.all( - chunk.map((test, index) => runTest(test, i + index)) - ); - - // wait for 3 seconds before running the next chunk - await new Promise((resolve) => setTimeout(resolve, 3000)); - - results.push(...chunkResults); - } - - const skippedTests = results.filter((result) => result.includes('Skipped')); - const failedTests = results.filter( - (result) => result.includes('Failed') || result.includes('Timed out') - ); - const passedTests = results.filter((result) => result.includes('Passed')); - - if (skippedTests.length > 0) { - console.log(`\x1b[90mTest Report: Some tests were skipped.\x1b[0m`); - skippedTests.forEach((skippedTest) => - console.log(`\x1b[90m- ${skippedTest}\x1b[0m`) - ); - } - - if (failedTests.length > 0) { - console.log(`\x1b[31mTest Report: Some tests failed.\x1b[0m`); - failedTests.forEach((failedTest) => - console.log(`\x1b[31m- ${failedTest}\x1b[0m`) - ); - } - - if (passedTests.length > 0) { - console.log( - `\x1b[32mTest Report: ${passedTests.length} test(s) passed.\x1b[0m` - ); - passedTests.forEach((passedTest) => - console.log(`\x1b[32m- ${passedTest}\x1b[0m`) - ); - } - - if (failedTests.length > 0) { - console.log( - `\x1b[31mTest Report: ${failedTests.length} test(s) failed.\x1b[0m` - ); - return 1; // Exit with error code if any test failed - } else { - console.log('\x1b[32mTest Report: All tests passed.\x1b[0m'); - return 0; // Exit successfully if all tests passed - } -}; diff --git a/local-tests/setup/tinny-person.ts b/local-tests/setup/tinny-person.ts deleted file mode 100644 index 3f2a0a038d..0000000000 --- a/local-tests/setup/tinny-person.ts +++ /dev/null @@ -1,224 +0,0 @@ -import { - AuthSig, - generateAuthSig, - createSiweMessage, -} from '@lit-protocol/auth-helpers'; -import { LitContracts } from '@lit-protocol/contracts-sdk'; -import { - AuthMethod, - BaseSiweMessage, - LIT_NETWORKS_KEYS, - LitContractContext, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { LIT_TESTNET, PKPInfo, TinnyEnvConfig } from './tinny-config'; -import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; -import { AuthMethodScope } from '@lit-protocol/constants'; - -export class TinnyPerson { - public privateKey: string; - public wallet: ethers.Wallet; - public siweMessage: string; - public authSig: AuthSig; - public authMethod: AuthMethod; - public contractsClient: LitContracts; - // public capacityTokenId: string; - // public capacityDelegationAuthSig: AuthSig; - public pkp: PKPInfo; - public authMethodOwnedPkp: PKPInfo; - - // Pass this to data to sign - public loveLetter: Uint8Array = ethers.utils.arrayify( - ethers.utils.keccak256([1, 2, 3, 4, 5]) - ); - - public provider: ethers.providers.StaticJsonRpcProvider; - - public envConfig: TinnyEnvConfig; - - constructor({ - privateKey, - envConfig, - }: { - privateKey: string; - envConfig: TinnyEnvConfig; - }) { - this.envConfig = envConfig; - - this.privateKey = privateKey; - this.provider = new ethers.providers.StaticJsonRpcProvider( - this.envConfig.rpc - ); - this.wallet = new ethers.Wallet(privateKey, this.provider); - } - - /** - * FIXME: Enabling this is causing the test to fail - * Switches the current wallet to a new funding wallet by creating a new funding wallet, - * funding it with a small amount of ethers, and updating the current wallet to the new one. - * - * @private - * @returns {Promise} A promise that resolves once the wallet has been switched. - */ - private async _switchWallet() { - // Create a new funding wallet, funds it with small amount of ethers, and updates the current wallet to the new one. - const fundingWallet = ethers.Wallet.createRandom().connect(this.provider); - - if (this.envConfig.network != LIT_TESTNET.LOCALCHAIN) { - // check balance this.wallet - const balance = await this.wallet.getBalance(); - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Wallet balance:', - ethers.utils.formatEther(balance) - ); - - const transferTx = await this.wallet.sendTransaction({ - to: fundingWallet.address, - value: ethers.utils.parseEther('0.00001'), - }); - - const transferReciept = await transferTx.wait(); - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Transfered Assets for person tx: ', - transferReciept.transactionHash - ); - this.wallet = fundingWallet; - } - } - - async spawn() { - // await this._switchWallet(); - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Spawning person:', this.wallet.address); - /** - * ==================================== - * Get Hot Wallet Auth Sig - * ==================================== - */ - this.siweMessage = await createSiweMessage({ - nonce: this.envConfig.litNodeClient.latestBlockhash, - walletAddress: this.wallet.address, - }); - - this.authSig = await generateAuthSig({ - signer: this.wallet, - toSign: this.siweMessage, - }); - - /** - * ==================================== - * Craft an authMethod from the authSig for the eth wallet auth method - * ==================================== - */ - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Crafting an authMethod from the authSig for the eth wallet auth method...' - ); - this.authMethod = await EthWalletProvider.authenticate({ - signer: this.wallet, - litNodeClient: this.envConfig.litNodeClient, - }); - - /** - * ==================================== - * Setup contracts-sdk client - * ==================================== - */ - if (this.envConfig.network === LIT_TESTNET.LOCALCHAIN) { - const networkContext = this.envConfig.contractContext; - this.contractsClient = new LitContracts({ - network: this.envConfig.network as LIT_NETWORKS_KEYS, - signer: this.wallet, - debug: this.envConfig.processEnvs.DEBUG, - rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc - customContext: networkContext as unknown as LitContractContext, - network: 'custom', - }); - } else { - this.contractsClient = new LitContracts({ - signer: this.wallet, - debug: this.envConfig.processEnvs.DEBUG, - network: this.envConfig.network, - }); - } - await this.contractsClient.connect(); - - /** - * ==================================== - * Mint a PKP - * ==================================== - */ - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP...'); - const walletMintRes = - await this.contractsClient.pkpNftContractUtils.write.mint(); - - this.pkp = walletMintRes.pkp; - - /** - * ==================================== - * Mint a PKP wiuth eth wallet auth method - * ==================================== - */ - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Minting a PKP with eth wallet auth method...' - ); - this.authMethodOwnedPkp = ( - await this.contractsClient.mintWithAuth({ - authMethod: this.authMethod, - scopes: [AuthMethodScope.SignAnything], - }) - ).pkp; - - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] 🐣 TinnyPerson spawned:', - this.wallet.address - ); - } - - /** - * ==================================== - * Mint a Capacity Credits NFT - * ==================================== - */ - async mintCapacityCreditsNFT() { - console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT '); - const capacityTokenId = ( - await this.contractsClient.mintCapacityCreditsNFT({ - requestsPerKilosecond: - this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - ).capacityTokenIdStr; - - return capacityTokenId; - } - - /** - * ==================================== - * Mint a Capacity Credits NFT and get a capacity delegation authSig with it - * ==================================== - */ - async createCapacityDelegationAuthSig( - addresses: string[] = [] - ): Promise { - console.log( - '[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' - ); - - const capacityTokenId = ( - await this.contractsClient.mintCapacityCreditsNFT({ - requestsPerKilosecond: - this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - ).capacityTokenIdStr; - - this.contractsClient.signer = this.wallet; - await this.contractsClient.connect(); - return ( - await this.envConfig.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: this.wallet, - capacityTokenId: capacityTokenId, - ...(addresses.length && { delegateeAddresses: addresses }), - }) - ).capacityDelegationAuthSig; - } -} diff --git a/local-tests/setup/tinny-utils.ts b/local-tests/setup/tinny-utils.ts deleted file mode 100644 index 53e0702f98..0000000000 --- a/local-tests/setup/tinny-utils.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { importer } from 'ipfs-unixfs-importer'; -import { Buffer } from 'buffer'; - -/** - * Converts a string to an IPFS hash. - * @param input - The input string to convert. - * @returns A Promise that resolves to the IPFS hash. - * @throws An error if the generated hash does not start with 'Qm'. - */ -export async function stringToIpfsHash(input: string): Promise { - const blockput = { - put: async (block: any) => { - return block.cid; - }, - }; - - // Convert the input string to a Buffer - const content = Buffer.from(input); - - // Import the content to create an IPFS file - const files = importer([{ content }], blockput as any); - - // Get the first (and only) file result - const result = (await files.next()).value; - - const ipfsHash = (result as any).cid.toString(); - - if (!ipfsHash.startsWith('Qm')) { - throw new Error('Generated hash does not start with Qm'); - } - - return ipfsHash; -} - -export function randomSolanaPrivateKey() { - const BASE58_ALPHABET = - '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; - const SOLANA_PRIVATE_KEY_LENGTH = 88; - - let result = ''; - const charactersLength = BASE58_ALPHABET.length; - for (let i = 0; i < SOLANA_PRIVATE_KEY_LENGTH; i++) { - const randomIndex = Math.floor(Math.random() * charactersLength); - result += BASE58_ALPHABET.charAt(randomIndex); - } - return result; -} - -/** - * Wraps a promise with a timeout. - * If the promise does not resolve or reject within the specified time, it will be rejected with a "Timed out" error. - * - * @param promise - The promise to wrap with a timeout. - * @param ms - The timeout duration in milliseconds. - * @returns A new promise that resolves or rejects based on the original promise or the timeout. - */ -export function withTimeout( - promise: Promise, - ms: number -): Promise { - const timeout = new Promise((_, reject) => - setTimeout(() => reject(new Error('Timed out')), ms) - ); - return Promise.race([promise, timeout]); -} - -function isErrorWithMessage(error: unknown): error is Error { - return ( - typeof error === 'object' && - error !== null && - 'message' in error && - typeof (error as Record).message === 'string' - ); -} - -// eslint-disable-next-line import/prefer-default-export -export function toErrorWithMessage(maybeError: unknown): Error { - if (isErrorWithMessage(maybeError)) return maybeError as Error; - - try { - return new Error(JSON.stringify(maybeError)); - } catch { - // fallback in case there's an error stringifying the maybeError - // like with circular references for example. - return new Error(String(maybeError)); - } -} diff --git a/local-tests/shim.mjs b/local-tests/shim.mjs deleted file mode 100644 index 32068375c1..0000000000 --- a/local-tests/shim.mjs +++ /dev/null @@ -1,3 +0,0 @@ -import { createRequire } from 'module'; -const require = createRequire(import.meta.url); -global.require = require; diff --git a/local-tests/test.ts b/local-tests/test.ts deleted file mode 100644 index 1c43482116..0000000000 --- a/local-tests/test.ts +++ /dev/null @@ -1,313 +0,0 @@ -import { TinnyEnvironment } from './setup/tinny-environment'; -import { runInBand, runTestsParallel } from './setup/tinny-operations'; -// import { testBundleSpeed } from './tests/test-bundle-speed'; -// import { testExample } from './tests/test-example'; -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 { testUsePkpSessionSigsToEncryptDecryptString } from './tests/testUsePkpSessionSigsToEncryptDecryptString'; -import { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString'; -import { testUseInvalidLitActionCodeToGenerateSessionSigs } from './tests/testUseInvalidLitActionCodeToGenerateSessionSigs'; -import { testUseEoaSessionSigsToEncryptDecryptFile } from './tests/testUseEoaSessionSigsToEncryptDecryptFile'; -import { testUseEoaSessionSigsToEncryptDecryptZip } from './tests/testUseEoaSessionSigsToEncryptDecryptZip'; -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 { testUsePkpSessionSigsToEncryptDecryptZip } from './tests/testUsePkpSessionSigsToEncryptDecryptZip'; -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 { testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip } from './tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip'; -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'; - -(async () => { - console.log('[𐬺πŸ§ͺ Tinny𐬺] Running tests...'); - const devEnv = new TinnyEnvironment(); - - await devEnv.init(); - - const relayerTests = { - testRelayer, - }; - - // --filter=WrappedKey - const wrappedKeysTests = { - // -- valid cases - 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, - - // -- import wrapped keys - testFailImportWrappedKeysWithSamePrivateKey, - testFailImportWrappedKeysWithEoaSessionSig, - testFailImportWrappedKeysWithMaxExpirySessionSig, - testFailImportWrappedKeysWithInvalidSessionSig, - testFailImportWrappedKeysWithExpiredSessionSig, - }; - - const eoaSessionSigsTests = { - testUseEoaSessionSigsToExecuteJsSigning, - testUseEoaSessionSigsToPkpSign, - testUseEoaSessionSigsToExecuteJsSigningInParallel, - testUseEoaSessionSigsToExecuteJsClaimKeys, - testUseEoaSessionSigsToExecuteJsClaimMultipleKeys, - testUseEoaSessionSigsToExecuteJsJsonResponse, - testUseEoaSessionSigsToExecuteJsConsoleLog, - testUseEoaSessionSigsToEncryptDecryptString, - testUseEoaSessionSigsToEncryptDecryptFile, - testUseEoaSessionSigsToEncryptDecryptZip, - }; - - const pkpSessionSigsTests = { - testUsePkpSessionSigsToExecuteJsSigning, - testUsePkpSessionSigsToPkpSign, - testUsePkpSessionSigsToExecuteJsSigningInParallel, - testUsePkpSessionSigsToExecuteJsClaimKeys, - testUsePkpSessionSigsToExecuteJsClaimMultipleKeys, - testUsePkpSessionSigsToExecuteJsJsonResponse, - testUsePkpSessionSigsToExecuteJsConsoleLog, - testUsePkpSessionSigsToEncryptDecryptString, - testUsePkpSessionSigsToEncryptDecryptFile, - testUsePkpSessionSigsToEncryptDecryptZip, - }; - - const litActionSessionSigsTests = { - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning, - testUseValidLitActionCodeGeneratedSessionSigsToPkpSign, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse, - testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog, - testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString, - testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile, - testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip, - - // -- 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, - }, - }; - - const testConfig = { - tests: { - // testExample, - // testBundleSpeed, - ...eoaSessionSigsTests, - ...pkpSessionSigsTests, - ...litActionSessionSigsTests, - ...litActionIpfsIdSessionSigsTests, - ...capacityDelegationTests, - ...bareAuthSigTests, - - ...pkpEthersTest.eoaSessionSigs, - ...pkpEthersTest.pkpSessionSigs, - ...pkpEthersTest.litActionSessionSigs, - - ...litActionCombiningTests.broadcastAndCombine, - ...litActionCombiningTests.decryptAndCombine, - ...litActionCombiningTests.ecdsaSignAndCombine, - - ...relayerTests, - ...wrappedKeysTests, - }, - devEnv, - }; - let res; - if (devEnv.processEnvs.RUN_IN_BAND) { - res = await runInBand(testConfig); - } else { - res = await runTestsParallel(testConfig); - } - await devEnv.stopTestnet(); - process.exit(res); -})(); diff --git a/local-tests/tests/test-bundle-speed.ts b/local-tests/tests/test-bundle-speed.ts deleted file mode 100644 index 703b9017f3..0000000000 --- a/local-tests/tests/test-bundle-speed.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test bundle speed - * @param devEnv - */ -export const testBundleSpeed = async (devEnv: TinnyEnvironment) => { - const a = await import('@lit-protocol/lit-node-client'); - const b = await import('@lit-protocol/contracts-sdk'); - const c = await import('@lit-protocol/auth-helpers'); - const d = await import('@lit-protocol/constants'); - const e = await import('@lit-protocol/lit-auth-client'); - - console.log(a, b, c, d, e); -}; diff --git a/local-tests/tests/test-example.ts b/local-tests/tests/test-example.ts deleted file mode 100644 index 9deedaebac..0000000000 --- a/local-tests/tests/test-example.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -export const testExample = async (devEnv: TinnyEnvironment) => { - // Note: This test will be skipped if we are testing on the Cayenne network - devEnv.setUnavailable(LIT_TESTNET.CAYENNE); - - const alice = await devEnv.createRandomPerson(); - - const aliceEoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const aliceExecuteJsRes = await devEnv.litNodeClient.executeJs({ - sessionSigs: aliceEoaSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.pkp.publicKey, - }, - }); - - console.log('aliceExecuteJsRes:', aliceExecuteJsRes); - - devEnv.releasePrivateKeyFromUser(alice); - - // console.log('aliceEoaSessionSigs: ', aliceEoaSessionSigs); - - // const alicePkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - // console.log('alicePkpSessionSigs: ', alicePkpSessionSigs); - - // const aliceLitActionSessionSigs = await getLitActionSessionSigs( - // devEnv, - // alice - // ); - // console.log('aliceLitActionSessionSigs: ', aliceLitActionSessionSigs); -}; diff --git a/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.ts b/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.ts deleted file mode 100644 index 0b2589a916..0000000000 --- a/local-tests/tests/testCosmosAuthSigToEncryptDecryptString.ts +++ /dev/null @@ -1,77 +0,0 @@ -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * ❌ NETWORK=cayenne yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString - * ❌ NETWORK=manzano yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString - * ❌ NETWORK=localchain yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString - * ❌ NETWORK=datil-dev yarn test:local --filter=testCosmosAuthSigToEncryptDecryptString - */ -export const testCosmosAuthSigToEncryptDecryptString = async ( - devEnv: TinnyEnvironment -) => { - console.log('❌❌ THIS IS A KNOWN FAILING TEST, PLEASE IGNORE FOR NOW. ❌❌'); - - devEnv.setUnavailable(LIT_TESTNET.CAYENNE); - devEnv.setUnavailable(LIT_TESTNET.LOCALCHAIN); - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - devEnv.setUnavailable(LIT_TESTNET.DATIL_DEV); - - const accs = AccessControlConditions.getCosmosBasicAccessControlConditions({ - userAddress: devEnv.bareCosmosAuthSig.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - unifiedAccessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - console.log('encryptRes:', encryptRes); - - // -- Expected output:Β΄ - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - // -- Decrypt the encrypted string - try { - const decryptRes = await LitJsSdk.decryptToString( - { - unifiedAccessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - authSig: devEnv.bareCosmosAuthSig, - chain: 'cosmos', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - console.log('decryptRes:', decryptRes); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - - console.log('βœ… decryptRes:', decryptRes); - } catch (e) { - console.log('❌ ERROR:', e); - } -}; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts deleted file mode 100644 index 2fca0422e5..0000000000 --- a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { - AuthMethodScope, - AuthMethodType, - LIT_ENDPOINT_VERSION, -} from '@lit-protocol/constants'; -import { LitAuthClient } from '@lit-protocol/lit-auth-client'; -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LitAbility } from '@lit-protocol/types'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; - -/** - * ## Scenario: - * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP - * - Given: The capacity credits NFT is minted by the dApp owner - * - When: The dApp owner creates a capacity delegation authSig - * - And: The dApp owner delegates the capacity credits NFT to Bob - * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne - * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs - * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs - */ -export const testDelegatingCapacityCreditsNFTToAnotherPkpToExecuteJs = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - // Checking the scopes of the PKP owned by Bob - const bobsAuthMethodAuthId = await LitAuthClient.getAuthIdByAuthMethod( - bob.authMethod - ); - - const scopes = - await bob.contractsClient.pkpPermissionsContract.read.getPermittedAuthMethodScopes( - bob.authMethodOwnedPkp.tokenId, - AuthMethodType.EthWallet, - bobsAuthMethodAuthId, - 3 - ); - - if (!scopes[AuthMethodScope.SignAnything]) { - throw new Error('Bob does not have the "SignAnything" scope on his PKP'); - } - - // As a dApp owner, create a capacity delegation authSig for Bob's PKP wallet - const capacityDelegationAuthSig = await alice.createCapacityDelegationAuthSig( - [bob.pkp.ethAddress] - ); - - // As a dApp owner, delegate the capacity credits NFT to Bob - const bobPkpSessionSigs = await devEnv.litNodeClient.getPkpSessionSigs({ - pkpPublicKey: bob.authMethodOwnedPkp.publicKey, - authMethods: [bob.authMethod], - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - capabilityAuthSigs: [capacityDelegationAuthSig], - }); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: bobPkpSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.authMethodOwnedPkp.publicKey, - }, - }); - - console.log('βœ… res:', res); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237", - // s: "480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc", - // recid: 0, - // signature: "0x00fdf6f2fc3f13410393939bb678c8ec26c0eb46bfc39dbecdcf58540b7f9237480b578c78137150db2420669c47b220001b42a0bb4e92194ce7b76f6fd78ddc1b", - // publicKey: "0465BFEE5CCFF60C0AF1D9B9481B680C2E34894A88F68F44CC094BA27501FD062A3C4AC61FA850BFA22D81D41AF72CBF983909501440FE51187F5FB3D1BC55C44E", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!res.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } -}; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts deleted file mode 100644 index ea397ebd8e..0000000000 --- a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP - * - Given: The capacity credits NFT is minted by the dApp owner - * - When: The dApp owner creates a capacity delegation authSig - * - And: The dApp owner delegates the capacity credits NFT to Bob - * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs - * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs - */ -export const testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = - await alice.createCapacityDelegationAuthSig([bob.wallet.address]); - - // 4. Bob receives the capacity delegation authSig use it to generate session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", - // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", - // recid: 1, - // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", - // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!res.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(res.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - console.log( - 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' - ); - }; diff --git a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts b/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts deleted file mode 100644 index 1d625ad771..0000000000 --- a/local-tests/tests/testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign.ts +++ /dev/null @@ -1,99 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Delegating capacity credits NFT to Bob (delegatee) for him to execute JS code to sign with his PKP - * - Given: The capacity credits NFT is minted by the dApp owner - * - When: The dApp owner creates a capacity delegation authSig - * - And: The dApp owner delegates the capacity credits NFT to Bob - * - Then: The delegated (Bob's) wallet can execute JS code to sign with his PKP using the capacity from the capacity credits NFT - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign - * - βœ… NETWORK=localchain yarn test:local --filter=testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign - */ -export const testDelegatingCapacityCreditsNFTToAnotherWalletToPkpSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = - await alice.createCapacityDelegationAuthSig([bob.wallet.address]); - - // 4. Bob receives the capacity delegation authSig use it to generate session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.pkpSign({ - sessionSigs: bobsSessionSigs, - toSign: alice.loveLetter, - pubKey: bob.pkp.publicKey, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // -- Expected output: - // { - // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", - // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", - // recid: 0, - // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", - // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - if (!res.r) { - throw new Error(`Expected "r" in res`); - } - if (!res.s) { - throw new Error(`Expected "s" in res`); - } - - if (!res.dataSigned) { - throw new Error(`Expected "dataSigned" in res`); - } - - if (!res.publicKey) { - throw new Error(`Expected "publicKey" in res`); - } - - // -- signature must start with 0x - if (!res.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- recid must be parseable as a number - if (isNaN(res.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - console.log('βœ… res:', res); -}; diff --git a/local-tests/tests/testEthAuthSigToEncryptDecryptString.ts b/local-tests/tests/testEthAuthSigToEncryptDecryptString.ts deleted file mode 100644 index 8ade5e1586..0000000000 --- a/local-tests/tests/testEthAuthSigToEncryptDecryptString.ts +++ /dev/null @@ -1,68 +0,0 @@ -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthAuthSigToEncryptDecryptString - * βœ… NETWORK=manzano yarn test:local --filter=testEthAuthSigToEncryptDecryptString - * βœ… NETWORK=localchain yarn test:local --filter=testEthAuthSigToEncryptDecryptString - */ -export const testEthAuthSigToEncryptDecryptString = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authSig.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output:Β΄ - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - authSig: alice.authSig, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - - console.log('βœ… decryptRes:', decryptRes); -}; diff --git a/local-tests/tests/testExecuteJsBroadcastAndCollect.ts b/local-tests/tests/testExecuteJsBroadcastAndCollect.ts deleted file mode 100644 index 3b056db7f5..0000000000 --- a/local-tests/tests/testExecuteJsBroadcastAndCollect.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * ❌ NOT AVAILABLE IN MANZANO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * - */ -export const testExecuteJsBroadcastAndCollect = async ( - devEnv: TinnyEnvironment -) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - let rand = Math.floor(Math.random() * 100); - const resp = await Lit.Actions.broadcastAndCollect({ - name: "temperature", - value: rand.toString(), - }); - Lit.Actions.setResponse({ - response: JSON.stringify(resp) - }); - })();`, - jsParams: {}, - }); - devEnv.releasePrivateKeyFromUser(alice); - - const response = res.response; - if (!response) { - throw new Error('Should contained broadcast data'); - } -}; diff --git a/local-tests/tests/testExecuteJsDecryptAndCombine.ts b/local-tests/tests/testExecuteJsDecryptAndCombine.ts deleted file mode 100644 index 3b24cd4416..0000000000 --- a/local-tests/tests/testExecuteJsDecryptAndCombine.ts +++ /dev/null @@ -1,86 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { - LitAccessControlConditionResource, - LitActionResource, -} from '@lit-protocol/auth-helpers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; -import * as accessControlConditions from '@lit-protocol/access-control-conditions'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * ❌ NOT AVAILABLE IN MANZANO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * - */ -export const testExecutJsDecryptAndCombine = async ( - devEnv: TinnyEnvironment -) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const resp = await Lit.Actions.decryptAndCombine({ - accessControlConditions, - ciphertext, - dataToEncryptHash, - authSig: null, - chain: 'ethereum', - }); - Lit.Actions.setResponse({ - response: resp - }); - })();`, - jsParams: { - accessControlConditions: accs, - dataToEncryptHash: encryptRes.dataToEncryptHash, - ciphertext: encryptRes.ciphertext, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - if (res.response !== 'Hello world') { - throw new Error('content does not match what was expected'); - } -}; diff --git a/local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts b/local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts deleted file mode 100644 index d2c808e776..0000000000 --- a/local-tests/tests/testExecuteJsSignAndCombineEcdsa.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing unrestricted access to execute js code using a capacity delegation authSig without specific delegatee restrictions - * - Given: A capacity delegation authSig is created by the dApp owner - * - When: The authSig does not specifically restrict delegatees - * - And: Any user attempts to execute js code using the capacity from the capacity credits NFT - * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs - * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs - */ -export const testExecuteJsSignAndCombineEcdsa = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = ( - await devEnv.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: alice.wallet, - }) - ).capacityDelegationAuthSig; - - // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 4. Bob can now execute JS code using the capacity credits NFT - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signAndCombineEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - Lit.Actions.setResponse({ - response: sigShare - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - /** - Response format - { - "success": true, - "signedData": {}, - "decryptedData": {}, - "claimData": {}, - "response": "{\"r\":\"026eede14267ca76064a7e22dbe6f9e44d786c7b5917b7d023f45ee4e84ce1ea47\",\"s\":\"22a6048bcb88d724d45bdb6161fefd151483f41d592d167e5c33f42e9fe6dac6\",\"v\":0}", - "logs": "" - } - */ - - if (!res.response) { - throw new Error('Response not found, expecting signature in response'); - } - - const sig = JSON.parse(res.response as string); - console.log('signature returned as a response', sig); - - if (!sig.r) { - throw new Error('invalid signature returned from lit action'); - } - - if (!sig.s) { - throw new Error('invalid signature returned from lit action'); - } - - if (sig.v === undefined) { - throw new Error('invalid signature returned from lit action'); - } - console.log('βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs'); -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.ts deleted file mode 100644 index ff681d6c07..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSign.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSign - */ -export const testPkpEthersWithEoaSessionSigsToEthSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - console.log('devEnv.network:', devEnv.network); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test eth_sign - try { - // Message to sign - const message = 'Hello world'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // DATA, 20 Bytes - address - // DATA, N Bytes - message to sign - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sign', - params: [alice.pkp.ethAddress, hexMsg], - }, - }); - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.ts deleted file mode 100644 index accf022ad0..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTransaction.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTransaction - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTransaction = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - // eth_sendTransaction parameters - // Transaction - Object - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction - // A serialized form of the whole transaction - const rawSignedTx = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTransaction', - params: [tx], - }, - }); - - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r, - s: parsedTransaction.s, - v: parsedTransaction.v, - }); - - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); - - const { v, r, s } = parsedTransaction; - - const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); - - // ==================== Post-Validation ==================== - if (!parsedTransaction) { - throw new Error('❌ parsedTransaction should not be null'); - } - - if (signature.length !== 132) { - throw new Error( - `❌ signature should be 132 characters long, got ${signature.length}` - ); - } - - if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` - ); - } - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.ts deleted file mode 100644 index c1d7c29a4b..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedData.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedData - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTypedData = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.ts deleted file mode 100644 index 41b0d7f2e4..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { - PKPEthersWallet, - ethRequestHandler, - signTypedData, -} from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataUtil = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - const signature = await signTypedData(pkpEthersWallet, msgParams); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.ts deleted file mode 100644 index a63712d77a..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV1 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v1 parameters - try { - const msgParams = [ - { - type: 'string', - name: 'Message', - value: 'Hi, Alice!', - }, - { - type: 'uint32', - name: 'A number', - value: '1337', - }, - ]; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v1', - params: [msgParams, alice.pkp.ethAddress], - }, - }); - - const signatureBytes = ethers.utils.arrayify(signature); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signatureBytes as any, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - - console.log('signature: ', signature); - console.log('recoveredAddr: ', recoveredAddr); - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.ts deleted file mode 100644 index 96c1727b14..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV3 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: { - // @ts-ignore - types: msgParams.types, - // @ts-ignore - domain: msgParams.domain, - // @ts-ignore - primaryType: msgParams.primaryType, - // @ts-ignore - message: msgParams.message, - }, - signature: signature, - version: SignTypedDataVersion.V3, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.ts deleted file mode 100644 index 1f2c6ff0a7..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 - */ -export const testPkpEthersWithEoaSessionSigsToEthSignTypedDataV4 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - domain: { - chainId: 80001, - name: 'Ether Mail', - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - version: '1', - }, - message: { - contents: 'Hello, Bob!', - from: { - name: 'Cow', - wallets: [ - '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', - ], - }, - to: [ - { - name: 'Bob', - wallets: [ - '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', - '0xB0B0b0b0b0b0B000000000000000000000000000', - ], - }, - ], - }, - primaryType: 'Mail', - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person[]' }, - { name: 'contents', type: 'string' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallets', type: 'address[]' }, - ], - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v4', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams as any, - signature: signature, - version: SignTypedDataVersion.V4, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.ts deleted file mode 100644 index b4cb9f79df..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToPersonalSign.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToPersonalSign - */ -export const testPkpEthersWithEoaSessionSigsToPersonalSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- personal_sign parameters - try { - // Message to sign - const message = 'Free the web'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // personal_sign parameters - // DATA, N Bytes - message to sign. - // DATA, 20 Bytes - address - // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'personal_sign', - params: [hexMsg, alice.pkp.ethAddress], - }, - }); - - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.ts deleted file mode 100644 index ad333351d3..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSendTx.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSendTx - */ -export const testPkpEthersWithEoaSessionSigsToSendTx = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await devEnv.getFunds(alice.pkp.ethAddress); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - const txRes = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sendTransaction', - params: [tx], - }, - }); - - console.log('βœ… txRes:', txRes); - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts deleted file mode 100644 index d3e5e4cb98..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignMessage.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignMessage - */ -export const testPkpEthersWithEoaSessionSigsToSignMessage = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: eoaSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test signMessage - try { - const signature = await pkpEthersWallet.signMessage(alice.loveLetter); - console.log('βœ… signature:', signature); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.ts b/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.ts deleted file mode 100644 index 456aa2692c..0000000000 --- a/local-tests/tests/testPkpEthersWithEoaSessionSigsToSignWithAuthContext.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { - LitAbility, - LitActionResource, - LitPKPResource, - createSiweMessageWithRecaps, - generateAuthSig, -} from '@lit-protocol/auth-helpers'; -import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; -import { AuthCallbackParams, AuthSig } from '@lit-protocol/types'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithEoaSessionSigsToSignWithAuthContext - */ -export const testPkpEthersWithEoaSessionSigsToSignWithAuthContext = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpEthersWallet = new PKPEthersWallet({ - pkpPubKey: alice.pkp.publicKey, - litNodeClient: devEnv.litNodeClient, - authContext: { - client: devEnv.litNodeClient, - getSessionSigsProps: { - authNeededCallback: async function ( - params: AuthCallbackParams - ): Promise { - const toSign = await createSiweMessageWithRecaps({ - uri: params.uri, - expiration: params.expiration, - resources: params.resourceAbilityRequests, - walletAddress: alice.wallet.address, - nonce: await devEnv.litNodeClient.getLatestBlockhash(), - litNodeClient: devEnv.litNodeClient, - }); - - const authSig = await generateAuthSig({ - signer: alice.wallet, - toSign, - }); - - return authSig; - }, - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - }, - }, - }); - - await pkpEthersWallet.init(); - - try { - const signature = await pkpEthersWallet.signMessage(alice.loveLetter); - console.log('βœ… signature:', signature); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.ts deleted file mode 100644 index 28439833ab..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSign.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSign - */ -export const testPkpEthersWithLitActionSessionSigsToEthSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - console.log('devEnv.network:', devEnv.network); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test eth_sign - try { - // Message to sign - const message = 'Hello world'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // DATA, 20 Bytes - address - // DATA, N Bytes - message to sign - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sign', - params: [alice.pkp.ethAddress, hexMsg], - }, - }); - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.ts deleted file mode 100644 index 8542bcc55c..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTransaction.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTransaction - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTransaction = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - // eth_sendTransaction parameters - // Transaction - Object - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction - // A serialized form of the whole transaction - const rawSignedTx = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTransaction', - params: [tx], - }, - }); - - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r, - s: parsedTransaction.s, - v: parsedTransaction.v, - }); - - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); - - const { v, r, s } = parsedTransaction; - - const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); - - // ==================== Post-Validation ==================== - if (!parsedTransaction) { - throw new Error('❌ parsedTransaction should not be null'); - } - - if (signature.length !== 132) { - throw new Error( - `❌ signature should be 132 characters long, got ${signature.length}` - ); - } - - if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` - ); - } - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.ts deleted file mode 100644 index 2ddf80f082..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedData.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedData - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTypedData = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.ts deleted file mode 100644 index f6102c40ae..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil.ts +++ /dev/null @@ -1,89 +0,0 @@ -import { PKPEthersWallet, signTypedData } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataUtil = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - const signature = await signTypedData(pkpEthersWallet, msgParams); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } - }; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.ts deleted file mode 100644 index 0c96a2689c..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV1 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v1 parameters - try { - const msgParams = [ - { - type: 'string', - name: 'Message', - value: 'Hi, Alice!', - }, - { - type: 'uint32', - name: 'A number', - value: '1337', - }, - ]; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v1', - params: [msgParams, alice.pkp.ethAddress], - }, - }); - - const signatureBytes = ethers.utils.arrayify(signature); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signatureBytes as any, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - - console.log('signature: ', signature); - console.log('recoveredAddr: ', recoveredAddr); - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.ts deleted file mode 100644 index a12d0efc05..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV3 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: { - // @ts-ignore - types: msgParams.types, - // @ts-ignore - domain: msgParams.domain, - // @ts-ignore - primaryType: msgParams.primaryType, - // @ts-ignore - message: msgParams.message, - }, - signature: signature, - version: SignTypedDataVersion.V3, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.ts deleted file mode 100644 index 5159129a8e..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 - */ -export const testPkpEthersWithLitActionSessionSigsToEthSignTypedDataV4 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - domain: { - chainId: 80001, - name: 'Ether Mail', - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - version: '1', - }, - message: { - contents: 'Hello, Bob!', - from: { - name: 'Cow', - wallets: [ - '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', - ], - }, - to: [ - { - name: 'Bob', - wallets: [ - '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', - '0xB0B0b0b0b0b0B000000000000000000000000000', - ], - }, - ], - }, - primaryType: 'Mail', - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person[]' }, - { name: 'contents', type: 'string' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallets', type: 'address[]' }, - ], - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v4', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams as any, - signature: signature, - version: SignTypedDataVersion.V4, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.ts deleted file mode 100644 index b303cf69f3..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToPersonalSign.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToPersonalSign - */ -export const testPkpEthersWithLitActionSessionSigsToPersonalSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- personal_sign parameters - try { - // Message to sign - const message = 'Free the web'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // personal_sign parameters - // DATA, N Bytes - message to sign. - // DATA, 20 Bytes - address - // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'personal_sign', - params: [hexMsg, alice.pkp.ethAddress], - }, - }); - - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.ts deleted file mode 100644 index 92dfc6f3c8..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSendTx.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSendTx - */ -export const testPkpEthersWithLitActionSessionSigsToSendTx = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await devEnv.getFunds(alice.pkp.ethAddress); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - const txRes = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sendTransaction', - params: [tx], - }, - }); - - console.log('βœ… txRes:', txRes); - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.ts b/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.ts deleted file mode 100644 index cb7a2f35ac..0000000000 --- a/local-tests/tests/testPkpEthersWithLitActionSessionSigsToSignMessage.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithLitActionSessionSigsToSignMessage - */ -export const testPkpEthersWithLitActionSessionSigsToSignMessage = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: litActionSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test signMessage - try { - const signature = await pkpEthersWallet.signMessage(alice.loveLetter); - console.log('βœ… signature:', signature); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.ts deleted file mode 100644 index 3a63f307ae..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSign.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSign - */ -export const testPkpEthersWithPkpSessionSigsToEthSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - console.log('devEnv.network:', devEnv.network); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test eth_sign - try { - // Message to sign - const message = 'Hello world'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // DATA, 20 Bytes - address - // DATA, N Bytes - message to sign - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sign', - params: [alice.pkp.ethAddress, hexMsg], - }, - }); - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ test eth_sign recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.ts deleted file mode 100644 index 794989c722..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTransaction.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTransaction - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTransaction = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - // eth_sendTransaction parameters - // Transaction - Object - // Reference: https://ethereum.github.io/execution-apis/api-documentation/#eth_sendTransaction - // A serialized form of the whole transaction - const rawSignedTx = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTransaction', - params: [tx], - }, - }); - - const parsedTransaction = ethers.utils.parseTransaction(rawSignedTx); - - const signature = ethers.utils.joinSignature({ - r: parsedTransaction.r, - s: parsedTransaction.s, - v: parsedTransaction.v, - }); - - const rawTx = { - nonce: parsedTransaction.nonce, - gasPrice: parsedTransaction.gasPrice, - gasLimit: parsedTransaction.gasLimit, - to: parsedTransaction.to, - value: parsedTransaction.value, - data: parsedTransaction.data, - chainId: parsedTransaction.chainId, // Include chainId if the transaction is EIP-155 - }; - - const txHash = ethers.utils.keccak256( - ethers.utils.serializeTransaction(rawTx) - ); - - const { v, r, s } = parsedTransaction; - - const recoveredAddress = ethers.utils.recoverAddress(txHash, { r, s, v }); - - // ==================== Post-Validation ==================== - if (!parsedTransaction) { - throw new Error('❌ parsedTransaction should not be null'); - } - - if (signature.length !== 132) { - throw new Error( - `❌ signature should be 132 characters long, got ${signature.length}` - ); - } - - if (recoveredAddress.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddres should be ${alice.pkp.ethAddress}, got ${recoveredAddress}` - ); - } - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.ts deleted file mode 100644 index 31d20c98be..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedData.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedData - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTypedData = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.ts deleted file mode 100644 index 1ec0ba2010..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil.ts +++ /dev/null @@ -1,90 +0,0 @@ -import { PKPEthersWallet, signTypedData } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataUtil = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData parameters - try { - // Example from https://github.com/MetaMask/test-dapp/blob/main/src/index.js#L1033 - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - const signature = await signTypedData(pkpEthersWallet, msgParams); - - // https://docs.ethers.io/v5/api/utils/signing-key/#utils-verifyTypedData - const recoveredAddr = ethers.utils.verifyTypedData( - msgParams.domain, - { Person: msgParams.types.Person, Mail: msgParams.types.Mail }, - msgParams.message, - signature - ); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.ts deleted file mode 100644 index ccaeb7cb48..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1.ts +++ /dev/null @@ -1,79 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV1 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v1 parameters - try { - const msgParams = [ - { - type: 'string', - name: 'Message', - value: 'Hi, Alice!', - }, - { - type: 'uint32', - name: 'A number', - value: '1337', - }, - ]; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v1', - params: [msgParams, alice.pkp.ethAddress], - }, - }); - - const signatureBytes = ethers.utils.arrayify(signature); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams, - signature: signatureBytes as any, - version: SignTypedDataVersion.V1, - }); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - - console.log('signature: ', signature); - console.log('recoveredAddr: ', recoveredAddr); - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.ts deleted file mode 100644 index bfae5a64ab..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV3 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallet', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person' }, - { name: 'contents', type: 'string' }, - ], - }, - primaryType: 'Mail', - domain: { - name: 'Ether Mail', - version: '1', - chainId: 80001, - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - }, - message: { - from: { - name: 'Cow', - wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - }, - to: { - name: 'Bob', - wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - }, - contents: 'Hello, Bob!', - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v3', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: { - // @ts-ignore - types: msgParams.types, - // @ts-ignore - domain: msgParams.domain, - // @ts-ignore - primaryType: msgParams.primaryType, - // @ts-ignore - message: msgParams.message, - }, - signature: signature, - version: SignTypedDataVersion.V3, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.ts deleted file mode 100644 index a4712ed587..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - SignTypedDataVersion, - recoverTypedSignature, -} from '@metamask/eth-sig-util'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 - */ -export const testPkpEthersWithPkpSessionSigsToEthSignTypedDataV4 = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- eth_signTypedData_v3 parameters - try { - const msgParams = { - domain: { - chainId: 80001, - name: 'Ether Mail', - verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC', - version: '1', - }, - message: { - contents: 'Hello, Bob!', - from: { - name: 'Cow', - wallets: [ - '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826', - '0xDeaDbeefdEAdbeefdEadbEEFdeadbeEFdEaDbeeF', - ], - }, - to: [ - { - name: 'Bob', - wallets: [ - '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB', - '0xB0BdaBea57B0BDABeA57b0bdABEA57b0BDabEa57', - '0xB0B0b0b0b0b0B000000000000000000000000000', - ], - }, - ], - }, - primaryType: 'Mail', - types: { - EIP712Domain: [ - { name: 'name', type: 'string' }, - { name: 'version', type: 'string' }, - { name: 'chainId', type: 'uint256' }, - { name: 'verifyingContract', type: 'address' }, - ], - Mail: [ - { name: 'from', type: 'Person' }, - { name: 'to', type: 'Person[]' }, - { name: 'contents', type: 'string' }, - ], - Person: [ - { name: 'name', type: 'string' }, - { name: 'wallets', type: 'address[]' }, - ], - }, - }; - - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_signTypedData_v4', - params: [alice.pkp.ethAddress, JSON.stringify(msgParams)], - }, - }); - - const recoveredAddr = recoverTypedSignature({ - data: msgParams as any, - signature: signature, - version: SignTypedDataVersion.V4, - }); - - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr.toLowerCase() !== alice.pkp.ethAddress.toLowerCase()) { - throw new Error( - `❌ recoveredAddr ${recoveredAddr} should be ${alice.pkp.ethAddress}` - ); - } - } catch (e) { - throw new Error(`❌ ${e.toString()}`); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.ts deleted file mode 100644 index 49a14f561a..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToPersonalSign.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToPersonalSign - */ -export const testPkpEthersWithPkpSessionSigsToPersonalSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- personal_sign parameters - try { - // Message to sign - const message = 'Free the web'; - const hexMsg = ethers.utils.hexlify(ethers.utils.toUtf8Bytes(message)); - - // personal_sign parameters - // DATA, N Bytes - message to sign. - // DATA, 20 Bytes - address - // Reference: https://metamask.github.io/api-playground/api-documentation/#personal_sign - const signature = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'personal_sign', - params: [hexMsg, alice.pkp.ethAddress], - }, - }); - - const recoveredAddr = ethers.utils.verifyMessage(message, signature); - - // ==================== Post-Validation ==================== - if (signature.length !== 132) { - throw new Error('❌ signature should be 132 characters long'); - } - - if (recoveredAddr !== alice.pkp.ethAddress) { - throw new Error( - `❌ recoveredAddr should be ${alice.pkp.ethAddress} but got ${recoveredAddr}` - ); - } - - console.log('βœ… personal_sign recoveredAddr:', recoveredAddr); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.ts deleted file mode 100644 index 73a0105fe7..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSendTx.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { PKPEthersWallet, ethRequestHandler } from '@lit-protocol/pkp-ethers'; -import { ethers } from 'ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSendTx - */ -export const testPkpEthersWithPkpSessionSigsToSendTx = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await devEnv.getFunds(alice.pkp.ethAddress); - - await pkpEthersWallet.init(); - - // -- eth_sendTransaction parameters - try { - // Transaction to sign and send - const from = alice.pkp.ethAddress; - const to = alice.pkp.ethAddress; - const gasLimit = ethers.BigNumber.from('21000'); - const value = ethers.BigNumber.from('0'); - const data = '0x'; - - // pkp-ethers signer will automatically add missing fields (nonce, chainId, gasPrice, gasLimit) - const tx = { - from: from, - to: to, - gasLimit, - value, - data, - }; - - const txRes = await ethRequestHandler({ - signer: pkpEthersWallet, - payload: { - method: 'eth_sendTransaction', - params: [tx], - }, - }); - - console.log('βœ… txRes:', txRes); - } catch (e) { - if (e.message.includes('insufficient FPE funds')) { - console.log( - `πŸ§ͺ PKPEthersWallet should be able to send tx (insufficient FPE funds ❗️)` - ); - } else { - throw new Error(`❌ Error: ${e.toString()}`); - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.ts b/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.ts deleted file mode 100644 index 3ad2a2a3d4..0000000000 --- a/local-tests/tests/testPkpEthersWithPkpSessionSigsToSignMessage.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { PKPEthersWallet } from '@lit-protocol/pkp-ethers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage - * βœ… NETWORK=manzano yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage - * βœ… NETWORK=localchain yarn test:local --filter=testPkpEthersWithPkpSessionSigsToSignMessage - */ -export const testPkpEthersWithPkpSessionSigsToSignMessage = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const pkpEthersWallet = new PKPEthersWallet({ - litNodeClient: devEnv.litNodeClient, - pkpPubKey: alice.pkp.publicKey, - controllerSessionSigs: pkpSessionSigs, - }); - - await pkpEthersWallet.init(); - - // -- test signMessage - try { - const signature = await pkpEthersWallet.signMessage(alice.loveLetter); - console.log('βœ… signature:', signature); - } catch (e) { - throw new Error('❌ Error: ' + e.message); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testRelayer.ts b/local-tests/tests/testRelayer.ts deleted file mode 100644 index 9cdabd0962..0000000000 --- a/local-tests/tests/testRelayer.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { - ClaimRequest, - ClaimResult, - ClientClaimProcessor, -} from '@lit-protocol/types'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { - EthWalletProvider, - LitAuthClient, -} from '@lit-protocol/lit-auth-client'; -import { ProviderType } from '@lit-protocol/constants'; -import { withTimeout } from 'local-tests/setup/tinny-utils'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testRelayer - * βœ… NETWORK=manzano yarn test:local --filter=testRelayer - * βœ… NETWORK=localchain yarn test:local --filter=testRelayer - * βœ… NETWORK=datil-dev yarn test:local --filter=testRelayer - */ -export const testRelayer = async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - - const litAuthClient = new LitAuthClient({ - litRelayConfig: { - relayApiKey: 'test-api-key', - }, - litNodeClient: devEnv.litNodeClient, - }); - - // -- test fetch pkps - const ethWalletProvider = litAuthClient.initProvider( - ProviderType.EthWallet - ); - - const pkps = await ethWalletProvider.fetchPKPsThroughRelayer( - alice.authMethod - ); - - if (pkps.length <= 0) { - throw new Error('No PKPs found'); - } else { - console.log('βœ… 1. [testRelayer] /fetch-pkps-by-auth-method works'); - } - - // -- test claims - const claimRequest: ClaimRequest = { - authMethod: alice.authMethod, - signer: alice.wallet, - }; - - const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); - - // Expected output: - // { - // signatures: [ - // { - // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", - // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", - // v: 28, - // }, { - // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", - // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", - // v: 28, - // }, { - // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", - // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", - // v: 27, - // }, { - // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", - // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", - // v: 27, - // }, { - // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", - // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", - // v: 27, - // }, { - // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", - // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", - // v: 27, - // }, { - // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", - // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", - // v: 28, - // } - // ], - // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", - // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", - // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", - // } - - // assertions - if (!claimRes.claimedKeyId) { - throw new Error(`Expected "claimedKeyId" in claimRes`); - } - if (!claimRes.pubkey) { - throw new Error(`Expected "pubkey" in claimRes`); - } - if (!claimRes.mintTx) { - throw new Error(`Expected "mintTx" in claimRes`); - } - - claimRes.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); - - log('βœ… 2. [testRelayer] Claim works'); -}; diff --git a/local-tests/tests/testSolAuthSigToEncryptDecryptString.ts b/local-tests/tests/testSolAuthSigToEncryptDecryptString.ts deleted file mode 100644 index 9e110e177c..0000000000 --- a/local-tests/tests/testSolAuthSigToEncryptDecryptString.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility, SolanaAuthSig } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testSolAuthSigToEncryptDecryptString - * βœ… NETWORK=manzano yarn test:local --filter=testSolAuthSigToEncryptDecryptString - * βœ… NETWORK=localchain yarn test:local --filter=testSolAuthSigToEncryptDecryptString - */ -export const testSolAuthSigToEncryptDecryptString = async ( - devEnv: TinnyEnvironment -) => { - const accs = AccessControlConditions.getSolBasicAccessControlConditions({ - userAddress: devEnv.bareSolAuthSig.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - solRpcConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - console.log('encryptRes:', encryptRes); - - // -- Expected output:Β΄ - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - solRpcConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - authSig: devEnv.bareSolAuthSig, - chain: 'solana', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - - console.log('βœ… decryptRes:', decryptRes); -}; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts deleted file mode 100644 index c6cf228505..0000000000 --- a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs.ts +++ /dev/null @@ -1,121 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing unrestricted access to execute js code using a capacity delegation authSig without specific delegatee restrictions - * - Given: A capacity delegation authSig is created by the dApp owner - * - When: The authSig does not specifically restrict delegatees - * - And: Any user attempts to execute js code using the capacity from the capacity credits NFT - * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs - * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs - */ -export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToExecuteJs = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = ( - await devEnv.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: alice.wallet, - }) - ).capacityDelegationAuthSig; - - // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 4. Bob can now execute JS code using the capacity credits NFT - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", - // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", - // recid: 1, - // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", - // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!res.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(res.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - console.log( - 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' - ); - }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts deleted file mode 100644 index 342c4419f3..0000000000 --- a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing unrestricted access to pkp sign using a capacity delegation authSig without specific delegatee restrictions - * - Given: A capacity delegation authSig is created by the dApp owner - * - When: The authSig does not specifically restrict delegatees - * - And: Any user attempts to pkp sign using the capacity from the capacity credits NFT - * - Then: The user should be able to sign with his/her PKP using the capacity without restrictions due to the absence of delegatee limits - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign - * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign - */ -export const testUseCapacityDelegationAuthSigWithUnspecifiedCapacityTokenIdToPkpSign = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = ( - await devEnv.litNodeClient.createCapacityDelegationAuthSig({ - dAppOwnerWallet: alice.wallet, - }) - ).capacityDelegationAuthSig; - - // 3. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 4. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.pkpSign({ - sessionSigs: bobsSessionSigs, - toSign: alice.loveLetter, - pubKey: bob.pkp.publicKey, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // -- Expected output: - // { - // r: "25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb636", - // s: "1e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c", - // recid: 0, - // signature: "0x25e04b2abdf220b1374b19228bc292bab71a3224a635726a46d4cbe3a62bb6361e5d96ffa6ec7cca961ec7bfa90e524a08b1c4fc9a833b69d8727eff1453064c1b", - // publicKey: "041FF0DC7B69D2B3C3E452AF9E0D30C7FDA6729A1B394059BDC8C4530D7F584FFCAEEEC19B1F22EFB054A22E5EF13AA0B5804994469570929066F5474D490B8A1F", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - if (!res.r) { - throw new Error(`Expected "r" in res`); - } - if (!res.s) { - throw new Error(`Expected "s" in res`); - } - - if (!res.dataSigned) { - throw new Error(`Expected "dataSigned" in res`); - } - - if (!res.publicKey) { - throw new Error(`Expected "publicKey" in res`); - } - - // -- signature must start with 0x - if (!res.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- recid must be parseable as a number - if (isNaN(res.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - console.log('βœ… res:', res); - }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts deleted file mode 100644 index 0ffb15dacc..0000000000 --- a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs.ts +++ /dev/null @@ -1,119 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing unrestricted access to execute JS code using a capacity delegation authSig without specific delegatee restrictions - * - Given: A capacity delegation authSig is created by the dApp owner - * - When: The authSig does not specifically restrict delegatees - * - And: Any user attempts to execute JS code using the capacity from the capacity credits NFT - * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs - * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs - */ - -export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToExecuteJs = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - // No delegatee addresses provided. It means that the capability will not restrict access based on delegatee list, but it may still enforce other restrictions such as usage limits and specific NFT IDs. - const appOwnersCapacityDelegationAuthSig = - await alice.createCapacityDelegationAuthSig(); - - // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc2", - // s: "43aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f17", - // recid: 1, - // signature: "0x0f4b8b20369a8a021aae7c2083076715820e32d2b18826ea7ccea525a9adadc243aa338fa2c90e13c88d9b432d7ee6c8e3df006b8ef94ad5b4ab32d64b507f171c", - // publicKey: "0406A76D2A6E3E729A537640C8C41592BBC2675799CCBBF310CD410691C028C529C5A8DE8016933CEC0B06EC7AA0FFAFBA2791158A11D382C558376DF392F436AD", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!res.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(res.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - console.log( - 'βœ… testDelegatingCapacityCreditsNFTToAnotherWalletToExecuteJs' - ); - }; diff --git a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts b/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts deleted file mode 100644 index 6cdd9d2779..0000000000 --- a/local-tests/tests/testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigsWithCapacityDelegations } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing unrestricted access to pkp sign code using a capacity delegation authSig without specific delegatee restrictions - * - Given: A capacity delegation authSig is created by the dApp owner - * - When: The authSig does not specifically restrict delegatees - * - And: Any user attempts to pkp sign code using the capacity from the capacity credits NFT - * - Then: The user should be able to execute the JS code using the capacity without restrictions due to the absence of delegatee limits - * - * - * ## Test Commands: - * - ❌ Not supported in Cayenne, but session sigs would still work - * - βœ… NETWORK=manzano yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign - * - βœ… NETWORK=localchain yarn test:local --filter=testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign - */ - -export const testUseCapacityDelegationAuthSigWithUnspecifiedDelegateesToPkpSign = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - const appOwnersCapacityDelegationAuthSig = - await alice.createCapacityDelegationAuthSig(); - - // 4. Bob gets the capacity delegation authSig from somewhere and uses it to get session sigs - const bobsSessionSigs = await getEoaSessionSigsWithCapacityDelegations( - devEnv, - bob.wallet, - appOwnersCapacityDelegationAuthSig - ); - - // -- printing out the recaps from the session sigs - const bobsSingleSessionSig = - bobsSessionSigs[devEnv.litNodeClient.config.bootstrapUrls[0]]; - - console.log('bobsSingleSessionSig:', bobsSingleSessionSig); - - const regex = /urn:recap:[\w+\/=]+/g; - - const recaps = bobsSingleSessionSig.signedMessage.match(regex) || []; - - recaps.forEach((r) => { - const encodedRecap = r.split(':')[2]; - const decodedRecap = Buffer.from(encodedRecap, 'base64').toString(); - console.log(decodedRecap); - }); - - // 5. Bob can now pkp sign using the capacity credits NFT - const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: bob.pkp.publicKey, - sessionSigs: bobsSessionSigs, - }); - - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - - // -- Expected output: - // { - // r: "36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f629", - // s: "29135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d05", - // recid: 1, - // signature: "0x36bd0039b4e4d1dae488a63437318790df86b8023ac4ffa842c8983245b7f62929135af930c40ee0901a9ea3ca5621d06a6b932aee2f2256cf2a99a65cb36d051c", - // publicKey: "04837486BD4DCF221D463D976E6A392E12BC2DFEFB124E189AB0A8EA406DFB1C73F4DCD268CC2B8F854C202256BD08E22D688121061EA9CFB1317142DBD2EAB4C4", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!runWithSessionSigs.r) { - throw new Error(`Expected "r" in runWithSessionSigs`); - } - if (!runWithSessionSigs.s) { - throw new Error(`Expected "s" in runWithSessionSigs`); - } - if (!runWithSessionSigs.dataSigned) { - throw new Error(`Expected "dataSigned" in runWithSessionSigs`); - } - if (!runWithSessionSigs.publicKey) { - throw new Error(`Expected "publicKey" in runWithSessionSigs`); - } - - // signature must start with 0x - if (!runWithSessionSigs.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(runWithSessionSigs.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }; diff --git a/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.ts b/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.ts deleted file mode 100644 index 3f3fa787b0..0000000000 --- a/local-tests/tests/testUseCustomAuthSessionSigsToPkpSignExecuteJs.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { - LitAbility, - LitActionResource, - LitPKPResource, -} from '@lit-protocol/auth-helpers'; -import { - AuthMethodScope, - CENTRALISATION_BY_NETWORK, -} from '@lit-protocol/constants'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { stringToIpfsHash } from 'local-tests/setup/tinny-utils'; - -/** - * Test Commands: - * NETWORK=cayenne yarn test:local --filter=testUseCustomAuthSessionSigsToPkpSignExecuteJs - * NOT AVAILABLE IN HABANERO - * NETWORK=localchain yarn test:local --filter=testUseCustomAuthSessionSigsToPkpSignExecuteJs - */ -export const testUseCustomAuthSessionSigsToPkpSignExecuteJs = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - /** - * This is a custom auth method. It can be anything you want. Even the shape of the object can be anything, - * because you will be handling the logic in the Lit action code yourself. - */ - const customAuthMethod = { - authMethodType: 89989, - authMethodId: 'app-id-xxx:user-id-yyy', - accessToken: 'xxx', - }; - - /** - * Alice assigns the custom auth method to her PKP. - */ - const addPermittedAuthMethodReceipt = - await alice.contractsClient.addPermittedAuthMethod({ - pkpTokenId: alice.pkp.tokenId, - authMethodType: customAuthMethod.authMethodType, - authMethodId: customAuthMethod.authMethodId, - authMethodScopes: [AuthMethodScope.SignAnything], - }); - - console.log( - 'βœ… addPermittedAuthMethodReceipt:', - addPermittedAuthMethodReceipt - ); - - /** - * Please note that the code below is first converted to a CID and stored in the smart contract. - * Therefore, the Lit action code executed in the `getPkpSessionSigs` function must match the CID stored in the smart contract. - * - * You can use https://explorer.litprotocol.com/create-action to create a Lit action and get the CID. - */ - const litActionCodeString = `(async () => { - const a = 1; - const b = 2; - - if (a + b === 3 && customAuthMethod.authMethodType === 89989) { - LitActions.setResponse({response:"true"}); - } else { - LitActions.setResponse({response:"false"}); - } - - console.log("Lit.Auth:", Lit.Auth); - })()`; - - const IPFSID = await stringToIpfsHash(litActionCodeString); - - console.log('βœ… IPFSID:', IPFSID.toString()); - - // Grant an action permission to use a PKP - const addPermittedActionReceipt = - await alice.contractsClient.addPermittedAction({ - ipfsId: IPFSID, - pkpTokenId: alice.pkp.tokenId, - authMethodScopes: [AuthMethodScope.SignAnything], - }); - - console.log('βœ… addPermittedActionReceipt:', addPermittedActionReceipt); - - const centralisation = - CENTRALISATION_BY_NETWORK[devEnv.litNodeClient.config.litNetwork]; - - const litActionSessionSigs = - await devEnv.litNodeClient.getLitActionSessionSigs({ - pkpPublicKey: alice.pkp.publicKey, - resourceAbilityRequests: [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ], - // litActionIpfsId: IPFSID, - litActionCode: Buffer.from(litActionCodeString).toString('base64'), - jsParams: { - publicKey: `0x${alice.pkp.publicKey}`, - customAuthMethod: customAuthMethod, - sigName: 'custom-auth-sig', - }, - - ...(centralisation === 'decentralised' && { - capabilityAuthSigs: [devEnv.superCapacityDelegationAuthSig], - }), - }); - - // -- pkp sign test - try { - const res = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.pkp.publicKey, - sessionSigs: litActionSessionSigs, - }); - - console.log('βœ… pkpSign res:', res); - } catch (e) { - throw new Error(e); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } - process.exit(); - // -- execute js - try { - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.pkp.publicKey, - }, - }); - console.log('βœ… executeJs res:', res); - } catch (e) { - throw new Error(e); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts deleted file mode 100644 index 302b2a0a38..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptFile.ts +++ /dev/null @@ -1,94 +0,0 @@ -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptFile - */ -export const testUseEoaSessionSigsToEncryptDecryptFile = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const message = 'Hello world'; - const blob = new Blob([message], { type: 'text/plain' }); - const blobArray = new Uint8Array(await blob.arrayBuffer()); - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.wallet.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decriptedFile = await LitJsSdk.decryptToFile( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: eoaSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (blobArray.length !== decriptedFile.length) { - throw new Error( - `decrypted file should match the original file but received ${decriptedFile}` - ); - } - for (let i = 0; i < blobArray.length; i++) { - if (blobArray[i] !== decriptedFile[i]) { - throw new Error(`decrypted file should match the original file`); - } - } - - console.log('decriptedFile:', decriptedFile); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts deleted file mode 100644 index 6a951cfc88..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptString.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptString - */ -export const testUseEoaSessionSigsToEncryptDecryptString = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.wallet.address, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: eoaSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts deleted file mode 100644 index f64eab4a5c..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToEncryptDecryptZip.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToEncryptDecryptZip - */ -export const testUseEoaSessionSigsToEncryptDecryptZip = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - const message = 'Hello world'; - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.wallet.address, - }); - - const encryptRes = await LitJsSdk.zipAndEncryptString( - { - accessControlConditions: accs, - dataToEncrypt: message, - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const eoaSessionSigs2 = await getEoaSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptedZip = await LitJsSdk.decryptToZip( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: eoaSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - const decryptedMessage = await decryptedZip['string.txt'].async('string'); - - if (message !== decryptedMessage) { - throw new Error( - `decryptedMessage should be ${message} but received ${decryptedMessage}` - ); - } - - console.log('decryptedMessage:', decryptedMessage); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts deleted file mode 100644 index 038b232e32..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimKeys.ts +++ /dev/null @@ -1,182 +0,0 @@ -// import { LitContracts } from '@lit-protocol/contracts-sdk'; -// import { log } from '@lit-protocol/misc'; -// import { -// ClaimRequest, -// ClaimResult, -// ClientClaimProcessor, -// } from '@lit-protocol/types'; -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * ## Scenario: - * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that keys can be claimed correctly. - * - * - Given: EOA sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * - * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. - * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimKeys - */ -export const testUseEoaSessionSigsToExecuteJsClaimKeys = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // claims: { - // foo: { - // signatures: [ - // { - // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", - // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", - // v: 27, - // }, { - // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", - // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", - // v: 27, - // }, { - // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", - // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", - // v: 27, - // } - // ], - // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); - - // const claimRequest: ClaimRequest = { - // authMethod: devEnv.bobsWalletAuthMethod, - // signer: devEnv.hotWallet, - // mintCallback: async (claimRes: ClaimResult) => { - // console.log('claimRes:', claimRes); - - // const litContracts = await devEnv.getContractsClient(claimRes.signer); - // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( - // `0x${claimRes.derivedKeyId}`, - // claimRes.signatures - // ); - - // return pkpInfo.tokenId; - // }, - // }; - - // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); - - // console.log('claimRes:', claimRes); - - // Expected output: - // { - // signatures: [ - // { - // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", - // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", - // v: 28, - // }, { - // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", - // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", - // v: 28, - // }, { - // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", - // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", - // v: 27, - // }, { - // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", - // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", - // v: 27, - // }, { - // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", - // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", - // v: 27, - // }, { - // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", - // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", - // v: 27, - // }, { - // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", - // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", - // v: 28, - // } - // ], - // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", - // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", - // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", - // } - - // assertions - // if (!claimRes.claimedKeyId) { - // throw new Error(`Expected "claimedKeyId" in claimRes`); - // } - // if (!claimRes.pubkey) { - // throw new Error(`Expected "pubkey" in claimRes`); - // } - // if (!claimRes.mintTx) { - // throw new Error(`Expected "mintTx" in claimRes`); - // } - - // claimRes.signatures.forEach((sig: any) => { - // if (!sig.r) { - // throw new Error(`Expected "r" in sig`); - // } - // if (!sig.s) { - // throw new Error(`Expected "s" in sig`); - // } - // if (!sig.v) { - // throw new Error(`Expected "v" in sig`); - // } - // }); - - log('βœ… testUseEoaSessionSigsToExecuteJsClaimKeys'); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts deleted file mode 100644 index c18f740365..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsClaimMultipleKeys.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing the capability to claim keys using EOA (Externally Owned Account) session sigs. This test ensures that multiple keys can be claimed correctly. - * - * - Given: EOA sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsClaimMultipleKeys - */ -export const testUseEoaSessionSigsToExecuteJsClaimMultipleKeys = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts deleted file mode 100644 index f6b90ae481..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsConsoleLog.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsConsoleLog - */ -export const testUseEoaSessionSigsToExecuteJsConsoleLog = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - console.log('hello world') - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "", - // logs: "hello world\n", - // } - - // -- assertions - if (res.response) { - throw new Error(`Expected "response" to be falsy`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts deleted file mode 100644 index 4e219a264f..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsJsonResponse.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsJsonResponse - */ -export const testUseEoaSessionSigsToExecuteJsJsonResponse = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - console.log('hello world') - - LitActions.setResponse({ - response: JSON.stringify({hello: 'world'}) - }); - - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "{\"hello\":\"world\"}", - // logs: "hello world\n", - // } - - // -- assertions - if (!res.response) { - throw new Error(`Expected "response" in res`); - } - - if (!res.response.startsWith('{')) { - throw new Error(`Expected "response" to start with {`); - } - - if (!res.response.endsWith('}')) { - throw new Error(`Expected "response" to end with }`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } - - if (res.success !== true) { - throw new Error(`Expected "success" to be true`); - } -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts deleted file mode 100644 index c381ded7a8..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigning.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigning - */ -export const testUseEoaSessionSigsToExecuteJsSigning = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.pkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe79", - // s: "1c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a", - // recid: 0, - // signature: "0x63311a761842b41686875862a3fb09975c838afff6ae11c5c3940da458dffe791c25f352b4a8bf15510cecbee4e798270cdf68c45a26cf93dc32d6e03dfc720a1b", - // publicKey: "0423F38A7663289FC58841B5F8E068FA43106BC7DDEE38D1F2542C03ABEC45B6733BE2D85A703C7B238865E45DF2175DD2A1736C56F2BAD0A965837F64BB21FB03", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - log('βœ… testUseEoaSessionSigsToExecuteJsSigning'); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts deleted file mode 100644 index 0b20018d88..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToExecuteJsSigningInParallel.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToExecuteJsSigningInParallel - */ -export const testUseEoaSessionSigsToExecuteJsSigningInParallel = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const fn = async (index: number) => { - log(`Index: ${index}`); - - return await devEnv.litNodeClient.executeJs({ - sessionSigs: eoaSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.pkp.publicKey, - }, - }); - }; - - const res = await Promise.all([fn(1), fn(2), fn(3)]); - devEnv.releasePrivateKeyFromUser(alice); - log('res:', res); - - // -- Expected output: - // [ - // { - // claims: {}, - // signatures: { - // sig: { - // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", - // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", - // recid: 0, - // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", - // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", - // recid: 1, - // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", - // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", - // recid: 0, - // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - // ] - - // -- assertions - res.forEach((r) => { - if (!r.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!r.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!r.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!r.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!r.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(r.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }); - - log('βœ… testUseEoaSessionSigsToExecuteJsSigningInParallel'); -}; diff --git a/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts b/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts deleted file mode 100644 index d50d5b5513..0000000000 --- a/local-tests/tests/testUseEoaSessionSigsToPkpSign.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseEoaSessionSigsToPkpSign - * βœ… NETWORK=manzano yarn test:local --filter=testUseEoaSessionSigsToPkpSign - * βœ… NETWORK=localchain yarn test:local --filter=testUseEoaSessionSigsToPkpSign - */ -export const testUseEoaSessionSigsToPkpSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - const runWithSessionSigs = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.pkp.publicKey, - sessionSigs: eoaSessionSigs, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // r: "25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9", - // s: "549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b101833214", - // recid: 1, - // signature: "0x25fc0d2fecde8ed801e9fee5ad26f2cf61d82e6f45c8ad1ad1e4798d3b747fd9549fe745b4a09536e6e7108d814cf7e44b93f1d73c41931b8d57d1b1018332141c", - // publicKey: "04A3CD53CCF63597D3FFCD1DF1E8236F642C7DF8196F532C8104625635DC55A1EE59ABD2959077432FF635DF2CED36CC153050902B71291C4D4867E7DAAF964049", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!runWithSessionSigs.r) { - throw new Error(`Expected "r" in runWithSessionSigs`); - } - if (!runWithSessionSigs.s) { - throw new Error(`Expected "s" in runWithSessionSigs`); - } - if (!runWithSessionSigs.dataSigned) { - throw new Error(`Expected "dataSigned" in runWithSessionSigs`); - } - if (!runWithSessionSigs.publicKey) { - throw new Error(`Expected "publicKey" in runWithSessionSigs`); - } - - // signature must start with 0x - if (!runWithSessionSigs.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(runWithSessionSigs.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - log('βœ… testUseEoaSessionSigsToPkpSign'); -}; diff --git a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts b/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts deleted file mode 100644 index 69d6cd36ad..0000000000 --- a/local-tests/tests/testUseInvalidLitActionCodeToGenerateSessionSigs.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getInvalidLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs - * ❌ NOT AVAILABLE IN MANZANO - * βœ… NETWORK=localchain yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseInvalidLitActionCodeToGenerateSessionSigs - */ -export const testUseInvalidLitActionCodeToGenerateSessionSigs = async ( - devEnv: TinnyEnvironment -) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - - try { - await getInvalidLitActionSessionSigs(devEnv, alice); - } catch (e: any) { - console.log('❌ This error is expected', e); - if ( - e.message === - 'There was an error getting the signing shares from the nodes' - ) { - console.log('βœ… testUseInvalidLitActionCodeToGenerateSessionSigs passed'); - } else { - throw e; - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.ts b/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.ts deleted file mode 100644 index 871009d8e5..0000000000 --- a/local-tests/tests/testUseInvalidLitActionIpfsCodeToGenerateSessionSigs.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getInvalidLitActionIpfsSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseInvalidLitActionIpfsCodeToGenerateSessionSigs - * ❌ NOT AVAILABLE IN MANZANO - * βœ… NETWORK=localchain yarn test:local --filter=testUseInvalidLitActionIpfsCodeToGenerateSessionSigs - */ -export const testUseInvalidLitActionIpfsCodeToGenerateSessionSigs = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - await getInvalidLitActionIpfsSessionSigs(devEnv, alice); - } catch (e: any) { - console.log('❌ THIS IS EXPECTED: ', e); - - if (e.message === 'An error related to validation has occured.') { - console.log( - 'βœ… testUseInvalidLitActionIpfsCodeToGenerateSessionSigs is expected to have an error' - ); - } else { - throw e; - } - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts deleted file mode 100644 index 4b4026eb28..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptFile.ts +++ /dev/null @@ -1,95 +0,0 @@ -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptFile - */ -export const testUsePkpSessionSigsToEncryptDecryptFile = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const message = 'Hello world'; - const blob = new Blob([message], { type: 'text/plain' }); - const blobArray = new Uint8Array(await blob.arrayBuffer()); - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decriptedFile = await LitJsSdk.decryptToFile( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: pkpSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (blobArray.length !== decriptedFile.length) { - throw new Error( - `decrypted file should match the original file but received ${decriptedFile}` - ); - } - for (let i = 0; i < blobArray.length; i++) { - if (blobArray[i] !== decriptedFile[i]) { - throw new Error(`decrypted file should match the original file`); - } - } - - console.log('decriptedFile:', decriptedFile); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts deleted file mode 100644 index f5918b1e73..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptString.ts +++ /dev/null @@ -1,81 +0,0 @@ -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptString - */ -export const testUsePkpSessionSigsToEncryptDecryptString = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: pkpSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts deleted file mode 100644 index abdc59ef4e..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToEncryptDecryptZip.ts +++ /dev/null @@ -1,90 +0,0 @@ -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToEncryptDecryptZip - */ -export const testUsePkpSessionSigsToEncryptDecryptZip = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const message = 'Hello world'; - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const encryptRes = await LitJsSdk.zipAndEncryptString( - { - accessControlConditions: accs, - dataToEncrypt: message, - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptedZip = await LitJsSdk.decryptToZip( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: pkpSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - const decryptedMessage = await decryptedZip['string.txt'].async('string'); - - if (message !== decryptedMessage) { - throw new Error( - `decryptedMessage should be ${message} but received ${decryptedMessage}` - ); - } - - console.log('decryptedMessage:', decryptedMessage); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts deleted file mode 100644 index 3dee2d97d3..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimKeys.ts +++ /dev/null @@ -1,172 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing the capability to claim keys using PKP session sigs. This test ensures that keys can be claimed correctly. - * - * - Given: PKP sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * - * - Note: The key claiming process involves multiple nodes within the Lit network verifying the sessionSigs and collaboratively signing the claim, which results in the generation of a new key pair if successful. - * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimKeys - */ -export const testUsePkpSessionSigsToExecuteJsClaimKeys = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // claims: { - // foo: { - // signatures: [ - // { - // r: "0x31e5dcf6eed3619aa6ff68d0c8f7a4bcf082acc2f12c3d5bcae9b8bbaf883c07", - // s: "0x405f671d1c659022105775b18afe805e01eaa1d0799c6b92887baef77dc023f5", - // v: 27, - // }, { - // r: "0xf2e9fe653d9155bd93feb7fe122c07a81769076fe44567c3ea93bb828f87146e", - // s: "0x01adf2b2780511f70b0b037360ff4b0c2b8d04657a689af780180bed9e6ea3c5", - // v: 27, - // }, { - // r: "0xfe1dcacd79f53b42b24dae75521f01315f34bbc492233e26083995c82218a3ff", - // s: "0x0b708b11704d986b50bce9f648bb5d40e8b9ad87f3a337a213999c7751dc1c0c", - // v: 27, - // } - // ], - // derivedKeyId: "22c14f271322473459c456056ffc6e1c0dc1efcb2d15e5be538ad081b224b3d0", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); - - // const claimRequest: ClaimRequest = { - // authMethod: devEnv.bobsWalletAuthMethod, - // signer: devEnv.hotWallet, - // mintCallback: async (claimRes: ClaimResult) => { - // console.log('claimRes:', claimRes); - - // const litContracts = await devEnv.getContractsClient(claimRes.signer); - // const pkpInfo = await litContracts.pkpNftContractUtils.write.claimAndMint( - // `0x${claimRes.derivedKeyId}`, - // claimRes.signatures - // ); - - // return pkpInfo.tokenId; - // }, - // }; - - // const claimRes = await devEnv.litNodeClient.claimKeyId(claimRequest); - - // console.log('claimRes:', claimRes); - - // Expected output: - // { - // signatures: [ - // { - // r: "0xf73ec73f2dd7858d9b463598420169cf153f8cd409c82af606b3832ff82f8774", - // s: "0x0de6ab4437749fdf1e6239a8d13af516ac9a0744fc0725f9897a880151799fde", - // v: 28, - // }, { - // r: "0x65ec2ac206c4d18aaf12d6d1f17826543c1f329657214cea66c509fcdec8d633", - // s: "0x710e2efb2c61f9ae504721d7bea0b8d1d3c519167e48e4d67c77bf61dfeca735", - // v: 28, - // }, { - // r: "0xe51bd0670463cb5b5e9994870362b3eaa747cb5732e5c666ccf25495fe9aaa54", - // s: "0x1b49aed6d46833c9b9ee0fa13a4009c533309dafdfd51dd30165f2556b6cdcf1", - // v: 27, - // }, { - // r: "0x4278d3f7f2eb38801da5940858be54527e42ee11b25d7b239cb491139c00765d", - // s: "0x13dac60eaa90a548a4c99f1e09ac24e07cb1ef7447e55d3c82cf2ea6d69ec190", - // v: 27, - // }, { - // r: "0xb18158eccd4b099d0cfae4c2f987843cbaf039ce50164410fe4f529e6dc2bb6a", - // s: "0x284d9d5326deeb3d10e2c1d81ed1a7d6fca584c46ad9606a4dad9f12d81874ab", - // v: 27, - // }, { - // r: "0x28ad76574d39d646948642d05f599a982a1dd0776e2e36138315f5fb2c03666e", - // s: "0x2a125a028df39b9230f5d866383fcda0107cc7ee2f42fa1f323d41b34f67273a", - // v: 27, - // }, { - // r: "0xb7ab5120aeffeaee6e8d6ab1456d6823a15fae7e5a70b88d2556dc85450486cf", - // s: "0x6e1e9ac479066d95d62a6cd86f0cb3db92e07367acf43873fb5a7b8ad558a09d", - // v: 28, - // } - // ], - // claimedKeyId: "4825e3caf11a273792ad0405524820410cd15d6323ae4621537f0a89c1322a74", - // pubkey: "049528b98ac4829b5eaf8f8e6addaa9c12e94e83c4d17baf8f86554c111f2ac6d774f483fca03ad06b268059f7c8bcf64c7fb93689e153dc2fed79dada7b289195", - // mintTx: "0x0000000000000000000000000000000000000000000000000000000000000000", - // } - - // assertions - // if (!claimRes.claimedKeyId) { - // throw new Error(`Expected "claimedKeyId" in claimRes`); - // } - // if (!claimRes.pubkey) { - // throw new Error(`Expected "pubkey" in claimRes`); - // } - // if (!claimRes.mintTx) { - // throw new Error(`Expected "mintTx" in claimRes`); - // } - - // claimRes.signatures.forEach((sig: any) => { - // if (!sig.r) { - // throw new Error(`Expected "r" in sig`); - // } - // if (!sig.s) { - // throw new Error(`Expected "s" in sig`); - // } - // if (!sig.v) { - // throw new Error(`Expected "v" in sig`); - // } - // }); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts deleted file mode 100644 index 6b960c9958..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsClaimMultipleKeys.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing the capability to claim keys using PKP session sigs. This test ensures that multiple keys can be claimed correctly. - * - * - Given: PKP sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsClaimMultipleKeys - */ -export const testUsePkpSessionSigsToExecuteJsClaimMultipleKeys = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts deleted file mode 100644 index dab300578d..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsConsoleLog.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsConsoleLog - */ -export const testUsePkpSessionSigsToExecuteJsConsoleLog = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - console.log('hello world') - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "", - // logs: "hello world\n", - // } - - // -- assertions - if (res.response) { - throw new Error(`Expected "response" to be falsy`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts deleted file mode 100644 index cc4e016d69..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsJsonResponse.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsJsonResponse - */ -export const testUsePkpSessionSigsToExecuteJsJsonResponse = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - console.log('hello world') - - LitActions.setResponse({ - response: JSON.stringify({hello: 'world'}) - }); - - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "{\"hello\":\"world\"}", - // logs: "hello world\n", - // } - - // -- assertions - if (!res.response) { - throw new Error(`Expected "response" in res`); - } - - if (!res.response.startsWith('{')) { - throw new Error(`Expected "response" to start with {`); - } - - if (!res.response.endsWith('}')) { - throw new Error(`Expected "response" to end with }`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } - - if (res.success !== true) { - throw new Error(`Expected "success" to be true`); - } -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts deleted file mode 100644 index 0864680c36..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigning.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigning - */ -export const testUsePkpSessionSigsToExecuteJsSigning = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f", - // s: "1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e4", - // recid: 1, - // signature: "0x8d2a3b3fa49e67b6bf9de15adfc0b5fbe04b6d730cbef60f4c211c4803bd9c3f1f819cc7a74a72e6f1b16a9a665f19cdd7294132d8a1c70871a752a6d70615e41c", - // publicKey: "044395E44BA89AC0D0E76DEECD937C7BC0AE96B47766AB01CEC5449A8F869754560ACAEAC82CD48FAD3553AD47D7FAA99131F6E7E1B19DEBA058BB6D6B97F2BDB1", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!res.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(res.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - log('βœ… res:', res); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts deleted file mode 100644 index 7469896024..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToExecuteJsSigningInParallel.ts +++ /dev/null @@ -1,123 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToExecuteJsSigningInParallel - */ -export const testUsePkpSessionSigsToExecuteJsSigningInParallel = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const fn = async (index: number) => { - log(`Index: ${index}`); - - return await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp.publicKey, - }, - }); - }; - - devEnv.releasePrivateKeyFromUser(alice); - - const res = await Promise.all([fn(1), fn(2), fn(3)]); - log('res:', res); - - // -- Expected output: - // [ - // { - // claims: {}, - // signatures: { - // sig: { - // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", - // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", - // recid: 0, - // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", - // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", - // recid: 1, - // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", - // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", - // recid: 0, - // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - // ] - - // -- assertions - res.forEach((r) => { - if (!r.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!r.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!r.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!r.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!r.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(r.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }); - - log('βœ… testUsePkpSessionSigsToExecuteJsSigningInParallel'); -}; diff --git a/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts b/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts deleted file mode 100644 index 658b676a73..0000000000 --- a/local-tests/tests/testUsePkpSessionSigsToPkpSign.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUsePkpSessionSigsToPkpSign - * βœ… NETWORK=manzano yarn test:local --filter=testUsePkpSessionSigsToPkpSign - * βœ… NETWORK=localchain yarn test:local --filter=testUsePkpSessionSigsToPkpSign - */ -export const testUsePkpSessionSigsToPkpSign = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.authMethodOwnedPkp.publicKey, - sessionSigs: pkpSessionSigs, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // r: "f67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a", - // s: "799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce42", - // recid: 1, - // signature: "0xf67785b9c516a1fdbd224e9591554171d594bb1fb9799c851bac56212956838a799edb2732f2ebeaf90ea84cbf4c2a2e2ba509487a19d5c6b88210afe362ce421c", - // publicKey: "0486C6E6E854337411A3884E0DEFF15D6D69663594826313BB73E18C465A079B4C2850719F45E9BE2FAC18AA78FFF2C7AEC912FA9D646B2F088C6CAAA8F7A0144A", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!res.r) { - throw new Error(`Expected "r" in res`); - } - if (!res.s) { - throw new Error(`Expected "s" in res`); - } - if (!res.dataSigned) { - throw new Error(`Expected "dataSigned" in res`); - } - if (!res.publicKey) { - throw new Error(`Expected "publicKey" in res`); - } - - // signature must start with 0x - if (!res.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(res.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - log('βœ… res:', res); -}; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts deleted file mode 100644 index 9481fa4a65..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile.ts +++ /dev/null @@ -1,98 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile - * βœ… NETWORK=manzano yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptFile = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - - const message = 'Hello world'; - const blob = new Blob([message], { type: 'text/plain' }); - const blobArray = new Uint8Array(await blob.arrayBuffer()); - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const pkpSessionSigs2 = await getPkpSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decriptedFile = await LitJsSdk.decryptToFile( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: pkpSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (blobArray.length !== decriptedFile.length) { - throw new Error( - `decrypted file should match the original file but received ${decriptedFile}` - ); - } - for (let i = 0; i < blobArray.length; i++) { - if (blobArray[i] !== decriptedFile[i]) { - throw new Error(`decrypted file should match the original file`); - } - } - - console.log('decriptedFile:', decriptedFile); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts deleted file mode 100644 index c62bb9f4e9..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * ❌ NOT AVAILABLE IN MANZANO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString - * - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptString = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const encryptRes = await LitJsSdk.encryptString( - { - accessControlConditions: accs, - dataToEncrypt: 'Hello world', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptRes = await LitJsSdk.decryptToString( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: litActionSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - if (decryptRes !== 'Hello world') { - throw new Error( - `Expected decryptRes to be 'Hello world' but got ${decryptRes}` - ); - } - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts deleted file mode 100644 index 1ef9ff9e5e..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import * as LitJsSdk from '@lit-protocol/lit-node-client-nodejs'; -import { ILitNodeClient, LitAbility } from '@lit-protocol/types'; -import { AccessControlConditions } from 'local-tests/setup/accs/accs'; -import { LitAccessControlConditionResource } from '@lit-protocol/auth-helpers'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { log } from '@lit-protocol/misc'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip - * ❌ Not supported in Manzano - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToEncryptDecryptZip = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - const alice = await devEnv.createRandomPerson(); - - const message = 'Hello world'; - - // set access control conditions for encrypting and decrypting - const accs = AccessControlConditions.getEmvBasicAccessControlConditions({ - userAddress: alice.authMethodOwnedPkp.ethAddress, - }); - - const encryptRes = await LitJsSdk.zipAndEncryptString( - { - accessControlConditions: accs, - dataToEncrypt: message, - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - log('encryptRes:', encryptRes); - - // await 5 seconds for the encryption to be mined - - // -- Expected output: - // { - // ciphertext: "pSP1Rq4xdyLBzSghZ3DtTtHp2UL7/z45U2JDOQho/WXjd2ntr4IS8BJfqJ7TC2U4CmktrvbVT3edoXJgFqsE7vy9uNrBUyUSTuUdHLfDVMIgh4a7fqMxsdQdkWZjHign3JOaVBihtOjAF5VthVena28D", - // dataToEncryptHash: "64ec88ca00b268e5ba1a35678a1b5316d212f4f366b2477232534a8aeca37f3c", - // } - - // -- assertions - if (!encryptRes.ciphertext) { - throw new Error(`Expected "ciphertext" in encryptRes`); - } - - if (!encryptRes.dataToEncryptHash) { - throw new Error(`Expected "dataToEncryptHash" to in encryptRes`); - } - - const accsResourceString = - await LitAccessControlConditionResource.generateResourceString( - accs, - encryptRes.dataToEncryptHash - ); - - const litActionSessionSigs2 = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitAccessControlConditionResource(accsResourceString), - ability: LitAbility.AccessControlConditionDecryption, - }, - ]); - - // -- Decrypt the encrypted string - const decryptedZip = await LitJsSdk.decryptToZip( - { - accessControlConditions: accs, - ciphertext: encryptRes.ciphertext, - dataToEncryptHash: encryptRes.dataToEncryptHash, - sessionSigs: litActionSessionSigs2, - chain: 'ethereum', - }, - devEnv.litNodeClient as unknown as ILitNodeClient - ); - - devEnv.releasePrivateKeyFromUser(alice); - - const decryptedMessage = await decryptedZip['string.txt'].async('string'); - - if (message !== decryptedMessage) { - throw new Error( - `decryptedMessage should be ${message} but received ${decryptedMessage}` - ); - } - - console.log('decryptedMessage:', decryptedMessage); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts deleted file mode 100644 index 9d6fd6e946..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LitAbility } from '@lit-protocol/types'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing the capability to claim keys using Lit ACtion PKP session sigs. This test ensures that multiple keys can be claimed correctly. - * - * - Given: Lit ACtion PKP sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys - * ❌ Not supported in Manzano - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimKeys = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts deleted file mode 100644 index 2cd2919b8d..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * ## Scenario: - * Testing the capability to claim keys using Lit Action PKP session sigs. This test ensures that multiple keys can be claimed correctly. - * - * - Given: Lit Action PKP sessionSigs are properly generated for the environment. - * - When: These sessionSigs are used to execute JS code within Lit Action. - * - And: The Lit Action JS code attempts to claim a key using the provided sessionSigs. - * - Then: The claim operation should successfully return signatures, derived key IDs, and validate the existence and structure of claimed results. - * * - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys - * ❌ Not supported in Manzano - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsClaimMultipleKeys = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - Lit.Actions.claimKey({keyId: "foo"}); - Lit.Actions.claimKey({keyId: "bar"}); - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // claims: { - // bar: { - // signatures: [ - // { - // r: "0x7ee7b329462acb08d1dd1d3fba17f8ac76263454e2582bc0d5f36c74f4aaac68", - // s: "0x1b20cd8ac8ab1efdcf500d7ff100229deee42ce44b6420619c609a694af33aad", - // v: 28, - // }, { - // r: "0x2bd6db983d5f5dd239b4fe27b087acf0547e49a69e6c62b8e1435d3890a5d4c5", - // s: "0x15a8a80b2a5bf16e9c155bfe9d5da1109847334b8a0a74a9ce277cdfc6b05fdd", - // v: 28, - // }, { - // r: "0x9294c656bdb6764fca46e431dc4b15c653e6347a41eb657d23145d93a1fa19d0", - // s: "0x7afe0be470e9393dda32c356a9a262f7794a59f8e75e551bdb7634beb3a0a114", - // v: 28, - // } - // ], - // derivedKeyId: "0961c21c8a46c4992003a7b7af9449c15f772a269633ae3242f6ed146708a819", - // }, - // foo: { - // signatures: [ - // { - // r: "0xc39c073d69c8878bf06c813af9d090b41e15319abc9677e20f07085c96451e98", - // s: "0x6ef6a3d4b365119f4a9613a89fd57af01c4a350a20222935581be306b4c8aba4", - // v: 27, - // }, { - // r: "0xa2473911de4b252349cadde340de121ce3195929cd1ebb4c717f3d9d65c67988", - // s: "0x597a45d27a3100fa0bb144644f6bdec62c8a827f35427814cea64f8d3d9a9fa8", - // v: 27, - // }, { - // r: "0x97c393fb1f733b946bfaafdbb13c46192f4cf5ad2b2a9fcf9ff0355a7a2dc5fa", - // s: "0x152737c1b0aba904182bb5ac70e3a99ba4301b631df55bd21b91d705eb5ef4d2", - // v: 27, - // } - // ], - // derivedKeyId: "7698c828a5e4ae6dd6f98ae72fcb5a96bc83f53fa6a09c614e28ceab8198d5ca", - // }, - // }, - // signatures: {}, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // assertions - if (!res.claims.foo) { - throw new Error(`Expected "foo" in res.claims`); - } - if (!res.claims.foo.derivedKeyId) { - throw new Error(`Expected "derivedKeyId" in res.claims.foo`); - } - - if (!res.claims.foo.signatures) { - throw new Error(`Expected "signatures" in res.claims.foo`); - } - - res.claims.foo.signatures.forEach((sig: any) => { - if (!sig.r) { - throw new Error(`Expected "r" in sig`); - } - if (!sig.s) { - throw new Error(`Expected "s" in sig`); - } - if (!sig.v) { - throw new Error(`Expected "v" in sig`); - } - }); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts deleted file mode 100644 index 53ffe99766..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LitAbility } from '@lit-protocol/types'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog - * ❌ Not supported on manzano - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsConsoleLog = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - console.log('hello world') - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - console.log('res:', res); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "", - // logs: "hello world\n", - // } - - // -- assertions - if (res.response) { - throw new Error(`Expected "response" to be falsy`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts deleted file mode 100644 index 007c9e448c..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse - * ❌ Not supported on manzano - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsJsonResponse = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - console.log('hello world') - - LitActions.setResponse({ - response: JSON.stringify({hello: 'world'}) - }); - - })();`, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // Expected output: - // { - // success: true, - // signedData: {}, - // decryptedData: {}, - // claimData: {}, - // response: "{\"hello\":\"world\"}", - // logs: "hello world\n", - // } - - // -- assertions - if (!res.response) { - throw new Error(`Expected "response" in res`); - } - - if (!res.response.startsWith('{')) { - throw new Error(`Expected "response" to start with {`); - } - - if (!res.response.endsWith('}')) { - throw new Error(`Expected "response" to end with }`); - } - - if (!res.logs) { - throw new Error(`Expected "logs" in res`); - } - - if (!res.logs.includes('hello world')) { - throw new Error(`Expected "logs" to include 'hello world'`); - } - - if (!res.success) { - throw new Error(`Expected "success" in res`); - } - - if (res.success !== true) { - throw new Error(`Expected "success" to be true`); - } - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts deleted file mode 100644 index 92b90b2556..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LitAbility } from '@lit-protocol/types'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning - * ❌ NOT AVAILABLE IN HABANERO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigning = - async (devEnv: TinnyEnvironment) => { - // - // devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice, [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ]); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp.publicKey, - }, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef", - // s: "4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee145", - // recid: 1, - // signature: "0x6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee1451c", - // publicKey: "04D10D941B04491FDC99B048E2252A69137333254C482511D6CCDD401C080AF4F51BF65D9AE2413FCE066E326D7F0CED9C139DD9BA2D1C6334FD8C14CA4DD7F3D0", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - log('βœ… res:', res); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts deleted file mode 100644 index e57cc6f451..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel.ts +++ /dev/null @@ -1,125 +0,0 @@ -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel - * ❌ Not available in Habanero - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel - */ -export const testUseValidLitActionCodeGeneratedSessionSigsToExecuteJsSigningInParallel = - async (devEnv: TinnyEnvironment) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const fn = async (index: number) => { - log(`Index: ${index}`); - - return await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp.publicKey, - }, - }); - }; - - devEnv.releasePrivateKeyFromUser(alice); - - const res = await Promise.all([fn(1), fn(2), fn(3)]); - log('res:', res); - - // -- Expected output: - // [ - // { - // claims: {}, - // signatures: { - // sig: { - // r: "d5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a", - // s: "0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d0", - // recid: 0, - // signature: "0xd5bc8b53b9f69604c2dfb2d1d3e6c8b7e01a225346055ee798f5f67fe542a05a0153071ac4c7f9b08330361575b109dec07d1c335edeecd85db47398795a00d01b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "d2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc", - // s: "5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd", - // recid: 1, - // signature: "0xd2ad9086e810a5fd9b49dc4c2a0e7e2cf417dd79f8e75cc5f7b7b21d1b7ae9bc5e28b3321e73bab4177f6a69fec924f9daec294cf89a9a4d9c1a8fad18810bbd1c", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // }, { - // claims: {}, - // signatures: { - // sig: { - // r: "50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3", - // s: "443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa9", - // recid: 0, - // signature: "0x50f87167ba2c8a92e78c95f34e2683a23c372fcc6d104ef9f4d9050d5e1621f3443f5895668e8df6b5d6097a3e9f363923dc2cb83a4734b79359c8213f220fa91b", - // publicKey: "0489782A60B39C758DD8405965DC83DE5F1DB9572861EBAB6064090223C3B7F60DD71C6E673D81550E127BE18497BEA8C349E3B91C8170AD572AD0572009797EA5", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - // ] - - // -- assertions - res.forEach((r) => { - if (!r.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!r.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!r.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!r.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - // -- signatures.sig.signature must start with 0x - if (!r.signatures.sig.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // -- signatures.sig.recid must be parseable as a number - if (isNaN(r.signatures.sig.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - }); - - log('βœ… testUsePkpSessionSigsToExecuteJsSigningInParallel'); - }; diff --git a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts b/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts deleted file mode 100644 index b72471a035..0000000000 --- a/local-tests/tests/testUseValidLitActionCodeGeneratedSessionSigsToPkpSign.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { LitPKPResource } from '@lit-protocol/auth-helpers'; -import { LIT_ENDPOINT_VERSION } from '@lit-protocol/constants'; -import { log } from '@lit-protocol/misc'; -import { LitAbility } from '@lit-protocol/types'; -import { LIT_TESTNET } from 'local-tests/setup/tinny-config'; -import { getLitActionSessionSigs } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign - * ❌ NOT AVAILABLE IN HABANERO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign - * βœ… NETWORK=datil-dev yarn test:local --filter=testUseValidLitActionCodeGeneratedSessionSigsToPkpSign - * - **/ -export const testUseValidLitActionCodeGeneratedSessionSigsToPkpSign = async ( - devEnv: TinnyEnvironment -) => { - devEnv.setUnavailable(LIT_TESTNET.MANZANO); - - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigs(devEnv, alice); - - const res = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.authMethodOwnedPkp.publicKey, - sessionSigs: litActionSessionSigs, - }); - - devEnv.releasePrivateKeyFromUser(alice); - - // -- Expected output: - // { - // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", - // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", - // recid: 1, - // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", - // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!res.r) { - throw new Error(`Expected "r" in res`); - } - if (!res.s) { - throw new Error(`Expected "s" in res`); - } - if (!res.dataSigned) { - throw new Error(`Expected "dataSigned" in res`); - } - if (!res.publicKey) { - throw new Error(`Expected "publicKey" in res`); - } - - // signature must start with 0x - if (!res.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(res.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - log('βœ… res:', res); -}; diff --git a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.ts b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.ts deleted file mode 100644 index 535521bd87..0000000000 --- a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { LitActionResource, LitPKPResource } from '@lit-protocol/auth-helpers'; -import { log } from '@lit-protocol/misc'; -import { LitAbility } from '@lit-protocol/types'; -import { getLitActionSessionSigsUsingIpfsId } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning - * ❌ NOT AVAILABLE IN HABANERO - * βœ… NETWORK=localchain yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning - */ -export const testUseValidLitActionIpfsCodeGeneratedSessionSigsToExecuteJsSigning = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId( - devEnv, - alice, - [ - { - resource: new LitPKPResource('*'), - ability: LitAbility.PKPSigning, - }, - { - resource: new LitActionResource('*'), - ability: LitAbility.LitActionExecution, - }, - ] - ); - - const res = await devEnv.litNodeClient.executeJs({ - sessionSigs: litActionSessionSigs, - code: `(async () => { - const sigShare = await LitActions.signEcdsa({ - toSign: dataToSign, - publicKey, - sigName: "sig", - }); - })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: alice.authMethodOwnedPkp.publicKey, - }, - }); - devEnv.releasePrivateKeyFromUser(alice); - console.log('βœ… res:', res); - - // -- Expected output: - // { - // claims: {}, - // signatures: { - // sig: { - // r: "6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef", - // s: "4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee145", - // recid: 1, - // signature: "0x6d5ce6f948ff763939c204fc0f1b750fa0267ed567ed59581082d0cbf283feef4957ece75c60388500c4b7aa38a5fbafb7c20427db181aff7806af54c16ee1451c", - // publicKey: "04D10D941B04491FDC99B048E2252A69137333254C482511D6CCDD401C080AF4F51BF65D9AE2413FCE066E326D7F0CED9C139DD9BA2D1C6334FD8C14CA4DD7F3D0", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // }, - // }, - // decryptions: [], - // response: undefined, - // logs: "", - // } - - // -- assertions - if (!res.signatures.sig.r) { - throw new Error(`Expected "r" in res.signatures.sig`); - } - if (!res.signatures.sig.s) { - throw new Error(`Expected "s" in res.signatures.sig`); - } - - if (!res.signatures.sig.dataSigned) { - throw new Error(`Expected "dataSigned" in res.signatures.sig`); - } - - if (!res.signatures.sig.publicKey) { - throw new Error(`Expected "publicKey" in res.signatures.sig`); - } - - log('βœ… res:', res); - }; diff --git a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.ts b/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.ts deleted file mode 100644 index 9d11289b7b..0000000000 --- a/local-tests/tests/testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { getLitActionSessionSigsUsingIpfsId } from 'local-tests/setup/session-sigs/get-lit-action-session-sigs'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign - * ❌ NOT AVAILABLE IN HABANERO - * ❌ NETWORK=localchain yarn test:local --filter=testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign - * - **/ -export const testUseValidLitActionIpfsCodeGeneratedSessionSigsToPkpSign = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - let litActionSessionSigs; - - try { - litActionSessionSigs = await getLitActionSessionSigsUsingIpfsId( - devEnv, - alice - ); - } catch (e: any) { - console.log('❌ This error is NOT expected:', e); - throw new Error(e); - } - - const res = await devEnv.litNodeClient.pkpSign({ - toSign: alice.loveLetter, - pubKey: alice.authMethodOwnedPkp.publicKey, - sessionSigs: litActionSessionSigs, - }); - devEnv.releasePrivateKeyFromUser(alice); - console.log('βœ… res:', res); - - // -- Expected output: - // { - // r: "ab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b", - // s: "4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e", - // recid: 1, - // signature: "0xab2cef959db920d56f001c3b05637ee49af4c4441f2867ea067c413594a4c87b4bf11e17b4bb618aa6ed75cbf0406e6babfd953c5b201da697077c5fbf5b542e1c", - // publicKey: "04400AD53C2F8BA11EBC69F05D1076D5BEE4EAE668CD66BABADE2E0770F756FDEEFC2C1D20F9A698EA3FEC6E9C944FF9FAFC2DC339B8E9392AFB9CC8AE75C5E5EC", - // dataSigned: "7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4", - // } - - // -- assertions - // r, s, dataSigned, and public key should be present - if (!res.r) { - throw new Error(`Expected "r" in res`); - } - if (!res.s) { - throw new Error(`Expected "s" in res`); - } - if (!res.dataSigned) { - throw new Error(`Expected "dataSigned" in res`); - } - if (!res.publicKey) { - throw new Error(`Expected "publicKey" in res`); - } - - // signature must start with 0x - if (!res.signature.startsWith('0x')) { - throw new Error(`Expected "signature" to start with 0x`); - } - - // recid must be parseable as a number - if (isNaN(res.recid)) { - throw new Error(`Expected "recid" to be parseable as a number`); - } - - log('βœ… res:', res); - }; diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts deleted file mode 100644 index 711516a3b3..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionGeneratedKey.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api, EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getBaseTransactionForNetwork } from './util'; - -const { signTransactionWithEncryptedKey, generatePrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumBroadcastTransactionGeneratedKey - */ -export const testEthereumBroadcastTransactionGeneratedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ - pkpSessionSigs, - network: 'evm', - litNodeClient: devEnv.litNodeClient, - memo: 'Test key', - }); - - const generatedKeysWalletAddress = - ethers.utils.computeAddress(generatedPublicKey); - console.log(`Sending funds to ${generatedKeysWalletAddress}`); - await devEnv.getFunds(generatedKeysWalletAddress, '0.005'); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient.config.litNetwork, - toAddress: alice.wallet.address, - }); - - const signedTx = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction, - broadcast: true, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signedTx'); - // console.log(signedTx); - - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } - - log('βœ… testEthereumBroadcastTransactionGeneratedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.ts b/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.ts deleted file mode 100644 index 85aae4d90e..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumBroadcastTransactionWrappedKey.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api, EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getBaseTransactionForNetwork } from './util'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumBroadcastTransactionWrappedKey - */ -export const testEthereumBroadcastTransactionWrappedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const wrappedKeysWallet = ethers.Wallet.createRandom(); - const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; - - const wrappedKeysWalletAddress = wrappedKeysWallet.address; - console.log(`Sending funds to ${wrappedKeysWalletAddress}`); - await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey: wrappedKeysWalletPrivateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient.config.litNetwork, - toAddress: alice.wallet.address, - }); - - const signedTx = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction, - broadcast: true, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signedTx'); - // console.log(signedTx); - - // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } - - log('βœ… testEthereumBroadcastTransactionWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.ts b/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.ts deleted file mode 100644 index 4c1e7af112..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumBroadcastWrappedKeyWithFetchGasParams.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api, EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getChainForNetwork } from './util'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumBroadcastWrappedKeyWithFetchGasParams - */ -export const testEthereumBroadcastWrappedKeyWithFetchGasParams = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const wrappedKeysWallet = ethers.Wallet.createRandom(); - const wrappedKeysWalletPrivateKey = wrappedKeysWallet.privateKey; - - const wrappedKeysWalletAddress = wrappedKeysWallet.address; - console.log(`Sending funds to ${wrappedKeysWalletAddress}`); - await devEnv.getFunds(wrappedKeysWallet.address, '0.005'); - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey: wrappedKeysWalletPrivateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction: EthereumLitTransaction = { - toAddress: alice.wallet.address, - value: '0.0001', // in ethers (Lit tokens) - dataHex: ethers.utils.hexlify( - ethers.utils.toUtf8Bytes('Test transaction from Alice to bob') - ), - ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork), - }; - - const signedTx = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction, - broadcast: true, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signedTx'); - // console.log(signedTx); - - // TODO: Get the raw input from the tx hash, convert it to UTF-8 and assert that it contains "Test transaction from Alice to bob" - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } - - log('βœ… testEthereumBroadcastWrappedKeyWithDefaultGasParams'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts b/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts deleted file mode 100644 index a06531dce0..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumSignMessageGeneratedKey.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -const { generatePrivateKey, signMessageWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumSignMessageGeneratedKey - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumSignMessageGeneratedKey - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumSignMessageGeneratedKey - */ -export const testEthereumSignMessageGeneratedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const { pkpAddress, id, generatedPublicKey } = await generatePrivateKey({ - pkpSessionSigs, - network: 'evm', - litNodeClient: devEnv.litNodeClient, - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedStringMessage = 'This is a test message'; - - const signature = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - messageToSign: unsignedStringMessage, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signature'); - // console.log(signature); - - if (!ethers.utils.isHexString(signature)) { - throw new Error(`signature isn't hex: ${signature}`); - } - - const unsignedBinaryMessage = ethers.utils.arrayify( - ethers.utils.toUtf8Bytes(unsignedStringMessage) - ); - - const signatureBinary = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - messageToSign: unsignedBinaryMessage, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signatureBinary'); - // console.log(signatureBinary); - - if (!ethers.utils.isHexString(signatureBinary)) { - throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); - } - - if (signatureBinary !== signature) { - throw new Error( - `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` - ); - } - - log('βœ… testEthereumSignMessageGeneratedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.ts b/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.ts deleted file mode 100644 index 05d692ea0f..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumSignMessageWrappedKey.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -const { importPrivateKey, signMessageWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumSignMessageWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumSignMessageWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumSignMessageWrappedKey - */ -export const testEthereumSignMessageWrappedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = ethers.Wallet.createRandom().privateKey; - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedStringMessage = 'This is a test message'; - - const signature = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - messageToSign: unsignedStringMessage, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signature'); - // console.log(signature); - - if (!ethers.utils.isHexString(signature)) { - throw new Error(`signature isn't hex: ${signature}`); - } - - const unsignedBinaryMessage = ethers.utils.arrayify( - ethers.utils.toUtf8Bytes(unsignedStringMessage) - ); - - const signatureBinary = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - messageToSign: unsignedBinaryMessage, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signatureBinary'); - // console.log(signatureBinary); - - if (!ethers.utils.isHexString(signatureBinary)) { - throw new Error(`signatureBinary isn't hex: ${signatureBinary}`); - } - - if (signatureBinary !== signature) { - throw new Error( - `signature: ${signature} doesn't match it's signatureBinary form: ${signatureBinary}` - ); - } - - log('βœ… testEthereumSignMessageWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.ts b/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.ts deleted file mode 100644 index a4b1ace84b..0000000000 --- a/local-tests/tests/wrapped-keys/testEthereumSignTransactionWrappedKey.ts +++ /dev/null @@ -1,83 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -import type { EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getBaseTransactionForNetwork } from './util'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testEthereumSignTransactionWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testEthereumSignTransactionWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testEthereumSignTransactionWrappedKey - */ -export const testEthereumSignTransactionWrappedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = ethers.Wallet.createRandom().privateKey; - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient.config.litNetwork, - toAddress: alice.wallet.address, - }); - - const signedTx = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction, - broadcast: false, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signedTx'); - // console.log(signedTx); - - if (!ethers.utils.isHexString(signedTx)) { - throw new Error(`signedTx isn't hex: ${signedTx}`); - } - - log('βœ… testEthereumSignTransactionWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testExportWrappedKey.ts b/local-tests/tests/wrapped-keys/testExportWrappedKey.ts deleted file mode 100644 index da390f1eda..0000000000 --- a/local-tests/tests/wrapped-keys/testExportWrappedKey.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from '../../setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from '../../setup/session-sigs/get-pkp-session-sigs'; -import { randomSolanaPrivateKey } from '../../setup/tinny-utils'; - -const { exportPrivateKey, importPrivateKey } = api; -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testExportWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testExportWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testExportWrappedKey - */ -export const testExportWrappedKey = async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigsImport = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsImport); - - const privateKey = randomSolanaPrivateKey(); - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs: pkpSessionSigsImport, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsExport = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsExport); - - const { decryptedPrivateKey } = await exportPrivateKey({ - pkpSessionSigs: pkpSessionSigsExport, - litNodeClient: devEnv.litNodeClient, - network: 'solana', - id, - }); - - if (decryptedPrivateKey !== privateKey) { - throw new Error( - `Decrypted private key: ${decryptedPrivateKey} doesn't match with the original private key: ${privateKey}` - ); - } - - log('βœ… testExportWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.ts b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.ts deleted file mode 100644 index eecd57a262..0000000000 --- a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyInvalidDecryption.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getPkpAccessControlCondition } from 'packages/wrapped-keys/src/lib/utils'; -import { encryptString } from '@lit-protocol/encryption'; -import { LIT_PREFIX } from 'packages/wrapped-keys/src/lib/constants'; -import { LIT_ACTION_CID_REPOSITORY } from '../../../packages/wrapped-keys/src/lib/lit-actions-client/constants'; -import { getBaseTransactionForNetwork } from './util'; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption - * βœ… NETWORK=manzano yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption - * βœ… NETWORK=localchain yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyInvalidDecryption - */ -export const testFailEthereumSignTransactionWrappedKeyInvalidDecryption = - async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - const bob = await devEnv.createRandomPerson(); - - try { - const privateKey = ethers.Wallet.createRandom().privateKey; - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - const decryptionAccessControlCondition = - getPkpAccessControlCondition(alicePkpAddress); - const { ciphertext, dataToEncryptHash } = await encryptString( - { - accessControlConditions: [decryptionAccessControlCondition], - dataToEncrypt: LIT_PREFIX + privateKey, - }, - devEnv.litNodeClient - ); - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - bob, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction = getBaseTransactionForNetwork({ - network: devEnv.litNodeClient.config.litNetwork, - toAddress: alice.wallet.address, - }); - - try { - const _res = await devEnv.litNodeClient.executeJs({ - sessionSigs: pkpSessionSigsSigning, - ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, - jsParams: { - ciphertext, - dataToEncryptHash, - unsignedTransaction, - accessControlConditions: [decryptionAccessControlCondition], - }, - }); - } catch (e: any) { - if ( - e.message.includes( - 'There was an error getting the signing shares from the nodes' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyInvalidDecryption is expected to have an error' - ); - } else { - throw e; - } - } - - log('βœ… testFailEthereumSignTransactionWrappedKeyInvalidDecryption'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - } - }; diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.ts b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.ts deleted file mode 100644 index f2e1ac8feb..0000000000 --- a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithInvalidParam.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api, EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getBaseTransactionForNetwork } from './util'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam - * βœ… NETWORK=manzano yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam - * βœ… NETWORK=localchain yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithInvalidParam - */ -export const testFailEthereumSignTransactionWrappedKeyWithInvalidParam = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = ethers.Wallet.createRandom().privateKey; - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const unsignedTransaction: EthereumLitTransaction = { - ...getBaseTransactionForNetwork({ - network: devEnv.litNodeClient.config.litNetwork, - toAddress: alice.wallet.address, - }), - dataHex: 'Test transaction from Alice to bob', - }; - - try { - const _res = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction, - broadcast: false, - litNodeClient: devEnv.litNodeClient, - id, - }); - } catch (e: any) { - if ( - e.message.includes( - 'Error executing the Signing Lit Action: Error: When signing transaction- invalid hexlify value' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyWithInvalidParam is expected to have an error' - ); - } else { - console.log('ERROR', e.message); - throw e; - } - } - - log('βœ… testFailEthereumSignTransactionWrappedKeyWithInvalidParam'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.ts b/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.ts deleted file mode 100644 index c66d81c44d..0000000000 --- a/local-tests/tests/wrapped-keys/testFailEthereumSignTransactionWrappedKeyWithMissingParam.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { ethers } from 'ethers'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { getChainForNetwork } from './util'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam - * βœ… NETWORK=manzano yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam - * βœ… NETWORK=localchain yarn test:local --filter=testFailEthereumSignTransactionWrappedKeyWithMissingParam - */ -export const testFailEthereumSignTransactionWrappedKeyWithMissingParam = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = ethers.Wallet.createRandom().privateKey; - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - try { - const _res = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'evm', - unsignedTransaction: { - ...getChainForNetwork(devEnv.litNodeClient.config.litNetwork), - // @ts-expect-error This test is intentionally using the type incorrectly. - serializedTransaction: 'random-value', - }, - broadcast: false, - litNodeClient: devEnv.litNodeClient, - id, - }); - } catch (e: any) { - if ( - e.message.includes( - 'Error executing the Signing Lit Action: Error: Missing required field: toAddress' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailEthereumSignTransactionWrappedKeyWithMissingParam is expected to have an error' - ); - } else { - throw e; - } - } - - log('βœ… testFailEthereumSignTransactionWrappedKeyWithMissingParam'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.ts b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.ts deleted file mode 100644 index 831fc5f04b..0000000000 --- a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithEoaSessionSig.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getEoaSessionSigs } from 'local-tests/setup/session-sigs/get-eoa-session-sigs'; -import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; - -const { importPrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig - * βœ… NETWORK=manzano yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig - * βœ… NETWORK=localchain yarn test:local --filter=testFailImportWrappedKeysWithEoaSessionSig - */ -export const testFailImportWrappedKeysWithEoaSessionSig = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const eoaSessionSigs = await getEoaSessionSigs(devEnv, alice); - - // console.log(eoaSessionSigs); - - const privateKey = randomSolanaPrivateKey(); - - try { - await importPrivateKey({ - pkpSessionSigs: eoaSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - } catch (e: any) { - if (e.message.includes('SessionSig is not from a PKP')) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithEoaSessionSig is expected to have an error' - ); - } else { - throw e; - } - } - - console.log('βœ… testFailImportWrappedKeysWithEoaSessionSig'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.ts b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.ts deleted file mode 100644 index 67f5422ef5..0000000000 --- a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithExpiredSessionSig.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; -import { SessionSigsMap } from '@lit-protocol/types'; - -const { importPrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig - * βœ… NETWORK=manzano yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig - * βœ… NETWORK=localchain yarn test:local --filter=testFailImportWrappedKeysWithExpiredSessionSig - */ -export const testFailImportWrappedKeysWithExpiredSessionSig = async ( - devEnv: TinnyEnvironment -) => { - const pkpSessionSigs: SessionSigsMap = { - 'https://207.244.70.36:8474': { - sig: '1827d1c7b79c979ce76d0b9e130f6804dbf7c7838b6dfa41d4cadf690b9a8bec23321dde6cc573e8a592c395193074ade303d94f3c198d8f0017ca0aca91bd0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8474"}`, - address: - '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', - algo: 'ed25519', - }, - 'https://207.244.70.36:8473': { - sig: '762b9849d2cc77d0c75aa354c3cce63abca008a9a07ec3efc69ee8a4954650c3362b8cb83cd3d63310ad98b446be5e68cb8193f9d486453b2df72188dc698d0e', - derivedVia: 'litSessionSignViaNacl', - signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8473"}`, - address: - '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', - algo: 'ed25519', - }, - 'https://207.244.70.36:8475': { - sig: '5e506dc973cc1540dcb3bd1de251afa687caf277cb5f3efe107339ecf4c25607d4bdf5d8c8910874519252e026a49cc66cea0b07bc5d38342c7cb2613decbe0a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: `{"sessionKey":"4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"{\\"ProofOfPossession\\":\\"8f060f34f55e996e8396c5036cb456dbf3b3cf79a6c9d2a9c036a27dae6be5cb286c0170c45404ce60d45ad5df384a030450f4eabe61af68d7267d2de035a1ff0697097b3b32413581d8550b198599b8ee5c29a78999c05f8806e33923705748\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0xd1Af1AAC50aC837C873200D17b78664aFCde597C\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Execution' for 'lit-litaction://*'. (2) 'Threshold': 'Signing' for 'lit-pkp://*'. (3) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b\\nVersion: 1\\nChain ID: 1\\nNonce: 0xa8b687976835989b8ac57e8e6cb17fa316cc9ef74ea6174a588f08b11571829c\\nIssued At: 2024-06-02T19:46:47Z\\nExpiration Time: 2024-06-03T19:47:14.907Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsImV4cGlyYXRpb24iOjE3MTc0NDQwMjAsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4MkY2ZjU4NzRhNGQyNTFlMzVDZDc4YjM1NzZDQTkwYkQyZjA1RmUwQiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0","address":"0xd1Af1AAC50aC837C873200D17b78664aFCde597C"}],"issuedAt":"2024-06-02T19:47:16.707Z","expiration":"2024-06-03T19:47:14.907Z","nodeAddress":"https://207.244.70.36:8475"}`, - address: - '4fd3d6ae41190cdd33a07bc5feb4a51b0c882474e6b51eb37cf799d6668eb44b', - algo: 'ed25519', - }, - }; - - try { - const privateKey = randomSolanaPrivateKey(); - - const res = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - // console.log(res); - } catch (e: any) { - if (e.message.includes('Invalid sessionSig: Expired')) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithExpiredSessionSig is expected to have an error' - ); - } else { - throw e; - } - } - - console.log('βœ… testFailImportWrappedKeysWithExpiredSessionSig'); -}; diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.ts b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.ts deleted file mode 100644 index 78cc80a53b..0000000000 --- a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithInvalidSessionSig.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; -import { AuthSig, SessionSigsMap } from '@lit-protocol/types'; - -const { importPrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig - * βœ… NETWORK=manzano yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig - * βœ… NETWORK=localchain yarn test:local --filter=testFailImportWrappedKeysWithInvalidSessionSig - */ -export const testFailImportWrappedKeysWithInvalidSessionSig = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - try { - const privateKey = randomSolanaPrivateKey(); - - await importPrivateKey({ - pkpSessionSigs: tamperPkpSessionSigs(pkpSessionSigs), - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - } catch (e: any) { - if (e.message.includes('bad public key size')) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithInvalidSessionSig is expected to have an error' - ); - } else { - throw e; - } - } - - console.log('βœ… testFailImportWrappedKeysWithInvalidSessionSig'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; - -const tamperPkpSessionSigs = ( - pkpSessionSig: SessionSigsMap -): SessionSigsMap => { - const tamperedPkpSessionSigs: SessionSigsMap = {}; - - for (const key in pkpSessionSig) { - if (pkpSessionSig.hasOwnProperty(key)) { - const authSig = pkpSessionSig[key]; - const updatedAuthSig: AuthSig = { - ...authSig, - address: authSig.address.slice(0, -1), - }; - tamperedPkpSessionSigs[key] = updatedAuthSig; - } - } - - // console.log(tamperedPkpSessionSigs); - - return tamperedPkpSessionSigs; -}; diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.ts b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.ts deleted file mode 100644 index 55ab120c21..0000000000 --- a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithMaxExpirySessionSig.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; - -const { importPrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig - * βœ… NETWORK=manzano yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig - * βœ… NETWORK=localchain yarn test:local --filter=testFailImportWrappedKeysWithMaxExpirySessionSig - */ -export const testFailImportWrappedKeysWithMaxExpirySessionSig = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - try { - const pkpSessionSigs = await getPkpSessionSigs(devEnv, alice); - - try { - const privateKey = randomSolanaPrivateKey(); - - await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - } catch (e: any) { - if (e.message.includes('Expires too far in the future')) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithMaxExpirySessionSig is expected to have an error' - ); - } else { - throw e; - } - } - - console.log('βœ… testFailImportWrappedKeysWithMaxExpirySessionSig'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.ts b/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.ts deleted file mode 100644 index 3c47591382..0000000000 --- a/local-tests/tests/wrapped-keys/testFailImportWrappedKeysWithSamePrivateKey.ts +++ /dev/null @@ -1,70 +0,0 @@ -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -const { importPrivateKey } = api; -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey - * βœ… NETWORK=manzano yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey - * βœ… NETWORK=localchain yarn test:local --filter=testFailImportWrappedKeysWithSamePrivateKey - */ -export const testFailImportWrappedKeysWithSamePrivateKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = - '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; // Already exists in the DB - - try { - await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - throw new Error( - 'Expected an AlreadyExists error but the importPrivateKey succeeded!' - ); - } catch (e: any) { - if ( - e.message.includes( - 'There is already a wrapped key stored with the same dataToEncryptHash' - ) - ) { - console.log('βœ… THIS IS EXPECTED: ', e); - console.log(e.message); - console.log( - 'βœ… testFailImportWrappedKeysWithSamePrivateKey is expected to have an error' - ); - } else { - throw e; - } - } - - console.log('βœ… testFailImportWrappedKeysWithSamePrivateKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.ts b/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.ts deleted file mode 100644 index 214780fa10..0000000000 --- a/local-tests/tests/wrapped-keys/testGenerateEthereumWrappedKey.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { ethers } from 'ethers'; -import { exportPrivateKey } from '../../../packages/wrapped-keys/src/lib/api'; - -const { generatePrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testGenerateEthereumWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testGenerateEthereumWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testGenerateEthereumWrappedKey - */ -export const testGenerateEthereumWrappedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ - pkpSessionSigs, - network: 'evm', - litNodeClient: devEnv.litNodeClient, - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsExport = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsExport); - - const { decryptedPrivateKey } = await exportPrivateKey({ - pkpSessionSigs: pkpSessionSigsExport, - litNodeClient: devEnv.litNodeClient, - network: 'evm', - id, - }); - - const wallet = new ethers.Wallet(decryptedPrivateKey); - const decryptedPublicKey = wallet.publicKey; - - if (decryptedPublicKey !== generatedPublicKey) { - throw new Error( - `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` - ); - } - - log('βœ… testGenerateEthereumWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.ts b/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.ts deleted file mode 100644 index 74bcae620d..0000000000 --- a/local-tests/tests/wrapped-keys/testGenerateSolanaWrappedKey.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import nacl from 'tweetnacl'; -import bs58 from 'bs58'; -import { Keypair } from '@solana/web3.js'; - -const { generatePrivateKey, signMessageWithEncryptedKey, exportPrivateKey } = - api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testGenerateSolanaWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testGenerateSolanaWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testGenerateSolanaWrappedKey - */ -export const testGenerateSolanaWrappedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const { pkpAddress, generatedPublicKey, id } = await generatePrivateKey({ - pkpSessionSigs, - network: 'solana', - litNodeClient: devEnv.litNodeClient, - memo: 'Test key', - }); - - console.log(`generatedPublicKey: ${generatedPublicKey}`); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - // console.log(pkpSessionSigsSigning); - - const messageToSign = 'This is a test message'; - - const signature = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'solana', - messageToSign, - litNodeClient: devEnv.litNodeClient, - id, - }); - - // console.log('signature'); - // console.log(signature); - - const signatureIsValidForPublicKey = nacl.sign.detached.verify( - Buffer.from(messageToSign), - bs58.decode(signature), - bs58.decode(generatedPublicKey) - ); - - if (!signatureIsValidForPublicKey) - throw new Error( - `signature: ${signature} doesn't validate for the Solana public key: ${generatedPublicKey}` - ); - - const pkpSessionSigsExport = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const { decryptedPrivateKey } = await exportPrivateKey({ - pkpSessionSigs: pkpSessionSigsExport, - litNodeClient: devEnv.litNodeClient, - network: 'solana', - id, - }); - - const solanaKeyPair = Keypair.fromSecretKey( - Buffer.from(decryptedPrivateKey, 'hex') - ); - const decryptedPublicKey = solanaKeyPair.publicKey; - - if (decryptedPublicKey.toString() !== generatedPublicKey) { - throw new Error( - `Decrypted decryptedPublicKey: ${decryptedPublicKey} doesn't match with the original generatedPublicKey: ${generatedPublicKey}` - ); - } - - log('βœ… testGenerateSolanaWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testImportWrappedKey.ts b/local-tests/tests/wrapped-keys/testImportWrappedKey.ts deleted file mode 100644 index 50bb507423..0000000000 --- a/local-tests/tests/wrapped-keys/testImportWrappedKey.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; -import { randomSolanaPrivateKey } from 'local-tests/setup/tinny-utils'; -import { listPrivateKeyMetadata } from '../../../packages/wrapped-keys/src/lib/service-client'; -import { getFirstSessionSig } from '../../../packages/wrapped-keys/src/lib/utils'; - -const { importPrivateKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testImportWrappedKey - * βœ… NETWORK=manzano yarn test:local --filter=testImportWrappedKey - * βœ… NETWORK=localchain yarn test:local --filter=testImportWrappedKey - */ -export const testImportWrappedKey = async (devEnv: TinnyEnvironment) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const privateKey = randomSolanaPrivateKey(); - // '4rXcTBAZVypFRGGER4TwSuGGxMvmRwvYA3jwuZfDY4YKX4VEbuUaPCWrZGSxujKknQCdN8UD9wMW8XYmT1BiLxmB'; - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const keys = await listPrivateKeyMetadata({ - sessionSig: getFirstSessionSig(pkpSessionSigs), - litNetwork: devEnv.litNodeClient.config.litNetwork, - }); - - if (keys.length !== 1 || keys[0].id !== id) { - throw new Error( - 'Keys returned by `listPrivateKeyMetadata()` do not match expected result.' - ); - } - - log('βœ… testImportWrappedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.ts b/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.ts deleted file mode 100644 index 485332c722..0000000000 --- a/local-tests/tests/wrapped-keys/testSignMessageWithSolanaEncryptedKey.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { api } from '@lit-protocol/wrapped-keys'; -import { Keypair } from '@solana/web3.js'; -import bs58 from 'bs58'; -import nacl from 'tweetnacl'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -const { importPrivateKey, signMessageWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testSignMessageWithSolanaEncryptedKey - * βœ… NETWORK=manzano yarn test:local --filter=testSignMessageWithSolanaEncryptedKey - * βœ… NETWORK=localchain yarn test:local --filter=testSignMessageWithSolanaEncryptedKey - */ -export const testSignMessageWithSolanaEncryptedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const solanaKeypair = Keypair.generate(); - const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const messageToSign = 'This is a test message'; - - const signature = await signMessageWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'solana', - messageToSign, - litNodeClient: devEnv.litNodeClient, - id, - }); - - console.log('signature'); - console.log(signature); - - const signatureIsValidForPublicKey = nacl.sign.detached.verify( - Buffer.from(messageToSign), - bs58.decode(signature), - solanaKeypair.publicKey.toBuffer() - ); - - if (!signatureIsValidForPublicKey) - throw new Error( - `signature: ${signature} doesn't validate for the Solana public key: ${solanaKeypair.publicKey.toString()}` - ); - - log('βœ… testSignMessageWithSolanaEncryptedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.ts b/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.ts deleted file mode 100644 index 4c63f94e31..0000000000 --- a/local-tests/tests/wrapped-keys/testSignTransactionWithSolanaEncryptedKey.ts +++ /dev/null @@ -1,113 +0,0 @@ -import { log } from '@lit-protocol/misc'; -import { TinnyEnvironment } from 'local-tests/setup/tinny-environment'; -import { SerializedTransaction, api } from '@lit-protocol/wrapped-keys'; -import { - Connection, - Keypair, - LAMPORTS_PER_SOL, - PublicKey, - SystemProgram, - Transaction, - clusterApiUrl, -} from '@solana/web3.js'; -import { getPkpSessionSigs } from 'local-tests/setup/session-sigs/get-pkp-session-sigs'; - -const { importPrivateKey, signTransactionWithEncryptedKey } = api; - -/** - * Test Commands: - * βœ… NETWORK=cayenne yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey - * βœ… NETWORK=manzano yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey - * βœ… NETWORK=localchain yarn test:local --filter=testSignTransactionWithSolanaEncryptedKey - */ -export const testSignTransactionWithSolanaEncryptedKey = async ( - devEnv: TinnyEnvironment -) => { - const alice = await devEnv.createRandomPerson(); - - try { - const pkpSessionSigs = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const solanaKeypair = Keypair.generate(); - const privateKey = Buffer.from(solanaKeypair.secretKey).toString('hex'); - - const { pkpAddress, id } = await importPrivateKey({ - pkpSessionSigs, - privateKey, - litNodeClient: devEnv.litNodeClient, - publicKey: '0xdeadbeef', - keyType: 'K256', - memo: 'Test key', - }); - - const alicePkpAddress = alice.authMethodOwnedPkp.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } - - const pkpSessionSigsSigning = await getPkpSessionSigs( - devEnv, - alice, - null, - new Date(Date.now() + 1000 * 60 * 10).toISOString() - ); // 10 mins expiry - - const solanaTransaction = new Transaction(); - solanaTransaction.add( - SystemProgram.transfer({ - fromPubkey: solanaKeypair.publicKey, - toPubkey: new PublicKey(solanaKeypair.publicKey), - lamports: LAMPORTS_PER_SOL / 100, // Transfer 0.01 SOL - }) - ); - solanaTransaction.feePayer = solanaKeypair.publicKey; - - const solanaConnection = new Connection( - clusterApiUrl('devnet'), - 'confirmed' - ); - const { blockhash } = await solanaConnection.getLatestBlockhash(); - solanaTransaction.recentBlockhash = blockhash; - - const serializedTransaction = solanaTransaction - .serialize({ - requireAllSignatures: false, // should be false as we're not signing the message - verifySignatures: false, // should be false as we're not signing the message - }) - .toString('base64'); - - const unsignedTransaction: SerializedTransaction = { - serializedTransaction, - chain: 'devnet', - }; - - const signedTx = await signTransactionWithEncryptedKey({ - pkpSessionSigs: pkpSessionSigsSigning, - network: 'solana', - unsignedTransaction, - broadcast: false, - litNodeClient: devEnv.litNodeClient, - id, - }); - - const signatureBuffer = Buffer.from(signedTx, 'base64'); - solanaTransaction.addSignature(solanaKeypair.publicKey, signatureBuffer); - - if (!solanaTransaction.verifySignatures()) { - throw new Error( - `Signature: ${signedTx} doesn't validate for the Solana transaction.` - ); - } - - log('βœ… testSignMessageWithSolanaEncryptedKey'); - } finally { - devEnv.releasePrivateKeyFromUser(alice); - } -}; diff --git a/local-tests/tests/wrapped-keys/util.ts b/local-tests/tests/wrapped-keys/util.ts deleted file mode 100644 index 68bf85f8dc..0000000000 --- a/local-tests/tests/wrapped-keys/util.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { LIT_NETWORKS_KEYS } from '@lit-protocol/types'; -import { LIT_CHAINS } from '@lit-protocol/constants'; -import { ethers } from 'ethers'; -import { EthereumLitTransaction } from '@lit-protocol/wrapped-keys'; - -export function getChainForNetwork(network: LIT_NETWORKS_KEYS): { - chain: string; - chainId: number; -} { - switch (network) { - case 'cayenne': - case 'habanero': - case 'manzano': - return { - chain: 'chronicleTestnet', - chainId: LIT_CHAINS['chronicleTestnet'].chainId, - }; - case 'datil-dev': - return { - chain: 'yellowstone', - chainId: LIT_CHAINS['yellowstone'].chainId, - }; - case 'datil-test': - return { - chain: 'yellowstone', - chainId: LIT_CHAINS['yellowstone'].chainId, - }; - case 'datil': - return { - chain: 'yellowstone', - chainId: LIT_CHAINS['yellowstone'].chainId, - }; - default: - throw new Error(`Cannot identify chain params for ${network}`); - } -} - -export function getGasParamsForNetwork(network: LIT_NETWORKS_KEYS): { - gasPrice?: string; - gasLimit: number; -} { - switch (network) { - case 'cayenne': - case 'habanero': - case 'manzano': - return { - gasPrice: '0.001', - gasLimit: 30000, - }; - case 'datil-dev': - return { gasLimit: 5000000 }; - case 'datil-test': - return { gasLimit: 5000000 }; - case 'datil': - return { gasLimit: 5000000 }; - default: - throw new Error(`Cannot identify chain params for ${network}`); - } -} - -export function getBaseTransactionForNetwork({ - toAddress, - network, -}: { - toAddress: string; - network: LIT_NETWORKS_KEYS; -}): EthereumLitTransaction { - return { - toAddress, - value: '0.0001', // in ethers (Lit tokens) - ...getChainForNetwork(network), - ...getGasParamsForNetwork(network), - dataHex: ethers.utils.hexlify( - ethers.utils.toUtf8Bytes('Test transaction from Alice to bob') - ), - }; -} diff --git a/package.json b/package.json index 722afbe83e..b53dd7b819 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --exclude=e2e-tests", "test:e2e": "nx run e2e-tests:test", - "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", + "test:unit": "nx run-many --target=test --exclude=e2e-tests", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", From a92897457399bb280ee0b49105c37ceb9b0d88db Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 13:10:47 -0400 Subject: [PATCH 114/136] chore: remove local test command --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index b53dd7b819..905d4788dd 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,6 @@ "postBuild:mapDepsToDist": "node tools/scripts/map-deps-to-dist.mjs packages dist @lit-protocol", "test:ci": "nx affected --target=test --exclude=e2e-tests", "test:e2e": "nx run e2e-tests:test", - "test:unit": "nx run-many --target=test --exclude=e2e-tests", "test:unit:watch": "nx run-many --target=test --watch", "test:unit:bun": "bun ./tools/scripts/unit-test-with-bun.mjs", From b66d228c2227accce7069d1fec1bc31a485ffb1a Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 13:12:08 -0400 Subject: [PATCH 115/136] chore: make tinny private --- packages/tinny/package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tinny/package.json b/packages/tinny/package.json index 85ed0399c1..cc2b4a5c81 100644 --- a/packages/tinny/package.json +++ b/packages/tinny/package.json @@ -1,6 +1,7 @@ { "name": "@lit-protocol/tinny", "version": "6.4.1", + "private": true, "dependencies": { "tslib": "^2.3.0" }, From 7ff79258f0ac6c34b1539537fc42d26b0d321785 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 22 Aug 2024 14:06:23 -0400 Subject: [PATCH 116/136] config: exclude tinny and e2e tests from release --- nx.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nx.json b/nx.json index 520827f403..35835d9c1b 100644 --- a/nx.json +++ b/nx.json @@ -59,5 +59,8 @@ "default": ["{projectRoot}/**/*", "sharedGlobals"], "sharedGlobals": [], "production": ["default", "!{projectRoot}/src/test-setup.[jt]s"] + }, + "release": { + "projects": ["!@lit-protocol/tinny", "!@lit-protocol/e2e-tests"] } } From 47d4216f007f5bef59e5e50c96dbaa91404f5575 Mon Sep 17 00:00:00 2001 From: Anson Date: Mon, 26 Aug 2024 16:45:19 +0100 Subject: [PATCH 117/136] Update packages/e2e-tests/setup.config.js Co-authored-by: Federico Amura Signed-off-by: Anson --- packages/e2e-tests/setup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index c5bbf01387..99491b94f4 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -13,7 +13,7 @@ require('dotenv').config(); console.log('loaded configuration from .env', __dirname); class CustomEnvironment extends NodeEnvironment { - _hasLoadedTinny = false; + private _hasLoadedTinny = false; constructor(config) { super(config); } From 088cae17d5184c43f70e69b91f803530d186c6b8 Mon Sep 17 00:00:00 2001 From: Anson Date: Mon, 26 Aug 2024 16:46:43 +0100 Subject: [PATCH 118/136] Update packages/e2e-tests/src/tests/Delegation.spec.ts Co-authored-by: Federico Amura Signed-off-by: Anson --- packages/e2e-tests/src/tests/Delegation.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 1f4c089ce7..36956d14ae 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -184,7 +184,7 @@ describe('Delegation', () => { expect(res?.signatures?.sig.publicKey).toBeDefined(); // -- signatures.sig.signature must start with 0x - expect(res?.signatures.sig.signature.startsWith('0x')).toBeDefined(); + expect(res?.signatures.sig.signature.startsWith('0x')).toBe(true); // -- signatures.sig.recid must be parseable as a number expect(isNaN(res?.signatures.sig.recid)).toBeTruthy(); From 81b7667e7e4a15721ddf24de4fa6b2b0aed6b0b3 Mon Sep 17 00:00:00 2001 From: Anson Date: Mon, 26 Aug 2024 16:47:57 +0100 Subject: [PATCH 119/136] fix: oops sorry reverted, didn't realise it's a .js file --- packages/e2e-tests/setup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/setup.config.js b/packages/e2e-tests/setup.config.js index 99491b94f4..c5bbf01387 100644 --- a/packages/e2e-tests/setup.config.js +++ b/packages/e2e-tests/setup.config.js @@ -13,7 +13,7 @@ require('dotenv').config(); console.log('loaded configuration from .env', __dirname); class CustomEnvironment extends NodeEnvironment { - private _hasLoadedTinny = false; + _hasLoadedTinny = false; constructor(config) { super(config); } From d16bd26da18d8cfa53dfafaa04b42aa47f5b0fd5 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 9 Sep 2024 13:48:40 -0400 Subject: [PATCH 120/136] ref: changes per PR comments --- .../e2e-tests/src/tests/Delegation.spec.ts | 46 +++++++------------ .../e2e-tests/src/tests/PKPEthers.spec.ts | 3 +- packages/e2e-tests/src/tests/Relayer.spec.ts | 3 +- .../e2e-tests/src/tests/SOLAuthSig.spec.ts | 3 +- .../e2e-tests/src/tests/SessionSigs.spec.ts | 3 +- .../e2e-tests/src/tests/WrappedKeys.spec.ts | 21 ++++----- .../e2e-tests/src/tests/connection.spec.ts | 3 +- packages/logger/src/lib/logger.spec.ts | 21 +++------ 8 files changed, 38 insertions(+), 65 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 36956d14ae..462813320c 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -31,8 +31,7 @@ describe('Delegation', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { @@ -96,9 +95,6 @@ describe('Delegation', () => { }, }); - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - // -- Expected output: // { // claims: {}, @@ -124,7 +120,7 @@ describe('Delegation', () => { expect(res?.signatures?.sig.publicKey).toBeDefined(); // -- signatures.sig.signature must start with 0x - expect(res?.signatures.sig.signature.startsWith('0x')).toBeDefined(); + expect(res?.signatures.sig.signature.startsWith('0x')).toBe(true); }); it('PKP to EOA ExecuteJs', async () => { @@ -139,25 +135,20 @@ describe('Delegation', () => { ); // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient - ?.executeJs({ - sessionSigs: bobsSessionSigs, - code: `(async () => { + const res = await devEnv.litNodeClient?.executeJs({ + sessionSigs: bobsSessionSigs, + code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, publicKey, sigName: "sig", }); })();`, - jsParams: { - dataToSign: alice.loveLetter, - publicKey: bob.pkp?.publicKey, - }, - }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - }); + jsParams: { + dataToSign: alice.loveLetter, + publicKey: bob.pkp?.publicKey, + }, + }); // Expected output: // { @@ -202,17 +193,12 @@ describe('Delegation', () => { ); // 5. Bob can now execute JS code using the capacity credits NFT - const res = await devEnv.litNodeClient - ?.pkpSign({ - sessionSigs: bobsSessionSigs!, - toSign: alice.loveLetter, - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain - pubKey: bob.pkp?.publicKey!, - }) - .finally(() => { - devEnv.releasePrivateKeyFromUser(alice); - devEnv.releasePrivateKeyFromUser(bob); - }); + const res = await devEnv.litNodeClient?.pkpSign({ + sessionSigs: bobsSessionSigs!, + toSign: alice.loveLetter, + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain + pubKey: bob.pkp?.publicKey!, + }); // Expected output: // { diff --git a/packages/e2e-tests/src/tests/PKPEthers.spec.ts b/packages/e2e-tests/src/tests/PKPEthers.spec.ts index cdf4beba05..f3d664cbe7 100644 --- a/packages/e2e-tests/src/tests/PKPEthers.spec.ts +++ b/packages/e2e-tests/src/tests/PKPEthers.spec.ts @@ -53,8 +53,7 @@ describe('PKP Ethers', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { diff --git a/packages/e2e-tests/src/tests/Relayer.spec.ts b/packages/e2e-tests/src/tests/Relayer.spec.ts index 81cbd1c340..237a5a12db 100644 --- a/packages/e2e-tests/src/tests/Relayer.spec.ts +++ b/packages/e2e-tests/src/tests/Relayer.spec.ts @@ -19,8 +19,7 @@ describe('Relayer', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { diff --git a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts index 628bd9fd55..0c78e2113a 100644 --- a/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts +++ b/packages/e2e-tests/src/tests/SOLAuthSig.spec.ts @@ -29,8 +29,7 @@ describe('Sol AuthSig', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 3f66d5e844..68dc9865a1 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -46,8 +46,7 @@ describe('SessionSigs', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 847a4b2531..609969eab9 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -86,8 +86,7 @@ describe('Wrapped Keys', () => { }); beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); afterAll(async () => { @@ -289,10 +288,7 @@ describe('Wrapped Keys', () => { bs58.decode(generatedPublicKey) ); - if (!signatureIsValidForPublicKey) - throw new Error( - `signature: ${signature} doesn't validate for the Solana public key: ${generatedPublicKey}` - ); + expect(signatureIsValidForPublicKey).toBeDefined(); const pkpSessionSigsExport = await getPkpSessionSigs( devEnv, @@ -332,11 +328,7 @@ describe('Wrapped Keys', () => { }); const alicePkpAddress = alice.authMethodOwnedPkp?.ethAddress; - if (pkpAddress !== alicePkpAddress) { - throw new Error( - `Received address: ${pkpAddress} doesn't match Alice's PKP address: ${alicePkpAddress}` - ); - } + expect(pkpAddress).toEqual(alicePkpAddress); const pkpSessionSigsExport = await getPkpSessionSigs( devEnv, @@ -1080,6 +1072,11 @@ export function getChainForNetwork(network: LIT_NETWORKS_KEYS): { chain: 'yellowstone', chainId: LIT_CHAINS['yellowstone'].chainId, }; + case 'datil': + return { + chain: 'yellowstone', + chainId: LIT_CHAINS['yellowstone'].chainId, + }; default: throw new Error(`Cannot identify chain params for ${network}`); } @@ -1101,6 +1098,8 @@ export function getGasParamsForNetwork(network: LIT_NETWORKS_KEYS): { return { gasLimit: 5000000 }; case 'datil-test': return { gasLimit: 5000000 }; + case 'datil': + return { gasLimit: 5000000 }; default: throw new Error(`Cannot identify chain params for ${network}`); } diff --git a/packages/e2e-tests/src/tests/connection.spec.ts b/packages/e2e-tests/src/tests/connection.spec.ts index 212a40ca41..0806423f4b 100644 --- a/packages/e2e-tests/src/tests/connection.spec.ts +++ b/packages/e2e-tests/src/tests/connection.spec.ts @@ -10,8 +10,7 @@ try { describe('Connections', () => { beforeEach(() => { - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); let devEnv: TinnyEnvironment; diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index 6a28d7c5e0..cbf39b0b1b 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -6,20 +6,13 @@ describe('logger', () => { LogManager.clearInstance(); lm = LogManager.Instance; - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'warn').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'info').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'debug').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'error').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'timeLog').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'time').mockImplementation(() => {}); - // eslint-disable-next-line @typescript-eslint/no-empty-function - jest.spyOn(console, 'log').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); + jest.spyOn(console, 'info').mockImplementation(jest.fn()); + jest.spyOn(console, 'debug').mockImplementation(jest.fn()); + jest.spyOn(console, 'error').mockImplementation(jest.fn()); + jest.spyOn(console, 'timeLog').mockImplementation(jest.fn()); + jest.spyOn(console, 'time').mockImplementation(jest.fn()); + jest.spyOn(console, 'log').mockImplementation(jest.fn()); }); it('Log Manager singleton should be defined', () => { From d5d9e564fc006d2678c837feb49fbb18da67b76e Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 9 Sep 2024 13:50:00 -0400 Subject: [PATCH 121/136] ref: remove message set in custom error constructor --- packages/tinny/src/lib/shiva-client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/tinny/src/lib/shiva-client.ts b/packages/tinny/src/lib/shiva-client.ts index 848d8185de..89bb11cec4 100644 --- a/packages/tinny/src/lib/shiva-client.ts +++ b/packages/tinny/src/lib/shiva-client.ts @@ -17,7 +17,6 @@ class ShivaError extends Error { if (!shivaResponse.errors) { super(message); this.name = 'ShivaError'; - this.message = message; return; } From 110b0119cc1c22717a0bba42295f89be2ae6c536 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 9 Sep 2024 13:50:14 -0400 Subject: [PATCH 122/136] docs: update comment on rpc --- packages/tinny/src/lib/tinny-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tinny/src/lib/tinny-config.ts b/packages/tinny/src/lib/tinny-config.ts index 2f0eed99dc..8bba8c8ce1 100644 --- a/packages/tinny/src/lib/tinny-config.ts +++ b/packages/tinny/src/lib/tinny-config.ts @@ -85,7 +85,7 @@ export interface ProcessEnvs { * The URL of Lit RPC server. * - If it's running locally on Anvil, it should be 'http://127.0.0.1:8545' * - If it's running on Chronicle, it should be 'https://chain-rpc.litprotocol.com/http' - * - If it's running on Vesuvius, it should be 'https://vesuvius-rpc.litprotocol.com' + * - If it's running on Yellowstone, it should be 'https://yellowstone-rpc.litprotocol.com' */ LIT_RPC_URL: string; From 50c781fff24a8d447ede70fb5e636a28f45fa4ef Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 9 Sep 2024 13:50:35 -0400 Subject: [PATCH 123/136] ref: refactor RLI mintnig methods --- packages/tinny/src/lib/tinny-person.ts | 28 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index d34061f958..c862ede570 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -180,13 +180,27 @@ export class TinnyPerson { */ async mintCapacityCreditsNFT() { console.log('[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT '); - const capacityTokenId = ( - await this.contractsClient?.mintCapacityCreditsNFT({ + const capacityToken = await this.contractsClient + ?.mintCapacityCreditsNFT({ requestsPerKilosecond: this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, daysUntilUTCMidnightExpiration: 2, }) - )?.capacityTokenIdStr; + .catch((err) => { + throw new Error( + `Error while minting capacity credit nft, error message: ${ + err.message ?? 'unknown' + }` + ); + }); + + if (!capacityToken) { + throw new Error( + 'Errpr while mitning capacity credit nft: receive undefined value' + ); + } + + const capacityTokenId = capacityToken.capacityTokenIdStr; return capacityTokenId; } @@ -203,13 +217,7 @@ export class TinnyPerson { '[𐬺πŸ§ͺ Tinny Person𐬺] Mint a Capacity Credits NFT and get a capacity delegation authSig with it' ); - const capacityTokenId = ( - await this.contractsClient?.mintCapacityCreditsNFT({ - requestsPerKilosecond: - this.envConfig.processEnvs.REQUEST_PER_KILOSECOND, - daysUntilUTCMidnightExpiration: 2, - }) - )?.capacityTokenIdStr; + const capacityTokenId = await this.mintCapacityCreditsNFT(); this.contractsClient!.signer = this.wallet; await this.contractsClient?.connect(); From 659203bd8ed0f22f05a49c7e21e3a646d5a153f7 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 9 Sep 2024 14:16:25 -0400 Subject: [PATCH 124/136] dev: revert change to explict preset options to use nx presets with explicit override --- jest.preset.js | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/jest.preset.js b/jest.preset.js index 6d72299174..cac6acca6d 100644 --- a/jest.preset.js +++ b/jest.preset.js @@ -1,34 +1,11 @@ /** - * Taken from https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts + * Direct link to nx presets + * https://github.com/nrwl/nx/blob/master/packages/jest/preset/jest-preset.ts */ -module.exports = { - // This is one of the patterns that jest finds by default https://jestjs.io/docs/configuration#testmatch-arraystring - testMatch: ['**/?(*.)+(spec|test).[jt]s?(x)'], - resolver: '@nx/jest/plugins/resolver', - moduleFileExtensions: ['ts', 'js', 'mjs', 'html'], - coverageReporters: ['html'], - transform: { - '^.+\\.(ts|js|html)$': [ - 'ts-jest', - { tsconfig: '/tsconfig.spec.json' }, - ], - }, - testEnvironment: 'node', - maxWorkers: 10, - /** - * manually set the exports names to load in common js, to mimic the behaviors of jest 27 - * before jest didn't fully support package exports and would load in common js code (typically via main field). now jest 28+ will load in the browser esm code, but jest esm support is not fully supported. - * In this case we will tell jest to load in the common js code regardless of environment. - * - * this can be removed via just overriding this setting in it's usage - * - * @example - * module.exports = { - * ...nxPreset, - * testEnvironmentOptions: {}, - * } - */ - testEnvironmentOptions: { - customExportConditions: ['node', 'require', 'default'], - }, +const nxPreset = require('@nx/jest/preset').default; + +const presets = { + ...nxPreset, }; + +presets.testEnviorment = 'node'; From 81888bd0c8191763f8cb97613ec2ae0779d93025 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 18 Sep 2024 14:14:35 -0400 Subject: [PATCH 125/136] test: fix property error in logger test --- packages/logger/src/lib/logger.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index a7b929304a..a85ba64666 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -119,6 +119,6 @@ describe('logger', () => { } expect(lm.getLogsForId('foo7').length).toEqual(count); - expect(lm.LoggerIds.size).toEqual(1); + expect(lm.LoggerIds.length).toEqual(1); }); }); From 0307a3049e8500236df292ac0d44633b9c3c2007 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 18 Sep 2024 14:31:02 -0400 Subject: [PATCH 126/136] test: update logger test case --- packages/logger/src/lib/logger.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index a85ba64666..fe7d9fcac2 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -119,6 +119,6 @@ describe('logger', () => { } expect(lm.getLogsForId('foo7').length).toEqual(count); - expect(lm.LoggerIds.length).toEqual(1); + expect(lm.LoggerIds.length).toEqual(10); }); }); From 663ac03082fe1275e26ece17f24c08555010f2e8 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 23 Sep 2024 13:42:32 -0400 Subject: [PATCH 127/136] chore: fmt --- packages/tinny/src/lib/tinny-environment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/tinny/src/lib/tinny-environment.ts b/packages/tinny/src/lib/tinny-environment.ts index e6150aae21..cb953b7023 100644 --- a/packages/tinny/src/lib/tinny-environment.ts +++ b/packages/tinny/src/lib/tinny-environment.ts @@ -417,7 +417,7 @@ export class TinnyEnvironment { const toSign = await createSiweMessage({ walletAddress: wallet.address, - nonce: await this?.litNodeClient?.getLatestBlockhash() ?? "", + nonce: (await this?.litNodeClient?.getLatestBlockhash()) ?? '', expiration: new Date( Date.now() + 29 * 24 * 60 * 60 * 1000 ).toISOString(), From b0ef22a0e90acc5b448460923423e9538176bf8d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 23 Sep 2024 13:59:16 -0400 Subject: [PATCH 128/136] ci: add missing container steps --- .github/workflows/ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3d2a9b33e1..b00c1c14e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,4 +99,11 @@ jobs: if: steps.session.outputs.exit_code == 0 id: pkp run: yarn test:e2e -t 'PKP Ethers' + - name: Get Container Logs + if: always() + run: docker logs shiva + - name: Post Pull Shiva Container + id: container-stop + if: steps.shiva-pull.outputs.exit_code == 0 + run: docker stop shiva && docker rm shiva From c17d4d899750cbdd120a9dc37a4c57c0107e8761 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 24 Sep 2024 09:09:23 -0400 Subject: [PATCH 129/136] ref: type updates for session signatures --- packages/e2e-tests/src/tests/Delegation.spec.ts | 4 ++-- packages/e2e-tests/src/tests/SessionSigs.spec.ts | 16 ++++++++-------- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/e2e-tests/src/tests/Delegation.spec.ts b/packages/e2e-tests/src/tests/Delegation.spec.ts index 462813320c..55710912e2 100644 --- a/packages/e2e-tests/src/tests/Delegation.spec.ts +++ b/packages/e2e-tests/src/tests/Delegation.spec.ts @@ -81,7 +81,7 @@ describe('Delegation', () => { }); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: bobPkpSessionSigs, + sessionSigs: bobPkpSessionSigs!, code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, @@ -136,7 +136,7 @@ describe('Delegation', () => { // 5. Bob can now execute JS code using the capacity credits NFT const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: bobsSessionSigs, + sessionSigs: bobsSessionSigs!, code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, diff --git a/packages/e2e-tests/src/tests/SessionSigs.spec.ts b/packages/e2e-tests/src/tests/SessionSigs.spec.ts index 68dc9865a1..8943e76204 100644 --- a/packages/e2e-tests/src/tests/SessionSigs.spec.ts +++ b/packages/e2e-tests/src/tests/SessionSigs.spec.ts @@ -301,7 +301,7 @@ const executeJsClaimKeys = async ( ]); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { Lit.Actions.claimKey({keyId: "foo"}); Lit.Actions.claimKey({keyId: "bar"}); @@ -390,7 +390,7 @@ const executeJsClaimKey = async ( const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { Lit.Actions.claimKey({keyId: "foo"}); })();`, @@ -481,7 +481,7 @@ const executeJsJSONResponse = async ( const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { console.log('hello world') @@ -519,7 +519,7 @@ const executeJsSigning = async ( ]); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, @@ -552,7 +552,7 @@ const executeJsSigningParallel = async ( const fn = async () => { return await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { const sigShare = await LitActions.signEcdsa({ toSign: dataToSign, @@ -653,7 +653,7 @@ const broadcastAndCollect = async ( const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { let rand = Math.floor(Math.random() * 100); const resp = await Lit.Actions.broadcastAndCollect({ @@ -710,7 +710,7 @@ const decryptAndCombine = async ( expect(!encryptRes.dataToEncryptHash).toBeDefined(); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { const resp = await Lit.Actions.decryptAndCombine({ accessControlConditions, @@ -745,7 +745,7 @@ const signAndCombine = async ( const litActionSessionSigs = await generator(devEnv, alice); const res = await devEnv.litNodeClient?.executeJs({ - sessionSigs: litActionSessionSigs, + sessionSigs: litActionSessionSigs!, code: `(async () => { const sigShare = await LitActions.signAndCombineEcdsa({ toSign: dataToSign, diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 609969eab9..9cb7a9eeb4 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -668,7 +668,7 @@ describe('Wrapped Keys', () => { devEnv.litNodeClient ?.executeJs({ - sessionSigs: pkpSessionSigsSigning, + sessionSigs: pkpSessionSigsSigning!, ipfsId: LIT_ACTION_CID_REPOSITORY.signTransaction.evm, jsParams: { ciphertext, From 03255cc9fa04cdf25515d08096da0b4739b80be6 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 24 Sep 2024 10:27:46 -0400 Subject: [PATCH 130/136] ci: add rpc url --- .env.ci | 1 + 1 file changed, 1 insertion(+) diff --git a/.env.ci b/.env.ci index 475a253061..546d7e0f87 100644 --- a/.env.ci +++ b/.env.ci @@ -10,6 +10,7 @@ NO_SETUP=false USE_SHIVA=true NETWORK_CONFIG=./networkContext.json TEST_TIMEOUT=45000 +LIT_RPC_URL=http://127.0.0.1:8545 #Shiva Client ENV Vars STOP_TESTNET=false From de2ce15c57571499decfaa6b305c97497e687d3c Mon Sep 17 00:00:00 2001 From: Josh Long Date: Tue, 24 Sep 2024 14:13:09 -0400 Subject: [PATCH 131/136] ref: add network context --- packages/tinny/src/lib/tinny-person.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index abc80f329c..2eb0e8958d 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -129,6 +129,7 @@ export class TinnyPerson { debug: this.envConfig.processEnvs.DEBUG, rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc customContext: networkContext as unknown as LitContractContext, + network: this.envConfig.processEnvs.NETWORK }); } else { this.contractsClient = new LitContracts({ From 572fc9882c93ac787850ce1e5102e927c15089fb Mon Sep 17 00:00:00 2001 From: Josh Long Date: Fri, 19 Jul 2024 10:44:39 -0400 Subject: [PATCH 132/136] dev: add dotenv loading in setup --- jest.setup.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jest.setup.js b/jest.setup.js index f44e2a7ef9..f7eef34dc7 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,3 +1,5 @@ +require('dotenv').config({path: '../../.env'}); +console.log("loaded configuration from .env"); const crypto = require('crypto'); global.TextEncoder = require('util').TextEncoder; From 0aafdcef921357cdaeb38351c67481928bfeb9f0 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Mon, 14 Oct 2024 11:28:53 -0400 Subject: [PATCH 133/136] test: fix logging unit test --- packages/logger/src/lib/logger.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/logger/src/lib/logger.spec.ts b/packages/logger/src/lib/logger.spec.ts index f446cafd66..528af1e59b 100644 --- a/packages/logger/src/lib/logger.spec.ts +++ b/packages/logger/src/lib/logger.spec.ts @@ -130,7 +130,7 @@ describe('logger', () => { const requestIds = lm.LoggerIds; expect(requestIds.length).toBe(2); - expect(loggerA.timestamp).toEqual(requestIds[0]); - expect(loggerB.timestamp).toEqual(requestIds[1]); + expect(loggerA.id).toEqual(requestIds[0]); + expect(loggerB.id).toEqual(requestIds[1]); }); }); From 00e8e747c81d9d7f1c3b61bcea35a141c9314c7f Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 16 Oct 2024 13:09:39 -0400 Subject: [PATCH 134/136] ref: fix import --- packages/e2e-tests/src/tests/WrappedKeys.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts index 9cb7a9eeb4..90f7c258b0 100644 --- a/packages/e2e-tests/src/tests/WrappedKeys.spec.ts +++ b/packages/e2e-tests/src/tests/WrappedKeys.spec.ts @@ -32,9 +32,9 @@ import { api, } from '@lit-protocol/wrapped-keys'; // Using absolute pathing as these members are not exported from the module +import { getPkpAccessControlCondition } from '@lit-protocol/wrapped-keys/src/lib/api/utils'; import { LIT_PREFIX } from '@lit-protocol/wrapped-keys/src/lib/constants'; import { LIT_ACTION_CID_REPOSITORY } from '@lit-protocol/wrapped-keys/src/lib/lit-actions-client/constants'; -import { getPkpAccessControlCondition } from '@lit-protocol/wrapped-keys/src/lib/utils'; const { importPrivateKey, From b644ec06d501c2793f794f9cc124f1bb6627a2bf Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 16 Oct 2024 13:09:54 -0400 Subject: [PATCH 135/136] chore: update package versions --- packages/e2e-tests/package.json | 2 +- packages/tinny/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 0a476f08a5..eb80481149 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -17,7 +17,7 @@ "tags": [ "universal" ], - "version": "6.4.1", + "version": "6.10.0", "private": true, "main": "./dist/src/index.js", "typings": "./dist/src/index.d.ts" diff --git a/packages/tinny/package.json b/packages/tinny/package.json index cc2b4a5c81..698ac00060 100644 --- a/packages/tinny/package.json +++ b/packages/tinny/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/tinny", - "version": "6.4.1", + "version": "6.10.0", "private": true, "dependencies": { "tslib": "^2.3.0" From f5958946980be075b0bec1b27a929ff96fc5216d Mon Sep 17 00:00:00 2001 From: Josh Long Date: Wed, 16 Oct 2024 13:13:28 -0400 Subject: [PATCH 136/136] chore: fmt --- jest.setup.js | 4 ++-- packages/tinny/src/lib/tinny-person.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/jest.setup.js b/jest.setup.js index f7eef34dc7..80ce51090b 100644 --- a/jest.setup.js +++ b/jest.setup.js @@ -1,5 +1,5 @@ -require('dotenv').config({path: '../../.env'}); -console.log("loaded configuration from .env"); +require('dotenv').config({ path: '../../.env' }); +console.log('loaded configuration from .env'); const crypto = require('crypto'); global.TextEncoder = require('util').TextEncoder; diff --git a/packages/tinny/src/lib/tinny-person.ts b/packages/tinny/src/lib/tinny-person.ts index 3ffddce5f0..6516239868 100644 --- a/packages/tinny/src/lib/tinny-person.ts +++ b/packages/tinny/src/lib/tinny-person.ts @@ -132,7 +132,7 @@ export class TinnyPerson { debug: this.envConfig.processEnvs.DEBUG, rpc: this.envConfig.processEnvs.LIT_RPC_URL, // anvil rpc customContext: networkContext as unknown as LitContractContext, - network: this.envConfig.processEnvs.NETWORK + network: this.envConfig.processEnvs.NETWORK, }); } else { this.contractsClient = new LitContracts({