diff --git a/.changeset/cute-experts-clap.md b/.changeset/cute-experts-clap.md new file mode 100644 index 0000000000..193101655f --- /dev/null +++ b/.changeset/cute-experts-clap.md @@ -0,0 +1,19 @@ +--- +'@lit-protocol/access-control-conditions': patch +'@lit-protocol/access-control-conditions-schemas': patch +'@lit-protocol/auth': patch +'@lit-protocol/auth-helpers': patch +'@lit-protocol/auth-services': patch +'@lit-protocol/constants': patch +'@lit-protocol/crypto': patch +'@lit-protocol/lit-client': patch +'@lit-protocol/logger': patch +'@lit-protocol/networks': patch +'@lit-protocol/schemas': patch +'@lit-protocol/types': patch +'@lit-protocol/wasm': patch +'@lit-protocol/wrapped-keys': patch +'@lit-protocol/wrapped-keys-lit-actions': patch +--- + +Initial version after networks unification diff --git a/.changeset/cyan-bears-invent.md b/.changeset/cyan-bears-invent.md new file mode 100644 index 0000000000..c0bb60ee6c --- /dev/null +++ b/.changeset/cyan-bears-invent.md @@ -0,0 +1,19 @@ +--- +'@lit-protocol/access-control-conditions': patch +'@lit-protocol/access-control-conditions-schemas': patch +'@lit-protocol/auth': patch +'@lit-protocol/auth-helpers': patch +'@lit-protocol/auth-services': patch +'@lit-protocol/constants': patch +'@lit-protocol/crypto': patch +'@lit-protocol/lit-client': patch +'@lit-protocol/logger': patch +'@lit-protocol/networks': patch +'@lit-protocol/schemas': patch +'@lit-protocol/types': patch +'@lit-protocol/wasm': patch +'@lit-protocol/wrapped-keys': patch +'@lit-protocol/wrapped-keys-lit-actions': patch +--- + +Initial release for networks unification diff --git a/.changeset/pre.json b/.changeset/pre.json index d0f34083a2..dc7a7847d8 100644 --- a/.changeset/pre.json +++ b/.changeset/pre.json @@ -18,5 +18,5 @@ "@lit-protocol/wrapped-keys": "7.0.0", "@lit-protocol/wrapped-keys-lit-actions": "7.0.0" }, - "changesets": ["cute-bottles-ask"] + "changesets": ["cute-bottles-ask", "cute-experts-clap", "cyan-bears-invent"] } diff --git a/.env.sample b/.env.sample index f25e351f3b..fe82c0f7af 100644 --- a/.env.sample +++ b/.env.sample @@ -1,21 +1,8 @@ -#Tinny ENV Vars -MAX_ATTEMPTS=1 -NETWORK=datil-dev -DEBUG=true -WAIT_FOR_KEY_INTERVAL=3000 -LIT_OFFICAL_RPC=https://chain-rpc.litprotocol.com/http -TIME_TO_RELEASE_KEY=10000 -RUN_IN_BAND=true -RUN_IN_BAND_INTERVAL=5000 -PRIVATE_KEYS="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d,0x5de4111afa1a4b94908f83103eb1f1706367c2e68ca870fc3fb9a804cdab365a,0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6,0x47e179ec197488593b187f80a00eb0da91f1b9d0b13f8733639f19c30a34926a,0x8b3a350cf5c34c9194ca85829a2df0ec3153be0318b5e2d3348e872092edffba,0x92db14e403b83dfe3df233f83dfa3a0d7096f21ca9b0d6d6b8d88b2b4ec1564e,0x4bbbf85ce3377467afe5d46f804f221813b2bb87f24d81f60f1fcdbf7cbf4356,0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97,0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6" -NO_SETUP=false -USE_SHIVA=false -NETWORK_CONFIG=./networkContext.json -TEST_TIMEOUT=45000 +# LIT_YELLOWSTONE_PRIVATE_RPC_URL= +# LOCAL_RPC_URL= -#Shiva Client ENV Vars -STOP_TESTNET=false -TESTNET_MANAGER_URL=http://0.0.0.0:8000 -USE_LIT_BINARIES=true -LIT_NODE_BINARY_PATH=/path/to/lit_node/binary -LIT_ACTION_BINARY_PATH=/path/to/lit_action_binary +LOG_LEVEL=silent +LIVE_MASTER_ACCOUNT= +LOCAL_MASTER_ACCOUNT=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 + +NODE_NO_WARNINGS=1 \ No newline at end of file diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 1e519c90aa..77a6754220 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -48,13 +48,13 @@ jobs: run: bun run build - name: Run health check for naga-dev - run: NETWORK=naga-dev bun run test:e2e all --timeout 5000000 + run: NETWORK=naga-dev bun run test:e2e all timeout-minutes: 10 - name: Run health check for naga-test - run: NETWORK=naga-test bun run test:e2e all --timeout 5000000 + run: NETWORK=naga-test bun run test:e2e all timeout-minutes: 10 - name: Run health check for naga-staging - run: NETWORK=naga-staging bun run test:e2e all --timeout 5000000 + run: NETWORK=naga-staging bun run test:e2e all timeout-minutes: 10 \ No newline at end of file diff --git a/e2e/artillery/configs/encrypt-decrypt.yml b/e2e/artillery/configs/encrypt-decrypt.yml index 4e9855ba85..a3233080fd 100644 --- a/e2e/artillery/configs/encrypt-decrypt.yml +++ b/e2e/artillery/configs/encrypt-decrypt.yml @@ -1,24 +1,24 @@ config: - target: "dummy" + target: 'dummy' phases: # Over 60s, ramp up to creating 50 vusers per second - duration: 60 arrivalRate: 5 rampTo: 150 - name: "Ramp Up" + name: 'Ramp Up' # Over 300s, create 50 vusers per second - duration: 300 arrivalRate: 150 - name: "Sustained Encrypt & Decrypt" + name: 'Sustained Encrypt & Decrypt' # Over 60s, ramp down to creating 5 vusers per second - duration: 60 arrivalRate: 20 - name: "Ramp Down" - processor: "../src/processors/multi-endpoints.ts" + name: 'Ramp Down' + processor: '../src/processors/multi-endpoints.ts' scenarios: - - name: "Encrypt & Decrypt Stress Test" + - name: 'Encrypt & Decrypt Stress Test' weight: 100 flow: - - function: "runEncryptDecryptTest" - - think: 0.1 \ No newline at end of file + - function: 'runEncryptDecryptTest' + - think: 0.1 diff --git a/e2e/artillery/configs/execute.yml b/e2e/artillery/configs/execute.yml index 50e549c8e5..4b5c07938a 100644 --- a/e2e/artillery/configs/execute.yml +++ b/e2e/artillery/configs/execute.yml @@ -1,24 +1,24 @@ config: - target: "dummy" + target: 'dummy' phases: # Over 60s, ramp up to creating 50 vusers per second - duration: 60 arrivalRate: 5 rampTo: 100 - name: "Ramp Up" + name: 'Ramp Up' # Over 300s, create 50 vusers per second - duration: 300 arrivalRate: 100 - name: "Sustained Encrypt & Decrypt" + name: 'Sustained Encrypt & Decrypt' # Over 60s, ramp down to creating 5 vusers per second - duration: 60 arrivalRate: 20 - name: "Ramp Down" - processor: "../src/processors/multi-endpoints.ts" + name: 'Ramp Down' + processor: '../src/processors/multi-endpoints.ts' scenarios: - - name: "Execute JS Stress Test" + - name: 'Execute JS Stress Test' weight: 100 flow: - - function: "runExecuteJSTest" - - think: 0.1 \ No newline at end of file + - function: 'runExecuteJSTest' + - think: 0.1 diff --git a/e2e/artillery/configs/mix.yml b/e2e/artillery/configs/mix.yml index 41c35f44ed..4bc26ad4e1 100644 --- a/e2e/artillery/configs/mix.yml +++ b/e2e/artillery/configs/mix.yml @@ -1,34 +1,34 @@ config: - target: "dummy" + target: 'dummy' phases: # Over 60s, ramp up to creating 50 vusers per second - duration: 60 arrivalRate: 5 rampTo: 75 - name: "Ramp Up" + name: 'Ramp Up' # Over 300s, create 50 vusers per second - duration: 300 arrivalRate: 75 - name: "Sustained Encrypt & Decrypt" + name: 'Sustained Encrypt & Decrypt' # Over 60s, ramp down to creating 5 vusers per second - duration: 60 arrivalRate: 20 - name: "Ramp Down" - processor: "../src/processors/multi-endpoints.ts" + name: 'Ramp Down' + processor: '../src/processors/multi-endpoints.ts' scenarios: - - name: "PKP Sign Stress Test" + - name: 'PKP Sign Stress Test' weight: 50 flow: - - function: "runPkpSignTest" + - function: 'runPkpSignTest' - think: 0.1 - - name: "Encrypt & Decrypt Stress Test" + - name: 'Encrypt & Decrypt Stress Test' weight: 25 flow: - - function: "runEncryptDecryptTest" + - function: 'runEncryptDecryptTest' - think: 0.1 - - name: "Execute JS Stress Test" + - name: 'Execute JS Stress Test' weight: 25 flow: - - function: "runExecuteJSTest" - - think: 0.1 \ No newline at end of file + - function: 'runExecuteJSTest' + - think: 0.1 diff --git a/e2e/artillery/configs/pkp-sign.yml b/e2e/artillery/configs/pkp-sign.yml index c915a79b20..f3a103f207 100644 --- a/e2e/artillery/configs/pkp-sign.yml +++ b/e2e/artillery/configs/pkp-sign.yml @@ -5,11 +5,11 @@ config: - duration: 60 arrivalRate: 5 rampTo: 80 - name: "Ramp Up" + name: 'Ramp Up' # Over 300s, create 50 vusers per second - duration: 300 arrivalRate: 80 - name: "Sustained PKP Signing" + name: 'Sustained PKP Signing' # Over 60s, ramp down to creating 5 vusers per second - duration: 60 arrivalRate: 20 diff --git a/e2e/src/helper/NetworkManager.ts b/e2e/src/helper/NetworkManager.ts index 102b24e521..093d9282bf 100644 --- a/e2e/src/helper/NetworkManager.ts +++ b/e2e/src/helper/NetworkManager.ts @@ -50,8 +50,12 @@ export const getViemPublicClient = async ({ networkModule: any; }) => { const viemChainConfig = networkModule.getChainConfig(); + const defaultRpcUrl = viemChainConfig.rpcUrls.default.http[0]; + const isLocalNetwork = defaultRpcUrl.includes('127.0.0.1'); + const customRpcUrl = isLocalNetwork + ? process.env['LOCAL_RPC_URL'] + : process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL']; - const customRpcUrl = process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL']; if (customRpcUrl) { console.log(`🔧 Using custom E2E RPC URL: ***${customRpcUrl.slice(-6)}`); } diff --git a/e2e/src/helper/fundAccount.ts b/e2e/src/helper/fundAccount.ts index c6dbe73374..3e7351c5f6 100644 --- a/e2e/src/helper/fundAccount.ts +++ b/e2e/src/helper/fundAccount.ts @@ -78,17 +78,24 @@ export const fundAccount = async ( thenFundWith?: string; } ) => { - const customRpcUrl = process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL']; + const defaultRpcUrl = networkModule.getChainConfig().rpcUrls.default.http[0]; + const isLocalNetwork = defaultRpcUrl.includes('127.0.0.1'); + const customRpcUrl = isLocalNetwork + ? process.env['LOCAL_RPC_URL'] + : process.env['LIT_YELLOWSTONE_PRIVATE_RPC_URL']; + if (customRpcUrl) { console.log(`🔧 Using custom E2E RPC URL: ***${customRpcUrl.slice(-6)}`); + } else if (isLocalNetwork) { + console.log(`🔧 Using local Anvil RPC URL: ${defaultRpcUrl}`); + } else { + console.log(`🔧 Using default network RPC URL: ${defaultRpcUrl}`); } // check account balance const publicClient = createPublicClient({ chain: networkModule.getChainConfig(), - transport: http( - customRpcUrl || networkModule.getChainConfig().rpcUrls.default.http[0] - ), + transport: http(customRpcUrl || defaultRpcUrl), }); const balance = await publicClient.getBalance({ @@ -101,9 +108,7 @@ export const fundAccount = async ( const walletClient = createWalletClient({ account: sponsorAccount, - transport: http( - customRpcUrl || networkModule.getChainConfig().rpcUrls.default.http[0] - ), + transport: http(customRpcUrl || defaultRpcUrl), }); // Get the next managed nonce for this sponsor account diff --git a/package.json b/package.json index 8870077c2b..40d3a8322c 100644 --- a/package.json +++ b/package.json @@ -4,21 +4,26 @@ "license": "MIT", "scripts": { "reset": "bun unlink-all && rimraf dist node_modules doc tmp yarn-error.log yarn.lock package-lock.json bun.lockb learn-debug.log tmp .nx lit-auth-storage pkp-tokens lit-auth-local ./e2e/dist ./e2e/node_modules", + "go": "bun run build && bun link-all", "build": "bun unlink-all && nx run-many --parallel=false --target=build --all --exclude=wrapped-keys,wrapped-keys-lit-actions && bun run prettier", - "build:affected": " nx affected --target=build --exclude=wrapped-keys,wrapped-keys-lit-actions", + "build:affected": "nx affected --target=build --exclude=wrapped-keys,wrapped-keys-lit-actions", "check-deps": "npx nx run-many --target=check-deps --exclude=wrapped-keys,wrapped-keys-lit-actions", "validate": "npm run check-deps && npm run build", "test:local": "node ./local-tests/build.mjs && dotenvx run --env-file=.env -- node ./local-tests/build/test.mjs", "test:unit": "npx nx run-many --target=test", "test:unit:watch": "npx nx run-many --target=test --watch", "show:affected": "npx nx show projects --affected --uncommitted", + "build:tinny": "node ./local-tests/build.mjs", + "publish:tinny": "cd ./local-tests && npm publish", + "gen:docs": "node ./tools/scripts/gen-doc.mjs", + "gen:readme": "node ./tools/scripts/gen-readme.mjs", "gen:local-network-context": "bun run packages/networks/src/networks/vNaga/envs/naga-local/scripts/00-generate-abi-signatures.ts", "prettier": "npx nx format:write --all", "format:check": "npx nx format:check --all", "link-all": "for dir in packages/*/; do echo \"Linking in $dir\"; (cd \"$dir\" && bun link) || { echo \"ERROR: Failed to link in $dir\"; exit 1; }; done", "unlink-all": "for dir in packages/*/; do echo \"Unlinking in $dir\"; (cd \"$dir\" && bun unlink) || { echo \"ERROR: Failed to unlink in $dir\"; exit 1; }; done", "auth-services": "cd packages/auth-services && bun run start", - "test:e2e": "bun test ./e2e/src/e2e.spec.ts -t", + "test:e2e": "bun test ./e2e/src/e2e.spec.ts --timeout 50000000 -t", "artillery:init": "bun run ./e2e/artillery/src/init.ts", "artillery:balance-status": "LOG_LEVEL=silent bun run ./e2e/artillery/src/balance-status.ts", "artillery:pkp-sign": "DEBUG_HTTP=true LOG_LEVEL=silent dotenvx run --env-file=.env -- sh -c 'artillery run ./e2e/artillery/configs/pkp-sign.yml ${ARTILLERY_KEY:+--record --key $ARTILLERY_KEY}'", diff --git a/packages/access-control-conditions-schemas/CHANGELOG.md b/packages/access-control-conditions-schemas/CHANGELOG.md index f6228e7bd9..ecc9af83b2 100644 --- a/packages/access-control-conditions-schemas/CHANGELOG.md +++ b/packages/access-control-conditions-schemas/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/access-control-conditions-schemas +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/access-control-conditions-schemas/package.json b/packages/access-control-conditions-schemas/package.json index cc3af53b1b..d97bbf8a02 100644 --- a/packages/access-control-conditions-schemas/package.json +++ b/packages/access-control-conditions-schemas/package.json @@ -20,7 +20,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts", "dependencies": { diff --git a/packages/access-control-conditions/CHANGELOG.md b/packages/access-control-conditions/CHANGELOG.md index bbb281fcc3..aef3a783bd 100644 --- a/packages/access-control-conditions/CHANGELOG.md +++ b/packages/access-control-conditions/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/access-control-conditions +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/access-control-conditions/package.json b/packages/access-control-conditions/package.json index d9925b3180..b315771e05 100644 --- a/packages/access-control-conditions/package.json +++ b/packages/access-control-conditions/package.json @@ -21,7 +21,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts", "dependencies": { diff --git a/packages/auth-helpers/CHANGELOG.md b/packages/auth-helpers/CHANGELOG.md index a6755a9155..4c94862255 100644 --- a/packages/auth-helpers/CHANGELOG.md +++ b/packages/auth-helpers/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/auth-helpers +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/auth-helpers/package.json b/packages/auth-helpers/package.json index ae1baeb71c..53b7411425 100644 --- a/packages/auth-helpers/package.json +++ b/packages/auth-helpers/package.json @@ -25,7 +25,7 @@ "crypto": false, "stream": false }, - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts", "dependencies": { diff --git a/packages/auth-services/CHANGELOG.md b/packages/auth-services/CHANGELOG.md index ad4e330742..fc4bf3dde6 100644 --- a/packages/auth-services/CHANGELOG.md +++ b/packages/auth-services/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/auth-services +## 2.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 2.0.0-beta.0 ### Major Changes diff --git a/packages/auth-services/package.json b/packages/auth-services/package.json index 88933eb398..1cd3373acc 100644 --- a/packages/auth-services/package.json +++ b/packages/auth-services/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/auth-services", - "version": "2.0.0-beta.0", + "version": "2.0.0-beta.1", "license": "MIT", "type": "module", "main": "./src/index.js", diff --git a/packages/auth/CHANGELOG.md b/packages/auth/CHANGELOG.md index a42bbb3e4a..7db5eaf405 100644 --- a/packages/auth/CHANGELOG.md +++ b/packages/auth/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/auth +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/auth/package.json b/packages/auth/package.json index cedaa42b5b..ef6a90469d 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -43,7 +43,7 @@ "crypto": false, "stream": false }, - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./dist/index.js", "typings": "./src/index.d.ts", "types": "./dist/index.d.ts" diff --git a/packages/constants/CHANGELOG.md b/packages/constants/CHANGELOG.md index 71538880bd..80b06bcb71 100644 --- a/packages/constants/CHANGELOG.md +++ b/packages/constants/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/constants +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/constants/package.json b/packages/constants/package.json index 6e961e0ccc..f0c6a71edf 100644 --- a/packages/constants/package.json +++ b/packages/constants/package.json @@ -25,7 +25,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts" } diff --git a/packages/constants/src/lib/constants/constants.ts b/packages/constants/src/lib/constants/constants.ts index 0769edf3db..54dc6a854e 100644 --- a/packages/constants/src/lib/constants/constants.ts +++ b/packages/constants/src/lib/constants/constants.ts @@ -1429,5 +1429,5 @@ export const SIWE_URI_PREFIX = { export type SIWE_URI_PREFIX_TYPE = ConstantKeys; export type SIWE_URI_PREFIX_VALUES = ConstantValues; - -export const DEV_PRIVATE_KEY = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"; \ No newline at end of file +export const DEV_PRIVATE_KEY = + '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'; diff --git a/packages/crypto/CHANGELOG.md b/packages/crypto/CHANGELOG.md index d5caaca61a..b8fbd5cde4 100644 --- a/packages/crypto/CHANGELOG.md +++ b/packages/crypto/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/crypto +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/crypto/package.json b/packages/crypto/package.json index f7c1c0dc55..a8b2f6c78d 100644 --- a/packages/crypto/package.json +++ b/packages/crypto/package.json @@ -21,7 +21,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts", "dependencies": { diff --git a/packages/lit-client/CHANGELOG.md b/packages/lit-client/CHANGELOG.md index d36902e3c5..df2b8cf37e 100644 --- a/packages/lit-client/CHANGELOG.md +++ b/packages/lit-client/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/lit-client +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/lit-client/package.json b/packages/lit-client/package.json index 243a89da6d..cdc2e2ac36 100644 --- a/packages/lit-client/package.json +++ b/packages/lit-client/package.json @@ -21,7 +21,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./dist/index.js", "typings": "./src/index.d.ts", "types": "./dist/index.d.ts", diff --git a/packages/lit-client/src/lib/LitClient/createLitClient.ts b/packages/lit-client/src/lib/LitClient/createLitClient.ts index 2a0edc5936..ac649ab836 100644 --- a/packages/lit-client/src/lib/LitClient/createLitClient.ts +++ b/packages/lit-client/src/lib/LitClient/createLitClient.ts @@ -176,7 +176,8 @@ export const _createNagaLitClient = async ( } ): Promise { _logger.info( - `🔥 signing on ${params.chain} with ${params.signingScheme} (bypass: ${params.bypassAutoHashing || false + `🔥 signing on ${params.chain} with ${params.signingScheme} (bypass: ${ + params.bypassAutoHashing || false })` ); @@ -808,9 +809,7 @@ export const _createNagaLitClient = async ( }, viewPKPPermissions: async (pkpIdentifier: PkpIdentifierRaw) => { // It's an Anvil private key, chill. 🤣 - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); + const account = privateKeyToAccount(DEV_PRIVATE_KEY); const pkpPermissionsManager = await networkModule.chainApi.getPKPPermissionsManager({ @@ -829,19 +828,17 @@ export const _createNagaLitClient = async ( }, viewPKPsByAuthData: async (params: { authData: - | { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - } - | AuthData; + | { + authMethodType: number | bigint; + authMethodId: string; + accessToken?: string; + } + | AuthData; pagination?: { limit?: number; offset?: number }; storageProvider?: PKPStorageProvider; }) => { // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); + const account = privateKeyToAccount(DEV_PRIVATE_KEY); return await networkModule.chainApi.getPKPsByAuthData({ authData: params.authData, @@ -856,9 +853,7 @@ export const _createNagaLitClient = async ( storageProvider?: PKPStorageProvider; }) => { // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); + const account = privateKeyToAccount(DEV_PRIVATE_KEY); return await networkModule.chainApi.getPKPsByAddress({ ownerAddress: params.ownerAddress, diff --git a/packages/lit-client/src/lib/LitClient/helper/createRequestId.ts b/packages/lit-client/src/lib/LitClient/helper/createRequestId.ts index 2bef72aa4b..d9e7bf4885 100644 --- a/packages/lit-client/src/lib/LitClient/helper/createRequestId.ts +++ b/packages/lit-client/src/lib/LitClient/helper/createRequestId.ts @@ -1,5 +1,3 @@ -/** - */ export const createRequestId = () => { return Math.random().toString(16).slice(2); }; diff --git a/packages/logger/CHANGELOG.md b/packages/logger/CHANGELOG.md index 7188267433..1a4f70912a 100644 --- a/packages/logger/CHANGELOG.md +++ b/packages/logger/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/logger +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/logger/package.json b/packages/logger/package.json index ed28136855..b81fc2575d 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/logger", - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "type": "commonjs", "tags": [ "universal" diff --git a/packages/networks/CHANGELOG.md b/packages/networks/CHANGELOG.md index d95b6f10ae..1abb0b83ab 100644 --- a/packages/networks/CHANGELOG.md +++ b/packages/networks/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/networks +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/networks/package.json b/packages/networks/package.json index 2094d27fb4..fea67bdb99 100644 --- a/packages/networks/package.json +++ b/packages/networks/package.json @@ -35,7 +35,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./dist/index.js", "typings": "./src/index.d.ts", "types": "./dist/index.d.ts" diff --git a/packages/networks/src/index.ts b/packages/networks/src/index.ts index 33398d9d0f..d9740dd627 100644 --- a/packages/networks/src/index.ts +++ b/packages/networks/src/index.ts @@ -34,8 +34,8 @@ export type LitNetworkModule = // | DatilLocalModule // ----- types -export type { ConnectionInfo } from './networks/vNaga/LitChainClient/types'; +export type { ConnectionInfo } from './networks/vNaga/shared/managers/LitChainClient/types'; export type { PKPStorageProvider } from './storage/types'; // Schema types -export type { MintRequestRaw } from './networks/vNaga/LitChainClient/schemas/MintRequestSchema'; +export type { MintRequestRaw } from './networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema'; diff --git a/packages/networks/src/networks/shared/README.md b/packages/networks/src/networks/shared/README.md new file mode 100644 index 0000000000..b0ff7a960f --- /dev/null +++ b/packages/networks/src/networks/shared/README.md @@ -0,0 +1 @@ +This directory contains shared code for all networks. diff --git a/packages/networks/src/networks/shared/helpers/createRandomHexString.ts b/packages/networks/src/networks/shared/helpers/createRandomHexString.ts deleted file mode 100644 index c0f6b41b4a..0000000000 --- a/packages/networks/src/networks/shared/helpers/createRandomHexString.ts +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Create a random hex string for use as an attestation challenge - * @returns { string } - */ -export const createRandomHexString = (size: number): string => { - return [...Array(size)] - .map(() => Math.floor(Math.random() * 16).toString(16)) - .join(''); -}; diff --git a/packages/networks/src/networks/shared/helpers/createRequestId.ts b/packages/networks/src/networks/shared/utils/createRequestId.ts similarity index 97% rename from packages/networks/src/networks/shared/helpers/createRequestId.ts rename to packages/networks/src/networks/shared/utils/createRequestId.ts index 2dd96a1e85..dcc3fc4c65 100644 --- a/packages/networks/src/networks/shared/helpers/createRequestId.ts +++ b/packages/networks/src/networks/shared/utils/createRequestId.ts @@ -1,5 +1,4 @@ /** - * * use the one in networks package */ export const createRequestId = () => { diff --git a/packages/networks/src/networks/types.d.ts b/packages/networks/src/networks/types.d.ts deleted file mode 100644 index 5c407ef612..0000000000 --- a/packages/networks/src/networks/types.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { LIT_ENDPOINT, HTTP, HTTPS } from '@lit-protocol/constants'; -import { Chain } from 'viem'; -/** - * Configuration specific to the underlying blockchain of a Lit network. - */ -/** - * Configuration for a specific Lit network. - */ -export interface LitNetworkConfig { - networkName: string; - httpProtocol: typeof HTTP | typeof HTTPS; - endpoints: typeof LIT_ENDPOINT; - rpcUrl: string; - chainConfig: Chain; - minNodeCount?: number; -} -export interface LitNetworkModuleBase { - id: string; - version: string; - config: { - requiredAttestation: boolean; - abortTimeout: number; - minimumThreshold: number; - }; - getNetworkName: () => string; - getHttpProtocol: () => typeof HTTP | typeof HTTPS; - getEndpoints: () => typeof LIT_ENDPOINT; - getRpcUrl: () => string; - getChainConfig: () => Chain; - createStateManager: () => Promise; -} diff --git a/packages/networks/src/networks/types.js b/packages/networks/src/networks/types.js deleted file mode 100644 index 07d09d39da..0000000000 --- a/packages/networks/src/networks/types.js +++ /dev/null @@ -1,3 +0,0 @@ -'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); -//# sourceMappingURL=types.js.map diff --git a/packages/networks/src/networks/types.js.map b/packages/networks/src/networks/types.js.map deleted file mode 100644 index 8da0887a56..0000000000 --- a/packages/networks/src/networks/types.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"types.js","sourceRoot":"","sources":["types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/LitChainClient/_config.ts b/packages/networks/src/networks/vNaga/LitChainClient/_config.ts deleted file mode 100644 index 15b47ef03a..0000000000 --- a/packages/networks/src/networks/vNaga/LitChainClient/_config.ts +++ /dev/null @@ -1,15 +0,0 @@ -// import { -// NagaLocalDevNetworkContext, -// nagaLocalDevNetworkContext, -// } from '../envs/local-dev/networkContext'; - -// /** -// * Due to the usage of arbitrum stylus contracts, -// * the gas limit is increased by 10% to avoid reverts due to out of gas errors -// */ -// const GAS_LIMIT_INCREASE_PERCENTAGE = 10; -// export const GAS_LIMIT_ADJUSTMENT = BigInt(100 + GAS_LIMIT_INCREASE_PERCENTAGE); - -// export const networkContext = nagaLocalDevNetworkContext; // we shall change this later - -// export type NetworkContext = NagaLocalDevNetworkContext; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/index.ts b/packages/networks/src/networks/vNaga/LitChainClient/index.ts deleted file mode 100644 index 50ea511307..0000000000 --- a/packages/networks/src/networks/vNaga/LitChainClient/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -export * from './apis/index'; -export * from './types'; -export { createContractsManager } from './contract-manager/createContractsManager'; -export { createReadOnlyContractsManager } from './contract-manager/createContractsManager'; diff --git a/packages/networks/src/networks/vNaga/envs/base/BaseNetworkEnvironment.ts b/packages/networks/src/networks/vNaga/envs/base/BaseNetworkEnvironment.ts new file mode 100644 index 0000000000..3e2b4f20db --- /dev/null +++ b/packages/networks/src/networks/vNaga/envs/base/BaseNetworkEnvironment.ts @@ -0,0 +1,67 @@ +import { Chain } from 'viem'; +import type { INetworkConfig } from '../../shared/interfaces/NetworkContext'; +import type { NagaEndpointsType } from '../../shared/managers/endpoints-manager/endpoints'; + +export interface BaseEnvironmentServices { + authServiceBaseUrl: string; + loginServiceBaseUrl: string; +} + +export interface BaseEnvironmentOptions { + network: string; + abiSignatures: T; + networkSpecificConfigs?: M; + services: BaseEnvironmentServices; + minimumThreshold?: number; + httpProtocol?: 'http://' | 'https://'; + requiredAttestation?: boolean; +} + +export abstract class BaseNetworkEnvironment { + protected readonly config: INetworkConfig; + + constructor(options: BaseEnvironmentOptions) { + this.config = { + minimumThreshold: options.minimumThreshold || 3, + network: options.network, + rpcUrl: this.getRpcUrl(), + abiSignatures: options.abiSignatures, + chainConfig: this.getChainConfig(), + httpProtocol: options.httpProtocol || 'https://', + networkSpecificConfigs: options.networkSpecificConfigs, + endpoints: this.getEndpoints(), + services: options.services, + requiredAttestation: options.requiredAttestation ?? true, + }; + } + + public getConfig(): INetworkConfig { + return this.config; + } + + public getNetworkName(): string { + return this.config.network; + } + + public getMinimumThreshold(): number { + return this.config.minimumThreshold; + } + + public getServices(): BaseEnvironmentServices { + return this.config.services; + } + + protected abstract getRpcUrl(): string; + protected abstract getChainConfig(): Chain; + protected abstract getEndpoints(): NagaEndpointsType; + protected abstract getDefaultRealmId(): bigint; +} + +export interface EnvironmentManager { + createStateManager: (params: { + callback: (params: any) => Promise; + networkModule: any; + }) => Promise; + getMaxPricesForNodeProduct: (params: any) => any; + getUserMaxPrice: (params: any) => any; +} diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.CreateRequestParams.ts deleted file mode 100644 index 5cc454dc69..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.CreateRequestParams.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - EoaAuthContextSchema, - HexPrefixedSchema, - PKPAuthContextSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { RawHandshakeResponseSchema } from '../handshake/handshake.schema'; - -export type PKPSignCreateRequestParams = { - serverKeys: Record< - string, - z.infer['data'] - >; - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - signingContext: { - pubKey: z.infer; - toSign: any; - signingScheme: z.infer; - bypassAutoHashing?: boolean; - }; - connectionInfo: ConnectionInfo; - version: string; - chain: z.infer; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.RequestDataSchema.ts deleted file mode 100644 index ce17266144..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.RequestDataSchema.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { walletEncrypt } from '@lit-protocol/crypto'; -import { - AuthSigSchema, - BytesArraySchema, - HexPrefixedSchema, - NodeSetsFromUrlsSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { hexToBytes, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { LitMessageSchema } from '../../../../schemas/LitMessageSchema'; - -// Schema for auth methods in v2 API -const AuthMethodSchema = z.object({ - authMethodType: z.number(), - accessToken: z.string(), -}); - -export const PKPSignRequestDataSchema = z - .object({ - toSign: BytesArraySchema, - signingScheme: SigningSchemeSchema, - // ❗️ THIS FREAKING "pubkey"! "k" is lowercase!! - pubkey: HexPrefixedSchema, - authSig: AuthSigSchema, - nodeSet: NodeSetsFromUrlsSchema, - chain: SigningChainSchema, - bypassAutoHashing: z.boolean().optional(), - - // NEW v2 API fields - epoch: z.number().default(0), - authMethods: z.array(AuthMethodSchema).default([]), - }) - .transform((item) => { - const toSignData = item.bypassAutoHashing - ? item.toSign - : LitMessageSchema.parse({ - toSign: item.toSign, - signingScheme: item.signingScheme, - chain: item.chain, - }); - - const unencrypted = { - toSign: toSignData, - signingScheme: item.signingScheme, - pubkey: item.pubkey, - authSig: item.authSig, - nodeSet: item.nodeSet, - epoch: item.epoch, - authMethods: item.authMethods, - }; - - return unencrypted; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.spec.ts deleted file mode 100644 index 697df53451..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createChainManager } from './createChainManager'; -import { privateKeyToAccount } from 'viem/accounts'; - -describe('createChainManager', () => { - it('should create a chain manager', () => { - const viemAccount = privateKeyToAccount( - process.env['PRIVATE_KEY']! as `0x${string}` - ); - - const chainManager = createChainManager(viemAccount); - - console.log(chainManager); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.ts index 3c51b21d8b..bf67850beb 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-dev/chain-manager/createChainManager.ts @@ -1,156 +1,22 @@ -import { privateKeyToAccount } from 'viem/accounts'; -import { api } from '../../../LitChainClient'; -import { getPKPsByAddress } from '../../../LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress'; -import { PkpIdentifierRaw } from '../../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { ExpectedAccountOrWalletClient } from '../../../LitChainClient/contract-manager/createContractsManager'; -import { DefaultNetworkConfig } from '../../../interfaces/NetworkContext'; -import { networkConfig } from '../naga-dev.config'; -import type { PKPStorageProvider } from '../../../../../storage/types'; -import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; +import type { ExpectedAccountOrWalletClient } from '../../../shared/managers/contract-manager/createContractsManager'; +import { + createChainManagerFactory, + createReadOnlyChainManagerFactory, + CreateChainManagerReturn, +} from '../../../shared/factories/BaseChainManagerFactory'; +import { nagaDevEnvironment } from '../naga-dev.env'; -export type CreateChainManagerReturn = { - api: { - mintWithEoa: ( - req?: Parameters[0] - ) => ReturnType; - mintPKP: ( - req: Parameters[0] - ) => ReturnType; - mintWithMultiAuths: ( - req: Parameters[0] - ) => ReturnType; - pkpPermissionsManager: ( - pkpIdentifier: PkpIdentifierRaw - ) => InstanceType; - paymentManager: () => InstanceType; - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => ReturnType; - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => ReturnType; - pricing: { - getPriceFeedInfo: ( - req: Parameters[0] - ) => ReturnType; - getNodePrices: ( - req: Parameters[0] - ) => ReturnType; - }; - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }) => ReturnType; - }; - }; -}; +export type { CreateChainManagerReturn }; export const createChainManager = ( accountOrWalletClient: ExpectedAccountOrWalletClient ): CreateChainManagerReturn => { - // TODO: This ideally should set to NagaLocalNetworkContext. - const _networkConfig = networkConfig as unknown as DefaultNetworkConfig; - - // Helper to bind the network context to an API function - const bindContext = ( - fn: ( - req: ReqArgType, - ctx: DefaultNetworkConfig, - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => RetType - ) => { - return (req: ReqArgType): RetType => - fn(req, _networkConfig, accountOrWalletClient); - }; - - return { - api: { - mintWithEoa: bindContext(api.mintWithEoa), - mintPKP: bindContext(api.mintPKP), - mintWithMultiAuths: bindContext(api.mintWithMultiAuths), - pkpPermissionsManager: (pkpIdentifier: PkpIdentifierRaw) => { - return new api.PKPPermissionsManager( - pkpIdentifier, - _networkConfig, - accountOrWalletClient - ); - }, - paymentManager: () => { - return new api.PaymentManager(_networkConfig, accountOrWalletClient); - }, - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => { - return api.PKPPermissionsManager.getPKPsByAuthData( - authData, - pagination, - storageProvider, - _networkConfig, - accountOrWalletClient - ); - }, - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => { - // Provide default pagination if not provided - const defaultPagination = { limit: 10, offset: 0 }; - const finalPagination = params.pagination - ? { - limit: params.pagination.limit ?? defaultPagination.limit, - offset: params.pagination.offset ?? defaultPagination.offset, - } - : defaultPagination; - - return getPKPsByAddress( - { - ownerAddress: params.ownerAddress, - pagination: finalPagination, - storageProvider: params.storageProvider, - }, - _networkConfig, - accountOrWalletClient - ); - }, - pricing: { - getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo), - getNodePrices: bindContext(api.pricing.getNodePrices), - }, - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }): ReturnType => { - return api.connection.getConnectionInfo({ - networkCtx: _networkConfig, - accountOrWalletClient: accountOrWalletClient, - nodeProtocol: args?.nodeProtocol, - }); - }, - }, - }, - }; -}; - -export const createReadOnlyChainManager = () => { - // dummy private key for read actions - const dummyAccount = privateKeyToAccount( - DEV_PRIVATE_KEY + return createChainManagerFactory( + nagaDevEnvironment.getConfig(), + accountOrWalletClient ); - const chainManager = createChainManager(dummyAccount); - return createChainManager(chainManager); }; + +export const createReadOnlyChainManager = createReadOnlyChainManagerFactory( + nagaDevEnvironment.getConfig() +); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.cjs b/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.cjs deleted file mode 100644 index efc3be044f..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.cjs +++ /dev/null @@ -1,2760 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; - -module.exports = { - signatures, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.js b/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.js deleted file mode 100644 index 12295e2727..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.js +++ /dev/null @@ -1,2756 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.ts deleted file mode 100644 index acac87aa1d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/generated/naga-develop.ts +++ /dev/null @@ -1,2757 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -} as const; -export type Signatures = typeof signatures; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/index.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/index.ts index f245c2d96a..64c9b58a8d 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/index.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-dev/index.ts @@ -1,3 +1 @@ -import { nagaDevModule } from './naga-dev.module'; - -export const nagaDev = nagaDevModule; +export { nagaDev } from './naga-dev.module'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.config.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.config.ts deleted file mode 100644 index b364064c19..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { nagaDevSignatures } from '@lit-protocol/contracts'; -import * as chainInfo from '../../../../chains/ChronicleYellowstone'; -import { NAGA_ENDPOINT } from '../../endpoints-manager/endpoints'; -import { INetworkConfig } from '../../interfaces/NetworkContext'; - -const NETWORK = 'naga-dev'; -const PROTOCOL = 'https://'; -const MINIMUM_THRESHOLD = 3; - -/** - * TODO: This is a temporary default realm id. There's are two abis functions called 'getAllReservedValidators' and 'numRealms' in the latest lit-assets branch. We need to call that to see how many realms there are. If there's only one realm, then we can use that as the default realm id. Otherwise, we will randomly choose one. - */ -const DEFAULT_REALM_ID = 1n; - -export interface NagaDevSpecificConfigs { - realmId?: bigint; - // privateKey?: Hex; -} - -export type NagaDevSignatures = typeof nagaDevSignatures; - -export const networkConfig: INetworkConfig< - NagaDevSignatures, - NagaDevSpecificConfigs -> = { - minimumThreshold: MINIMUM_THRESHOLD, - network: NETWORK, - rpcUrl: chainInfo.RPC_URL, - abiSignatures: nagaDevSignatures, - chainConfig: chainInfo.viemChainConfig, - httpProtocol: PROTOCOL, - networkSpecificConfigs: { - realmId: DEFAULT_REALM_ID, - }, - endpoints: NAGA_ENDPOINT, - services: { - authServiceBaseUrl: 'https://naga-auth-service.getlit.dev', - loginServiceBaseUrl: 'https://login.litgateway.com', - }, -}; - -export type NagaStagingNetworkConfig = typeof networkConfig; - -// network object calls the chain client -// LitClient could use the network to figure out diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.env.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.env.ts new file mode 100644 index 0000000000..a132adf503 --- /dev/null +++ b/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.env.ts @@ -0,0 +1,58 @@ +import { nagaDevSignatures } from '@lit-protocol/contracts'; +import { Chain } from 'viem'; +import * as chainInfo from '../../../../chains/ChronicleYellowstone'; +import { NAGA_ENDPOINT } from '../../shared/managers/endpoints-manager/endpoints'; +import type { NagaEndpointsType } from '../../shared/managers/endpoints-manager/endpoints'; +import { BaseNetworkEnvironment } from '../base/BaseNetworkEnvironment'; + +const NETWORK = 'naga-dev'; +const PROTOCOL = 'https://'; +const MINIMUM_THRESHOLD = 3; +const DEFAULT_REALM_ID = 1n; + +export interface NagaDevSpecificConfigs { + realmId?: bigint; +} + +export type NagaDevSignatures = typeof nagaDevSignatures; + +export class NagaDevEnvironment extends BaseNetworkEnvironment< + NagaDevSignatures, + NagaDevSpecificConfigs +> { + constructor() { + super({ + network: NETWORK, + abiSignatures: nagaDevSignatures, + networkSpecificConfigs: { + realmId: DEFAULT_REALM_ID, + }, + services: { + authServiceBaseUrl: 'https://naga-auth-service.getlit.dev', + loginServiceBaseUrl: 'https://login.litgateway.com', + }, + minimumThreshold: MINIMUM_THRESHOLD, + httpProtocol: PROTOCOL, + requiredAttestation: false, + }); + } + + protected getRpcUrl(): string { + return chainInfo.RPC_URL; + } + + protected getChainConfig(): Chain { + return chainInfo.viemChainConfig; + } + + protected getEndpoints(): NagaEndpointsType { + return NAGA_ENDPOINT; + } + + protected getDefaultRealmId(): bigint { + return DEFAULT_REALM_ID; + } +} + +// Create singleton instance +export const nagaDevEnvironment = new NagaDevEnvironment(); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.module.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.module.ts index 876fcdaf32..1d5771b1a7 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.module.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-dev/naga-dev.module.ts @@ -1,1372 +1,14 @@ -import { DEV_PRIVATE_KEY, version } from '@lit-protocol/constants'; -import { verifyAndDecryptWithSignatureShares } from '@lit-protocol/crypto'; -import { - AuthData, - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, - GenericResultBuilder, - HexPrefixedSchema, - JsonSignCustomSessionKeyRequestForPkpReturnSchema, - JsonSignSessionKeyRequestForPkpReturnSchema, -} from '@lit-protocol/schemas'; -import { Hex, hexToBytes, stringToBytes } from 'viem'; - -import { z } from 'zod'; -import { LitNetworkModuleBase } from '../../../types'; -import type { ExpectedAccountOrWalletClient } from '../../LitChainClient/contract-manager/createContractsManager'; -import { networkConfig } from './naga-dev.config'; -import { PricingContextSchema } from './pricing-manager/PricingContextSchema'; -import { issueSessionFromContext } from './session-manager/issueSessionFromContext'; -import { createStateManager } from './state-manager/createStateManager'; - -// Import the necessary types for the explicit return type annotation -import { NetworkError } from '@lit-protocol/constants'; -import { - combineSignatureShares, - mostCommonString, - normalizeAndStringify, - ReleaseVerificationConfig, -} from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { nacl } from '@lit-protocol/nacl'; -import { - AuthMethod, - AuthSig, - CallbackParams, - KeySet, - LitActionResponseStrategy, - NagaJitContext, - NodeAttestation, - Optional, - OrchestrateHandshakeResponse, - RequestItem, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { computeAddress } from 'ethers/lib/utils'; -import type { PKPStorageProvider } from '../../../../storage/types'; -import { createRequestId } from '../../../shared/helpers/createRequestId'; -import { handleAuthServerRequest } from '../../../shared/helpers/handleAuthServerRequest'; -import { composeLitUrl } from '../../endpoints-manager/composeLitUrl'; -import { - getNodePrices, - PKPPermissionsManager, -} from '../../LitChainClient/apis/highLevelApis'; -import { PaymentManager } from '../../LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager'; -import { MintWithMultiAuthsRequest } from '../../LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths'; -import { PkpIdentifierRaw } from '../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { GenericTxRes, LitTxRes } from '../../LitChainClient/apis/types'; -import type { PKPData } from '../../LitChainClient/schemas/shared/PKPDataSchema'; -import { ConnectionInfo } from '../../LitChainClient/types'; -import { DecryptCreateRequestParams } from './api-manager/decrypt/decrypt.CreateRequestParams'; -import { DecryptInputSchema } from './api-manager/decrypt/decrypt.InputSchema'; -import { DecryptRequestDataSchema } from './api-manager/decrypt/decrypt.RequestDataSchema'; -import { DecryptResponseDataSchema } from './api-manager/decrypt/decrypt.ResponseDataSchema'; -import { E2EERequestManager } from './api-manager/e2ee-request-manager/E2EERequestManager'; -import { handleResponse as handleExecuteJsResponse } from './api-manager/executeJs'; -import { ExecuteJsCreateRequestParams } from './api-manager/executeJs/executeJs.CreateRequestParams'; -import { ExecuteJsInputSchema } from './api-manager/executeJs/executeJs.InputSchema'; -import { ExecuteJsRequestDataSchema } from './api-manager/executeJs/executeJs.RequestDataSchema'; -import { ExecuteJsResponseDataSchema } from './api-manager/executeJs/executeJs.ResponseDataSchema'; -import { RawHandshakeResponseSchema } from './api-manager/handshake/handshake.schema'; -import { combinePKPSignSignatures } from './api-manager/helper/get-signatures'; -import { PKPSignCreateRequestParams } from './api-manager/pkpSign/pkpSign.CreateRequestParams'; -import { - BitCoinPKPSignInputSchema, - EthereumPKPSignInputSchema, - PKPSignInputSchema, -} from './api-manager/pkpSign/pkpSign.InputSchema'; -import { PKPSignRequestDataSchema } from './api-manager/pkpSign/pkpSign.RequestDataSchema'; -import { PKPSignResponseDataSchema } from './api-manager/pkpSign/pkpSign.ResponseDataSchema'; -import { - createChainManager, - CreateChainManagerReturn, -} from './chain-manager/createChainManager'; -import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct'; -import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice'; -import { privateKeyToAccount } from 'viem/accounts'; - -const MODULE_NAME = 'naga-dev'; - -const _logger = getChildLogger({ - module: `${MODULE_NAME}-module`, +import { createBaseModule } from '../../shared/factories/BaseModuleFactory'; +import { createChainManager } from './chain-manager/createChainManager'; +import { nagaDevEnvironment } from './naga-dev.env'; +import type { ExpectedAccountOrWalletClient } from '../../shared/managers/contract-manager/createContractsManager'; + +const nagaDev = createBaseModule({ + networkConfig: nagaDevEnvironment.getConfig(), + moduleName: nagaDevEnvironment.getNetworkName(), + createChainManager: (account: ExpectedAccountOrWalletClient) => + createChainManager(account), }); -// Release verification types and constants -interface ReleaseInfo { - status: number; - env: number; - typ: number; - platform: number; - options: { asU32: () => number }; - publicKey: Uint8Array; - idKeyDigest: Uint8Array; -} - -enum ReleaseStatus { - Null = 0, - Active = 1, - Inactive = 2, -} - -// Basic Release Register Contract ABI - only the functions we need -const RELEASE_REGISTER_ABI = [ - { - inputs: [], - name: 'RELEASE_REGISTER_CONTRACT', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -/** - * Extract release ID from attestation data - * @param attestation The node attestation containing release ID - * @returns The release ID string - */ -function extractReleaseId(attestation: NodeAttestation): string { - const releaseId = attestation.data.RELEASE_ID; - if (!releaseId) { - throw new NetworkError( - { info: { attestation } }, - 'Missing RELEASE_ID in attestation data' - ); - } - return Buffer.from(releaseId, 'base64').toString('utf8'); -} - -/** - * Extract subnet ID from release ID - * Based on the Rust implementation: subnet_id_from_release_id - * @param releaseId The release ID string - * @returns The subnet ID - */ -function getSubnetIdFromReleaseId(releaseId: string): string { - // In the Rust code, this extracts the subnet ID from the release ID - // For now, this is a simplified version - you may need to adjust based on actual format - const parts = releaseId.split('-'); - if (parts.length < 2) { - throw new NetworkError( - { info: { releaseId } }, - 'Invalid release ID format' - ); - } - return parts[0]; // First part is typically the subnet ID -} - -/** - * Pad release ID to 32 bytes for contract call - * @param releaseId The release ID string - * @returns Padded bytes32 for contract call - */ -function padReleaseIdToBytes32(releaseId: string): string { - const releaseIdBuffer = Buffer.from(releaseId, 'utf8'); - if (releaseIdBuffer.length > 32) { - throw new NetworkError( - { info: { releaseId } }, - 'Release ID too long for bytes32' - ); - } - const paddedBuffer = Buffer.alloc(32); - releaseIdBuffer.copy(paddedBuffer); - return ethers.utils.hexlify(paddedBuffer); -} - -/** - * Verify release ID against the on-chain release register contract - * This function is provided to the crypto package for dependency injection - * @param attestation The node attestation - * @param config Configuration for release verification - */ -const verifyReleaseId = async ( - attestation: NodeAttestation, - config: ReleaseVerificationConfig -): Promise => { - _logger.info('verifyReleaseId: Starting release verification', { - subnetId: config.subnetId, - environment: config.environment, - }); - - // 1. Extract release ID from attestation - const releaseId = extractReleaseId(attestation); - - // 2. Verify release ID length - if (releaseId.length !== 64) { - // RELEASE_ID_STR_LEN from Rust code - throw new NetworkError( - { - info: { releaseId, expectedLength: 64, actualLength: releaseId.length }, - }, - `Release ID length is incorrect: expected 64, got ${releaseId.length}` - ); - } - - // 3. Extract and verify subnet ID - const releaseSubnetId = getSubnetIdFromReleaseId(releaseId); - if (releaseSubnetId !== config.subnetId) { - throw new NetworkError( - { info: { releaseSubnetId, expectedSubnetId: config.subnetId } }, - `Subnet ID mismatch: expected ${config.subnetId}, got ${releaseSubnetId}` - ); - } - - // 4. Query the release register contract - const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl); - const contract = new ethers.Contract( - config.releaseRegisterContractAddress, - RELEASE_REGISTER_ABI, - provider - ); - - const releaseIdPadded = padReleaseIdToBytes32(releaseId); - - try { - const release = await contract['getReleaseByIdAndSubnetId']( - config.subnetId, - releaseIdPadded - ); - - // 5. Verify release status is active - if (release.status !== ReleaseStatus.Active) { - throw new NetworkError( - { info: { releaseId, status: release.status } }, - `Release is not active: status ${release.status}` - ); - } - - // 6. Verify environment matches - if (release.env !== config.environment) { - throw new NetworkError( - { - info: { - releaseId, - releaseEnv: release.env, - expectedEnv: config.environment, - }, - }, - `Environment mismatch: expected ${config.environment}, got ${release.env}` - ); - } - - _logger.info('verifyReleaseId: Release verification successful', { - releaseId, - status: release.status, - environment: release.env, - }); - } catch (error: any) { - if (error.code === 'CALL_EXCEPTION') { - throw new NetworkError( - { - info: { - releaseId, - contractAddress: config.releaseRegisterContractAddress, - }, - }, - `Release ID ${releaseId} not found on chain` - ); - } - throw error; - } -}; - -// Store response strategy separately for executeJs requests -let executeJsResponseStrategy: LitActionResponseStrategy | undefined; - -// Store secret keys for PKP sign requests to use in handleResponse -// const globalPkpSignSecretKeys: Record> = {}; -// const globalPkpSignNodeKeys: Record> = {}; - -// Define ProcessedBatchResult type (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -// Define the object first -const networkModuleObject = { - id: 'naga', - version: `${version}-naga-dev`, - config: { - requiredAttestation: false, - abortTimeout: 20_000, - minimumThreshold: networkConfig.minimumThreshold, - httpProtocol: networkConfig.httpProtocol, - }, - schemas: { - GenericResponseSchema: GenericResultBuilder, - }, - getNetworkName: () => networkConfig.network, - getHttpProtocol: () => networkConfig.httpProtocol, - getEndpoints: () => networkConfig.endpoints, - getRpcUrl: () => networkConfig.rpcUrl, - getChainConfig: () => networkConfig.chainConfig, - getDefaultAuthServiceBaseUrl: () => networkConfig.services.authServiceBaseUrl, - getDefaultLoginBaseUrl: () => networkConfig.services.loginServiceBaseUrl, - getMinimumThreshold: () => networkConfig.minimumThreshold, - // composeLitUrl: composeLitUrl, - /** - * 🧠 This is the core function that keeps all the network essential information - * up to data, such as: - * - latest blockhash - * - connection info (node urls, epoch, etc.) - it listens for StateChange events - * - orchestrate handshake via callback - */ - createStateManager: async (params: { - callback: (params: CallbackParams) => Promise; - networkModule: M; - }): Promise>>> => { - return await createStateManager({ - networkConfig, - callback: params.callback, - networkModule: params.networkModule as LitNetworkModuleBase, - }); - }, - getMaxPricesForNodeProduct: getMaxPricesForNodeProduct, - getUserMaxPrice: getUserMaxPrice, - getVerifyReleaseId: () => verifyReleaseId, - chainApi: { - getPKPPermissionsManager: async (params: { - pkpIdentifier: PkpIdentifierRaw; - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.pkpPermissionsManager(params.pkpIdentifier); - }, - - /** - * Gets a PaymentManager instance for managing deposits, withdrawals, and balance queries - */ - getPaymentManager: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.paymentManager(); - }, - - /** - * Gets all PKPs associated with specific authentication data - */ - getPKPsByAuthData: async (params: { - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAuthData( - params.authData, - params.pagination, - params.storageProvider - ); - }, - - /** - * Gets all PKPs owned by a specific address - */ - getPKPsByAddress: async (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAddress({ - ownerAddress: params.ownerAddress, - pagination: params.pagination, - storageProvider: params.storageProvider, - }); - }, - - /** - * Mints a PKP using EOA directly - */ - mintWithEoa: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithEoa(); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - /** - * Mints a PKP using Auth Method - */ - mintWithAuth: async (params: { - account: ExpectedAccountOrWalletClient; - authData: Optional; - scopes: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintPKP({ - scopes: params.scopes, - // authMethod: authMethod, - authMethodId: params.authData.authMethodId, - authMethodType: params.authData.authMethodType, - pubkey: params.authData.publicKey, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - mintWithMultiAuths: async ( - params: { - account: ExpectedAccountOrWalletClient; - } & MintWithMultiAuthsRequest - ): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithMultiAuths({ - authMethodIds: params.authMethodIds, - authMethodTypes: params.authMethodTypes, - authMethodScopes: params.authMethodScopes, - pubkeys: params.pubkeys, - addPkpEthAddressAsPermittedAddress: - params.addPkpEthAddressAsPermittedAddress, - sendPkpToItself: params.sendPkpToItself, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - }, - authService: { - pkpMint: async (params: { - authData: AuthData; - authServiceBaseUrl?: string; - scopes?: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }) => { - return await handleAuthServerRequest({ - jobName: 'PKP Minting', - serverUrl: - params.authServiceBaseUrl || - networkConfig.services.authServiceBaseUrl, - path: '/pkp/mint', - body: { - authMethodType: params.authData.authMethodType, - authMethodId: params.authData.authMethodId, - pubkey: params.authData.publicKey, - scopes: params.scopes, - }, - }); - }, - }, - api: { - /** - * The Lit Client and Network Module exchange data in a request-response cycle: - * - * 1. 🟪 The Network Module constructs the request. - * 2. 🟩 The Lit Client sends it to the Lit Network. - * 3. 🟪 The Network Module processes the response. - * - * In some cases, we need to maintain a piece of state that is relevant to both step 1 (request creation) - * and step 3 (response handling). To support this, we introduce a *network-specific context object* - * that can be passed between the Lit Client and Network Module. - * - * One key example is managing a just-in-time (JIT) state for ephemeral secrets or signing keys - * — such as those used in PKP signing — which must persist across the request lifecycle. - */ - createJitContext: async ( - connectionInfo: ConnectionInfo, - handshakeResult: OrchestrateHandshakeResponse - ): Promise => { - const keySet: KeySet = {}; - - // 1. Generate a key set for the JIT context - for (const url of connectionInfo.bootstrapUrls) { - keySet[url] = { - publicKey: hexToBytes( - HexPrefixedSchema.parse( - handshakeResult.serverKeys[url].nodeIdentityKey - ) as `0x${string}` - ), - secretKey: nacl.box.keyPair().secretKey, - }; - } - - // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); - - // 2. Fetch the price feed info - const nodePrices = await getNodePrices( - { - realmId: 1, - networkCtx: networkConfig, - }, - account - ); - - return { keySet, nodePrices }; - }, - handshake: { - schemas: { - Input: { - ResponseData: RawHandshakeResponseSchema, - }, - }, - }, - pkpSign: { - schemas: { - Input: { - raw: PKPSignInputSchema, - ethereum: EthereumPKPSignInputSchema, - bitcoin: BitCoinPKPSignInputSchema, - }, - RequestData: PKPSignRequestDataSchema, - ResponseData: PKPSignResponseDataSchema, - }, - createRequest: async ( - params: PKPSignCreateRequestParams - ): Promise>[]> => { - _logger.info('pkpSign:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('pkpSign:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - - const requests: RequestItem>[] = - []; - - _logger.info('pkpSign:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - // // Reset and store secret keys for this request - // globalPkpSignSecretKeys[_requestId] = {}; - // globalPkpSignNodeKeys[_requestId] = {}; - - for (const url of urls) { - _logger.info('pkpSign:createRequest: Generating request data', { - url, - }); - - const _requestData = PKPSignRequestDataSchema.parse({ - toSign: Array.from(params.signingContext.toSign), - signingScheme: params.signingContext.signingScheme, - pubkey: params.signingContext.pubKey, - authSig: sessionSigs[url], - nodeSet: urls, - - // additional meta to determine hash function, but not - // sent to the node - chain: params.chain, - bypassAutoHashing: params.signingContext.bypassAutoHashing, - epoch: params.connectionInfo.epochState.currentNumber, - }); - - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().PKP_SIGN, - }); - - _logger.info('pkpSign:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'pkpSign:createRequest: No requests generated for pkpSign.' - ); - throw new Error('Failed to generate requests for pkpSign.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'PKP Sign' - ); - } - - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual PKP sign data from the response wrapper - const pkpSignData = decryptedJson.data; - if (!pkpSignData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - wrap in expected format - const wrappedData = { - success: pkpSignData.success, - values: [pkpSignData], // Wrap the individual response in an array - }; - - const responseData = PKPSignResponseDataSchema.parse(wrappedData); - return responseData.values[0]; // Return the individual PKP sign response - } - ); - - const signatures = await combinePKPSignSignatures({ - nodesPkpSignResponseData: decryptedValues, - requestId, - threshold: networkConfig.minimumThreshold, - }); - - return signatures; - }, - }, - decrypt: { - schemas: { - Input: DecryptInputSchema, - RequestData: DecryptRequestDataSchema, - ResponseData: DecryptResponseDataSchema, - }, - createRequest: async (params: DecryptCreateRequestParams) => { - _logger.info('decrypt:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs for decrypt - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('decrypt:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('decrypt:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('decrypt:createRequest: Generating request data', { - url, - }); - - const _requestData = DecryptRequestDataSchema.parse({ - ciphertext: params.ciphertext, - dataToEncryptHash: params.dataToEncryptHash, - accessControlConditions: params.accessControlConditions, - evmContractConditions: params.evmContractConditions, - solRpcConditions: params.solRpcConditions, - unifiedAccessControlConditions: - params.unifiedAccessControlConditions, - authSig: sessionSigs[url], - chain: params.chain, - }); - - // Encrypt the request data using the generic encryption function - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().ENCRYPTION_SIGN, - }); - - _logger.info('decrypt:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'decrypt:createRequest: No requests generated for decrypt.' - ); - throw new Error('Failed to generate requests for decrypt.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - - identityParam: string, - ciphertext: string, - subnetPubKey: string, - jitContext: NagaJitContext - ) => { - _logger.info('decrypt:handleResponse: Processing decrypt response', { - requestId, - }); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Decryption' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual decrypt data from the response wrapper - const decryptData = decryptedJson.data; - if (!decryptData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - const responseData = DecryptResponseDataSchema.parse(decryptData); - return responseData; - } - ); - - _logger.info('decrypt:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // Extract signature shares from decrypted node responses - const signatureShares = decryptedValues.map((nodeResponse: any) => { - return { - ProofOfPossession: { - identifier: - nodeResponse.signatureShare.ProofOfPossession.identifier, - value: nodeResponse.signatureShare.ProofOfPossession.value, - }, - }; - }); - - _logger.info('decrypt:handleResponse: Signature shares extracted', { - signatureShares, - }); - - // Verify and decrypt using signature shares - const decryptedData = await verifyAndDecryptWithSignatureShares( - subnetPubKey, - stringToBytes(identityParam), - ciphertext, - signatureShares - ); - - _logger.info('decrypt:handleResponse: Decryption completed'); - - return { decryptedData }; - }, - }, - signSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - // extract the authMethod from the requestBody - const authMethod = { - authMethodType: requestBody.authData.authMethodType, - accessToken: requestBody.authData.accessToken, - } as AuthMethod; - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [authMethod], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - maxPrice: getUserMaxPrice({ - product: 'SIGN_SESSION_KEY', - }).toString(), - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signSessionKey:createRequest: No requests generated for signSessionKey.' - ); - throw new Error('Failed to generate requests for signSessionKey.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signSessionKey:handleResponse: Processing signSessionKey response' - ); - - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signSessionKeyData = decryptedJson.data; - if (!signSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signSessionKey response is the individual response, return it directly - return signSessionKeyData; - } - ); - - _logger.info('signSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signSessionKey responses - const values = decryptedValues; - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info('signSessionKey:handleResponse: BLS combined signature', { - blsCombinedSignature, - }); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - signCustomSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignCustomSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signCustomSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signCustomSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signCustomSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - litActionCode: requestBody.litActionCode, - litActionIpfsId: requestBody.litActionIpfsId, - jsParams: requestBody.jsParams, - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signCustomSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signCustomSessionKey:createRequest: No requests generated for signCustomSessionKey.' - ); - throw new Error( - 'Failed to generate requests for signCustomSessionKey.' - ); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signCustomSessionKey:handleResponse: Processing signCustomSessionKey response' - ); - - // Check if the result indicates failure but has an encrypted error payload - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signCustomSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signCustomSessionKeyData = decryptedJson.data; - if (!signCustomSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signCustomSessionKey response is the individual response, return it directly - return signCustomSessionKeyData; - } - ); - - _logger.info('signCustomSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signCustomSessionKey responses - const values = decryptedValues; - - _logger.info('signCustomSessionKey:handleResponse: Values', { - values, - }); - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signCustomSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info( - 'signCustomSessionKey:handleResponse: BLS combined signature', - { - blsCombinedSignature, - } - ); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signCustomSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signCustomSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - executeJs: { - schemas: { - Input: ExecuteJsInputSchema, - RequestData: ExecuteJsRequestDataSchema, - ResponseData: ExecuteJsResponseDataSchema, - }, - createRequest: async (params: ExecuteJsCreateRequestParams) => { - _logger.info('executeJs:createRequest: Creating request', { - hasCode: !!params.executionContext.code, - hasIpfsId: !!params.executionContext.ipfsId, - hasJsParams: !!params.executionContext.jsParams, - responseStrategy: params.responseStrategy?.strategy || 'default', - }); - - // Store response strategy for later use in handleResponse - executeJsResponseStrategy = params.responseStrategy; - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('executeJs:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('executeJs:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('executeJs:createRequest: Generating request data', { - url, - }); - - // Base64 encode the code if provided - let encodedCode: string | undefined; - if (params.executionContext.code) { - encodedCode = Buffer.from( - params.executionContext.code, - 'utf-8' - ).toString('base64'); - _logger.info('executeJs:createRequest: Code encoded to base64', { - originalLength: params.executionContext.code.length, - encodedLength: encodedCode.length, - }); - } - - // Build the request data that gets sent to the nodes - const _requestData = ExecuteJsRequestDataSchema.parse({ - authSig: sessionSigs[url], - nodeSet: urls, - ...(encodedCode && { code: encodedCode }), - ...(params.executionContext.ipfsId && { - ipfsId: params.executionContext.ipfsId, - }), - ...(params.executionContext.jsParams && { - jsParams: { - jsParams: params.executionContext.jsParams, - }, - }), - }); - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().EXECUTE_JS, - }); - - _logger.info('executeJs:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'executeJs:createRequest: No requests generated for executeJs.' - ); - throw new Error('Failed to generate requests for executeJs.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'executeJs:handleResponse: Processing executeJs response', - { - requestId, - responseStrategy: executeJsResponseStrategy?.strategy || 'default', - } - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'JS execution' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedResponseValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual executeJs response data from the response wrapper - const executeJsData = decryptedJson.data; - if (!executeJsData) { - throw new Error('Decrypted response missing data field'); - } - - return executeJsData; // Return the executeJs response directly - } - ); - - // The decryptedResponseValues are individual response objects with the correct fields - // Wrap them in the expected batch result format - const batchResponseData = { - success: true, - values: decryptedResponseValues, // These are the individual executeJs responses - }; - - // Create the correctly structured ProcessedBatchResult for handleExecuteJsResponse - const correctProcessedResult: ProcessedBatchResult< - z.infer - > = { - success: true as const, - values: [batchResponseData], // batchResponseData is the ExecuteJsResponseDataSchema structure - }; - - // Use the handleResponse from the executeJs module with response strategy - const executeJsResponse = await handleExecuteJsResponse( - correctProcessedResult, - requestId, - networkConfig.minimumThreshold, - executeJsResponseStrategy - ); - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response processed successfully', - { - requestId, - hasSignatures: - !!executeJsResponse.signatures && - Object.keys(executeJsResponse.signatures).length > 0, - hasResponse: !!executeJsResponse.response, - hasClaims: - !!executeJsResponse.claims && - Object.keys(executeJsResponse.claims).length > 0, - } - ); - - return executeJsResponse; - }, - }, - }, -}; - -// Now define the type by taking the type of the object, but overriding getChainManager -export type NagaDevModule = Omit< - typeof networkModuleObject, - 'getChainManager' -> & { - getChainManager: ( - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => CreateChainManagerReturn; -}; - -// Export the correctly typed object -export const nagaDevModule = networkModuleObject as NagaDevModule; +export type NagaDevUnifiedModule = typeof nagaDev; +export { nagaDev }; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/PricingContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/PricingContextSchema.ts deleted file mode 100644 index 6ee852fe2b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/PricingContextSchema.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { z } from 'zod'; -import { getUserMaxPrice } from './getUserMaxPrice'; -import { PRODUCT_IDS } from './pricing.constants'; - -export const PricingContextSchema = z - .object({ - product: z.enum(['DECRYPTION', 'SIGN', 'LIT_ACTION']), - userMaxPrice: z.bigint().optional(), - nodePrices: z.array( - z.object({ url: z.string(), prices: z.array(z.bigint()) }) - ), - threshold: z.number(), - }) - .transform(({ product, userMaxPrice, nodePrices, threshold }) => { - const _userMaxPrice = - userMaxPrice ?? - getUserMaxPrice({ - product: product, - }); - - return { - product: { - id: PRODUCT_IDS[product], - name: product, - }, - userMaxPrice: _userMaxPrice, - nodePrices, - threshold, - }; - }); - -export type PricingContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getUserMaxPrice.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getUserMaxPrice.ts deleted file mode 100644 index 560c17c976..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getUserMaxPrice.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { PRODUCT_IDS, UNSIGNED_128_MAX } from './pricing.constants'; - -/** - * In the context for Lit pricing model, the U128 value is used as a default "unlimited" - * or maximum price when a specific `userMaxPrice` is not set - */ -export const getUserMaxPrice = (params: { - product: keyof typeof PRODUCT_IDS; -}) => { - /** Tracks the total max price a user is willing to pay for each supported product type - * This must be distributed across all nodes; each node will get a percentage of this price - * - * If the user never sets a max price, it means 'unlimited' - */ - const defaultMaxPriceByProduct: Record = { - DECRYPTION: BigInt(-1), - SIGN: BigInt(-1), - LIT_ACTION: BigInt(-1), - SIGN_SESSION_KEY: BigInt(-1), - }; - - if (defaultMaxPriceByProduct[params.product] === BigInt(-1)) { - return UNSIGNED_128_MAX; - } - - // If the user has set a max price, return that - return defaultMaxPriceByProduct[params.product]; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/scripts/00-generate-abi-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/scripts/00-generate-abi-signatures.ts deleted file mode 100644 index 523fe2b43b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/scripts/00-generate-abi-signatures.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures'; - -const JSON_FILE_PATH = process.env['NETWORK_CONFIG'] as string; - -console.log('JSON_FILE_PATH:', JSON_FILE_PATH); - -if (!JSON_FILE_PATH) { - throw new Error( - '❌ NETWORK_CONFIG is not set. Please set it in your .env file.' - ); -} - -async function main() { - await generateSignaturesFromContext({ - jsonFilePath: JSON_FILE_PATH, - networkName: 'naga-develop', - outputDir: '../generated', - useScriptDirectory: true, - - // @ts-ignore - callerPath: import.meta.url, - }); -} - -// gogogo! -main().catch(console.error); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.spec.ts deleted file mode 100644 index 5337321997..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.spec.ts +++ /dev/null @@ -1,348 +0,0 @@ -import { createStateManager } from './createStateManager'; -import { STAKING_STATES } from '@lit-protocol/constants'; -import { createReadOnlyChainManager } from '@nagaDev/ChainManager'; -import { createReadOnlyContractsManager } from '@vNaga/LitChainClient'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { createEvmEventState } from '../../../../shared/StateManager/src/createEvmEventState'; -import { createRefreshedValue } from '../../../../shared/StateManager/src/createRefreshedValue'; -import { getChildLogger } from '@lit-protocol/logger'; - -// Mock dependencies -jest.mock('@nagaDev/ChainManager'); -jest.mock('@vNaga/LitChainClient'); -jest.mock('ethers'); -jest.mock('../../../../shared/StateManager/helpers/fetchBlockchainData'); -jest.mock('../../../../shared/StateManager/src/createEvmEventState'); -jest.mock('../../../../shared/StateManager/src/createRefreshedValue'); -jest.mock('@lit-protocol/logger'); - -const mockGetChildLogger = getChildLogger as jest.Mock; -const mockCreateReadOnlyChainManager = createReadOnlyChainManager as jest.Mock; -const mockCreateReadOnlyContractsManager = - createReadOnlyContractsManager as jest.Mock; -const mockEthersContract = ethers.Contract as jest.Mock; -const mockEthersJsonRpcProvider = ethers.providers.JsonRpcProvider as jest.Mock; -const mockFetchBlockchainData = fetchBlockchainData as jest.Mock; -const mockCreateEvmEventState = createEvmEventState as jest.Mock; -const mockCreateRefreshedValue = createRefreshedValue as jest.Mock; - -describe('createStateManager', () => { - let mockNetworkConfig: any; - let mockLogger: any; - let mockGetConnectionInfo: jest.Mock; - let mockGetOrRefreshAndGet: jest.Mock; - let mockEvmEventStateInstance: { - listen: jest.Mock; - stop: jest.Mock; - onChangeCallback?: (newState: any) => Promise; - }; - - beforeEach(() => { - jest.clearAllMocks(); - - mockLogger = { - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - mockGetChildLogger.mockReturnValue(mockLogger); - - mockGetConnectionInfo = jest.fn(); - mockCreateReadOnlyChainManager.mockReturnValue({ - api: { - connection: { - getConnectionInfo: mockGetConnectionInfo, - }, - }, - }); - - mockCreateReadOnlyContractsManager.mockReturnValue({ - stakingContract: { - address: '0xStakingContractAddress', - abi: [], - }, - }); - - mockEthersContract.mockImplementation(() => ({})); - mockEthersJsonRpcProvider.mockImplementation(() => ({})); - - mockGetOrRefreshAndGet = jest.fn(); - mockCreateRefreshedValue.mockReturnValue({ - getOrRefreshAndGet: mockGetOrRefreshAndGet, - }); - - mockEvmEventStateInstance = { - listen: jest.fn(), - stop: jest.fn(), - }; - mockCreateEvmEventState.mockImplementation(({ onChange }) => { - // Capture the onChange callback to simulate events - mockEvmEventStateInstance.onChangeCallback = onChange; - return mockEvmEventStateInstance; - }); - - mockNetworkConfig = { - rpcUrl: 'http://localhost:8545', - // Add other necessary config properties if your tests need them - }; - }); - - const initialConnectionInfo = { - bootstrapUrls: ['http://node1.com'], - epochInfo: { number: 1, id: 'epoch1' }, - connectedNodes: new Map([['node1', {}]]), - }; - - const updatedConnectionInfo = { - bootstrapUrls: ['http://node2.com', 'http://node3.com'], - epochInfo: { number: 2, id: 'epoch2' }, - connectedNodes: new Map([['node2', {}]]), - }; - - it('should initialize, fetch initial connection info, and start listeners', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - expect(mockGetChildLogger).toHaveBeenCalledWith({ module: 'StateManager' }); - expect(mockCreateReadOnlyChainManager).toHaveBeenCalled(); - expect(mockCreateReadOnlyContractsManager).toHaveBeenCalledWith( - mockNetworkConfig - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockCreateEvmEventState).toHaveBeenCalled(); - expect(mockEvmEventStateInstance.listen).toHaveBeenCalled(); - expect(mockLogger.info).toHaveBeenCalledWith( - 'State manager background processes started.' - ); - }); - - it('should throw an error if initial connection info fetch fails', async () => { - const error = new Error('Failed to connect'); - mockGetConnectionInfo.mockRejectedValueOnce(error); - - await expect( - createStateManager({ networkConfig: mockNetworkConfig }) - ).rejects.toThrow('Failed to initialize state manager connection info.'); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get initial connection info for State Manager', - error - ); - }); - - describe('getLatestBlockhash', () => { - it('should return blockhash from blockhashManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const mockBlockhash = '0x123abc'; - mockGetOrRefreshAndGet.mockResolvedValueOnce(mockBlockhash); - - const blockhash = await stateManager.getLatestBlockhash(); - expect(blockhash).toBe(mockBlockhash); - expect(mockGetOrRefreshAndGet).toHaveBeenCalled(); - }); - - it('should throw error if blockhashManager fails', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const error = new Error('Blockhash fetch failed'); - mockGetOrRefreshAndGet.mockRejectedValueOnce(error); - - await expect(stateManager.getLatestBlockhash()).rejects.toThrow(error); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Error getting latest blockhash', - error - ); - }); - }); - - describe('getLatestConnectionInfo', () => { - it('should return the latest connection info', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - }); - - describe('staking state changes', () => { - it('should refresh connection info, update urls and epoch when state becomes Active and data changed', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo - mockGetConnectionInfo.mockResolvedValueOnce(updatedConnectionInfo); - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); // Initial + Active state - expect(stateManager.getLatestConnectionInfo()).toEqual( - updatedConnectionInfo - ); - expect(mockLogger.warn).toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: initialConnectionInfo.bootstrapUrls, - newUrls: updatedConnectionInfo.bootstrapUrls, - }) - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number updated from 1 to 2' - ); - }); - - it('should refresh connection info but not log warnings if URLs and epoch are the same', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo returns same data - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'BootstrapUrls remain unchanged.' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number 1 remains the same.' - ); - expect(mockLogger.warn).not.toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - }) - ); - }); - - it('should handle error when fetching connection info during Active state', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - const fetchError = new Error('Fetch connection info failed'); - mockGetConnectionInfo.mockRejectedValueOnce(fetchError); // Fail on the second call - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get connection info during staking onChange', - fetchError - ); - // Connection info should remain the initial one - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should not refresh connection info if state is not Active', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Paused); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Paused"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is "Paused", not Active. Connection info not refreshed via event.' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); // Only initial call - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should do nothing if new state is null in onChange', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await createStateManager({ networkConfig: mockNetworkConfig }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(null); - expect(mockLogger.info).not.toHaveBeenCalledWith( - expect.stringContaining('New staking state detected:') - ); - }); - }); - - describe('stop', () => { - it('should call stop on eventStateManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - stateManager.stop(); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'Stopping state manager listeners...' - ); - expect(mockEvmEventStateInstance.stop).toHaveBeenCalled(); - }); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.ts b/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.ts deleted file mode 100644 index ad2b888c8d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/createStateManager.ts +++ /dev/null @@ -1,253 +0,0 @@ -import { STAKING_STATES, STAKING_STATES_VALUES } from '@lit-protocol/constants'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { - createEvmEventState, - EventState, -} from '../../../../shared/StateManager/src/createEvmEventState'; -import { - createRefreshedValue, - RefreshedValue, -} from '../../../../shared/StateManager/src/createRefreshedValue'; -import { - ConnectionInfo, - createReadOnlyContractsManager, -} from '../../../LitChainClient'; -import { createReadOnlyChainManager } from '../chain-manager/createChainManager'; -import { NagaStagingNetworkConfig } from '../naga-dev.config'; -// Import EpochInfo type (adjust path if necessary based on actual export location) -import { getChildLogger } from '@lit-protocol/logger'; -import type { CallbackParams, EndPoint, EpochInfo } from '@lit-protocol/types'; -import { LitNetworkModuleBase } from '../../../../types'; -import { areStringArraysDifferent } from './helper/areStringArraysDifferent'; - -const _logger = getChildLogger({ - module: 'StateManager', -}); - -const BLOCKHASH_SYNC_INTERVAL = 30_000; - -// export type EndPoint = { -// [key: string]: { -// path: string; -// version: string; -// }; -// }; - -// export type CallbackParams = { -// bootstrapUrls: string[]; -// currentEpoch: number; -// version: string; -// requiredAttestation: boolean; -// minimumThreshold: number; -// abortTimeout: number; -// endpoints: EndPoint[]; -// }; - -/** - * It returns a blockhash manager for latestBlockhash/nonce and event state - * manager for latest connection info. - */ -export const createStateManager = async (params: { - networkConfig: NagaStagingNetworkConfig; - callback: (params: CallbackParams) => Promise; - networkModule: LitNetworkModuleBase; -}) => { - // --- Internal State --- Keep track of the latest known values - let latestBootstrapUrls: string[] = []; - let latestEpochInfo: EpochInfo | null = null; - let latestConnectionInfo: ConnectionInfo | null = null; - let callbackResult: T | null = null; - - // just a test to check on the Lit Client we are getting the latest result - // let counter = 0; - - // --- Internal Managers --- (Not directly exposed) - const blockhashManager: RefreshedValue = createRefreshedValue( - { - fetch: fetchBlockchainData, - ttlMs: BLOCKHASH_SYNC_INTERVAL, - } - ); - - const readOnlyChainManager = createReadOnlyChainManager(); - const contractManager = createReadOnlyContractsManager(params.networkConfig); - - // --- Initial Fetch for Connection Info --- - try { - const initialConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - latestBootstrapUrls = initialConnectionInfo.bootstrapUrls; - latestEpochInfo = initialConnectionInfo.epochInfo; // Store initial epoch info - latestConnectionInfo = initialConnectionInfo; // Store initial connection info - _logger.info({ - msg: 'State Manager Initialized with Connection Info', - initialUrls: latestBootstrapUrls, - initialEpoch: latestEpochInfo?.number, - initialConnectionInfo, - }); - - // --- Initial callback - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo?.number, - version: params.networkModule.version, - requiredAttestation: params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - // releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - } catch (error: any) { - _logger.error( - 'Failed to get initial connection info for State Manager', - error - ); - // Depending on requirements, might want to re-throw or handle differently - throw new Error(error); - } - - // --- Setup Staking Event Listener --- - const stakingContract = new ethers.Contract( - contractManager.stakingContract.address, - contractManager.stakingContract.abi, - new ethers.providers.JsonRpcProvider(params.networkConfig.rpcUrl) - ); - - const eventStateManager: EventState = - createEvmEventState({ - contract: stakingContract, - eventName: 'StateChanged', - initialValue: null, // Initial value of the *event state itself* - transform: (args: any[]): STAKING_STATES_VALUES => { - return args[0] as STAKING_STATES_VALUES; - }, - onChange: async (newState) => { - // 1. check if the new state is valid - if (newState === null) return; - - _logger.info(`New staking state detected: "${newState}"`); - - // 2. If state is Active, refresh connection info - if (newState === (STAKING_STATES.Active as STAKING_STATES_VALUES)) { - try { - _logger.info( - '🖐 Staking state is Active. Fetching latest connection info...' - ); - const newConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - const newBootstrapUrls = newConnectionInfo.bootstrapUrls; - const newEpochInfo = newConnectionInfo.epochInfo; // Get new epoch info - latestConnectionInfo = newConnectionInfo; // Update internal state for connection info - - const bootstrapUrlsChanged = areStringArraysDifferent( - latestBootstrapUrls, - newBootstrapUrls - ); - - if (bootstrapUrlsChanged) { - _logger.warn({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: latestBootstrapUrls, - newUrls: newBootstrapUrls, - }); - latestBootstrapUrls = newBootstrapUrls; // Update internal state - } else { - _logger.info('BootstrapUrls remain unchanged.'); - } - - // Always update epoch info when Active state is processed - if (latestEpochInfo?.number !== newEpochInfo.number) { - _logger.info( - `Epoch number updated from ${latestEpochInfo?.number} to ${newEpochInfo.number}` - ); - latestEpochInfo = newEpochInfo; - } else { - _logger.info( - `Epoch number ${newEpochInfo.number} remains the same.` - ); - } - - // -- callback - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo!.number, - version: params.networkModule.version, - requiredAttestation: - params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - } catch (error) { - _logger.error( - 'Failed to get connection info during staking onChange', - error - ); - // Decide how to handle this error - maybe keep old state? - } - } else { - _logger.info( - `Staking state is "${newState}", not Active. Connection info not refreshed via event.` - ); - } - }, - }); - - // --- Start Listeners --- - // Assumes createEvmEventState requires explicit start or returns an interface with listen() - // If createRefreshedValue requires explicit start, call it too. - // Adjust based on actual library API. - eventStateManager.listen(); // Assuming .listen() starts the EVM listener - - _logger.info('State manager background processes started.'); - - // -- Start counter - // const timer = setInterval(() => { - // counter++; - // }, 3000); - - // --- Return the Public Interface --- - return { - /** - * Gets the latest known blockhash, potentially triggering a fetch or refresh if needed. - */ - getLatestBlockhash: async (): Promise => { - try { - return await blockhashManager.getOrRefreshAndGet(); - } catch (error) { - _logger.error('Error getting latest blockhash', error); - throw error; // Re-throw after logging - } - }, - - getCallbackResult: (): T | null => { - return callbackResult; - }, - - // getCounter: (): number => { - // return counter; - // }, - - /** - * Gets the latest known connection info, updated when staking state becomes Active. - */ - getLatestConnectionInfo: (): ConnectionInfo | null => { - // Return a deep copy if ConnectionInfo is mutable, otherwise direct return is fine - return latestConnectionInfo ? { ...latestConnectionInfo } : null; - }, - - /** - * Stops the background listeners (blockhash refresh, event listening). - */ - stop: () => { - _logger.info('Stopping state manager listeners...'); - // RefreshedValue does not have a stop method, only stop the event listener - eventStateManager.stop(); - // clearInterval(timer); - }, - }; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.CreateRequestParams.ts deleted file mode 100644 index d7e1ab9a2d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { ConnectionInfo } from '../../../../LitChainClient/types'; -import type { z } from 'zod'; -import type { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import type { NagaJitContext } from '@lit-protocol/types'; - -export type DecryptCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - ciphertext: string; - dataToEncryptHash: string; - accessControlConditions?: any; - evmContractConditions?: any; - solRpcConditions?: any; - unifiedAccessControlConditions?: any; - connectionInfo: ConnectionInfo; - version: string; - chain: string; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.InputSchema.ts deleted file mode 100644 index 51c466a3b6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.InputSchema.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { z } from 'zod'; -import { DecryptRequestSchema } from '@lit-protocol/schemas'; - -export const DecryptInputSchema = DecryptRequestSchema; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.RequestDataSchema.ts deleted file mode 100644 index 2523102a9c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.RequestDataSchema.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { z } from 'zod'; -import { MultipleAccessControlConditionsSchema } from '@lit-protocol/access-control-conditions-schemas'; -import { AuthSigSchema } from '@lit-protocol/schemas'; - -export const DecryptRequestDataSchema = - MultipleAccessControlConditionsSchema.extend({ - ciphertext: z.string(), - dataToEncryptHash: z.string(), - authSig: AuthSigSchema, - chain: z.string(), - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.ResponseDataSchema.ts deleted file mode 100644 index 0a1d70f163..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/decrypt/decrypt.ResponseDataSchema.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { z } from 'zod'; - -export const DecryptResponseDataSchema = z.object({ - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - // Keep backward compatibility fields - share_id: z.string().optional(), - signature_share: z.string().optional(), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/e2ee-request-manager/E2EERequestManager.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/e2ee-request-manager/E2EERequestManager.ts deleted file mode 100644 index 42a83e4836..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/e2ee-request-manager/E2EERequestManager.ts +++ /dev/null @@ -1,200 +0,0 @@ -import { walletDecrypt, walletEncrypt } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { NagaJitContext } from '@lit-protocol/types'; -import { bytesToHex, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, -} from '@lit-protocol/schemas'; - -const _logger = getChildLogger({ - module: 'E2EERequestManager', -}); - -/** - * Generic function to encrypt request data using JIT context - * @param requestData The request data to encrypt - * @param url The node URL to encrypt for - * @param jitContext The JIT context containing key mappings - * @returns Encrypted payload ready to send to the node - */ -const encryptRequestData = ( - requestData: any, - url: string, - jitContext: NagaJitContext -): z.infer => { - if (!jitContext.keySet[url]) { - throw new Error(`No encryption keys found for node URL: ${url}`); - } - - return walletEncrypt( - jitContext.keySet[url].secretKey, // client secret key - jitContext.keySet[url].publicKey, // node public key - stringToBytes(JSON.stringify(requestData)) - ); -}; - -/** - * Generic function to decrypt batch responses using JIT context - * @param encryptedResult The encrypted batch result from nodes - * @param jitContext The JIT context containing key mappings - * @param extractResponseData Function to extract actual response data from decrypted content - * @returns Array of decrypted response values - */ -const decryptBatchResponse = ( - encryptedResult: z.infer, - jitContext: NagaJitContext, - extractResponseData: (decryptedJson: any) => T -): T[] => { - const parsedResult = GenericEncryptedPayloadSchema.parse(encryptedResult); - - if (!parsedResult.success) { - throw new Error(`Batch decryption failed: ${JSON.stringify(parsedResult)}`); - } - - const decryptedValues: T[] = []; - - // Create a reverse mapping: nodePublicKey -> client secret key - const verificationKeyToSecretKey: Record< - string, - { url: string; secretKey: Uint8Array } - > = {}; - - for (const url of Object.keys(jitContext.keySet)) { - // Convert the stored node public key (Uint8Array) to hex string without 0x prefix - const nodePublicKeyHex = bytesToHex( - jitContext.keySet[url].publicKey - ).replace('0x', ''); - verificationKeyToSecretKey[nodePublicKeyHex] = { - url, - secretKey: jitContext.keySet[url].secretKey, - }; - } - - // Decrypt each encrypted payload - for (let i = 0; i < parsedResult.values.length; i++) { - const encryptedResponse = parsedResult.values[i]; - const verificationKey = encryptedResponse.payload.verification_key; - - // Find the correct secret key for this response based on verification key - const keyData = verificationKeyToSecretKey[verificationKey]; - - if (!keyData) { - throw new Error( - `No secret key found for verification key: ${verificationKey}` - ); - } - - try { - const encryptedPayload: z.infer = { - version: encryptedResponse.version, - payload: encryptedResponse.payload, - }; - - const decrypted = walletDecrypt(keyData.secretKey, encryptedPayload); - - // Parse the decrypted content - const decryptedText = new TextDecoder().decode(decrypted); - const parsedData = JSON.parse(decryptedText); - - // Extract the actual response data using the provided function - const responseData = extractResponseData(parsedData); - decryptedValues.push(responseData); - } catch (decryptError) { - const errorMessage = - decryptError instanceof Error ? decryptError.message : 'Unknown error'; - throw new Error( - `Failed to decrypt response ${i} with key from ${keyData.url}: ${errorMessage}` - ); - } - } - - if (decryptedValues.length === 0) { - throw new Error('No responses were successfully decrypted'); - } - - return decryptedValues; -}; - -const handleEncryptedError = ( - errorResult: any, - jitContext: NagaJitContext, - operationName: string -): never => { - if (errorResult.error && errorResult.error.payload) { - // Try to decrypt the error payload to get the actual error message - try { - _logger.info( - `"${operationName}": Attempting to decrypt error payload for detailed error information...` - ); - - const errorAsEncryptedPayload = { - success: true, // Fake success so the decryption can proceed - values: [errorResult.error], // Wrap the error payload as if it's a successful response - }; - - const decryptedErrorValues = decryptBatchResponse( - errorAsEncryptedPayload as z.infer< - typeof GenericEncryptedPayloadSchema - >, - jitContext, - (decryptedJson) => { - return decryptedJson.data || decryptedJson; // Return whatever we can get - } - ); - - _logger.error( - `"${operationName}": Decrypted error details from nodes:`, - decryptedErrorValues - ); - - // Use the actual error message from the nodes - const firstError = decryptedErrorValues[0]; - if (firstError && firstError.error) { - const errorMessage = firstError.error; - const errorDetails = firstError.errorObject - ? `. Details: ${firstError.errorObject}` - : ''; - throw new Error( - `"${operationName}" failed. ${errorMessage}${errorDetails}` - ); - } - - // If no specific error field, show the full decrypted response - throw new Error( - `"${operationName}" failed. ${JSON.stringify(decryptedErrorValues)}` - ); - } catch (decryptError) { - _logger.error( - `"${operationName}": Failed to decrypt error payload:`, - decryptError - ); - - // If the decryptError is actually our thrown error with the node's message, re-throw it - if ( - decryptError instanceof Error && - decryptError.message.includes(`"${operationName}" failed.`) - ) { - throw decryptError; - } - - throw new Error( - `"${operationName}" failed. The nodes returned an encrypted error response that could not be decrypted. ` + - `This may indicate a configuration or network connectivity issue. ${JSON.stringify( - errorResult - )}` - ); - } - } else { - throw new Error( - `"${operationName}" failed. ${JSON.stringify(errorResult)}` - ); - } -}; - -export const E2EERequestManager = { - encryptRequestData, - decryptBatchResponse, - handleEncryptedError, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.CreateRequestParams.ts deleted file mode 100644 index 1992cd2102..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy, NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; - -export type ExecuteJsCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - executionContext: { - code?: string; - ipfsId?: string; - jsParams?: Record; - }; - connectionInfo: ConnectionInfo; - version: string; - useSingleNode?: boolean; - responseStrategy?: LitActionResponseStrategy; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.InputSchema.ts deleted file mode 100644 index d5da5b5951..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.InputSchema.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy } from '@lit-protocol/types'; -import { z } from 'zod'; - -/** - * ExecuteJs Input Schema - * Based on JsonExecutionSdkParams but following the naga-local module pattern - */ -export const ExecuteJsInputSchema = z - .object({ - /** - * JS code to run on the nodes - */ - code: z.string().optional(), - - /** - * The IPFS ID of some JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * An object that contains params to expose to the Lit Action. - * These will be injected to the JS runtime before your code runs. - */ - jsParams: z - .union([ - z.any(), - z - .object({ - publicKey: z.string().optional(), - sigName: z.string().optional(), - }) - .catchall(z.any()), - ]) - .optional(), - - /** - * Authentication context - either PKP or EOA based - */ - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - - /** - * User's maximum price they're willing to pay for the request - */ - userMaxPrice: z.bigint().optional(), - - /** - * Only run the action on a single node; this will only work if all code in your action is non-interactive - */ - useSingleNode: z.boolean().optional(), - - /** - * Response strategy for processing Lit Action responses - */ - responseStrategy: z.custom().optional(), - }) - .refine((data) => data.code || data.ipfsId, { - message: "Either 'code' or 'ipfsId' must be provided", - path: ['code'], - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.RequestDataSchema.ts deleted file mode 100644 index 8efc97c999..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.RequestDataSchema.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { AuthSigSchema, NodeSetsFromUrlsSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -/** - * ExecuteJs Request Data Schema - * This defines the structure of the request sent to the nodes for executeJs - * Based on the actual working format - only includes fields sent to nodes - */ -export const ExecuteJsRequestDataSchema = z.object({ - /** - * JS code to run on the nodes (base64 encoded) - */ - code: z.string().optional(), - - /** - * The IPFS ID of JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * Parameters to expose to the Lit Action - */ - jsParams: z.record(z.any()).optional(), - - /** - * Authentication signature - */ - authSig: AuthSigSchema, - - /** - * Node set for the request - automatically transforms URLs to nodeSet format - */ - nodeSet: NodeSetsFromUrlsSchema, -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ResponseDataSchema.ts deleted file mode 100644 index 99d621e531..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ResponseDataSchema.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { z } from 'zod'; - -/** - * Schema for Lit Action signed data - * This is completely flexible to handle any signature structure that can be returned - * since the structure depends entirely on what the Lit Action code does and what - * sigName(s) are used in the signing operations - */ -const LitActionSignedDataSchema = z.any(); - -/** - * Schema for Lit Action claim data - */ -const LitActionClaimDataSchema = z.object({ - signatures: z.array(z.any()), - derivedKeyId: z.string(), -}); - -/** - * ExecuteJs Response Data Schema - * This defines the structure of responses from nodes for executeJs requests - * Based on ExecuteJsValueResponse interface - */ -export const ExecuteJsResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - /** - * Success status of the execution - */ - success: z.boolean(), - - /** - * Claim data from the Lit Action execution - */ - claimData: z.record(z.string(), LitActionClaimDataSchema), - - /** - * Any decrypted data from the execution - */ - decryptedData: z.any(), - - /** - * Console logs from the Lit Action execution - */ - logs: z.string(), - - /** - * Response data from the Lit Action (usually JSON string) - */ - response: z.string(), - - /** - * Signed data from the Lit Action execution - */ - signedData: z.record(z.string(), LitActionSignedDataSchema), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ts deleted file mode 100644 index 54af39d68d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/executeJs.ts +++ /dev/null @@ -1,529 +0,0 @@ -/** - * ExecuteJs API Implementation for naga-local - * - * This module provides the executeJs functionality following the same pattern as pkpSign - * but adapted for Lit Action execution with signature combination and response processing. - * - * Features: - * - Handles response aggregation and signature combination - * - Processes claims, logs, and response data - * - Includes response strategy processing (mostCommon, leastCommon, custom) - * - Follows the established naga-local module pattern - * - * Usage: - * This is used internally by the naga-local module to handle executeJs responses. - */ - -import { findMostCommonResponse } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { - ExecuteJsResponse, - LitActionResponseStrategy, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { combineExecuteJSSignatures } from '../helper/get-signatures'; -import { ExecuteJsValueResponse, LitActionClaimData } from '../types'; -import { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; - -const _logger = getChildLogger({ - module: 'executeJs-api', -}); - -// Define ProcessedBatchResult type locally (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -/** - * Find frequency of elements in an array - * @param arr Array of elements to analyze - * @returns Object with min (least common) and max (most common) elements - */ -const _findFrequency = (arr: T[]): { min: T; max: T } => { - const frequency: Map = new Map(); - - // Count frequencies - for (const item of arr) { - const key = JSON.stringify(item); - const existing = frequency.get(key); - if (existing) { - existing.count++; - } else { - frequency.set(key, { count: 1, value: item }); - } - } - - // Find min and max - let minCount = Infinity; - let maxCount = 0; - let minValue = arr[0]; - let maxValue = arr[0]; - - for (const { count, value } of Array.from(frequency.values())) { - if (count < minCount) { - minCount = count; - minValue = value; - } - if (count > maxCount) { - maxCount = count; - maxValue = value; - } - } - - return { min: minValue, max: maxValue }; -}; - -/** - * Process Lit Action response strategy - * @param responses Array of ExecuteJs responses from nodes - * @param strategy Response strategy configuration - * @returns Processed response based on strategy - */ -export const processLitActionResponseStrategy = ( - responses: ExecuteJsValueResponse[], - strategy: LitActionResponseStrategy -) => { - const executionResponses = responses.map((nodeResp) => { - return nodeResp.response; - }); - - const copiedExecutionResponses = executionResponses.map((r) => { - return '' + r; - }); - - if (strategy.strategy === 'custom') { - try { - if (strategy.customFilter) { - const customResponseFilterResult = strategy?.customFilter( - executionResponses as any - ); - return customResponseFilterResult; - } else { - _logger.error( - 'Custom filter specified for response strategy but none found. using most common' - ); - } - } catch (e) { - _logger.error( - 'Error while executing custom response filter, defaulting to most common', - (e as Error).toString() - ); - } - } - - const respFrequency = _findFrequency(copiedExecutionResponses); - if (strategy?.strategy === 'leastCommon') { - _logger.info( - 'strategy found to be least common, taking least common response from execution results' - ); - return respFrequency.min; - } else if (strategy?.strategy === 'mostCommon') { - _logger.info( - 'strategy found to be most common, taking most common response from execution results' - ); - return respFrequency.max; - } else { - _logger.info( - 'no strategy found, using least common response object from execution results' - ); - return respFrequency.min; - } -}; - -/** - * Check if an object contains signature data (r, s, v properties) - * @param obj Object to check - * @returns true if object contains signature properties - */ -const _isSignatureObject = (obj: any): boolean => { - return ( - typeof obj === 'object' && - obj !== null && - 'r' in obj && - 's' in obj && - 'v' in obj - ); -}; - -/** - * Extract signature data from parsed response objects - * @param responses Array of parsed response objects - * @returns Object containing signatures and cleaned responses - */ -const _extractSignaturesFromResponses = ( - responses: ExecuteJsValueResponse[] -): { - hasSignatureData: boolean; - signatureShares: Array<{ signature: any; derivedKeyId?: string }>; - cleanedResponses: ExecuteJsValueResponse[]; -} => { - const signatureShares: Array<{ signature: any; derivedKeyId?: string }> = []; - const cleanedResponses: ExecuteJsValueResponse[] = []; - let hasSignatureData = false; - - for (const nodeResp of responses) { - try { - const parsedResponse = JSON.parse(nodeResp.response as string); - - // Check if response contains signature data - if (parsedResponse && typeof parsedResponse === 'object') { - // Look for direct signature object - if (_isSignatureObject(parsedResponse)) { - hasSignatureData = true; - signatureShares.push({ signature: parsedResponse }); - // For direct signature objects, set response to empty or success message - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify({ success: true }), - }); - } - // Look for signature within response object (like your example) - else if (parsedResponse.signature) { - let signatureObj; - try { - // Handle case where signature is a string that needs parsing - signatureObj = - typeof parsedResponse.signature === 'string' - ? JSON.parse(parsedResponse.signature) - : parsedResponse.signature; - - if (_isSignatureObject(signatureObj)) { - hasSignatureData = true; - signatureShares.push({ signature: signatureObj }); - - // Remove signature from response and keep the rest - const cleanedResponse = { ...parsedResponse }; - delete cleanedResponse.signature; - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // Not a signature object, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse signature, keep response as-is - cleanedResponses.push(nodeResp); - } - } else { - // Check for nested signature objects in response properties - let foundSignature = false; - const cleanedResponse = { ...parsedResponse }; - - for (const [key, value] of Object.entries(parsedResponse)) { - if (_isSignatureObject(value)) { - hasSignatureData = true; - foundSignature = true; - signatureShares.push({ signature: value }); - delete cleanedResponse[key]; - } - } - - if (foundSignature) { - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // No signature data found, keep as-is - cleanedResponses.push(nodeResp); - } - } - } else { - // Not an object response, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse JSON, keep original response - cleanedResponses.push(nodeResp); - } - } - - return { hasSignatureData, signatureShares, cleanedResponses }; -}; - -/** - * Handles the response from executeJs operation - * - * @param result - The batch result from executing the requests - * @param requestId - Request ID for logging - * @param threshold - Minimum number of successful responses required - * @param responseStrategy - Optional response strategy for processing responses - * @returns Promise resolving to the executeJs response - */ -export const handleResponse = async ( - result: ProcessedBatchResult>, - requestId: string, - threshold: number, - responseStrategy?: LitActionResponseStrategy -): Promise => { - _logger.info('executeJs:handleResponse: Processing executeJs response', { - requestId, - threshold, - responseStrategy: responseStrategy?.strategy || 'default', - }); - - if (!result.success) { - _logger.error('executeJs:handleResponse: Batch failed', { - requestId, - error: 'error' in result ? result.error : 'Unknown error', - }); - throw new Error( - `ExecuteJs batch failed: ${JSON.stringify( - 'error' in result ? result.error : 'Unknown error' - )}` - ); - } - - // Extract the ExecuteJsResponseDataSchema from the ProcessedBatchResult - const executeJsResponseData = result.values[0]; - const { values } = ExecuteJsResponseDataSchema.parse(executeJsResponseData); - - _logger.info('executeJs:handleResponse: Response values received', { - requestId, - valueCount: values.length, - successfulValues: values.filter((v) => v.success).length, - }); - - // Filter successful responses - const successfulValues = values.filter((value) => value.success); - - if (successfulValues.length < threshold) { - throw new Error( - `Not enough successful executeJs responses. Expected ${threshold}, got ${successfulValues.length}` - ); - } - - // Convert to ExecuteJsValueResponse format for compatibility with old code - const responseData: ExecuteJsValueResponse[] = successfulValues.map( - (value) => ({ - success: value.success, - response: value.response, - logs: value.logs, - signedData: value.signedData || {}, - claimData: Object.entries(value.claimData || {}).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signature: '', // Convert from signatures array to single signature for compatibility - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ), - decryptedData: value.decryptedData || {}, - }) - ); - - // Check for signature data in responses and extract if found - const { hasSignatureData, signatureShares, cleanedResponses } = - _extractSignaturesFromResponses(responseData); - - // Use cleaned responses for further processing if signatures were extracted - const dataToProcess = hasSignatureData ? cleanedResponses : responseData; - - // Find most common response data using the existing function - const mostCommonResponse = findMostCommonResponse(dataToProcess); - - // Apply response strategy processing - const responseFromStrategy = processLitActionResponseStrategy( - dataToProcess, - responseStrategy ?? { strategy: 'leastCommon' } - ); - mostCommonResponse.response = responseFromStrategy as string; - - const hasSignedData = Object.keys(mostCommonResponse.signedData).length > 0; - const hasClaimData = Object.keys(mostCommonResponse.claimData).length > 0; - - // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - if (!hasSignedData && !hasClaimData && !hasSignatureData) { - return { - success: mostCommonResponse.success, - claims: {}, - signatures: {}, - response: mostCommonResponse.response, - logs: mostCommonResponse.logs, - }; - } - - // ========== Extract shares from response data ========== - - // Combine signatures if any exist - let signatures: Record = {}; - - if (hasSignedData) { - _logger.info( - 'executeJs:handleResponse: Combining signatures from signedData', - { - requestId, - } - ); - - signatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: dataToProcess, - requestId, - threshold, - }); - - _logger.info('executeJs:handleResponse: Signatures combined successfully', { - requestId, - signatureKeys: Object.keys(signatures), - }); - } - - // Handle signatures extracted from response data - if (hasSignatureData) { - _logger.info( - 'executeJs:handleResponse: Processing signatures from response data', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // Check if these are final signatures (with r,s,v) or signature shares that need combining - const firstSignature = signatureShares[0]?.signature; - const isFinalSignature = _isSignatureObject(firstSignature); - - if (isFinalSignature) { - _logger.info( - 'executeJs:handleResponse: Detected final signatures in response, using directly', - { - requestId, - } - ); - - // These are final signatures, not shares - use them directly - // Apply most common strategy to pick the signature to use - const signatureObjects = signatureShares.map((share) => share.signature); - const mostCommonSignature = findMostCommonResponse( - signatureObjects.map((sig) => ({ response: JSON.stringify(sig) })) - ); - - // Convert r,s,v to the expected signature format - const parsedSignature = JSON.parse(mostCommonSignature.response); - const signature = { - r: parsedSignature.r, - s: parsedSignature.s, - recovery: parsedSignature.v, - v: parsedSignature.v, - // Create full signature string if needed - signature: `0x${parsedSignature.r}${ - parsedSignature.s - }${parsedSignature.v.toString(16).padStart(2, '0')}`, - }; - - signatures['response_signature'] = signature; - - _logger.info( - 'executeJs:handleResponse: Final signature processed successfully', - { - requestId, - signatureKeys: ['response_signature'], - } - ); - } else { - _logger.info( - 'executeJs:handleResponse: Detected signature shares, combining them', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // These are signature shares that need to be combined - // Convert signature shares to the format expected by combineExecuteJSSignatures - const signatureResponseData: ExecuteJsValueResponse[] = - signatureShares.map((share, index) => ({ - success: true, - response: '', - logs: '', - signedData: { - response_signature: { - publicKey: share.derivedKeyId || '', // Use derivedKeyId as publicKey fallback - signatureShare: JSON.stringify(share.signature), - sigName: 'response_signature', - sigType: 'K256' as any, // Default to K256 for ECDSA - }, - }, - claimData: {}, - decryptedData: {}, - })); - - const responseSignatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: signatureResponseData, - requestId, - threshold, - }); - - // Merge with existing signatures - signatures = { ...signatures, ...responseSignatures }; - - _logger.info( - 'executeJs:handleResponse: Signature shares combined successfully', - { - requestId, - responseSignatureKeys: Object.keys(responseSignatures), - } - ); - } - } - - // Process claims data if present - let claims: Record = {}; - - if (hasClaimData) { - _logger.info('executeJs:handleResponse: Processing claims data', { - requestId, - claimKeys: Object.keys(mostCommonResponse.claimData), - }); - - // Convert claim data to expected format - claims = Object.entries(mostCommonResponse.claimData).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signatures: [claimData.signature], // Convert single signature to array format - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ); - } - - // Try to parse response as JSON if it's a string - let processedResponse: string | object = mostCommonResponse.response || ''; - - if (typeof processedResponse === 'string' && processedResponse.trim()) { - try { - // Attempt to parse as JSON - const parsed = JSON.parse(processedResponse); - // Keep as parsed object if it's valid JSON - processedResponse = parsed; - } catch { - // Keep as string if not valid JSON - // This is expected behaviour for non-JSON responses - } - } - - const executeJsResponse: ExecuteJsResponse = { - success: true, - signatures, - response: processedResponse, - logs: mostCommonResponse.logs || '', - ...(Object.keys(claims).length > 0 && { claims }), - }; - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response created successfully', - { - requestId, - hasSignatures: Object.keys(signatures).length > 0, - hasResponse: !!processedResponse, - hasClaims: Object.keys(claims).length > 0, - } - ); - - return executeJsResponse; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/index.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/index.ts deleted file mode 100644 index 5a1147e856..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/executeJs/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ExecuteJs API Manager Index - * - * Exports the main functions for the executeJs API following the naga-local module pattern. - */ - -export { handleResponse } from './executeJs'; -export type { ExecuteJsCreateRequestParams } from './executeJs.CreateRequestParams'; -export { ExecuteJsInputSchema } from './executeJs.InputSchema'; -export { ExecuteJsRequestDataSchema } from './executeJs.RequestDataSchema'; -export { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/handshake/handshake.schema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/handshake/handshake.schema.ts deleted file mode 100644 index 205cb629ff..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/handshake/handshake.schema.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { GenericResultBuilder, HexSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const RawHandshakeResponseSchema = GenericResultBuilder( - z.object({ - serverPublicKey: z.string(), - subnetPublicKey: z.string(), - networkPublicKey: z.string(), - networkPublicKeySet: z.string(), - clientSdkVersion: z.string(), - hdRootPubkeys: z.array(z.string()), - attestation: z.any().optional(), // ❗️ Attestation data if provided by node. -dev version will be null. - latestBlockhash: HexSchema, - nodeIdentityKey: z.string(), - nodeVersion: z.string(), - epoch: z.number(), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.test.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.test.ts deleted file mode 100644 index 3671f6d652..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.test.ts +++ /dev/null @@ -1,438 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - ExecuteJsValueResponse, - LitNodeSignature, - PKPSignEndpointResponse, -} from '@lit-protocol/types'; - -import { - combineExecuteJSSignatures, - combinePKPSignSignatures, -} from './get-signatures'; - -const requestId = 'REQUEST_ID'; -const threshold = 3; - -describe('combineExecuteJSSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: false, - signedData: {}, - decryptedData: {}, - claimData: {}, - response: '', - logs: '', - }, - ]; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"B7AF0DBCE67A07EFDEB38D44491673EF23CC9FF9CBC81399A2C3A3948ED2B1BC\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"2F4376CF77A51A7EFBC604FAFFC56F31A7370B359C559EF56C51EA236C8C3F70\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '266e0aae5b98f78a82c7e11072b0a9cb1284dd1b326c34aa144d44f6c31f48f520fcc05ac9e243aa2596cb8c65ce1e015bc3d690243b9f462cccd8f5600bcc341c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - ]; - const combinedSignatures: Record = { - ethPersonalSignMessageEcdsa: { - signature: - '0x64400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA13250B66E224A3E84AE9F8077BC751575AD904E19F0506A34C669E116F7F34DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - signEcdsa: { - signature: - '0x5AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A6FB7EB58D7AA6C7BFE5A2A510B3C237335EC0BCDE15BE1CE2658E265E55918DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - }; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignatures); - }); -}); - -describe('combinePKPSignSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"3D53B4698F798F98F65D2CB90BFD170278E7014E3DA87E217BCAAEBBB8D5DDF9"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"A0DD6D5EEC9EADACF86E14C8B252344EAEB505B722F5A7C18ECB4F3FFA44A3AE"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: false, - signedData: [], - signatureShare: { - EcdsaSignedMessageShare: { - digest: '', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1"', - peer_id: - '5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a', - signature_share: - '"159E02F1F0B5B875FE65A8A534109E0A35DAE0F900FC3CDE2400491289A975FD"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"F3B8CAAAC28A09D5F9125D6FD0A122E41451CDDCE8E9001C07D8D91F5DBE0F23"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"42D2DA7F7E05CBCF927EA934797919D2857AA9D7EB35F3BECAE0C59BC62B81E0"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - const combinedSignature: LitNodeSignature = { - signature: - '0x265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC244C29A81C31458E1B89F6AF497E2ADAC214F87BC725D2907D36E78940DD5CC5BF', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A034200042E0CFE8E42758449DA56EF09669EC4A31C3D8B55F8B28D390C830264D1426DC73BBE2171D83F52483A66922746BFDA297BD1DC69C4D5ED5163A523B0B10D0DB3', - signedData: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - recoveryId: 1, - publicKey: - '0x042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3', - sigType: 'EcdsaK256Sha256', - }; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignature); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.ts deleted file mode 100644 index 891700532b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/get-signatures.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - applyTransformations, - cleanStringValues, - combineExecuteJsNodeShares, - combinePKPSignNodeShares, - hexifyStringValues, - logErrorWithRequestId, - mostCommonString, -} from '@lit-protocol/crypto'; -import { - PKPSignEndpointResponse as CryptoPKPSignEndpointResponse, - LitNodeSignature, - SigType, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { PKPSignResponseDataSchema } from '../pkpSign/pkpSign.ResponseDataSchema'; -import { - ExecuteJsValueResponse, - LitActionSignedData, - PKPSignEndpointResponse as LocalPKPSignEndpointResponse, -} from '../types'; -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -function assertThresholdShares( - requestId: string, - threshold: number, - shares: { success: boolean }[] -) { - const successfulShareSources = shares.filter((response) => response.success); - - if (successfulShareSources.length < threshold) { - logErrorWithRequestId( - requestId, - `Not enough successful items. Expected ${threshold}, got ${successfulShareSources.length}` - ); - throw new NoValidShares( - { - info: { - requestId, - itemCount: shares.length, - successfulItems: successfulShareSources.length, - threshold, - }, - }, - `The total number of successful items "${successfulShareSources.length}" does not meet the threshold of "${threshold}"` - ); - } -} - -/** - * Combines signature shares from multiple nodes running a lit action to generate the final signatures. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesLitActionSignedData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combineExecuteJSSignatures = async (params: { - nodesLitActionSignedData: ExecuteJsValueResponse[]; - requestId: string; - threshold: number; -}): Promise> => { - const { threshold, requestId, nodesLitActionSignedData } = params; - - assertThresholdShares(requestId, threshold, nodesLitActionSignedData); - - const sigResponses = {} as Record; - - // Group signature shares by signature name (e.g., "random-sig-name", "sig-identifier", etc.) - const keyedSignedData = nodesLitActionSignedData.reduce< - Record - >((acc, nodeLitActionSignedData) => { - Object.keys(nodeLitActionSignedData.signedData).forEach((signedDataKey) => { - if (!acc[signedDataKey]) { - acc[signedDataKey] = []; - } - - acc[signedDataKey].push( - nodeLitActionSignedData.signedData[signedDataKey] - ); - }); - - return acc; - }, {} as Record); - - const signatureKeys = Object.keys(keyedSignedData); - - await Promise.all( - signatureKeys.map(async (signatureKey) => { - const signatureShares = keyedSignedData[signatureKey]; - - // Parse signature shares similar to PKP sign process - const preparedShares: Array<{ - originalShare: LitActionSignedData; - parsedSignatureShareObject: any; - publicKey?: string; - sigType?: string; - }> = []; - - for (const share of signatureShares) { - try { - // Parse the JSON string in signatureShare field - let parsedSignatureShare; - if (typeof share.signatureShare === 'string') { - parsedSignatureShare = JSON.parse(share.signatureShare); - } else { - parsedSignatureShare = share.signatureShare; - } - - // Extract publicKey and sigType from the share - let publicKey = share.publicKey; - let sigType = share.sigType; - - // If publicKey is a JSON string, parse it - if (typeof publicKey === 'string' && publicKey.startsWith('"')) { - publicKey = JSON.parse(publicKey); - } - - preparedShares.push({ - originalShare: share, - parsedSignatureShareObject: parsedSignatureShare, - publicKey, - sigType, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error parsing signature share for key ${signatureKey}: ${JSON.stringify( - share.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - preparedSharesCount: preparedShares.length, - threshold, - }, - }, - `Not enough valid signature shares for ${signatureKey}: ${preparedShares.length} (expected ${threshold})` - ); - } - - // Get most common public key and sig type - const publicKey = mostCommonString( - preparedShares.map((s) => s.publicKey).filter(Boolean) as string[] - ); - const sigType = mostCommonString( - preparedShares.map((s) => s.sigType).filter(Boolean) as string[] - ); - - if (!publicKey || !sigType) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - publicKey, - sigType, - shares: preparedShares, - }, - }, - `Could not get public key or sig type from lit action shares for ${signatureKey}` - ); - } - - // Prepare shares for crypto library (similar to PKP sign process) - const sharesForCryptoLib: LitActionSignedData[] = preparedShares.map( - (ps) => ({ - publicKey: ps.publicKey!, - signatureShare: - typeof ps.originalShare.signatureShare === 'string' - ? ps.originalShare.signatureShare - : JSON.stringify(ps.originalShare.signatureShare), - sigName: ps.originalShare.sigName, - sigType: ps.sigType! as any, // Cast to match EcdsaSigType - }) - ); - - // Combine the signature shares using the crypto library - const combinedSignature = await combineExecuteJsNodeShares( - sharesForCryptoLib - ); - - const sigResponse = applyTransformations( - { - ...combinedSignature, - publicKey, - sigType: sigType as SigType, - }, - [cleanStringValues, hexifyStringValues] - ) as unknown as LitNodeSignature; - - sigResponses[signatureKey] = sigResponse; - }) - ); - - return sigResponses; -}; - -/** - * Combines signature shares from multiple nodes running pkp sign to generate the final signature. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesPkpSignResponseData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combinePKPSignSignatures = async (params: { - nodesPkpSignResponseData: z.infer['values']; - requestId: string; - threshold: number; -}): Promise => { - const { threshold, requestId, nodesPkpSignResponseData } = params; - - // console.log( - // `[${requestId}] Initial nodesPkpSignResponseData (count: ${nodesPkpSignResponseData.length}):`, - // JSON.stringify(nodesPkpSignResponseData, null, 2) - // ); - - assertThresholdShares(requestId, threshold, nodesPkpSignResponseData); - - const sharesAfterInitialFilter = nodesPkpSignResponseData - .filter((share) => share.success) - .filter(Boolean); - - const rawShares = sharesAfterInitialFilter.filter((share) => { - const sigShareType = typeof share.signatureShare; - const sigShareIsNull = share.signatureShare === null; - const sigShareIsObjectNonNull = - sigShareType === 'object' && !sigShareIsNull; - return sigShareIsObjectNonNull; - }); - - if (rawShares.length < threshold) { - throw new NoValidShares( - { info: { requestId, rawSharesCount: rawShares.length, threshold } }, - `Not enough processable signature shares after initial filtering: ${rawShares.length} (expected ${threshold})` - ); - } - - const preparedShares: Array<{ - originalRawShare: z.infer< - typeof PKPSignResponseDataSchema - >['values'][number]; - parsedSignatureShareObject: any; - localPSEInput: LocalPKPSignEndpointResponse; - publicKey?: string; - sigType?: string; - }> = []; - - for (const rawShare of rawShares) { - try { - const signatureShareObject = rawShare.signatureShare; - preparedShares.push({ - originalRawShare: rawShare, - parsedSignatureShareObject: signatureShareObject, - localPSEInput: { - success: rawShare.success, - signedData: rawShare.signedData, - signatureShare: signatureShareObject, - }, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error processing rawShare (should be object): ${JSON.stringify( - rawShare.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesAfterParsingAttempt: preparedShares.length, - threshold, - }, - }, - `Not enough shares after object preparation: ${preparedShares.length}` - ); - } - - const parsingResults = parsePkpSignResponse( - preparedShares.map((p) => p.localPSEInput) - ); - - if (preparedShares.length !== parsingResults.length) { - logErrorWithRequestId( - requestId, - `Mismatch in length between prepared shares (${preparedShares.length}) and parsing results (${parsingResults.length})` - ); - throw new Error( - 'Share processing length mismatch after parsePkpSignResponse' - ); - } - preparedShares.forEach((ps, index) => { - const result = parsingResults[index]; - if (result) { - ps.publicKey = result.publicKey; - ps.sigType = result.sigType; - } else { - logErrorWithRequestId( - requestId, - `No parsing result for prepared share at index ${index}` - ); - } - }); - - const sharesForCryptoLib: CryptoPKPSignEndpointResponse[] = preparedShares - .filter((ps) => ps.publicKey && ps.sigType) - .map((ps) => ({ - success: ps.originalRawShare.success, - signedData: new Uint8Array(ps.originalRawShare.signedData as number[]), - signatureShare: ps.parsedSignatureShareObject, - })); - - if (sharesForCryptoLib.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesForCryptoCount: sharesForCryptoLib.length, - threshold, - }, - }, - `Not enough shares for crypto lib: ${sharesForCryptoLib.length}` - ); - } - - const combinedSignature = await combinePKPSignNodeShares(sharesForCryptoLib); - - const successfullyProcessedShares = preparedShares.filter( - (ps) => ps.publicKey && ps.sigType - ); - - const finalPublicKey = mostCommonString( - successfullyProcessedShares - .map((p) => p.publicKey) - .filter(Boolean) as string[] - ); - const finalSigType = mostCommonString( - successfullyProcessedShares - .map((p) => p.sigType) - .filter(Boolean) as string[] - ); - - if (!finalPublicKey || !finalSigType) { - throw new NoValidShares( - { - info: { - requestId, - finalPublicKey, - finalSigType, - pkSigPairsCount: successfullyProcessedShares.length, - }, - }, - 'Could not determine final public key or sig type from parsed shares' - ); - } - - const sigResponse = { - ...combinedSignature, - publicKey: finalPublicKey, - sigType: finalSigType as SigType, - }; - - return sigResponse as LitNodeSignature; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.test.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.test.ts deleted file mode 100644 index f64fe89add..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.test.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { - cleanStringValues, - convertKeysToCamelCase, - snakeToCamel, -} from '@lit-protocol/misc'; -import { PKPSignEndpointResponse } from '@lit-protocol/types'; - -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -describe('parsePkpSignResponse', () => { - it('should parse ECDSA PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - digest: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - bigR: '', - compressedPublicKey: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0x3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0xB1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); - - it('should parse FROST PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - signing_commitments: '', - verifying_share: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[21,126,1,81,188,147,173,138,16,169,115,205,1,224,43,54,73,148,113,48,206,233,7,6,217,224,119,81,249,220,48,41]]', - peer_id: - '77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signature_share: - '["K256Sha256","12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed"]', - signing_commitments: - '["K256Sha256","00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629"]', - verifying_share: - '["K256Sha256","022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[226,183,233,101,218,75,198,127,202,46,107,100,150,15,170,176,229,25,121,33,202,13,26,6,192,49,160,84,130,11,169,174]]', - peer_id: - '8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signature_share: - '["K256Sha256","5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b"]', - signing_commitments: - '["K256Sha256","00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a"]', - verifying_share: - '["K256Sha256","02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - message: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - signingCommitments: '', - verifyingShare: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 21, 126, 1, 81, 188, 147, 173, 138, 16, 169, 115, 205, 1, 224, 43, 54, - 73, 148, 113, 48, 206, 233, 7, 6, 217, 224, 119, 81, 249, 220, 48, 41, - ]), - peerId: - '0x77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signatureShare: - '0x12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed', - signingCommitments: - '0x00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629', - verifyingShare: - '0x022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 226, 183, 233, 101, 218, 75, 198, 127, 202, 46, 107, 100, 150, 15, - 170, 176, 229, 25, 121, 33, 202, 13, 26, 6, 192, 49, 160, 84, 130, 11, - 169, 174, - ]), - peerId: - '0x8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signatureShare: - '0x5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b', - signingCommitments: - '0x00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a', - verifyingShare: - '0x02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('cleanStringValues', () => { - it('should remove double quotes from string values in an object', () => { - const input = { - name: '"Josh"', - age: 18, - city: '"New York"', - }; - - const expectedOutput = { - name: 'Josh', - age: 18, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify non-string values in an object', () => { - const input = { - name: 'John', - age: 25, - city: 'New York', - }; - - const expectedOutput = { - name: 'John', - age: 25, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('convertKeysToCamelCase', () => { - it('should convert keys to camel case', () => { - const input = { - first_name: 'John', - last_name: 'Doe', - age: 25, - city_name: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify keys that are already in camel case', () => { - const input = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('snakeToCamel', () => { - it('should convert snake case to camel case', () => { - const input = 'hello_world'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should convert multiple snake case words to camel case', () => { - const input = 'hello_world_example'; - const expectedOutput = 'helloWorldExample'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify camel case words', () => { - const input = 'helloWorld'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify words without underscores', () => { - const input = 'hello'; - const expectedOutput = 'hello'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.ts deleted file mode 100644 index 8ed910072d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/helper/parse-pkp-sign-response.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - applyTransformations, - cleanArrayValues, - cleanStringValues, - convertKeysToCamelCase, - convertNumberArraysToUint8Arrays, - hexifyStringValues, -} from '@lit-protocol/crypto'; -import { PKPSignEndpointResponse, PKPSignEndpointSharesParsed } from '../types'; - -/** - * Parses the PKP sign response data and transforms it into a standardised format because the raw response contains snake cases and double quotes. - * @param responseData - The response data containing PKP sign shares. - * @returns An array of objects with the signature data. - */ -export const parsePkpSignResponse = ( - responseData: PKPSignEndpointResponse[] -): PKPSignEndpointSharesParsed[] => { - const parsedSignatureShares = responseData.map( - ({ signatureShare }) => { - // Determine if the object is lifted or contains a nested structure - // Example scenarios this logic handles: - // 1. If `signatureShare` is nested (e.g., { EcdsaSignedMessageShare: { ... } }), - // it will extract the nested object (i.e., the value of `EcdsaSignedMessageShare`). - // NOTE: against `f8047310fd4ac97ac01ff07a7cd1213808a3396e` in this case - // 2. If `signatureShare` is directly lifted (e.g., { digest: "...", result: "...", share_id: "..." }), - // it will treat `signatureShare` itself as the resolved object. - // NOTE: against `60318791258d273df8209b912b386680d25d0df3` in this case - // 3. If `signatureShare` is null, not an object, or does not match expected patterns, - // it will throw an error later for invalid structure. - const resolvedShare = - typeof signatureShare === 'object' && - !Array.isArray(signatureShare) && - Object.keys(signatureShare).length === 1 && - typeof signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] === 'object' - ? signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] - : signatureShare; - - if (!resolvedShare || typeof resolvedShare !== 'object') { - throw new Error('Invalid signatureShare structure.'); - } - - const transformations = [ - convertKeysToCamelCase, - cleanArrayValues, - convertNumberArraysToUint8Arrays, - cleanStringValues, - hexifyStringValues, - ]; - const parsedShare = applyTransformations(resolvedShare, transformations); - - // Frost has `message`, Ecdsa has `digest`. Copy both to `dataSigned` - if (parsedShare['digest'] || parsedShare['message']) { - parsedShare['dataSigned'] = - parsedShare['digest'] || parsedShare['message']; - } - - delete parsedShare['result']; - - return parsedShare as unknown as PKPSignEndpointSharesParsed; - } - ); - - return parsedSignatureShares; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.CreateRequestParams.ts deleted file mode 100644 index 5cc454dc69..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.CreateRequestParams.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - EoaAuthContextSchema, - HexPrefixedSchema, - PKPAuthContextSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { RawHandshakeResponseSchema } from '../handshake/handshake.schema'; - -export type PKPSignCreateRequestParams = { - serverKeys: Record< - string, - z.infer['data'] - >; - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - signingContext: { - pubKey: z.infer; - toSign: any; - signingScheme: z.infer; - bypassAutoHashing?: boolean; - }; - connectionInfo: ConnectionInfo; - version: string; - chain: z.infer; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.InputSchema.ts deleted file mode 100644 index f0a47da466..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.InputSchema.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - HexPrefixedSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const PKPSignInputSchema = z.object({ - /** - * Picking the chains would use the correct hash function for the signing scheme. - * - * @example - * ethereum -> keccak256() - * bitcoin -> sha256() - */ - chain: SigningChainSchema, - signingScheme: SigningSchemeSchema, - pubKey: HexPrefixedSchema, - toSign: z.any(), - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - userMaxPrice: z.bigint().optional(), -}); - -export const EthereumPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - // signingScheme: z.enum([ - // 'EcdsaK256Sha256', - // 'EcdsaP256Sha256', - // 'EcdsaP384Sha384', - // ]), - }) - .transform((item) => { - return { - ...item, - signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('ethereum'), - }; - }); - -export const BitCoinPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - signingScheme: z.enum([ - 'EcdsaK256Sha256', - 'SchnorrK256Sha256', - 'SchnorrK256Taproot', - ]), - }) - .transform((item) => { - return { - ...item, - // signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('bitcoin'), - }; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.RequestDataSchema.ts deleted file mode 100644 index ce17266144..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.RequestDataSchema.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { walletEncrypt } from '@lit-protocol/crypto'; -import { - AuthSigSchema, - BytesArraySchema, - HexPrefixedSchema, - NodeSetsFromUrlsSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { hexToBytes, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { LitMessageSchema } from '../../../../schemas/LitMessageSchema'; - -// Schema for auth methods in v2 API -const AuthMethodSchema = z.object({ - authMethodType: z.number(), - accessToken: z.string(), -}); - -export const PKPSignRequestDataSchema = z - .object({ - toSign: BytesArraySchema, - signingScheme: SigningSchemeSchema, - // ❗️ THIS FREAKING "pubkey"! "k" is lowercase!! - pubkey: HexPrefixedSchema, - authSig: AuthSigSchema, - nodeSet: NodeSetsFromUrlsSchema, - chain: SigningChainSchema, - bypassAutoHashing: z.boolean().optional(), - - // NEW v2 API fields - epoch: z.number().default(0), - authMethods: z.array(AuthMethodSchema).default([]), - }) - .transform((item) => { - const toSignData = item.bypassAutoHashing - ? item.toSign - : LitMessageSchema.parse({ - toSign: item.toSign, - signingScheme: item.signingScheme, - chain: item.chain, - }); - - const unencrypted = { - toSign: toSignData, - signingScheme: item.signingScheme, - pubkey: item.pubkey, - authSig: item.authSig, - nodeSet: item.nodeSet, - epoch: item.epoch, - authMethods: item.authMethods, - }; - - return unencrypted; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts deleted file mode 100644 index 7be045b3e8..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { z } from 'zod'; -import { GenericResultSchemaBuilder } from '@lit-protocol/schemas'; - -// Define the schema for the EcdsaSignedMessageShare object -const EcdsaSignedMessageShareDataSchema = z.object({ - digest: z.string(), - result: z.string(), // Or z.literal('success') if it's always "success" - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - big_r: z.string(), - compressed_public_key: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -// Define the schema for the FrostSignedMessageShare object -const FrostSignedMessageShareDataSchema = z.object({ - message: z.string(), - result: z.string(), // Or z.literal('success') - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - signing_commitments: z.string(), - verifying_share: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -export const PKPSignEncryptedPayloadSchema = z.object({}); - -export const PKPSignResponseDataSchema = GenericResultSchemaBuilder( - z.object({ - success: z.boolean(), - signedData: z.array(z.number()), - signatureShare: z.union([ - z.object({ - EcdsaSignedMessageShare: EcdsaSignedMessageShareDataSchema, - }), - z.object({ - FrostSignedMessageShare: FrostSignedMessageShareDataSchema, - }), - // Add other potential share types here if they exist - // For example: z.object({ SomeOtherShareType: SomeOtherShareSchema }) - ]), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts deleted file mode 100644 index be123802a6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from 'zod'; - -export const SignSessionKeyResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - result: z.string(), - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - curveType: z.string(), - siweMessage: z.string(), - dataSigned: z.string(), - blsRootPubkey: z.string(), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/types.ts b/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/types.ts deleted file mode 100644 index e9e8138264..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/api-manager/types.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { - // BlsSigType - EcdsaSigType, - FrostSigType, -} from '@lit-protocol/constants'; -import { Hex } from '@lit-protocol/types'; - -// See src/p2p_comms/web/models.rs > BlsSignedMessageShare -// Example output: -// "BlsSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "share_id": "\"19a7c43a2b7bbedcea0a40ab17fe0f4a1acf31bdecb9ebeb96c1d3a62e4885f0\"", -// "signature_share": "{\"ProofOfPossession\":{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24\"}}", -// "verifying_share": "{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b\"}", -// "public_key": "\"8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d\"", -// "sig_type": "Bls12381G1ProofOfPossession" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -// export interface BlsSignedMessageShareRaw { -// message: string; -// peer_id: string; -// public_key: string; -// result: string; -// share_id: string; -// sig_type: string; -// signature_share: string; -// verifying_share: string; -// } - -// See src/p2p_comms/web/models.rs > EcdsaSignedMessageShare -// Example output: -// "EcdsaSignedMessageShare": { -// "digest": "74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", -// "result": "success", -// "share_id": "\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\"", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "signature_share": "\"4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B\"", -// "big_r": "\"037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356\"", -// "compressed_public_key": "\"021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce\"", -// "public_key": "\"041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80\"", -// "sig_type": "EcdsaK256Sha256" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface EcdsaSignedMessageShareRaw { - big_r: string; - compressed_public_key: string; - digest: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; -} - -// See src/p2p_comms/web/models.rs > FrostSignedMessageShare -// Example output: -// "FrostSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "share_id": "[\"Ed25519Sha512\",[120,2,187,138,101,21,192,99,172,206,182,184,45,83,216,198,184,93,183,55,83,34,185,90,150,221,88,228,91,232,123,2]]", -// "peer_id": "6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", -// "signature_share": "[\"Ed25519Sha512\",\"c5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b\"]", -// "signing_commitments": "[\"Ed25519Sha512\",\"00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f\"]", -// "verifying_share": "[\"Ed25519Sha512\",\"8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842\"]", -// "public_key": "[\"Ed25519Sha512\",\"87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4\"]", -// "sig_type": "SchnorrEd25519Sha512" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface FrostSignedMessageShareRaw { - message: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; - signing_commitments: string; - verifying_share: string; -} - -type SignatureShare = - // | { - // BlsSignedMessageShare: BlsSignedMessageShareRaw; - // } - | { - EcdsaSignedMessageShare: EcdsaSignedMessageShareRaw; - } - | { - FrostSignedMessageShare: FrostSignedMessageShareRaw; - }; - -/** - * This is what the /web/pkp/sign endpoint returns - */ -export interface PKPSignEndpointResponse { - success: boolean; - signedData: number[]; // Convertible to Uint8Array - signatureShare: SignatureShare; -} - -export interface LitActionClaimData { - signature: string; - derivedKeyId: string; -} - -export interface LitActionSignedData { - publicKey: string; - signatureShare: string; // JSON.stringify(SignatureShare) - sigName: string; - sigType: EcdsaSigType; -} - -/** - * This is what the /web/execute/v2 endpoint returns - */ -export interface ExecuteJsValueResponse { - claimData: Record; - decryptedData: any; // TODO check - logs: string; - response: string; - signedData: Record; - success: boolean; -} - -/** - * This is the cleaned up version of the BlsSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "shareId": Uint8Array(...), - * "signatureShare": "{ProofOfPossession:{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24}}", - * "verifyingShare": "{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b}", - * "publicKey": "0x8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d", - * "sigType": "Bls12381G1ProofOfPossession", - * "dataSigned": "0x0102030405" - * } - */ -// export interface BlsSignedMessageShareParsed { -// dataSigned: Hex; -// message: Hex; -// peerId: Hex; -// publicKey: Hex; -// shareId: Uint8Array; -// signatureShare: Hex; -// signingCommitments: Hex; -// sigType: BlsSigType; -// verifyingShare: Hex; -// } - -/** - * This is the cleaned up version of the EcdsaSignedMessageShareRaw - * - * @example - * { - * "digest": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", - * "shareId": "0x989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "signatureShare": "0x4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B", - * "bigR": "0x037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356", - * "compressedPublicKey": "0x021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce", - * "publicKey": "0x041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80", - * "sigType": "EcdsaK256Sha256", - * "dataSigned": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0" - * } - */ -export interface EcdsaSignedMessageShareParsed { - bigR: Hex; - compressedPublicKey: Hex; - dataSigned: Hex; - digest: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Hex; - signatureShare: Hex; - sigType: EcdsaSigType; -} - -/** - * This is the cleaned up version of the FrostSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "shareId": Uint8Array(...), - * "peerId": "0x6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", - * "signatureShare": "0xc5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b", - * "signingCommitments": "0x00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f", - * "verifyingShare": "0x8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842", - * "publicKey": "0x87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4", - * "sigType": "SchnorrEd25519Sha512", - * "dataSigned": "0x0102030405" - * } - */ -export interface FrostSignedMessageShareParsed { - dataSigned: Hex; - message: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Uint8Array; - signatureShare: Hex; - signingCommitments: Hex; - sigType: FrostSigType; - verifyingShare: Hex; -} - -export type PKPSignEndpointSharesParsed = - // | BlsSignedMessageShareParsed - EcdsaSignedMessageShareParsed | FrostSignedMessageShareParsed; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.spec.ts deleted file mode 100644 index 697df53451..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createChainManager } from './createChainManager'; -import { privateKeyToAccount } from 'viem/accounts'; - -describe('createChainManager', () => { - it('should create a chain manager', () => { - const viemAccount = privateKeyToAccount( - process.env['PRIVATE_KEY']! as `0x${string}` - ); - - const chainManager = createChainManager(viemAccount); - - console.log(chainManager); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.ts b/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.ts index be1da2dba0..f02a12d942 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-local/chain-manager/createChainManager.ts @@ -1,156 +1,22 @@ -import { privateKeyToAccount } from 'viem/accounts'; -import { api } from '../../../LitChainClient'; -import { getPKPsByAddress } from '../../../LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress'; -import { PkpIdentifierRaw } from '../../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { ExpectedAccountOrWalletClient } from '../../../LitChainClient/contract-manager/createContractsManager'; -import { DefaultNetworkConfig } from '../../../interfaces/NetworkContext'; -import { networkConfig } from '../naga-local.config'; -import type { PKPStorageProvider } from '../../../../../storage/types'; -import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; +import type { ExpectedAccountOrWalletClient } from '../../../shared/managers/contract-manager/createContractsManager'; +import { + createChainManagerFactory, + createReadOnlyChainManagerFactory, + CreateChainManagerReturn, +} from '../../../shared/factories/BaseChainManagerFactory'; +import { nagaLocalEnvironment } from '../naga-local.env'; -export type CreateChainManagerReturn = { - api: { - mintWithEoa: ( - req?: Parameters[0] - ) => ReturnType; - mintPKP: ( - req: Parameters[0] - ) => ReturnType; - mintWithMultiAuths: ( - req: Parameters[0] - ) => ReturnType; - pkpPermissionsManager: ( - pkpIdentifier: PkpIdentifierRaw - ) => InstanceType; - paymentManager: () => InstanceType; - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => ReturnType; - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => ReturnType; - pricing: { - getPriceFeedInfo: ( - req: Parameters[0] - ) => ReturnType; - getNodePrices: ( - req: Parameters[0] - ) => ReturnType; - }; - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }) => ReturnType; - }; - }; -}; +export type { CreateChainManagerReturn }; export const createChainManager = ( accountOrWalletClient: ExpectedAccountOrWalletClient ): CreateChainManagerReturn => { - // TODO: This ideally should set to NagaLocalNetworkContext. - const _networkConfig = networkConfig as unknown as DefaultNetworkConfig; - - // Helper to bind the network context to an API function - const bindContext = ( - fn: ( - req: ReqArgType, - ctx: DefaultNetworkConfig, - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => RetType - ) => { - return (req: ReqArgType): RetType => - fn(req, _networkConfig, accountOrWalletClient); - }; - - return { - api: { - mintWithEoa: bindContext(api.mintWithEoa), - mintPKP: bindContext(api.mintPKP), - mintWithMultiAuths: bindContext(api.mintWithMultiAuths), - pkpPermissionsManager: (pkpIdentifier: PkpIdentifierRaw) => { - return new api.PKPPermissionsManager( - pkpIdentifier, - _networkConfig, - accountOrWalletClient - ); - }, - paymentManager: () => { - return new api.PaymentManager(_networkConfig, accountOrWalletClient); - }, - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => { - return api.PKPPermissionsManager.getPKPsByAuthData( - authData, - pagination, - storageProvider, - _networkConfig, - accountOrWalletClient - ); - }, - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => { - // Provide default pagination if not provided - const defaultPagination = { limit: 10, offset: 0 }; - const finalPagination = params.pagination - ? { - limit: params.pagination.limit ?? defaultPagination.limit, - offset: params.pagination.offset ?? defaultPagination.offset, - } - : defaultPagination; - - return getPKPsByAddress( - { - ownerAddress: params.ownerAddress, - pagination: finalPagination, - storageProvider: params.storageProvider, - }, - _networkConfig, - accountOrWalletClient - ); - }, - pricing: { - getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo), - getNodePrices: bindContext(api.pricing.getNodePrices), - }, - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }): ReturnType => { - return api.connection.getConnectionInfo({ - networkCtx: _networkConfig, - accountOrWalletClient: accountOrWalletClient, - nodeProtocol: args?.nodeProtocol, - }); - }, - }, - }, - }; -}; - -export const createReadOnlyChainManager = () => { - // dummy private key for read actions - const dummyAccount = privateKeyToAccount( - DEV_PRIVATE_KEY + return createChainManagerFactory( + nagaLocalEnvironment.getConfig(), + accountOrWalletClient ); - const chainManager = createChainManager(dummyAccount); - return createChainManager(chainManager); }; + +export const createReadOnlyChainManager = createReadOnlyChainManagerFactory( + nagaLocalEnvironment.getConfig() +); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.cjs b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.cjs index c5f3351ad1..fe2a93e21b 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.cjs +++ b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.cjs @@ -711,6 +711,46 @@ const signatures = { stateMutability: 'nonpayable', type: 'function', }, + addPermittedAuthMethod: { + 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', + }, addPermittedAuthMethodScope: { inputs: [ { @@ -978,6 +1018,34 @@ const signatures = { stateMutability: 'nonpayable', type: 'function', }, + removePermittedAuthMethodScope: { + 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', + }, }, events: [ { diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.js b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.js index acfa9cf693..21476cd821 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.js +++ b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.js @@ -711,6 +711,46 @@ export const signatures = { stateMutability: 'nonpayable', type: 'function', }, + addPermittedAuthMethod: { + 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', + }, addPermittedAuthMethodScope: { inputs: [ { @@ -978,6 +1018,34 @@ export const signatures = { stateMutability: 'nonpayable', type: 'function', }, + removePermittedAuthMethodScope: { + 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', + }, }, events: [ { diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.ts b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.ts index 4c74fed23e..162e4ebe9b 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-local/generated/naga-develop.ts @@ -711,6 +711,46 @@ export const signatures = { stateMutability: 'nonpayable', type: 'function', }, + addPermittedAuthMethod: { + 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', + }, addPermittedAuthMethodScope: { inputs: [ { @@ -978,6 +1018,34 @@ export const signatures = { stateMutability: 'nonpayable', type: 'function', }, + removePermittedAuthMethodScope: { + 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', + }, }, events: [ { diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/index.ts b/packages/networks/src/networks/vNaga/envs/naga-local/index.ts index 6f7c5ef1c9..fc5194b85e 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/index.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-local/index.ts @@ -1,3 +1 @@ -import { nagaLocalModule } from './naga-local.module'; - -export const nagaLocal = nagaLocalModule; +export { nagaLocal } from './naga-local.module'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x70940169B142291086EA040b9d609A2f318f6A7e b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x70940169B142291086EA040b9d609A2f318f6A7e deleted file mode 100644 index 758cd34403..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x70940169B142291086EA040b9d609A2f318f6A7e +++ /dev/null @@ -1 +0,0 @@ -{"sessionKey":{"keyPair":{"publicKey":"4d0ec8b76d3081f76e40cedaba22f58d661515eeeacf18a29ae7ce6f22d20639","secretKey":"592c78528a77ce1fb0c655e001da990ba594bf82d832080deef6fab0964e6c61"},"expiresAt":"2025-05-30T15:10:14.965Z"},"authMethodType":1} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x711640858DC93e2d3D3B276248Ad08266C23c76C b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x711640858DC93e2d3D3B276248Ad08266C23c76C deleted file mode 100644 index 52cca71442..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x711640858DC93e2d3D3B276248Ad08266C23c76C +++ /dev/null @@ -1 +0,0 @@ -{"sessionKey":{"keyPair":{"publicKey":"2f9f69225fe57e6b9f5bd2335fd8297665b25db3c39b9f72ff3e2eed2c4902c6","secretKey":"59b0bf2c4b0277ac9acb36f66b7a2b2d0cda6a23f00792ad934400c23fd585e2"},"expiresAt":"2025-05-30T14:52:26.421Z"},"authMethodType":1} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x997588EeDB4436B9f078d48885d60D4a147eA8CC b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x997588EeDB4436B9f078d48885d60D4a147eA8CC deleted file mode 100644 index e2618614c9..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0x997588EeDB4436B9f078d48885d60D4a147eA8CC +++ /dev/null @@ -1 +0,0 @@ -{"sessionKey":{"keyPair":{"publicKey":"4ad0d3626c7370988129308ace1d0ec17f736dd251c93d258e692947de24d3d4","secretKey":"2816d9d6067a204746f036897b1506cdb5b0ca7439b56ff60fe2582fa58d877b"},"expiresAt":"2025-05-30T14:55:48.561Z"},"authMethodType":1} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee deleted file mode 100644 index 58ed23bdd4..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee +++ /dev/null @@ -1 +0,0 @@ -{"sessionKey":{"keyPair":{"publicKey":"ccd6397ada851509cdd511a89b0726d7a2d69d010c8b951c73d3708ea532ef6d","secretKey":"c50528df40492401fd5a669c9907d3e667590c0570d44624ef4d3c169d96f1e1"},"expiresAt":"2025-05-29T15:42:31.940Z"},"authMethodType":1} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 deleted file mode 100644 index 519aa14f0f..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app%3Anaga-local%3A0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 +++ /dev/null @@ -1 +0,0 @@ -{"sessionKey":{"keyPair":{"publicKey":"a20f954660566e83be0e47d221cbb0ad88bb18f1c8134b3a672599db45bb1bab","secretKey":"5666b64a5c6bd4cc067bf4314c08025b63a3cb61aa6426a280ddd1c508db7e07"},"expiresAt":"2025-05-29T15:42:31.763Z"},"authMethodType":1} \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app-inner-delegation%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee b/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app-inner-delegation%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee deleted file mode 100644 index 23b213482d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/lit-auth-local/lit-auth%3Amy-local-testing-app-inner-delegation%3Anaga-local%3A0xb2A431128459C33b5C28F73061395F11E61B78Ee +++ /dev/null @@ -1 +0,0 @@ -"{\"sig\":\"{\\\"ProofOfPossession\\\":\\\"b59037a9a107da320a6303b8413195c2560e11be59cadb2ad8b117bf6cd2ce1d4d8f3b1da336ef98d6dd5f2ee116fd710bef4757aeada224c5013ef9ee873a84e7c9d9e49f761f22812257023a1d5ea9a92b4c2e8fe0b18f7328615606340505\\\"}\",\"algo\":\"LIT_BLS\",\"derivedVia\":\"lit.bls\",\"signedMessage\":\"localhost wants you to sign in with your Ethereum account:\\n0xb2A431128459C33b5C28F73061395F11E61B78Ee\\n\\nLit Protocol PKP session signature I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Decryption' for 'lit-accesscontrolcondition://*'. I further authorize the stated URI to perform the following actions on my behalf: (1) 'Threshold': 'Decryption' for 'lit-accesscontrolcondition://*'. (2) 'Auth': 'Auth' for 'lit-resolvedauthcontext://*'.\\n\\nURI: lit:session:ccd6397ada851509cdd511a89b0726d7a2d69d010c8b951c73d3708ea532ef6d\\nVersion: 1\\nChain ID: 1\\nNonce: 0xc49ef8e313829f6b615b0316b9d7a60350bbac3ebce468b60ce9ef4038b968a4\\nIssued At: 2025-05-29T15:27:59Z\\nExpiration Time: 2025-05-29T15:43:08.600Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWFjY2Vzc2NvbnRyb2xjb25kaXRpb246Ly8qIjp7IlRocmVzaG9sZC9EZWNyeXB0aW9uIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOltdLCJhdXRoTWV0aG9kQ29udGV4dHMiOlt7ImFwcElkIjoibGl0IiwiYXV0aE1ldGhvZFR5cGUiOjEsInVzZWRGb3JTaWduU2Vzc2lvbktleVJlcXVlc3QiOnRydWUsInVzZXJJZCI6IjB4ZjM5RmQ2ZTUxYWFkODhGNkY0Y2U2YUI4ODI3Mjc5Y2ZmRmI5MjI2NiJ9XSwiYXV0aFNpZ0FkZHJlc3MiOm51bGwsImN1c3RvbUF1dGhSZXNvdXJjZSI6IiIsInJlc291cmNlcyI6W119fV19fSwicHJmIjpbXX0\",\"address\":\"0xb2A431128459C33b5C28F73061395F11E61B78Ee\"}" \ No newline at end of file diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.config.ts b/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.config.ts deleted file mode 100644 index d37dbd3f73..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.config.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Hex } from 'viem'; -import * as chainInfo from '../../../../chains/Anvil'; -import { INetworkConfig } from '../../interfaces/NetworkContext'; - -/** - * This is locally generated signatures - */ -import { NAGA_ENDPOINT } from '../../endpoints-manager/endpoints'; -import { signatures } from './generated/naga-develop'; - -const NETWORK = 'custom'; -const PROTOCOL = 'http://'; -const MINIMUM_THRESHOLD = 3; -const REALM_ID = 1n; - -interface NagaLocalDevSpecificConfigs { - realmId?: bigint; - privateKey?: Hex; -} - -export type NagaLocalSignatures = typeof signatures; - -export const networkConfig: INetworkConfig< - NagaLocalSignatures, - NagaLocalDevSpecificConfigs -> = { - minimumThreshold: MINIMUM_THRESHOLD, - network: NETWORK, - rpcUrl: chainInfo.RPC_URL, - abiSignatures: signatures, - chainConfig: chainInfo.viemChainConfig, - httpProtocol: PROTOCOL, - networkSpecificConfigs: { - realmId: REALM_ID, - privateKey: chainInfo.DEV_PRIVATE_KEY, - }, - endpoints: NAGA_ENDPOINT, - services: { - authServiceBaseUrl: 'http://localhost:3301', - loginServiceBaseUrl: 'http://localhost:3300', - }, -}; - -export type NagaLocalNetworkContext = typeof networkConfig; - -// network object calls the chain client -// LitClient could use the network to figure out diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.env.ts b/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.env.ts new file mode 100644 index 0000000000..7830ee2e4d --- /dev/null +++ b/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.env.ts @@ -0,0 +1,65 @@ +import { Chain, Hex } from 'viem'; +import * as chainInfo from '../../../../chains/Anvil'; +import { NAGA_ENDPOINT } from '../../shared/managers/endpoints-manager/endpoints'; +import type { NagaEndpointsType } from '../../shared/managers/endpoints-manager/endpoints'; +import { BaseNetworkEnvironment } from '../base/BaseNetworkEnvironment'; +import { signatures } from './generated/naga-develop'; + +const NETWORK = 'custom'; +const PROTOCOL = 'http://'; // Note: Different from dev/staging +const MINIMUM_THRESHOLD = 3; +const DEFAULT_REALM_ID = 1n; + +export interface NagaLocalSpecificConfigs { + realmId?: bigint; + privateKey?: Hex; // Note: Local has private key config +} + +export type NagaLocalSignatures = typeof signatures; + +export class NagaLocalEnvironment extends BaseNetworkEnvironment< + NagaLocalSignatures, + NagaLocalSpecificConfigs +> { + constructor() { + super({ + network: NETWORK, + abiSignatures: signatures, // Note: Uses locally generated signatures + networkSpecificConfigs: { + realmId: DEFAULT_REALM_ID, + privateKey: chainInfo.DEV_PRIVATE_KEY, // Note: Includes private key + }, + services: { + authServiceBaseUrl: 'https://naga-auth-service.getlit.dev', + loginServiceBaseUrl: 'http://localhost:3300', + }, + minimumThreshold: MINIMUM_THRESHOLD, + httpProtocol: PROTOCOL, // Note: HTTP not HTTPS + requiredAttestation: false, + }); + } + + protected getRpcUrl(): string { + return chainInfo.RPC_URL; // Note: Uses Anvil instead of ChronicleYellowstone + } + + protected getChainConfig(): Chain { + return chainInfo.viemChainConfig; // Note: Anvil chain config + } + + protected getEndpoints(): NagaEndpointsType { + return NAGA_ENDPOINT; + } + + protected getDefaultRealmId(): bigint { + return DEFAULT_REALM_ID; + } + + // Additional getter for the private key (specific to local environment) + public getPrivateKey(): Hex | undefined { + return this.config.networkSpecificConfigs?.privateKey; + } +} + +// Create singleton instance +export const nagaLocalEnvironment = new NagaLocalEnvironment(); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.module.ts b/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.module.ts index d4b5483391..56a15798d4 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.module.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-local/naga-local.module.ts @@ -1,1372 +1,21 @@ -import { DEV_PRIVATE_KEY, version } from '@lit-protocol/constants'; -import { verifyAndDecryptWithSignatureShares } from '@lit-protocol/crypto'; -import { - AuthData, - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, - GenericResultBuilder, - HexPrefixedSchema, - JsonSignCustomSessionKeyRequestForPkpReturnSchema, - JsonSignSessionKeyRequestForPkpReturnSchema, -} from '@lit-protocol/schemas'; -import { Hex, hexToBytes, stringToBytes } from 'viem'; - -import { z } from 'zod'; -import { LitNetworkModuleBase } from '../../../types'; -import type { ExpectedAccountOrWalletClient } from '../../LitChainClient/contract-manager/createContractsManager'; -import { networkConfig } from './naga-local.config'; -import { PricingContextSchema } from './pricing-manager/PricingContextSchema'; -import { issueSessionFromContext } from './session-manager/issueSessionFromContext'; -import { createStateManager } from './state-manager/createStateManager'; - -// Import the necessary types for the explicit return type annotation -import { NetworkError } from '@lit-protocol/constants'; -import { - combineSignatureShares, - mostCommonString, - normalizeAndStringify, - ReleaseVerificationConfig, -} from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { - AuthMethod, - AuthSig, - CallbackParams, - KeySet, - LitActionResponseStrategy, - NagaJitContext, - NodeAttestation, - Optional, - OrchestrateHandshakeResponse, - RequestItem, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { computeAddress } from 'ethers/lib/utils'; -import { nacl } from '@lit-protocol/nacl'; -import type { PKPStorageProvider } from '../../../../storage/types'; -import { createRequestId } from '../../../shared/helpers/createRequestId'; -import { handleAuthServerRequest } from '../../../shared/helpers/handleAuthServerRequest'; -import { composeLitUrl } from '../../endpoints-manager/composeLitUrl'; -import { - getNodePrices, - PKPPermissionsManager, -} from '../../LitChainClient/apis/highLevelApis'; -import { PaymentManager } from '../../LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager'; -import { MintWithMultiAuthsRequest } from '../../LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths'; -import { PkpIdentifierRaw } from '../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { GenericTxRes, LitTxRes } from '../../LitChainClient/apis/types'; -import type { PKPData } from '../../LitChainClient/schemas/shared/PKPDataSchema'; -import { ConnectionInfo } from '../../LitChainClient/types'; -import { DecryptCreateRequestParams } from './api-manager/decrypt/decrypt.CreateRequestParams'; -import { DecryptInputSchema } from './api-manager/decrypt/decrypt.InputSchema'; -import { DecryptRequestDataSchema } from './api-manager/decrypt/decrypt.RequestDataSchema'; -import { DecryptResponseDataSchema } from './api-manager/decrypt/decrypt.ResponseDataSchema'; -import { E2EERequestManager } from './api-manager/e2ee-request-manager/E2EERequestManager'; -import { handleResponse as handleExecuteJsResponse } from './api-manager/executeJs'; -import { ExecuteJsCreateRequestParams } from './api-manager/executeJs/executeJs.CreateRequestParams'; -import { ExecuteJsInputSchema } from './api-manager/executeJs/executeJs.InputSchema'; -import { ExecuteJsRequestDataSchema } from './api-manager/executeJs/executeJs.RequestDataSchema'; -import { ExecuteJsResponseDataSchema } from './api-manager/executeJs/executeJs.ResponseDataSchema'; -import { RawHandshakeResponseSchema } from './api-manager/handshake/handshake.schema'; -import { combinePKPSignSignatures } from './api-manager/helper/get-signatures'; -import { PKPSignCreateRequestParams } from './api-manager/pkpSign/pkpSign.CreateRequestParams'; -import { - BitCoinPKPSignInputSchema, - EthereumPKPSignInputSchema, - PKPSignInputSchema, -} from './api-manager/pkpSign/pkpSign.InputSchema'; -import { PKPSignRequestDataSchema } from './api-manager/pkpSign/pkpSign.RequestDataSchema'; -import { PKPSignResponseDataSchema } from './api-manager/pkpSign/pkpSign.ResponseDataSchema'; -import { - createChainManager, - CreateChainManagerReturn, -} from './chain-manager/createChainManager'; -import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct'; -import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice'; -import { privateKeyToAccount } from 'viem/accounts'; - -const MODULE_NAME = 'naga-local'; - -const _logger = getChildLogger({ - module: `${MODULE_NAME}-module`, +import { createBaseModule } from '../../shared/factories/BaseModuleFactory'; +import { createChainManager } from './chain-manager/createChainManager'; +import { nagaLocalEnvironment } from './naga-local.env'; +import type { ExpectedAccountOrWalletClient } from '../../shared/managers/contract-manager/createContractsManager'; + +const baseModule = createBaseModule({ + networkConfig: nagaLocalEnvironment.getConfig(), + moduleName: nagaLocalEnvironment.getNetworkName(), + createChainManager: (account: ExpectedAccountOrWalletClient) => + createChainManager(account), }); -// Release verification types and constants -interface ReleaseInfo { - status: number; - env: number; - typ: number; - platform: number; - options: { asU32: () => number }; - publicKey: Uint8Array; - idKeyDigest: Uint8Array; -} - -enum ReleaseStatus { - Null = 0, - Active = 1, - Inactive = 2, -} - -// Basic Release Register Contract ABI - only the functions we need -const RELEASE_REGISTER_ABI = [ - { - inputs: [], - name: 'RELEASE_REGISTER_CONTRACT', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -/** - * Extract release ID from attestation data - * @param attestation The node attestation containing release ID - * @returns The release ID string - */ -function extractReleaseId(attestation: NodeAttestation): string { - const releaseId = attestation.data.RELEASE_ID; - if (!releaseId) { - throw new NetworkError( - { info: { attestation } }, - 'Missing RELEASE_ID in attestation data' - ); - } - return Buffer.from(releaseId, 'base64').toString('utf8'); -} - -/** - * Extract subnet ID from release ID - * Based on the Rust implementation: subnet_id_from_release_id - * @param releaseId The release ID string - * @returns The subnet ID - */ -function getSubnetIdFromReleaseId(releaseId: string): string { - // In the Rust code, this extracts the subnet ID from the release ID - // For now, this is a simplified version - you may need to adjust based on actual format - const parts = releaseId.split('-'); - if (parts.length < 2) { - throw new NetworkError( - { info: { releaseId } }, - 'Invalid release ID format' - ); - } - return parts[0]; // First part is typically the subnet ID -} - -/** - * Pad release ID to 32 bytes for contract call - * @param releaseId The release ID string - * @returns Padded bytes32 for contract call - */ -function padReleaseIdToBytes32(releaseId: string): string { - const releaseIdBuffer = Buffer.from(releaseId, 'utf8'); - if (releaseIdBuffer.length > 32) { - throw new NetworkError( - { info: { releaseId } }, - 'Release ID too long for bytes32' - ); - } - const paddedBuffer = Buffer.alloc(32); - releaseIdBuffer.copy(paddedBuffer); - return ethers.utils.hexlify(paddedBuffer); -} - -/** - * Verify release ID against the on-chain release register contract - * This function is provided to the crypto package for dependency injection - * @param attestation The node attestation - * @param config Configuration for release verification - */ -const verifyReleaseId = async ( - attestation: NodeAttestation, - config: ReleaseVerificationConfig -): Promise => { - _logger.info('verifyReleaseId: Starting release verification', { - subnetId: config.subnetId, - environment: config.environment, - }); - - // 1. Extract release ID from attestation - const releaseId = extractReleaseId(attestation); - - // 2. Verify release ID length - if (releaseId.length !== 64) { - // RELEASE_ID_STR_LEN from Rust code - throw new NetworkError( - { - info: { releaseId, expectedLength: 64, actualLength: releaseId.length }, - }, - `Release ID length is incorrect: expected 64, got ${releaseId.length}` - ); - } - - // 3. Extract and verify subnet ID - const releaseSubnetId = getSubnetIdFromReleaseId(releaseId); - if (releaseSubnetId !== config.subnetId) { - throw new NetworkError( - { info: { releaseSubnetId, expectedSubnetId: config.subnetId } }, - `Subnet ID mismatch: expected ${config.subnetId}, got ${releaseSubnetId}` - ); - } - - // 4. Query the release register contract - const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl); - const contract = new ethers.Contract( - config.releaseRegisterContractAddress, - RELEASE_REGISTER_ABI, - provider - ); - - const releaseIdPadded = padReleaseIdToBytes32(releaseId); - - try { - const release = await contract['getReleaseByIdAndSubnetId']( - config.subnetId, - releaseIdPadded - ); - - // 5. Verify release status is active - if (release.status !== ReleaseStatus.Active) { - throw new NetworkError( - { info: { releaseId, status: release.status } }, - `Release is not active: status ${release.status}` - ); - } - - // 6. Verify environment matches - if (release.env !== config.environment) { - throw new NetworkError( - { - info: { - releaseId, - releaseEnv: release.env, - expectedEnv: config.environment, - }, - }, - `Environment mismatch: expected ${config.environment}, got ${release.env}` - ); - } - - _logger.info('verifyReleaseId: Release verification successful', { - releaseId, - status: release.status, - environment: release.env, - }); - } catch (error: any) { - if (error.code === 'CALL_EXCEPTION') { - throw new NetworkError( - { - info: { - releaseId, - contractAddress: config.releaseRegisterContractAddress, - }, - }, - `Release ID ${releaseId} not found on chain` - ); - } - throw error; - } -}; - -// Store response strategy separately for executeJs requests -let executeJsResponseStrategy: LitActionResponseStrategy | undefined; - -// Store secret keys for PKP sign requests to use in handleResponse -// const globalPkpSignSecretKeys: Record> = {}; -// const globalPkpSignNodeKeys: Record> = {}; - -// Define ProcessedBatchResult type (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -// Define the object first -const networkModuleObject = { - id: 'naga', - version: `${version}-naga-local`, - config: { - requiredAttestation: false, - abortTimeout: 20_000, - minimumThreshold: networkConfig.minimumThreshold, - httpProtocol: networkConfig.httpProtocol, - }, - schemas: { - GenericResponseSchema: GenericResultBuilder, - }, - getNetworkName: () => networkConfig.network, - getHttpProtocol: () => networkConfig.httpProtocol, - getEndpoints: () => networkConfig.endpoints, - getRpcUrl: () => networkConfig.rpcUrl, - getChainConfig: () => networkConfig.chainConfig, - getDefaultAuthServiceBaseUrl: () => networkConfig.services.authServiceBaseUrl, - getDefaultLoginBaseUrl: () => networkConfig.services.loginServiceBaseUrl, - getMinimumThreshold: () => networkConfig.minimumThreshold, - // composeLitUrl: composeLitUrl, - /** - * 🧠 This is the core function that keeps all the network essential information - * up to data, such as: - * - latest blockhash - * - connection info (node urls, epoch, etc.) - it listens for StateChange events - * - orchestrate handshake via callback - */ - createStateManager: async (params: { - callback: (params: CallbackParams) => Promise; - networkModule: M; - }): Promise>>> => { - return await createStateManager({ - networkConfig, - callback: params.callback, - networkModule: params.networkModule as LitNetworkModuleBase, - }); - }, - getMaxPricesForNodeProduct: getMaxPricesForNodeProduct, - getUserMaxPrice: getUserMaxPrice, - getVerifyReleaseId: () => verifyReleaseId, - chainApi: { - getPKPPermissionsManager: async (params: { - pkpIdentifier: PkpIdentifierRaw; - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.pkpPermissionsManager(params.pkpIdentifier); - }, - - /** - * Gets a PaymentManager instance for managing deposits, withdrawals, and balance queries - */ - getPaymentManager: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.paymentManager(); - }, - - /** - * Gets all PKPs associated with specific authentication data - */ - getPKPsByAuthData: async (params: { - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAuthData( - params.authData, - params.pagination, - params.storageProvider - ); - }, - - /** - * Gets all PKPs owned by a specific address - */ - getPKPsByAddress: async (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAddress({ - ownerAddress: params.ownerAddress, - pagination: params.pagination, - storageProvider: params.storageProvider, - }); - }, - - /** - * Mints a PKP using EOA directly - */ - mintWithEoa: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithEoa(); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - /** - * Mints a PKP using Auth Method - */ - mintWithAuth: async (params: { - account: ExpectedAccountOrWalletClient; - authData: Optional; - scopes: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintPKP({ - scopes: params.scopes, - // authMethod: authMethod, - authMethodId: params.authData.authMethodId, - authMethodType: params.authData.authMethodType, - pubkey: params.authData.publicKey, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - mintWithMultiAuths: async ( - params: { - account: ExpectedAccountOrWalletClient; - } & MintWithMultiAuthsRequest - ): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithMultiAuths({ - authMethodIds: params.authMethodIds, - authMethodTypes: params.authMethodTypes, - authMethodScopes: params.authMethodScopes, - pubkeys: params.pubkeys, - addPkpEthAddressAsPermittedAddress: - params.addPkpEthAddressAsPermittedAddress, - sendPkpToItself: params.sendPkpToItself, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - }, - authService: { - pkpMint: async (params: { - authData: AuthData; - authServiceBaseUrl?: string; - scopes?: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }) => { - return await handleAuthServerRequest({ - jobName: 'PKP Minting', - serverUrl: - params.authServiceBaseUrl || - networkConfig.services.authServiceBaseUrl, - path: '/pkp/mint', - body: { - authMethodType: params.authData.authMethodType, - authMethodId: params.authData.authMethodId, - pubkey: params.authData.publicKey, - scopes: params.scopes, - }, - }); - }, - }, - api: { - /** - * The Lit Client and Network Module exchange data in a request-response cycle: - * - * 1. 🟪 The Network Module constructs the request. - * 2. 🟩 The Lit Client sends it to the Lit Network. - * 3. 🟪 The Network Module processes the response. - * - * In some cases, we need to maintain a piece of state that is relevant to both step 1 (request creation) - * and step 3 (response handling). To support this, we introduce a *network-specific context object* - * that can be passed between the Lit Client and Network Module. - * - * One key example is managing a just-in-time (JIT) state for ephemeral secrets or signing keys - * — such as those used in PKP signing — which must persist across the request lifecycle. - */ - createJitContext: async ( - connectionInfo: ConnectionInfo, - handshakeResult: OrchestrateHandshakeResponse - ): Promise => { - // 1. Generate a key set for the JIT context - const keySet: KeySet = {}; - - for (const url of connectionInfo.bootstrapUrls) { - keySet[url] = { - publicKey: hexToBytes( - HexPrefixedSchema.parse( - handshakeResult.serverKeys[url].nodeIdentityKey - ) as `0x${string}` - ), - secretKey: nacl.box.keyPair().secretKey, - }; - } - - // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); - - // 2. Fetch the price feed info - const nodePrices = await getNodePrices( - { - realmId: 1, - networkCtx: networkConfig, - }, - account - ); - - return { keySet, nodePrices }; - }, - handshake: { - schemas: { - Input: { - ResponseData: RawHandshakeResponseSchema, - }, - }, - }, - pkpSign: { - schemas: { - Input: { - raw: PKPSignInputSchema, - ethereum: EthereumPKPSignInputSchema, - bitcoin: BitCoinPKPSignInputSchema, - }, - RequestData: PKPSignRequestDataSchema, - ResponseData: PKPSignResponseDataSchema, - }, - createRequest: async ( - params: PKPSignCreateRequestParams - ): Promise>[]> => { - _logger.info('pkpSign:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('pkpSign:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - - const requests: RequestItem>[] = - []; - - _logger.info('pkpSign:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - // // Reset and store secret keys for this request - // globalPkpSignSecretKeys[_requestId] = {}; - // globalPkpSignNodeKeys[_requestId] = {}; - - for (const url of urls) { - _logger.info('pkpSign:createRequest: Generating request data', { - url, - }); - - const _requestData = PKPSignRequestDataSchema.parse({ - toSign: Array.from(params.signingContext.toSign), - signingScheme: params.signingContext.signingScheme, - pubkey: params.signingContext.pubKey, - authSig: sessionSigs[url], - nodeSet: urls, - - // additional meta to determine hash function, but not - // sent to the node - chain: params.chain, - bypassAutoHashing: params.signingContext.bypassAutoHashing, - epoch: params.connectionInfo.epochState.currentNumber, - }); - - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().PKP_SIGN, - }); - - _logger.info('pkpSign:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'pkpSign:createRequest: No requests generated for pkpSign.' - ); - throw new Error('Failed to generate requests for pkpSign.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'PKP Sign' - ); - } - - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual PKP sign data from the response wrapper - const pkpSignData = decryptedJson.data; - if (!pkpSignData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - wrap in expected format - const wrappedData = { - success: pkpSignData.success, - values: [pkpSignData], // Wrap the individual response in an array - }; - - const responseData = PKPSignResponseDataSchema.parse(wrappedData); - return responseData.values[0]; // Return the individual PKP sign response - } - ); - - const signatures = await combinePKPSignSignatures({ - nodesPkpSignResponseData: decryptedValues, - requestId, - threshold: networkConfig.minimumThreshold, - }); - - return signatures; - }, - }, - decrypt: { - schemas: { - Input: DecryptInputSchema, - RequestData: DecryptRequestDataSchema, - ResponseData: DecryptResponseDataSchema, - }, - createRequest: async (params: DecryptCreateRequestParams) => { - _logger.info('decrypt:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs for decrypt - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('decrypt:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('decrypt:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('decrypt:createRequest: Generating request data', { - url, - }); - - const _requestData = DecryptRequestDataSchema.parse({ - ciphertext: params.ciphertext, - dataToEncryptHash: params.dataToEncryptHash, - accessControlConditions: params.accessControlConditions, - evmContractConditions: params.evmContractConditions, - solRpcConditions: params.solRpcConditions, - unifiedAccessControlConditions: - params.unifiedAccessControlConditions, - authSig: sessionSigs[url], - chain: params.chain, - }); - - // Encrypt the request data using the generic encryption function - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().ENCRYPTION_SIGN, - }); - - _logger.info('decrypt:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'decrypt:createRequest: No requests generated for decrypt.' - ); - throw new Error('Failed to generate requests for decrypt.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - - identityParam: string, - ciphertext: string, - subnetPubKey: string, - jitContext: NagaJitContext - ) => { - _logger.info('decrypt:handleResponse: Processing decrypt response', { - requestId, - }); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Decryption' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual decrypt data from the response wrapper - const decryptData = decryptedJson.data; - if (!decryptData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - const responseData = DecryptResponseDataSchema.parse(decryptData); - return responseData; - } - ); - - _logger.info('decrypt:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // Extract signature shares from decrypted node responses - const signatureShares = decryptedValues.map((nodeResponse: any) => { - return { - ProofOfPossession: { - identifier: - nodeResponse.signatureShare.ProofOfPossession.identifier, - value: nodeResponse.signatureShare.ProofOfPossession.value, - }, - }; - }); - - _logger.info('decrypt:handleResponse: Signature shares extracted', { - signatureShares, - }); - - // Verify and decrypt using signature shares - const decryptedData = await verifyAndDecryptWithSignatureShares( - subnetPubKey, - stringToBytes(identityParam), - ciphertext, - signatureShares - ); - - _logger.info('decrypt:handleResponse: Decryption completed'); - - return { decryptedData }; - }, - }, - signSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - // extract the authMethod from the requestBody - const authMethod = { - authMethodType: requestBody.authData.authMethodType, - accessToken: requestBody.authData.accessToken, - } as AuthMethod; - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [authMethod], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - maxPrice: getUserMaxPrice({ - product: 'SIGN_SESSION_KEY', - }).toString(), - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signSessionKey:createRequest: No requests generated for signSessionKey.' - ); - throw new Error('Failed to generate requests for signSessionKey.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signSessionKey:handleResponse: Processing signSessionKey response' - ); - - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signSessionKeyData = decryptedJson.data; - if (!signSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signSessionKey response is the individual response, return it directly - return signSessionKeyData; - } - ); - - _logger.info('signSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signSessionKey responses - const values = decryptedValues; - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info('signSessionKey:handleResponse: BLS combined signature', { - blsCombinedSignature, - }); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - signCustomSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignCustomSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signCustomSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signCustomSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signCustomSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - litActionCode: requestBody.litActionCode, - litActionIpfsId: requestBody.litActionIpfsId, - jsParams: requestBody.jsParams, - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signCustomSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signCustomSessionKey:createRequest: No requests generated for signCustomSessionKey.' - ); - throw new Error( - 'Failed to generate requests for signCustomSessionKey.' - ); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signCustomSessionKey:handleResponse: Processing signCustomSessionKey response' - ); - - // Check if the result indicates failure but has an encrypted error payload - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signCustomSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signCustomSessionKeyData = decryptedJson.data; - if (!signCustomSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signCustomSessionKey response is the individual response, return it directly - return signCustomSessionKeyData; - } - ); - - _logger.info('signCustomSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signCustomSessionKey responses - const values = decryptedValues; - - _logger.info('signCustomSessionKey:handleResponse: Values', { - values, - }); - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signCustomSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info( - 'signCustomSessionKey:handleResponse: BLS combined signature', - { - blsCombinedSignature, - } - ); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signCustomSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signCustomSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - executeJs: { - schemas: { - Input: ExecuteJsInputSchema, - RequestData: ExecuteJsRequestDataSchema, - ResponseData: ExecuteJsResponseDataSchema, - }, - createRequest: async (params: ExecuteJsCreateRequestParams) => { - _logger.info('executeJs:createRequest: Creating request', { - hasCode: !!params.executionContext.code, - hasIpfsId: !!params.executionContext.ipfsId, - hasJsParams: !!params.executionContext.jsParams, - responseStrategy: params.responseStrategy?.strategy || 'default', - }); - - // Store response strategy for later use in handleResponse - executeJsResponseStrategy = params.responseStrategy; - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('executeJs:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('executeJs:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('executeJs:createRequest: Generating request data', { - url, - }); - - // Base64 encode the code if provided - let encodedCode: string | undefined; - if (params.executionContext.code) { - encodedCode = Buffer.from( - params.executionContext.code, - 'utf-8' - ).toString('base64'); - _logger.info('executeJs:createRequest: Code encoded to base64', { - originalLength: params.executionContext.code.length, - encodedLength: encodedCode.length, - }); - } - - // Build the request data that gets sent to the nodes - const _requestData = ExecuteJsRequestDataSchema.parse({ - authSig: sessionSigs[url], - nodeSet: urls, - ...(encodedCode && { code: encodedCode }), - ...(params.executionContext.ipfsId && { - ipfsId: params.executionContext.ipfsId, - }), - ...(params.executionContext.jsParams && { - jsParams: { - jsParams: params.executionContext.jsParams, - }, - }), - }); - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().EXECUTE_JS, - }); - - _logger.info('executeJs:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'executeJs:createRequest: No requests generated for executeJs.' - ); - throw new Error('Failed to generate requests for executeJs.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'executeJs:handleResponse: Processing executeJs response', - { - requestId, - responseStrategy: executeJsResponseStrategy?.strategy || 'default', - } - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'JS execution' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedResponseValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual executeJs response data from the response wrapper - const executeJsData = decryptedJson.data; - if (!executeJsData) { - throw new Error('Decrypted response missing data field'); - } - - return executeJsData; // Return the executeJs response directly - } - ); - - // The decryptedResponseValues are individual response objects with the correct fields - // Wrap them in the expected batch result format - const batchResponseData = { - success: true, - values: decryptedResponseValues, // These are the individual executeJs responses - }; - - // Create the correctly structured ProcessedBatchResult for handleExecuteJsResponse - const correctProcessedResult: ProcessedBatchResult< - z.infer - > = { - success: true as const, - values: [batchResponseData], // batchResponseData is the ExecuteJsResponseDataSchema structure - }; - - // Use the handleResponse from the executeJs module with response strategy - const executeJsResponse = await handleExecuteJsResponse( - correctProcessedResult, - requestId, - networkConfig.minimumThreshold, - executeJsResponseStrategy - ); - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response processed successfully', - { - requestId, - hasSignatures: - !!executeJsResponse.signatures && - Object.keys(executeJsResponse.signatures).length > 0, - hasResponse: !!executeJsResponse.response, - hasClaims: - !!executeJsResponse.claims && - Object.keys(executeJsResponse.claims).length > 0, - } - ); - - return executeJsResponse; - }, - }, - }, -}; - -// Now define the type by taking the type of the object, but overriding getChainManager -export type NagaLocalModule = Omit< - typeof networkModuleObject, - 'getChainManager' -> & { - getChainManager: ( - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => CreateChainManagerReturn; +// Add local-specific methods and maintain backward compatibility +const nagaLocal = { + ...baseModule, + // Local environment specific getter for private key + getPrivateKey: () => nagaLocalEnvironment.getPrivateKey(), }; -// Export the correctly typed object -export const nagaLocalModule = networkModuleObject as NagaLocalModule; +export type NagaLocal = typeof nagaLocal; +export { nagaLocal }; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/PricingContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/PricingContextSchema.ts deleted file mode 100644 index 6ee852fe2b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/PricingContextSchema.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { z } from 'zod'; -import { getUserMaxPrice } from './getUserMaxPrice'; -import { PRODUCT_IDS } from './pricing.constants'; - -export const PricingContextSchema = z - .object({ - product: z.enum(['DECRYPTION', 'SIGN', 'LIT_ACTION']), - userMaxPrice: z.bigint().optional(), - nodePrices: z.array( - z.object({ url: z.string(), prices: z.array(z.bigint()) }) - ), - threshold: z.number(), - }) - .transform(({ product, userMaxPrice, nodePrices, threshold }) => { - const _userMaxPrice = - userMaxPrice ?? - getUserMaxPrice({ - product: product, - }); - - return { - product: { - id: PRODUCT_IDS[product], - name: product, - }, - userMaxPrice: _userMaxPrice, - nodePrices, - threshold, - }; - }); - -export type PricingContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getMaxPricesForNodeProduct.ts b/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getMaxPricesForNodeProduct.ts deleted file mode 100644 index 5d90c4ed44..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getMaxPricesForNodeProduct.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { MaxPriceTooLow, PRODUCT_ID_VALUES } from '@lit-protocol/constants'; - -/** - * @deprecated - use the one in the type package - */ -export interface MaxPricesForNodes { - nodePrices: { url: string; prices: bigint[] }[]; - userMaxPrice: bigint; - productId: PRODUCT_ID_VALUES; - numRequiredNodes?: number; -} - -/** - * Builds an object with updated prices distributed proportionally across nodes. - * Ensures the total cost does not exceed userMaxPrice. - * Operates in the order of lowest priced node to highest. - * - * @param nodePrices - An object where keys are node addresses and values are arrays of prices for different action types. - * @param userMaxPrice - The maximum price the user is willing to pay to execute the request. - * @param productId - The ID of the product to determine which price to consider. - * @param numRequiredNodes - Optional number of nodes required to execute the action. Defaults to all nodes. - * @returns An object with updated prices distributed proportionally. - * @throws A MaxPriceTooLow error if the total price exceeds userMaxPrice - */ -export function getMaxPricesForNodeProduct({ - nodePrices, - userMaxPrice, - productId, - numRequiredNodes, -}: MaxPricesForNodes): { url: string; price: bigint }[] { - // If we don't need all nodes to service the request, only use the cheapest `n` of them - const nodesToConsider = numRequiredNodes - ? nodePrices.slice(0, numRequiredNodes) - : nodePrices; - - let totalBaseCost = 0n; - - // Calculate the base total cost without adjustments - for (const { prices } of nodesToConsider) { - totalBaseCost += prices[productId]; - } - - // Verify that we have a high enough userMaxPrice to fulfill the request - if (totalBaseCost > userMaxPrice) { - throw new MaxPriceTooLow( - { - info: { - totalBaseCost: totalBaseCost.toString(), - userMaxPrice: userMaxPrice.toString(), - }, - }, - `Max price is too low: Minimum required price is ${totalBaseCost.toString()}, got ${userMaxPrice.toString()}.` - ); - } - - /* If the user is willing to pay more than the nodes charge based on our current view of pricing - * then we can provide extra margin to the maxPrice for each node -- making it less likely for - * our request to fail if the price on some of the nodes is higher than we think it was, as long as it's not - * drastically different than we expect it to be - */ - const excessBalance = userMaxPrice - totalBaseCost; - - // Map matching the keys from `nodePrices`, but w/ the per-node maxPrice computed based on `userMaxPrice` - const maxPricesPerNode: { url: string; price: bigint }[] = []; - - for (const { url, prices } of nodesToConsider) { - // For now, we'll distribute the remaining balance equally across nodes - maxPricesPerNode.push({ - url, - price: excessBalance - ? prices[productId] + excessBalance / BigInt(nodesToConsider.length) - : prices[productId], - }); - } - - return maxPricesPerNode; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.spec.ts deleted file mode 100644 index e7d98e4e95..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - getUserMaxPrice, - PRODUCT_IDS, - UNSIGNED_128_MAX, -} from './getUserMaxPrice'; - -describe('getUserMaxPrice', () => { - const expectedMaxPrice = UNSIGNED_128_MAX; - - it('should return the rust U128 max price for DECRYPTION product', () => { - expect(getUserMaxPrice({ product: 'DECRYPTION' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for SIGN product', () => { - expect(getUserMaxPrice({ product: 'SIGN' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for LIT_ACTION product', () => { - expect(getUserMaxPrice({ product: 'LIT_ACTION' })).toBe(expectedMaxPrice); - }); - - // Test with values from PRODUCT_IDS to ensure they are correctly handled - it('should return the rust U128 max price when using PRODUCT_IDS.DECRYPTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.DECRYPTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.SIGN', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.SIGN - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.LIT_ACTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.LIT_ACTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/pricing.constants.ts b/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/pricing.constants.ts deleted file mode 100644 index 7154ce0e6c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/pricing.constants.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Rust U128 max - * See https://cheats.rs/ for more info - */ -export const UNSIGNED_128_MAX = - 340_282_366_920_938_463_463_374_607_431_768_211_455n; - -/** - * Product IDs used for price feed and node selection - * - * - DECRYPTION (0): Used for decryption operations - * - SIGN (1): Used for signing operations - * - LIT_ACTION (2): Used for Lit Actions execution - * - SIGN_SESSION_KEY (3): Used for sign session key operations - */ -export const PRODUCT_IDS = { - DECRYPTION: 0n, // For decryption operations - SIGN: 1n, // For signing operations - LIT_ACTION: 2n, // For Lit Actions execution - SIGN_SESSION_KEY: 3n, // For sign session key operations -} as const; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/scripts/00-generate-abi-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-local/scripts/00-generate-abi-signatures.ts deleted file mode 100644 index 523fe2b43b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/scripts/00-generate-abi-signatures.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures'; - -const JSON_FILE_PATH = process.env['NETWORK_CONFIG'] as string; - -console.log('JSON_FILE_PATH:', JSON_FILE_PATH); - -if (!JSON_FILE_PATH) { - throw new Error( - '❌ NETWORK_CONFIG is not set. Please set it in your .env file.' - ); -} - -async function main() { - await generateSignaturesFromContext({ - jsonFilePath: JSON_FILE_PATH, - networkName: 'naga-develop', - outputDir: '../generated', - useScriptDirectory: true, - - // @ts-ignore - callerPath: import.meta.url, - }); -} - -// gogogo! -main().catch(console.error); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/AuthContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/AuthContextSchema.ts deleted file mode 100644 index b6090200f7..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/AuthContextSchema.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - AuthSigSchema, - HexPrefixedSchema, - ISessionCapabilityObjectSchema, - LitResourceAbilityRequestSchema, - SessionKeyPairSchema, - AuthConfigSchema, - AuthMethodSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; -import { Account } from 'viem'; - -// { -// pkpPublicKey: "0x04e5603fe1cc5ce207c12950939738583b599f22a152c3672a4c0eee887d75dd405246ac3ed2430283935a99733eac9520581af9923c0fc04fad1d67d60908ce18", -// chain: "ethereum", -// resourceAbilityRequests: [ -// { -// resource: { -// getResourceKey: [Function], -// isValidLitAbility: [Function], -// toString: [Function], -// resourcePrefix: "lit-pkp", -// resource: "*", -// }, -// ability: "pkp-signing", -// } -// ], -// sessionKeyPair: { -// publicKey: "1d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// secretKey: "faa9b3b04f89ef6066f8842ad713a8c1d2d12540b65129f328a1e301366ebc051d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// }, -// sessionCapabilityObject: SessionCapabilityObjectSchema, -// authNeededCallback: [AsyncFunction: authNeededCallback], -// capabilityAuthSigs: [], -// } -// export const AuthContextSchema = z.object({ -// pkpPublicKey: HexPrefixedSchema.optional(), -// // viemAccount: z.custom().optional(), -// // authMethod: AuthMethodSchema.optional(), -// chain: z.string(), -// sessionKeyPair: SessionKeyPairSchema, -// // which one do we need here? -// resourceAbilityRequests: z.array(LitResourceAbilityRequestSchema), -// // which one do we need here? -// sessionCapabilityObject: ISessionCapabilityObjectSchema, -// // which one do we need here? TODO: ❗️ specify the type properly -// siweResources: z.any(), -// authNeededCallback: z.function(), -// capabilityAuthSigs: z.array(AuthSigSchema), -// authConfig: AuthConfigSchema, -// }); - -// export type AuthContext = z.infer; - -// export const EoaAuthContextSchema = z.object({ -// viemAccount: z.custom(), -// authMethod: AuthMethodSchema, -// authNeededCallback: z.function(), -// sessionKeyPair: SessionKeyPairSchema, -// authConfig: AuthConfigSchema, -// }); - -// export const GenericAuthContextSchema = z.union([ -// AuthContextSchema, -// EoaAuthContextSchema, -// ]); - -// export type GenericAuthContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.test.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.test.ts deleted file mode 100644 index 44b8384ad9..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.test.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { formatSessionSigs } from './session-sigs-reader'; - -const MOCK_VALID_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -const MOCK_EXPIRED_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -describe('formatSessionSigs', () => { - it('should format session signatures correctly', () => { - const currentTime = new Date('2022-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_VALID_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2022-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2024-10-16T13:48:18.135Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ✅ Not expired (valid for 1020 days) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2024-10-16T13:48:13.383Z - * Expiration: 2024-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ✅ Not expired (valid for 1026 days) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2024-10-16T13:47:47.000Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ✅ Not expired (valid for 1020 days) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - - expect(formattedSessionSigs).toBe(expectedOutput); - }); - - it('should handle expired session signatures correctly', () => { - const currentTime = new Date('2024-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_EXPIRED_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2024-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2022-10-16T13:48:18.135Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ❌ Expired (expired 440 days ago) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2022-10-16T13:48:13.383Z - * Expiration: 2022-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ❌ Expired (expired 434 days ago) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2022-10-16T13:47:47.000Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ❌ Expired (expired 440 days ago) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - expect(formattedSessionSigs).toBe(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.ts deleted file mode 100644 index 99c66792fd..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-reader.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { InvalidArgumentException } from '@lit-protocol/constants'; -import { logger } from '@lit-protocol/logger'; - -import { parseSignedMessage } from './session-sigs-validator'; - -function formatDuration(start: Date, end: Date): string { - const diff = end.getTime() - start.getTime(); - const days = Math.floor(diff / (1000 * 60 * 60 * 24)); - const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); - const seconds = ((diff % (1000 * 60)) / 1000).toFixed(3); - - let elapsedTime: string; - - if (days > 0) { - elapsedTime = `${days} days`; - } else if (hours > 0) { - elapsedTime = `${hours} hours, ${minutes} minutes, ${seconds} seconds`; - } else { - elapsedTime = `${minutes} minutes, ${seconds} seconds`; - } - - return elapsedTime; -} - -function formatStatus(expirationDate: Date, currentDate: Date): string { - if (expirationDate > currentDate) { - const timeLeft = formatDuration(currentDate, expirationDate); - return `✅ Not expired (valid for ${timeLeft})`; - } else { - const timeAgo = formatDuration(expirationDate, currentDate); - return `❌ Expired (expired ${timeAgo} ago)`; - } -} - -/** - * Convert this format: - * {"lit-ratelimitincrease://25364":{"Auth/Auth":[{"nft_id":["25364"]}]}} - * to human-readable format - */ -function humanReadableAtt(obj: any, indentLevel: number = 0): string { - const indent = ' '.repeat(indentLevel * 2); - let result = ''; - - for (const key in obj) { - result += `${indent}* ${key}\n`; - - if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) { - result += humanReadableAtt(obj[key], indentLevel + 1); - } else if (Array.isArray(obj[key])) { - obj[key].forEach((item: any) => { - if (typeof item === 'object') { - result += humanReadableAtt(item, indentLevel + 1); - } else { - result += `${indent} * ${item}\n`; - } - }); - } else { - result += `${indent} * ${obj[key]}\n`; - } - } - return result; -} - -export function formatSessionSigs( - sessionSigs: string, - currentTime: Date = new Date() -): string { - const parsedSigs = JSON.parse(sessionSigs); - const firstNodeKey = Object.keys(parsedSigs)[0]; - const firstNode = parsedSigs[firstNodeKey]; - let signedMessage; - - try { - signedMessage = JSON.parse(firstNode.signedMessage); - } catch (error: unknown) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - firstNodeSignedMessage: firstNode.signedMessage, - }, - }, - `Invalid JSON format for signedMessage: ${errorMessage}` - ); - } - - const currentDate = new Date(currentTime); - - let result = `The request time is at: ${currentDate.toISOString()}\n`; - - // Outer expiration - let issuedAt, expiration; - try { - issuedAt = new Date(signedMessage.issuedAt); - expiration = new Date(signedMessage.expiration); - } catch (error) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - }, - }, - `Error parsing issuedAt or expiration: ${errorMessage}` - ); - } - - result += '* Outer expiration:\n'; - result += ` * Issued at: ${issuedAt.toISOString()}\n`; - result += ` * Expiration: ${expiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration(issuedAt, expiration)}\n`; - result += ` * Status: ${formatStatus(expiration, currentDate)}\n`; - - // Capabilities - result += '* Capabilities:\n'; - signedMessage.capabilities.forEach((cap: any, index: number) => { - const capType = cap.derivedVia; - const parsedCapMessage = parseSignedMessage(cap.signedMessage); - let attenuation: string = ''; - - try { - const encodedRecap = (parsedCapMessage['- urn'] as string)?.split(':')[1]; - const decodedRecap = atob(encodedRecap); - const jsonRecap = JSON.parse(decodedRecap); - attenuation = humanReadableAtt(jsonRecap.att, 6); - } catch (e) { - // swallow error - logger.info({ - function: 'formatSessionSigs', - msg: 'Error parsing attenuation', - error: e, - }); - } - - const capIssuedAt = new Date(parsedCapMessage['Issued At'] || ''); - const capExpiration = new Date(parsedCapMessage['Expiration Time'] || ''); - - result += ` * Capability ${index + 1} (${capType}):\n`; - result += ` * Issued at: ${capIssuedAt.toISOString()}\n`; - result += ` * Expiration: ${capExpiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration( - capIssuedAt, - capExpiration - )}\n`; - result += ` * Status: ${formatStatus(capExpiration, currentDate)}\n`; - result += ` * Attenuation:\n`; - result += attenuation; - }); - return result; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.spec.ts deleted file mode 100644 index 24a7c1680a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.spec.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { AuthSig } from '@lit-protocol/types'; - -import { validateSessionSigs } from './session-sigs-validator'; - -describe('validateSessionSigs', () => { - // Mock session signature with valid data for reference - const validSessionSig: AuthSig = { - sig: 'valid-sig', - derivedVia: 'some-method', - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: 2099-12-31T23:59:59Z`, - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', // Valid future date - }), - address: '0xValidAddress', - algo: 'ed25519', - }; - - // Helper function to create a SessionSigsMap - function createSessionSigsMap(sigs: { - [key: string]: AuthSig; - }): Record { - return sigs; - } - - // 1. Invalid JSON in signedMessage - it('should handle invalid JSON in signedMessage', () => { - const invalidJsonSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidJsonSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Main signedMessage is not valid JSON." - ); - }); - - // 2. Missing capabilities field - it('should handle missing capabilities field', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.capabilities; // Remove the capabilities field - - const missingCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Capabilities not found in main signedMessage." - ); - }); - - // 3. Empty capabilities array - it('should not accept an empty capabilities array', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities = []; // Set capabilities to empty array - - const emptyCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: emptyCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining('No capabilities found in main signedMessage.') - ); - }); - - // 4. Invalid capability in capabilities - it('should handle invalid capability in capabilities', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities[0].signedMessage = `Capability Signed Message -Expiration Time: invalid-date-format`; // Invalid expiration date in capability - - const invalidCapabilitySessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidCapabilitySessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in capability 0" - ) - ); - }); - - // 5. Missing expiration in main signedMessage - it('should handle missing expiration in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.expiration; // Remove the expiration field - - const missingExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Expiration Time not found in outer signedMessage." - ); - }); - - // 6. Invalid expiration date format in main signedMessage - it('should handle invalid expiration date format in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = 'invalid-date-format'; // Set invalid expiration date - - const invalidExpirationFormatSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidExpirationFormatSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in main signedMessage" - ) - ); - }); - - // 7. Expired expiration date in main signedMessage - it('should handle expired expiration date in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = '2000-01-01T00:00:00Z'; // Past date - - const expiredExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: expiredExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Expired main signedMessage. Expiration Time:" - ) - ); - }); - - // 8. Multiple session signatures, some valid and some invalid - it('should validate multiple session signatures and report errors', () => { - const session1 = validSessionSig; // Valid - const session2: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', // Invalid JSON - }; - const session3: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: invalid-date-format`, // Invalid date format - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', - }), - }; - - const sessionSigs = createSessionSigsMap({ - session1, - session2, - session3, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session2': Main signedMessage is not valid JSON." - ); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session3': Invalid Expiration Time format in capability 0" - ) - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.ts deleted file mode 100644 index 55847d2b8a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/helper/session-sigs-validator.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { - AuthSig, - Capability, - ParsedSessionMessage, - ParsedSignedMessage, - SessionSigsMap, -} from '@lit-protocol/types'; - -interface ValidationResult { - isValid: boolean; - errors: string[]; -} - -// Function to parse a signedMessage string into an object -export function parseSignedMessage(signedMessage: string): ParsedSignedMessage { - const lines = signedMessage.split('\n'); - const parsedData: ParsedSignedMessage = {}; - let currentKey: string | null = null as string | null; - let currentValue = ''; - - lines.forEach((line) => { - // Match lines with 'Key: Value' pattern - const keyValueMatch = line.match(/^([^:]+):\s*(.*)$/); - - if (keyValueMatch) { - // Save the previous key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // Start a new key-value pair - currentKey = keyValueMatch[1]; - currentValue = keyValueMatch[2]; - } else if (line.startsWith('- ')) { - // Handle list items - const item = line.substring(2).trim(); - if (!parsedData[currentKey!]) { - parsedData[currentKey!] = []; - } - (parsedData[currentKey!] as string[]).push(item); - } else if (line.trim() === '') { - // Skip empty lines - } else { - // Continuation of the current value - currentValue += '\n' + line; - } - }); - - // Save the last key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // parsedData: { - // 'localhost wants you to sign in with your Ethereum account': '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - // 'This is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf': "(1) 'Auth': 'Auth' for 'lit-ratelimitincrease://24529'.", - // URI: 'lit:capability:delegation', - // Version: '1', - // 'Chain ID': '1', - // Nonce: '0x921dd92f497527857ee8dda62f1805e56c34c99a6b37691b4e56e6fb171a5a70', - // 'Issued At': '2024-09-19T13:07:33.606Z', - // 'Expiration Time': '2024-09-26T13:07:33.602Z', - // Resources: '', - // '- urn': 'recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjQ1MjkiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjQ1MjkiXSwidXNlcyI6IjIwMCJ9XX19LCJwcmYiOltdfQ' - // } - return parsedData; -} - -// Function to validate expiration date -function validateExpiration( - expirationTimeStr: string, - context: string -): ValidationResult { - const errors: string[] = []; - const expirationTime = new Date(expirationTimeStr); - const currentTime = new Date(); - - if (isNaN(expirationTime.getTime())) { - errors.push( - `Invalid Expiration Time format in ${context}: ${expirationTimeStr}` - ); - } else if (expirationTime < currentTime) { - errors.push( - `Expired ${context}. Expiration Time: ${expirationTime.toISOString()}` - ); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -// Function to parse and validate capabilities -function parseCapabilities(capabilities: Capability[]): ValidationResult { - const errors: string[] = []; - - capabilities.forEach((capability, index) => { - const { signedMessage } = capability; - - // Parse the signedMessage - const parsedCapabilityMessage = parseSignedMessage(signedMessage); - capability.parsedSignedMessage = parsedCapabilityMessage; - - // Extract and validate expiration date - const expirationTimeStr = parsedCapabilityMessage['Expiration Time']; - - if (expirationTimeStr) { - const validationResult = validateExpiration( - expirationTimeStr, - `capability ${index}` - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push( - `Expiration Time not found in capability ${index}'s signedMessage.` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signature. - * - * @param sessionSig - The session signature to validate. - * @returns The validation result, indicating whether the session signature is valid and any errors encountered during validation. - */ -export function validateSessionSig(sessionSig: AuthSig): ValidationResult { - const errors: string[] = []; - - // Parse the main signedMessage - let parsedSignedMessage: ParsedSessionMessage; - try { - parsedSignedMessage = JSON.parse(sessionSig.signedMessage); - } catch (error) { - errors.push('Main signedMessage is not valid JSON.'); - return { isValid: false, errors }; - } - - // Validate capabilities - const capabilities: Capability[] = parsedSignedMessage.capabilities; - - if (!capabilities) { - errors.push('Capabilities not found in main signedMessage.'); - } else if (capabilities.length === 0) { - errors.push('No capabilities found in main signedMessage.'); - } else { - const capabilitiesValidationResult = parseCapabilities(capabilities); - - if (!capabilitiesValidationResult.isValid) { - errors.push(...capabilitiesValidationResult.errors); - } - } - - // Validate outer expiration - const outerExpirationTimeStr = parsedSignedMessage['expiration']; - - if (outerExpirationTimeStr) { - const validationResult = validateExpiration( - outerExpirationTimeStr, - 'main signedMessage' - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push('Expiration Time not found in outer signedMessage.'); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signatures. - * - * @param sessionSigs - The session signatures to validate. - * @returns The validation result, indicating whether the session signatures are valid and any errors encountered during validation. - */ -export function validateSessionSigs( - sessionSigs: SessionSigsMap -): ValidationResult { - const errors: string[] = []; - - Object.entries(sessionSigs).forEach(([key, sessionSig]) => { - const validationResult = validateSessionSig(sessionSig); - - if (!validationResult.isValid) { - errors.push( - `Session Sig '${key}': ${validationResult.errors.join(', ')}` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/issueSessionFromContext.ts b/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/issueSessionFromContext.ts deleted file mode 100644 index 8195feb80c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/session-manager/issueSessionFromContext.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { InvalidSessionSigs } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - AuthConfigSchema, -} from '@lit-protocol/schemas'; -import { - LitResourceAbilityRequest, - SessionSigningTemplate, - SessionSigsMap, -} from '@lit-protocol/types'; -import { ed25519 } from '@noble/curves/ed25519'; -import { hexToBytes } from '@noble/hashes/utils'; -import { z } from 'zod'; -import { getMaxPricesForNodeProduct } from '../pricing-manager/getMaxPricesForNodeProduct'; -import { PricingContext } from '../pricing-manager/PricingContextSchema'; -import { validateSessionSigs } from './helper/session-sigs-validator'; - -/** - * Attempts to normalize a string by unescaping it until it can be parsed as a JSON object, - * then stringifies it exactly once. If the input is a regular string that does not represent - * a JSON object or array, the function will return it as is without modification. - * This function is designed to handle cases where strings might be excessively escaped due - * to multiple layers of encoding, ensuring that JSON data is stored in a consistent and - * predictable format, and regular strings are left unchanged. - * - * @param input The potentially excessively escaped string. - * @return A string that is either the JSON.stringify version of the original JSON object - * or the original string if it does not represent a JSON object or array. - */ -export function normalizeAndStringify(input: string): string { - try { - // Directly return the string if it's not in a JSON format - if (!input.startsWith('{') && !input.startsWith('[')) { - return input; - } - - // Attempt to parse the input as JSON - const parsed = JSON.parse(input); - - // If parsing succeeds, return the stringified version of the parsed JSON - return JSON.stringify(parsed); - } catch (error) { - // If parsing fails, it might be due to extra escaping - const unescaped = input.replace(/\\(.)/g, '$1'); - - // If unescaping doesn't change the string, return it as is - if (input === unescaped) { - return input; - } - - // Otherwise, recursively call the function with the unescaped string - return normalizeAndStringify(unescaped); - } -} - -export const issueSessionFromContext = async (params: { - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - pricingContext: PricingContext; - // latestBlockhash: string; -}): Promise => { - const authSig = await params.authContext.authNeededCallback(); - const _authConfig = AuthConfigSchema.parse(params.authContext.authConfig); - - const capabilities = [ - ...(_authConfig?.capabilityAuthSigs || []), // Spreads existing sigs, or an empty array if null/undefined/empty - authSig, - ]; - - // This is the template that will be combined with the node address as a single object, then signed by the session key - // so that the node can verify the session signature - const sessionSigningTemplate = { - sessionKey: params.authContext.sessionKeyPair.publicKey, - resourceAbilityRequests: (_authConfig.resources || - []) as LitResourceAbilityRequest[], - capabilities: capabilities, - issuedAt: new Date().toISOString(), - - // @ts-ignore - adding ! because zod schema has a default so this value will never be undefined - // otherwise, "const toSign" below will throw lint error - expiration: _authConfig.expiration!, - }; - - // console.log('🔄 sessionSigningTemplate', sessionSigningTemplate); - - const sessionSigs: SessionSigsMap = {}; - - const _userMaxPrices = getMaxPricesForNodeProduct({ - nodePrices: params.pricingContext.nodePrices, - userMaxPrice: params.pricingContext.userMaxPrice, - - // @ts-ignore - need to change the MaxPricesForNodes interface - productId: Number(params.pricingContext.product.id), - numRequiredNodes: params.pricingContext.threshold, - }); - - // console.log('🔄 _userMaxPrices', _userMaxPrices); - - _userMaxPrices.forEach(({ url: nodeAddress, price }) => { - const toSign: SessionSigningTemplate = { - ...sessionSigningTemplate, - nodeAddress, - maxPrice: price.toString(), - }; - - // console.log(`Setting maxprice for ${nodeAddress} to `, price.toString()); - - const signedMessage = JSON.stringify(toSign); - - const messageHex = new Uint8Array(Buffer.from(signedMessage, 'utf8')); - - const secretKeyBytes = hexToBytes( - params.authContext.sessionKeyPair.secretKey - ); - const signature = ed25519.sign(messageHex, secretKeyBytes); - - // one of these is essentially what wrapped key service need. - sessionSigs[nodeAddress] = { - sig: Buffer.from(signature).toString('hex'), - derivedVia: 'litSessionSignViaNacl', - signedMessage: signedMessage, - address: params.authContext.sessionKeyPair.publicKey, - algo: 'ed25519', - }; - }); - - const validatedSessionSigs = validateSessionSigs(sessionSigs); - - if (validatedSessionSigs.isValid === false) { - throw new InvalidSessionSigs( - {}, - `Invalid sessionSigs. Errors: ${validatedSessionSigs.errors}` - ); - } - - // make this only log when debug is enabled - // if (typeof process !== 'undefined' && process.env['PINO_LOG_LEVEL']) { - // console.log( - // '💡 PINO_LOG_LEVEL is defined, printing human readable session sigs' - // ); - // console.log(formatSessionSigs(JSON.stringify(sessionSigs))); - // } - - return sessionSigs; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.spec.ts deleted file mode 100644 index 5337321997..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.spec.ts +++ /dev/null @@ -1,348 +0,0 @@ -import { createStateManager } from './createStateManager'; -import { STAKING_STATES } from '@lit-protocol/constants'; -import { createReadOnlyChainManager } from '@nagaDev/ChainManager'; -import { createReadOnlyContractsManager } from '@vNaga/LitChainClient'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { createEvmEventState } from '../../../../shared/StateManager/src/createEvmEventState'; -import { createRefreshedValue } from '../../../../shared/StateManager/src/createRefreshedValue'; -import { getChildLogger } from '@lit-protocol/logger'; - -// Mock dependencies -jest.mock('@nagaDev/ChainManager'); -jest.mock('@vNaga/LitChainClient'); -jest.mock('ethers'); -jest.mock('../../../../shared/StateManager/helpers/fetchBlockchainData'); -jest.mock('../../../../shared/StateManager/src/createEvmEventState'); -jest.mock('../../../../shared/StateManager/src/createRefreshedValue'); -jest.mock('@lit-protocol/logger'); - -const mockGetChildLogger = getChildLogger as jest.Mock; -const mockCreateReadOnlyChainManager = createReadOnlyChainManager as jest.Mock; -const mockCreateReadOnlyContractsManager = - createReadOnlyContractsManager as jest.Mock; -const mockEthersContract = ethers.Contract as jest.Mock; -const mockEthersJsonRpcProvider = ethers.providers.JsonRpcProvider as jest.Mock; -const mockFetchBlockchainData = fetchBlockchainData as jest.Mock; -const mockCreateEvmEventState = createEvmEventState as jest.Mock; -const mockCreateRefreshedValue = createRefreshedValue as jest.Mock; - -describe('createStateManager', () => { - let mockNetworkConfig: any; - let mockLogger: any; - let mockGetConnectionInfo: jest.Mock; - let mockGetOrRefreshAndGet: jest.Mock; - let mockEvmEventStateInstance: { - listen: jest.Mock; - stop: jest.Mock; - onChangeCallback?: (newState: any) => Promise; - }; - - beforeEach(() => { - jest.clearAllMocks(); - - mockLogger = { - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - mockGetChildLogger.mockReturnValue(mockLogger); - - mockGetConnectionInfo = jest.fn(); - mockCreateReadOnlyChainManager.mockReturnValue({ - api: { - connection: { - getConnectionInfo: mockGetConnectionInfo, - }, - }, - }); - - mockCreateReadOnlyContractsManager.mockReturnValue({ - stakingContract: { - address: '0xStakingContractAddress', - abi: [], - }, - }); - - mockEthersContract.mockImplementation(() => ({})); - mockEthersJsonRpcProvider.mockImplementation(() => ({})); - - mockGetOrRefreshAndGet = jest.fn(); - mockCreateRefreshedValue.mockReturnValue({ - getOrRefreshAndGet: mockGetOrRefreshAndGet, - }); - - mockEvmEventStateInstance = { - listen: jest.fn(), - stop: jest.fn(), - }; - mockCreateEvmEventState.mockImplementation(({ onChange }) => { - // Capture the onChange callback to simulate events - mockEvmEventStateInstance.onChangeCallback = onChange; - return mockEvmEventStateInstance; - }); - - mockNetworkConfig = { - rpcUrl: 'http://localhost:8545', - // Add other necessary config properties if your tests need them - }; - }); - - const initialConnectionInfo = { - bootstrapUrls: ['http://node1.com'], - epochInfo: { number: 1, id: 'epoch1' }, - connectedNodes: new Map([['node1', {}]]), - }; - - const updatedConnectionInfo = { - bootstrapUrls: ['http://node2.com', 'http://node3.com'], - epochInfo: { number: 2, id: 'epoch2' }, - connectedNodes: new Map([['node2', {}]]), - }; - - it('should initialize, fetch initial connection info, and start listeners', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - expect(mockGetChildLogger).toHaveBeenCalledWith({ module: 'StateManager' }); - expect(mockCreateReadOnlyChainManager).toHaveBeenCalled(); - expect(mockCreateReadOnlyContractsManager).toHaveBeenCalledWith( - mockNetworkConfig - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockCreateEvmEventState).toHaveBeenCalled(); - expect(mockEvmEventStateInstance.listen).toHaveBeenCalled(); - expect(mockLogger.info).toHaveBeenCalledWith( - 'State manager background processes started.' - ); - }); - - it('should throw an error if initial connection info fetch fails', async () => { - const error = new Error('Failed to connect'); - mockGetConnectionInfo.mockRejectedValueOnce(error); - - await expect( - createStateManager({ networkConfig: mockNetworkConfig }) - ).rejects.toThrow('Failed to initialize state manager connection info.'); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get initial connection info for State Manager', - error - ); - }); - - describe('getLatestBlockhash', () => { - it('should return blockhash from blockhashManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const mockBlockhash = '0x123abc'; - mockGetOrRefreshAndGet.mockResolvedValueOnce(mockBlockhash); - - const blockhash = await stateManager.getLatestBlockhash(); - expect(blockhash).toBe(mockBlockhash); - expect(mockGetOrRefreshAndGet).toHaveBeenCalled(); - }); - - it('should throw error if blockhashManager fails', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const error = new Error('Blockhash fetch failed'); - mockGetOrRefreshAndGet.mockRejectedValueOnce(error); - - await expect(stateManager.getLatestBlockhash()).rejects.toThrow(error); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Error getting latest blockhash', - error - ); - }); - }); - - describe('getLatestConnectionInfo', () => { - it('should return the latest connection info', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - }); - - describe('staking state changes', () => { - it('should refresh connection info, update urls and epoch when state becomes Active and data changed', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo - mockGetConnectionInfo.mockResolvedValueOnce(updatedConnectionInfo); - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); // Initial + Active state - expect(stateManager.getLatestConnectionInfo()).toEqual( - updatedConnectionInfo - ); - expect(mockLogger.warn).toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: initialConnectionInfo.bootstrapUrls, - newUrls: updatedConnectionInfo.bootstrapUrls, - }) - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number updated from 1 to 2' - ); - }); - - it('should refresh connection info but not log warnings if URLs and epoch are the same', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo returns same data - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'BootstrapUrls remain unchanged.' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number 1 remains the same.' - ); - expect(mockLogger.warn).not.toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - }) - ); - }); - - it('should handle error when fetching connection info during Active state', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - const fetchError = new Error('Fetch connection info failed'); - mockGetConnectionInfo.mockRejectedValueOnce(fetchError); // Fail on the second call - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get connection info during staking onChange', - fetchError - ); - // Connection info should remain the initial one - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should not refresh connection info if state is not Active', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Paused); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Paused"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is "Paused", not Active. Connection info not refreshed via event.' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); // Only initial call - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should do nothing if new state is null in onChange', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await createStateManager({ networkConfig: mockNetworkConfig }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(null); - expect(mockLogger.info).not.toHaveBeenCalledWith( - expect.stringContaining('New staking state detected:') - ); - }); - }); - - describe('stop', () => { - it('should call stop on eventStateManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - stateManager.stop(); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'Stopping state manager listeners...' - ); - expect(mockEvmEventStateInstance.stop).toHaveBeenCalled(); - }); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.ts b/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.ts deleted file mode 100644 index 7c97a3ad9e..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/createStateManager.ts +++ /dev/null @@ -1,253 +0,0 @@ -import { STAKING_STATES, STAKING_STATES_VALUES } from '@lit-protocol/constants'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { - createEvmEventState, - EventState, -} from '../../../../shared/StateManager/src/createEvmEventState'; -import { - createRefreshedValue, - RefreshedValue, -} from '../../../../shared/StateManager/src/createRefreshedValue'; -import { - ConnectionInfo, - createReadOnlyContractsManager, -} from '../../../LitChainClient'; -import { createReadOnlyChainManager } from '../chain-manager/createChainManager'; -import { NagaLocalNetworkContext } from '../naga-local.config'; -// Import EpochInfo type (adjust path if necessary based on actual export location) -import { getChildLogger } from '@lit-protocol/logger'; -import type { CallbackParams, EndPoint, EpochInfo } from '@lit-protocol/types'; -import { LitNetworkModuleBase } from '../../../../types'; -import { areStringArraysDifferent } from './helper/areStringArraysDifferent'; - -const _logger = getChildLogger({ - module: 'StateManager', -}); - -const BLOCKHASH_SYNC_INTERVAL = 30_000; - -// export type EndPoint = { -// [key: string]: { -// path: string; -// version: string; -// }; -// }; - -// export type CallbackParams = { -// bootstrapUrls: string[]; -// currentEpoch: number; -// version: string; -// requiredAttestation: boolean; -// minimumThreshold: number; -// abortTimeout: number; -// endpoints: EndPoint[]; -// }; - -/** - * It returns a blockhash manager for latestBlockhash/nonce and event state - * manager for latest connection info. - */ -export const createStateManager = async (params: { - networkConfig: NagaLocalNetworkContext; - callback: (params: CallbackParams) => Promise; - networkModule: LitNetworkModuleBase; -}) => { - // --- Internal State --- Keep track of the latest known values - let latestBootstrapUrls: string[] = []; - let latestEpochInfo: EpochInfo | null = null; - let latestConnectionInfo: ConnectionInfo | null = null; - let callbackResult: T | null = null; - - // just a test to check on the Lit Client we are getting the latest result - // let counter = 0; - - // --- Internal Managers --- (Not directly exposed) - const blockhashManager: RefreshedValue = createRefreshedValue( - { - fetch: fetchBlockchainData, - ttlMs: BLOCKHASH_SYNC_INTERVAL, - } - ); - - const readOnlyChainManager = createReadOnlyChainManager(); - const contractManager = createReadOnlyContractsManager(params.networkConfig); - - // --- Initial Fetch for Connection Info --- - try { - const initialConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - latestBootstrapUrls = initialConnectionInfo.bootstrapUrls; - latestEpochInfo = initialConnectionInfo.epochInfo; // Store initial epoch info - latestConnectionInfo = initialConnectionInfo; // Store initial connection info - _logger.info({ - msg: 'State Manager Initialized with Connection Info', - initialUrls: latestBootstrapUrls, - initialEpoch: latestEpochInfo?.number, - initialConnectionInfo, - }); - - // --- Initial callback - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo?.number, - version: params.networkModule.version, - requiredAttestation: params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - // releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - } catch (error: any) { - _logger.error( - 'Failed to get initial connection info for State Manager', - error - ); - // Depending on requirements, might want to re-throw or handle differently - throw new Error(error); - } - - // --- Setup Staking Event Listener --- - const stakingContract = new ethers.Contract( - contractManager.stakingContract.address, - contractManager.stakingContract.abi, - new ethers.providers.JsonRpcProvider(params.networkConfig.rpcUrl) - ); - - const eventStateManager: EventState = - createEvmEventState({ - contract: stakingContract, - eventName: 'StateChanged', - initialValue: null, // Initial value of the *event state itself* - transform: (args: any[]): STAKING_STATES_VALUES => { - return args[0] as STAKING_STATES_VALUES; - }, - onChange: async (newState) => { - // 1. check if the new state is valid - if (newState === null) return; - - _logger.info(`New staking state detected: "${newState}"`); - - // 2. If state is Active, refresh connection info - if (newState === (STAKING_STATES.Active as STAKING_STATES_VALUES)) { - try { - _logger.info( - '🖐 Staking state is Active. Fetching latest connection info...' - ); - const newConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - const newBootstrapUrls = newConnectionInfo.bootstrapUrls; - const newEpochInfo = newConnectionInfo.epochInfo; // Get new epoch info - latestConnectionInfo = newConnectionInfo; // Update internal state for connection info - - const bootstrapUrlsChanged = areStringArraysDifferent( - latestBootstrapUrls, - newBootstrapUrls - ); - - if (bootstrapUrlsChanged) { - _logger.warn({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: latestBootstrapUrls, - newUrls: newBootstrapUrls, - }); - latestBootstrapUrls = newBootstrapUrls; // Update internal state - } else { - _logger.info('BootstrapUrls remain unchanged.'); - } - - // Always update epoch info when Active state is processed - if (latestEpochInfo?.number !== newEpochInfo.number) { - _logger.info( - `Epoch number updated from ${latestEpochInfo?.number} to ${newEpochInfo.number}` - ); - latestEpochInfo = newEpochInfo; - } else { - _logger.info( - `Epoch number ${newEpochInfo.number} remains the same.` - ); - } - - // -- callback - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo!.number, - version: params.networkModule.version, - requiredAttestation: - params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - } catch (error) { - _logger.error( - 'Failed to get connection info during staking onChange', - error - ); - // Decide how to handle this error - maybe keep old state? - } - } else { - _logger.info( - `Staking state is "${newState}", not Active. Connection info not refreshed via event.` - ); - } - }, - }); - - // --- Start Listeners --- - // Assumes createEvmEventState requires explicit start or returns an interface with listen() - // If createRefreshedValue requires explicit start, call it too. - // Adjust based on actual library API. - eventStateManager.listen(); // Assuming .listen() starts the EVM listener - - _logger.info('State manager background processes started.'); - - // -- Start counter - // const timer = setInterval(() => { - // counter++; - // }, 3000); - - // --- Return the Public Interface --- - return { - /** - * Gets the latest known blockhash, potentially triggering a fetch or refresh if needed. - */ - getLatestBlockhash: async (): Promise => { - try { - return await blockhashManager.getOrRefreshAndGet(); - } catch (error) { - _logger.error('Error getting latest blockhash', error); - throw error; // Re-throw after logging - } - }, - - getCallbackResult: (): T | null => { - return callbackResult; - }, - - // getCounter: (): number => { - // return counter; - // }, - - /** - * Gets the latest known connection info, updated when staking state becomes Active. - */ - getLatestConnectionInfo: (): ConnectionInfo | null => { - // Return a deep copy if ConnectionInfo is mutable, otherwise direct return is fine - return latestConnectionInfo ? { ...latestConnectionInfo } : null; - }, - - /** - * Stops the background listeners (blockhash refresh, event listening). - */ - stop: () => { - _logger.info('Stopping state manager listeners...'); - // RefreshedValue does not have a stop method, only stop the event listener - eventStateManager.stop(); - // clearInterval(timer); - }, - }; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.spec.ts deleted file mode 100644 index 891ae695c5..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { areStringArraysDifferent } from './areStringArraysDifferent'; - -describe('areStringArraysDifferent', () => { - it('should return false for two empty arrays', () => { - expect(areStringArraysDifferent([], [])).toBe(false); - }); - - it('should return false for two arrays with the same elements in the same order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'c'])).toBe( - false - ); - }); - - it('should return false for two arrays with the same elements in a different order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['c', 'a', 'b'])).toBe( - false - ); - }); - - it('should return true for arrays with different lengths (first shorter)', () => { - expect(areStringArraysDifferent(['a', 'b'], ['a', 'b', 'c'])).toBe(true); - }); - - it('should return true for arrays with different lengths (first longer)', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b'])).toBe(true); - }); - - it('should return true for arrays with the same length but different elements', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'd'])).toBe( - true - ); - }); - - it('should return true for one empty array and one non-empty array', () => { - expect(areStringArraysDifferent([], ['a', 'b', 'c'])).toBe(true); - expect(areStringArraysDifferent(['a', 'b', 'c'], [])).toBe(true); - }); - - it('should return false for arrays with duplicate elements that are otherwise the same', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['c', 'a', 'b', 'a']) - ).toBe(false); - }); - - it('should return true for arrays with duplicate elements that make them different', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['a', 'b', 'b', 'c']) - ).toBe(true); - }); - - it("should return true if one array has an element the other doesn't, even if same length", () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'x'])).toBe( - true - ); - }); - - it('should return false for identical arrays with numbers as strings', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '3'])).toBe( - false - ); - }); - - it('should return true for arrays with numbers as strings where one element differs', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '4'])).toBe( - true - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.ts b/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.ts deleted file mode 100644 index 67f7ff04e0..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-local/state-manager/helper/areStringArraysDifferent.ts +++ /dev/null @@ -1,31 +0,0 @@ -// -- Helper Function (copied from lit-node-client) -- -/** - * Compares two arrays of strings to determine if they are different. - * Two arrays are considered different if they have different lengths, - * or if they do not contain the same elements with the same frequencies, regardless of order. - * - * @param arr1 The first array of strings. - * @param arr2 The second array of strings. - * @returns True if the arrays are different, false otherwise. - */ -export const areStringArraysDifferent = ( - arr1: string[], - arr2: string[] -): boolean => { - if (arr1.length !== arr2.length) { - return true; - } - - // Create sorted copies of the arrays - const sortedArr1 = [...arr1].sort(); - const sortedArr2 = [...arr2].sort(); - - // Compare the sorted arrays element by element - for (let i = 0; i < sortedArr1.length; i++) { - if (sortedArr1[i] !== sortedArr2[i]) { - return true; // Found a difference - } - } - - return false; // Arrays are permutations of each other (same elements, same frequencies) -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-prod/handlers/index.ts b/packages/networks/src/networks/vNaga/envs/naga-prod/handlers/index.ts deleted file mode 100644 index 93327eb646..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-prod/handlers/index.ts +++ /dev/null @@ -1 +0,0 @@ -// This directory to contain request/response handlers that are specific to mainnet naga; will compose from `../handlers/...` for shared handlers diff --git a/packages/networks/src/networks/vNaga/envs/naga-prod/index.ts b/packages/networks/src/networks/vNaga/envs/naga-prod/index.ts deleted file mode 100644 index 614923db51..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-prod/index.ts +++ /dev/null @@ -1,60 +0,0 @@ -// import { HTTPS, LIT_CHAINS, LIT_ENDPOINT } from '@lit-protocol/constants'; -// import { nagaDev } from '@lit-protocol/contracts'; -// import { LitNetwork } from '../../../LitNetworkModule'; - -// import type { LitNetworkConfig } from '../../../types'; - -// export class Naga extends LitNetwork { -// constructor(params: Partial) { -// // NOTE: only contractData is managed by network; LitChainClient must handle the full ContractContext as it needs to actually hit the chain -// // to get contract addresses, and the LitNetwork doesn't use the chain directly -// super({ -// name: 'naga', -// endpoints: LIT_ENDPOINT, -// httpProtocol: HTTPS, -// chainConfig: { -// chain: LIT_CHAINS['yellowstone'], -// contractData: nagaDev.data.map((c) => ({ -// address: c.contracts[0].address_hash, -// abi: c.contracts[0].ABI, -// name: c.name, -// })), -// }, -// ...params, -// }); -// } - -// // Note: Node selection logic happens in the createXXXRequest() methods, as it is network-specific - -// // TODO: Input: LitNodeClient.decrypt() params -// // TODO: Output: LitNodeClient.sendCommandToNode() params array -// async createDecryptRequests(params: unknown) { -// return undefined; -// } - -// // TODO: Input: Result from sending decrypt requests to all necessary nodes -// // TODO: Output: LitNodeClient.decrypt() return value -// async handleDecryptResponses(response: unknown) { -// return {}; -// } - -// // TODO: LitNodeClient.executeJs() params -// async createExecuteJsRequests(params: unknown) { -// return undefined; -// } - -// // TODO: LitNodeClient.executeJs() return value -// async handleExecuteJsResponses(response: unknown) { -// return {}; -// } - -// // TODO: LitNodeClient.pkpSign() params -// async createSignRequests(params: unknown) { -// return undefined; -// } - -// // TODO: LitNodeClient.pkpSign() return value -// async handleSignResponses(response: unknown) { -// return {}; -// } -// } diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.CreateRequestParams.ts deleted file mode 100644 index d7e1ab9a2d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { ConnectionInfo } from '../../../../LitChainClient/types'; -import type { z } from 'zod'; -import type { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import type { NagaJitContext } from '@lit-protocol/types'; - -export type DecryptCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - ciphertext: string; - dataToEncryptHash: string; - accessControlConditions?: any; - evmContractConditions?: any; - solRpcConditions?: any; - unifiedAccessControlConditions?: any; - connectionInfo: ConnectionInfo; - version: string; - chain: string; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.InputSchema.ts deleted file mode 100644 index 51c466a3b6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.InputSchema.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { z } from 'zod'; -import { DecryptRequestSchema } from '@lit-protocol/schemas'; - -export const DecryptInputSchema = DecryptRequestSchema; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.RequestDataSchema.ts deleted file mode 100644 index 2523102a9c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.RequestDataSchema.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { z } from 'zod'; -import { MultipleAccessControlConditionsSchema } from '@lit-protocol/access-control-conditions-schemas'; -import { AuthSigSchema } from '@lit-protocol/schemas'; - -export const DecryptRequestDataSchema = - MultipleAccessControlConditionsSchema.extend({ - ciphertext: z.string(), - dataToEncryptHash: z.string(), - authSig: AuthSigSchema, - chain: z.string(), - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.ResponseDataSchema.ts deleted file mode 100644 index 0a1d70f163..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/decrypt/decrypt.ResponseDataSchema.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { z } from 'zod'; - -export const DecryptResponseDataSchema = z.object({ - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - // Keep backward compatibility fields - share_id: z.string().optional(), - signature_share: z.string().optional(), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/e2ee-request-manager/E2EERequestManager.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/e2ee-request-manager/E2EERequestManager.ts deleted file mode 100644 index 0a4ac18ee1..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/e2ee-request-manager/E2EERequestManager.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { walletDecrypt, walletEncrypt } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { NagaJitContext } from '@lit-protocol/types'; -import { bytesToHex, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, -} from '@lit-protocol/schemas'; - -const _logger = getChildLogger({ - module: 'E2EERequestManager', -}); - -/** - * Generic function to encrypt request data using JIT context - * @param requestData The request data to encrypt - * @param url The node URL to encrypt for - * @param jitContext The JIT context containing key mappings - * @returns Encrypted payload ready to send to the node - */ -const encryptRequestData = ( - requestData: any, - url: string, - jitContext: NagaJitContext -): z.infer => { - if (!jitContext.keySet[url]) { - throw new Error(`No encryption keys found for node URL: ${url}`); - } - - return walletEncrypt( - jitContext.keySet[url].secretKey, // client secret key - jitContext.keySet[url].publicKey, // node public key - stringToBytes(JSON.stringify(requestData)) - ); -}; - -/** - * Generic function to decrypt batch responses using JIT context - * @param encryptedResult The encrypted batch result from nodes - * @param jitContext The JIT context containing key mappings - * @param extractResponseData Function to extract actual response data from decrypted content - * @returns Array of decrypted response values - */ -const decryptBatchResponse = ( - encryptedResult: z.infer, - jitContext: NagaJitContext, - extractResponseData: (decryptedJson: any) => T -): T[] => { - const parsedResult = GenericEncryptedPayloadSchema.parse(encryptedResult); - - if (!parsedResult.success) { - throw new Error(`Batch decryption failed: ${JSON.stringify(parsedResult)}`); - } - - const decryptedValues: T[] = []; - - // Create a reverse mapping: nodePublicKey -> client secret key - const verificationKeyToSecretKey: Record< - string, - { url: string; secretKey: Uint8Array } - > = {}; - - for (const url of Object.keys(jitContext.keySet)) { - // Convert the stored node public key (Uint8Array) to hex string without 0x prefix - const nodePublicKeyHex = bytesToHex( - jitContext.keySet[url].publicKey - ).replace('0x', ''); - verificationKeyToSecretKey[nodePublicKeyHex] = { - url, - secretKey: jitContext.keySet[url].secretKey, - }; - } - - // Decrypt each encrypted payload - for (let i = 0; i < parsedResult.values.length; i++) { - const encryptedResponse = parsedResult.values[i]; - const verificationKey = encryptedResponse.payload.verification_key; - - // Find the correct secret key for this response based on verification key - const keyData = verificationKeyToSecretKey[verificationKey]; - - if (!keyData) { - throw new Error( - `No secret key found for verification key: ${verificationKey}` - ); - } - - try { - const encryptedPayload: z.infer = { - version: encryptedResponse.version, - payload: encryptedResponse.payload, - }; - - const decrypted = walletDecrypt(keyData.secretKey, encryptedPayload); - - // Parse the decrypted content - const decryptedText = new TextDecoder().decode(decrypted); - const parsedData = JSON.parse(decryptedText); - - // Extract the actual response data using the provided function - const responseData = extractResponseData(parsedData); - decryptedValues.push(responseData); - } catch (decryptError) { - const errorMessage = - decryptError instanceof Error ? decryptError.message : 'Unknown error'; - throw new Error( - `Failed to decrypt response ${i} with key from ${keyData.url}: ${errorMessage}` - ); - } - } - - if (decryptedValues.length === 0) { - throw new Error('No responses were successfully decrypted'); - } - - return decryptedValues; -}; - -const handleEncryptedError = ( - errorResult: any, - jitContext: NagaJitContext, - operationName: string -): never => { - if (errorResult.error && errorResult.error.payload) { - // Try to decrypt the error payload to get the actual error message - try { - _logger.info( - `${operationName}: Attempting to decrypt error payload for detailed error information...` - ); - - const errorAsEncryptedPayload = { - success: true, // Fake success so the decryption can proceed - values: [errorResult.error], // Wrap the error payload as if it's a successful response - }; - - const decryptedErrorValues = decryptBatchResponse( - errorAsEncryptedPayload as z.infer< - typeof GenericEncryptedPayloadSchema - >, - jitContext, - (decryptedJson) => { - return decryptedJson.data || decryptedJson; // Return whatever we can get - } - ); - - _logger.error( - `${operationName}: Decrypted error details from nodes:`, - decryptedErrorValues - ); - - // Use the actual error message from the nodes - const firstError = decryptedErrorValues[0]; - if (firstError && firstError.error) { - const errorMessage = firstError.error; - const errorDetails = firstError.errorObject - ? `. Details: ${firstError.errorObject}` - : ''; - throw new Error( - `${operationName} failed. ${errorMessage}${errorDetails}` - ); - } - - // If no specific error field, show the full decrypted response - throw new Error( - `${operationName} failed. ${JSON.stringify(decryptedErrorValues)}` - ); - } catch (decryptError) { - _logger.error( - `${operationName}: Failed to decrypt error payload:`, - decryptError - ); - - // If the decryptError is actually our thrown error with the node's message, re-throw it - if ( - decryptError instanceof Error && - decryptError.message.includes(`${operationName} failed.`) - ) { - throw decryptError; - } - - throw new Error( - `${operationName} failed. The nodes returned an encrypted error response that could not be decrypted. ` + - `This may indicate a configuration or network connectivity issue.` - ); - } - } else { - throw new Error(`${operationName} failed with no error details provided`); - } -}; - -export const E2EERequestManager = { - encryptRequestData, - decryptBatchResponse, - handleEncryptedError, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.CreateRequestParams.ts deleted file mode 100644 index 1992cd2102..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy, NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; - -export type ExecuteJsCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - executionContext: { - code?: string; - ipfsId?: string; - jsParams?: Record; - }; - connectionInfo: ConnectionInfo; - version: string; - useSingleNode?: boolean; - responseStrategy?: LitActionResponseStrategy; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.InputSchema.ts deleted file mode 100644 index 237f35c7f7..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.InputSchema.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy } from '@lit-protocol/types'; -import { z } from 'zod'; - -/** - * ExecuteJs Input Schema - * Based on JsonExecutionSdkParams but following the naga-dev module pattern - */ -export const ExecuteJsInputSchema = z - .object({ - /** - * JS code to run on the nodes - */ - code: z.string().optional(), - - /** - * The IPFS ID of some JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * An object that contains params to expose to the Lit Action. - * These will be injected to the JS runtime before your code runs. - */ - jsParams: z - .union([ - z.any(), - z - .object({ - publicKey: z.string().optional(), - sigName: z.string().optional(), - }) - .catchall(z.any()), - ]) - .optional(), - - /** - * Authentication context - either PKP or EOA based - */ - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - - /** - * User's maximum price they're willing to pay for the request - */ - userMaxPrice: z.bigint().optional(), - - /** - * Only run the action on a single node; this will only work if all code in your action is non-interactive - */ - useSingleNode: z.boolean().optional(), - - /** - * Response strategy for processing Lit Action responses - */ - responseStrategy: z.custom().optional(), - }) - .refine((data) => data.code || data.ipfsId, { - message: "Either 'code' or 'ipfsId' must be provided", - path: ['code'], - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.RequestDataSchema.ts deleted file mode 100644 index 8efc97c999..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.RequestDataSchema.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { AuthSigSchema, NodeSetsFromUrlsSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -/** - * ExecuteJs Request Data Schema - * This defines the structure of the request sent to the nodes for executeJs - * Based on the actual working format - only includes fields sent to nodes - */ -export const ExecuteJsRequestDataSchema = z.object({ - /** - * JS code to run on the nodes (base64 encoded) - */ - code: z.string().optional(), - - /** - * The IPFS ID of JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * Parameters to expose to the Lit Action - */ - jsParams: z.record(z.any()).optional(), - - /** - * Authentication signature - */ - authSig: AuthSigSchema, - - /** - * Node set for the request - automatically transforms URLs to nodeSet format - */ - nodeSet: NodeSetsFromUrlsSchema, -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ResponseDataSchema.ts deleted file mode 100644 index 99d621e531..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ResponseDataSchema.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { z } from 'zod'; - -/** - * Schema for Lit Action signed data - * This is completely flexible to handle any signature structure that can be returned - * since the structure depends entirely on what the Lit Action code does and what - * sigName(s) are used in the signing operations - */ -const LitActionSignedDataSchema = z.any(); - -/** - * Schema for Lit Action claim data - */ -const LitActionClaimDataSchema = z.object({ - signatures: z.array(z.any()), - derivedKeyId: z.string(), -}); - -/** - * ExecuteJs Response Data Schema - * This defines the structure of responses from nodes for executeJs requests - * Based on ExecuteJsValueResponse interface - */ -export const ExecuteJsResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - /** - * Success status of the execution - */ - success: z.boolean(), - - /** - * Claim data from the Lit Action execution - */ - claimData: z.record(z.string(), LitActionClaimDataSchema), - - /** - * Any decrypted data from the execution - */ - decryptedData: z.any(), - - /** - * Console logs from the Lit Action execution - */ - logs: z.string(), - - /** - * Response data from the Lit Action (usually JSON string) - */ - response: z.string(), - - /** - * Signed data from the Lit Action execution - */ - signedData: z.record(z.string(), LitActionSignedDataSchema), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ts deleted file mode 100644 index d1e258e112..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/executeJs.ts +++ /dev/null @@ -1,529 +0,0 @@ -/** - * ExecuteJs API Implementation for naga-dev - * - * This module provides the executeJs functionality following the same pattern as pkpSign - * but adapted for Lit Action execution with signature combination and response processing. - * - * Features: - * - Handles response aggregation and signature combination - * - Processes claims, logs, and response data - * - Includes response strategy processing (mostCommon, leastCommon, custom) - * - Follows the established naga-dev module pattern - * - * Usage: - * This is used internally by the naga-dev module to handle executeJs responses. - */ - -import { findMostCommonResponse } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { - ExecuteJsResponse, - LitActionResponseStrategy, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { combineExecuteJSSignatures } from '../helper/get-signatures'; -import { ExecuteJsValueResponse, LitActionClaimData } from '../types'; -import { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; - -const _logger = getChildLogger({ - module: 'executeJs-api', -}); - -// Define ProcessedBatchResult type locally (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -/** - * Find frequency of elements in an array - * @param arr Array of elements to analyze - * @returns Object with min (least common) and max (most common) elements - */ -const _findFrequency = (arr: T[]): { min: T; max: T } => { - const frequency: Map = new Map(); - - // Count frequencies - for (const item of arr) { - const key = JSON.stringify(item); - const existing = frequency.get(key); - if (existing) { - existing.count++; - } else { - frequency.set(key, { count: 1, value: item }); - } - } - - // Find min and max - let minCount = Infinity; - let maxCount = 0; - let minValue = arr[0]; - let maxValue = arr[0]; - - for (const { count, value } of Array.from(frequency.values())) { - if (count < minCount) { - minCount = count; - minValue = value; - } - if (count > maxCount) { - maxCount = count; - maxValue = value; - } - } - - return { min: minValue, max: maxValue }; -}; - -/** - * Process Lit Action response strategy - * @param responses Array of ExecuteJs responses from nodes - * @param strategy Response strategy configuration - * @returns Processed response based on strategy - */ -export const processLitActionResponseStrategy = ( - responses: ExecuteJsValueResponse[], - strategy: LitActionResponseStrategy -) => { - const executionResponses = responses.map((nodeResp) => { - return nodeResp.response; - }); - - const copiedExecutionResponses = executionResponses.map((r) => { - return '' + r; - }); - - if (strategy.strategy === 'custom') { - try { - if (strategy.customFilter) { - const customResponseFilterResult = strategy?.customFilter( - executionResponses as any - ); - return customResponseFilterResult; - } else { - _logger.error( - 'Custom filter specified for response strategy but none found. using most common' - ); - } - } catch (e) { - _logger.error( - 'Error while executing custom response filter, defaulting to most common', - (e as Error).toString() - ); - } - } - - const respFrequency = _findFrequency(copiedExecutionResponses); - if (strategy?.strategy === 'leastCommon') { - _logger.info( - 'strategy found to be least common, taking least common response from execution results' - ); - return respFrequency.min; - } else if (strategy?.strategy === 'mostCommon') { - _logger.info( - 'strategy found to be most common, taking most common response from execution results' - ); - return respFrequency.max; - } else { - _logger.info( - 'no strategy found, using least common response object from execution results' - ); - return respFrequency.min; - } -}; - -/** - * Check if an object contains signature data (r, s, v properties) - * @param obj Object to check - * @returns true if object contains signature properties - */ -const _isSignatureObject = (obj: any): boolean => { - return ( - typeof obj === 'object' && - obj !== null && - 'r' in obj && - 's' in obj && - 'v' in obj - ); -}; - -/** - * Extract signature data from parsed response objects - * @param responses Array of parsed response objects - * @returns Object containing signatures and cleaned responses - */ -const _extractSignaturesFromResponses = ( - responses: ExecuteJsValueResponse[] -): { - hasSignatureData: boolean; - signatureShares: Array<{ signature: any; derivedKeyId?: string }>; - cleanedResponses: ExecuteJsValueResponse[]; -} => { - const signatureShares: Array<{ signature: any; derivedKeyId?: string }> = []; - const cleanedResponses: ExecuteJsValueResponse[] = []; - let hasSignatureData = false; - - for (const nodeResp of responses) { - try { - const parsedResponse = JSON.parse(nodeResp.response as string); - - // Check if response contains signature data - if (parsedResponse && typeof parsedResponse === 'object') { - // Look for direct signature object - if (_isSignatureObject(parsedResponse)) { - hasSignatureData = true; - signatureShares.push({ signature: parsedResponse }); - // For direct signature objects, set response to empty or success message - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify({ success: true }), - }); - } - // Look for signature within response object (like your example) - else if (parsedResponse.signature) { - let signatureObj; - try { - // Handle case where signature is a string that needs parsing - signatureObj = - typeof parsedResponse.signature === 'string' - ? JSON.parse(parsedResponse.signature) - : parsedResponse.signature; - - if (_isSignatureObject(signatureObj)) { - hasSignatureData = true; - signatureShares.push({ signature: signatureObj }); - - // Remove signature from response and keep the rest - const cleanedResponse = { ...parsedResponse }; - delete cleanedResponse.signature; - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // Not a signature object, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse signature, keep response as-is - cleanedResponses.push(nodeResp); - } - } else { - // Check for nested signature objects in response properties - let foundSignature = false; - const cleanedResponse = { ...parsedResponse }; - - for (const [key, value] of Object.entries(parsedResponse)) { - if (_isSignatureObject(value)) { - hasSignatureData = true; - foundSignature = true; - signatureShares.push({ signature: value }); - delete cleanedResponse[key]; - } - } - - if (foundSignature) { - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // No signature data found, keep as-is - cleanedResponses.push(nodeResp); - } - } - } else { - // Not an object response, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse JSON, keep original response - cleanedResponses.push(nodeResp); - } - } - - return { hasSignatureData, signatureShares, cleanedResponses }; -}; - -/** - * Handles the response from executeJs operation - * - * @param result - The batch result from executing the requests - * @param requestId - Request ID for logging - * @param threshold - Minimum number of successful responses required - * @param responseStrategy - Optional response strategy for processing responses - * @returns Promise resolving to the executeJs response - */ -export const handleResponse = async ( - result: ProcessedBatchResult>, - requestId: string, - threshold: number, - responseStrategy?: LitActionResponseStrategy -): Promise => { - _logger.info('executeJs:handleResponse: Processing executeJs response', { - requestId, - threshold, - responseStrategy: responseStrategy?.strategy || 'default', - }); - - if (!result.success) { - _logger.error('executeJs:handleResponse: Batch failed', { - requestId, - error: 'error' in result ? result.error : 'Unknown error', - }); - throw new Error( - `ExecuteJs batch failed: ${JSON.stringify( - 'error' in result ? result.error : 'Unknown error' - )}` - ); - } - - // Extract the ExecuteJsResponseDataSchema from the ProcessedBatchResult - const executeJsResponseData = result.values[0]; - const { values } = ExecuteJsResponseDataSchema.parse(executeJsResponseData); - - _logger.info('executeJs:handleResponse: Response values received', { - requestId, - valueCount: values.length, - successfulValues: values.filter((v) => v.success).length, - }); - - // Filter successful responses - const successfulValues = values.filter((value) => value.success); - - if (successfulValues.length < threshold) { - throw new Error( - `Not enough successful executeJs responses. Expected ${threshold}, got ${successfulValues.length}` - ); - } - - // Convert to ExecuteJsValueResponse format for compatibility with old code - const responseData: ExecuteJsValueResponse[] = successfulValues.map( - (value) => ({ - success: value.success, - response: value.response, - logs: value.logs, - signedData: value.signedData || {}, - claimData: Object.entries(value.claimData || {}).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signature: '', // Convert from signatures array to single signature for compatibility - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ), - decryptedData: value.decryptedData || {}, - }) - ); - - // Check for signature data in responses and extract if found - const { hasSignatureData, signatureShares, cleanedResponses } = - _extractSignaturesFromResponses(responseData); - - // Use cleaned responses for further processing if signatures were extracted - const dataToProcess = hasSignatureData ? cleanedResponses : responseData; - - // Find most common response data using the existing function - const mostCommonResponse = findMostCommonResponse(dataToProcess); - - // Apply response strategy processing - const responseFromStrategy = processLitActionResponseStrategy( - dataToProcess, - responseStrategy ?? { strategy: 'leastCommon' } - ); - mostCommonResponse.response = responseFromStrategy as string; - - const hasSignedData = Object.keys(mostCommonResponse.signedData).length > 0; - const hasClaimData = Object.keys(mostCommonResponse.claimData).length > 0; - - // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - if (!hasSignedData && !hasClaimData && !hasSignatureData) { - return { - success: mostCommonResponse.success, - claims: {}, - signatures: {}, - response: mostCommonResponse.response, - logs: mostCommonResponse.logs, - }; - } - - // ========== Extract shares from response data ========== - - // Combine signatures if any exist - let signatures: Record = {}; - - if (hasSignedData) { - _logger.info( - 'executeJs:handleResponse: Combining signatures from signedData', - { - requestId, - } - ); - - signatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: dataToProcess, - requestId, - threshold, - }); - - _logger.info('executeJs:handleResponse: Signatures combined successfully', { - requestId, - signatureKeys: Object.keys(signatures), - }); - } - - // Handle signatures extracted from response data - if (hasSignatureData) { - _logger.info( - 'executeJs:handleResponse: Processing signatures from response data', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // Check if these are final signatures (with r,s,v) or signature shares that need combining - const firstSignature = signatureShares[0]?.signature; - const isFinalSignature = _isSignatureObject(firstSignature); - - if (isFinalSignature) { - _logger.info( - 'executeJs:handleResponse: Detected final signatures in response, using directly', - { - requestId, - } - ); - - // These are final signatures, not shares - use them directly - // Apply most common strategy to pick the signature to use - const signatureObjects = signatureShares.map((share) => share.signature); - const mostCommonSignature = findMostCommonResponse( - signatureObjects.map((sig) => ({ response: JSON.stringify(sig) })) - ); - - // Convert r,s,v to the expected signature format - const parsedSignature = JSON.parse(mostCommonSignature.response); - const signature = { - r: parsedSignature.r, - s: parsedSignature.s, - recovery: parsedSignature.v, - v: parsedSignature.v, - // Create full signature string if needed - signature: `0x${parsedSignature.r}${ - parsedSignature.s - }${parsedSignature.v.toString(16).padStart(2, '0')}`, - }; - - signatures['response_signature'] = signature; - - _logger.info( - 'executeJs:handleResponse: Final signature processed successfully', - { - requestId, - signatureKeys: ['response_signature'], - } - ); - } else { - _logger.info( - 'executeJs:handleResponse: Detected signature shares, combining them', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // These are signature shares that need to be combined - // Convert signature shares to the format expected by combineExecuteJSSignatures - const signatureResponseData: ExecuteJsValueResponse[] = - signatureShares.map((share, index) => ({ - success: true, - response: '', - logs: '', - signedData: { - response_signature: { - publicKey: share.derivedKeyId || '', // Use derivedKeyId as publicKey fallback - signatureShare: JSON.stringify(share.signature), - sigName: 'response_signature', - sigType: 'K256' as any, // Default to K256 for ECDSA - }, - }, - claimData: {}, - decryptedData: {}, - })); - - const responseSignatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: signatureResponseData, - requestId, - threshold, - }); - - // Merge with existing signatures - signatures = { ...signatures, ...responseSignatures }; - - _logger.info( - 'executeJs:handleResponse: Signature shares combined successfully', - { - requestId, - responseSignatureKeys: Object.keys(responseSignatures), - } - ); - } - } - - // Process claims data if present - let claims: Record = {}; - - if (hasClaimData) { - _logger.info('executeJs:handleResponse: Processing claims data', { - requestId, - claimKeys: Object.keys(mostCommonResponse.claimData), - }); - - // Convert claim data to expected format - claims = Object.entries(mostCommonResponse.claimData).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signatures: [claimData.signature], // Convert single signature to array format - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ); - } - - // Try to parse response as JSON if it's a string - let processedResponse: string | object = mostCommonResponse.response || ''; - - if (typeof processedResponse === 'string' && processedResponse.trim()) { - try { - // Attempt to parse as JSON - const parsed = JSON.parse(processedResponse); - // Keep as parsed object if it's valid JSON - processedResponse = parsed; - } catch { - // Keep as string if not valid JSON - // This is expected behaviour for non-JSON responses - } - } - - const executeJsResponse: ExecuteJsResponse = { - success: true, - signatures, - response: processedResponse, - logs: mostCommonResponse.logs || '', - ...(Object.keys(claims).length > 0 && { claims }), - }; - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response created successfully', - { - requestId, - hasSignatures: Object.keys(signatures).length > 0, - hasResponse: !!processedResponse, - hasClaims: Object.keys(claims).length > 0, - } - ); - - return executeJsResponse; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/index.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/index.ts deleted file mode 100644 index 7a6d53f16b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/executeJs/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ExecuteJs API Manager Index - * - * Exports the main functions for the executeJs API following the naga-dev module pattern. - */ - -export { handleResponse } from './executeJs'; -export type { ExecuteJsCreateRequestParams } from './executeJs.CreateRequestParams'; -export { ExecuteJsInputSchema } from './executeJs.InputSchema'; -export { ExecuteJsRequestDataSchema } from './executeJs.RequestDataSchema'; -export { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/handshake/handshake.schema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/handshake/handshake.schema.ts deleted file mode 100644 index 205cb629ff..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/handshake/handshake.schema.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { GenericResultBuilder, HexSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const RawHandshakeResponseSchema = GenericResultBuilder( - z.object({ - serverPublicKey: z.string(), - subnetPublicKey: z.string(), - networkPublicKey: z.string(), - networkPublicKeySet: z.string(), - clientSdkVersion: z.string(), - hdRootPubkeys: z.array(z.string()), - attestation: z.any().optional(), // ❗️ Attestation data if provided by node. -dev version will be null. - latestBlockhash: HexSchema, - nodeIdentityKey: z.string(), - nodeVersion: z.string(), - epoch: z.number(), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.test.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.test.ts deleted file mode 100644 index 3671f6d652..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.test.ts +++ /dev/null @@ -1,438 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - ExecuteJsValueResponse, - LitNodeSignature, - PKPSignEndpointResponse, -} from '@lit-protocol/types'; - -import { - combineExecuteJSSignatures, - combinePKPSignSignatures, -} from './get-signatures'; - -const requestId = 'REQUEST_ID'; -const threshold = 3; - -describe('combineExecuteJSSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: false, - signedData: {}, - decryptedData: {}, - claimData: {}, - response: '', - logs: '', - }, - ]; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"B7AF0DBCE67A07EFDEB38D44491673EF23CC9FF9CBC81399A2C3A3948ED2B1BC\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"2F4376CF77A51A7EFBC604FAFFC56F31A7370B359C559EF56C51EA236C8C3F70\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '266e0aae5b98f78a82c7e11072b0a9cb1284dd1b326c34aa144d44f6c31f48f520fcc05ac9e243aa2596cb8c65ce1e015bc3d690243b9f462cccd8f5600bcc341c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - ]; - const combinedSignatures: Record = { - ethPersonalSignMessageEcdsa: { - signature: - '0x64400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA13250B66E224A3E84AE9F8077BC751575AD904E19F0506A34C669E116F7F34DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - signEcdsa: { - signature: - '0x5AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A6FB7EB58D7AA6C7BFE5A2A510B3C237335EC0BCDE15BE1CE2658E265E55918DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - }; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignatures); - }); -}); - -describe('combinePKPSignSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"3D53B4698F798F98F65D2CB90BFD170278E7014E3DA87E217BCAAEBBB8D5DDF9"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"A0DD6D5EEC9EADACF86E14C8B252344EAEB505B722F5A7C18ECB4F3FFA44A3AE"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: false, - signedData: [], - signatureShare: { - EcdsaSignedMessageShare: { - digest: '', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1"', - peer_id: - '5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a', - signature_share: - '"159E02F1F0B5B875FE65A8A534109E0A35DAE0F900FC3CDE2400491289A975FD"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"F3B8CAAAC28A09D5F9125D6FD0A122E41451CDDCE8E9001C07D8D91F5DBE0F23"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"42D2DA7F7E05CBCF927EA934797919D2857AA9D7EB35F3BECAE0C59BC62B81E0"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - const combinedSignature: LitNodeSignature = { - signature: - '0x265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC244C29A81C31458E1B89F6AF497E2ADAC214F87BC725D2907D36E78940DD5CC5BF', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A034200042E0CFE8E42758449DA56EF09669EC4A31C3D8B55F8B28D390C830264D1426DC73BBE2171D83F52483A66922746BFDA297BD1DC69C4D5ED5163A523B0B10D0DB3', - signedData: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - recoveryId: 1, - publicKey: - '0x042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3', - sigType: 'EcdsaK256Sha256', - }; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignature); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.ts deleted file mode 100644 index 891700532b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/get-signatures.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - applyTransformations, - cleanStringValues, - combineExecuteJsNodeShares, - combinePKPSignNodeShares, - hexifyStringValues, - logErrorWithRequestId, - mostCommonString, -} from '@lit-protocol/crypto'; -import { - PKPSignEndpointResponse as CryptoPKPSignEndpointResponse, - LitNodeSignature, - SigType, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { PKPSignResponseDataSchema } from '../pkpSign/pkpSign.ResponseDataSchema'; -import { - ExecuteJsValueResponse, - LitActionSignedData, - PKPSignEndpointResponse as LocalPKPSignEndpointResponse, -} from '../types'; -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -function assertThresholdShares( - requestId: string, - threshold: number, - shares: { success: boolean }[] -) { - const successfulShareSources = shares.filter((response) => response.success); - - if (successfulShareSources.length < threshold) { - logErrorWithRequestId( - requestId, - `Not enough successful items. Expected ${threshold}, got ${successfulShareSources.length}` - ); - throw new NoValidShares( - { - info: { - requestId, - itemCount: shares.length, - successfulItems: successfulShareSources.length, - threshold, - }, - }, - `The total number of successful items "${successfulShareSources.length}" does not meet the threshold of "${threshold}"` - ); - } -} - -/** - * Combines signature shares from multiple nodes running a lit action to generate the final signatures. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesLitActionSignedData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combineExecuteJSSignatures = async (params: { - nodesLitActionSignedData: ExecuteJsValueResponse[]; - requestId: string; - threshold: number; -}): Promise> => { - const { threshold, requestId, nodesLitActionSignedData } = params; - - assertThresholdShares(requestId, threshold, nodesLitActionSignedData); - - const sigResponses = {} as Record; - - // Group signature shares by signature name (e.g., "random-sig-name", "sig-identifier", etc.) - const keyedSignedData = nodesLitActionSignedData.reduce< - Record - >((acc, nodeLitActionSignedData) => { - Object.keys(nodeLitActionSignedData.signedData).forEach((signedDataKey) => { - if (!acc[signedDataKey]) { - acc[signedDataKey] = []; - } - - acc[signedDataKey].push( - nodeLitActionSignedData.signedData[signedDataKey] - ); - }); - - return acc; - }, {} as Record); - - const signatureKeys = Object.keys(keyedSignedData); - - await Promise.all( - signatureKeys.map(async (signatureKey) => { - const signatureShares = keyedSignedData[signatureKey]; - - // Parse signature shares similar to PKP sign process - const preparedShares: Array<{ - originalShare: LitActionSignedData; - parsedSignatureShareObject: any; - publicKey?: string; - sigType?: string; - }> = []; - - for (const share of signatureShares) { - try { - // Parse the JSON string in signatureShare field - let parsedSignatureShare; - if (typeof share.signatureShare === 'string') { - parsedSignatureShare = JSON.parse(share.signatureShare); - } else { - parsedSignatureShare = share.signatureShare; - } - - // Extract publicKey and sigType from the share - let publicKey = share.publicKey; - let sigType = share.sigType; - - // If publicKey is a JSON string, parse it - if (typeof publicKey === 'string' && publicKey.startsWith('"')) { - publicKey = JSON.parse(publicKey); - } - - preparedShares.push({ - originalShare: share, - parsedSignatureShareObject: parsedSignatureShare, - publicKey, - sigType, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error parsing signature share for key ${signatureKey}: ${JSON.stringify( - share.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - preparedSharesCount: preparedShares.length, - threshold, - }, - }, - `Not enough valid signature shares for ${signatureKey}: ${preparedShares.length} (expected ${threshold})` - ); - } - - // Get most common public key and sig type - const publicKey = mostCommonString( - preparedShares.map((s) => s.publicKey).filter(Boolean) as string[] - ); - const sigType = mostCommonString( - preparedShares.map((s) => s.sigType).filter(Boolean) as string[] - ); - - if (!publicKey || !sigType) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - publicKey, - sigType, - shares: preparedShares, - }, - }, - `Could not get public key or sig type from lit action shares for ${signatureKey}` - ); - } - - // Prepare shares for crypto library (similar to PKP sign process) - const sharesForCryptoLib: LitActionSignedData[] = preparedShares.map( - (ps) => ({ - publicKey: ps.publicKey!, - signatureShare: - typeof ps.originalShare.signatureShare === 'string' - ? ps.originalShare.signatureShare - : JSON.stringify(ps.originalShare.signatureShare), - sigName: ps.originalShare.sigName, - sigType: ps.sigType! as any, // Cast to match EcdsaSigType - }) - ); - - // Combine the signature shares using the crypto library - const combinedSignature = await combineExecuteJsNodeShares( - sharesForCryptoLib - ); - - const sigResponse = applyTransformations( - { - ...combinedSignature, - publicKey, - sigType: sigType as SigType, - }, - [cleanStringValues, hexifyStringValues] - ) as unknown as LitNodeSignature; - - sigResponses[signatureKey] = sigResponse; - }) - ); - - return sigResponses; -}; - -/** - * Combines signature shares from multiple nodes running pkp sign to generate the final signature. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesPkpSignResponseData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combinePKPSignSignatures = async (params: { - nodesPkpSignResponseData: z.infer['values']; - requestId: string; - threshold: number; -}): Promise => { - const { threshold, requestId, nodesPkpSignResponseData } = params; - - // console.log( - // `[${requestId}] Initial nodesPkpSignResponseData (count: ${nodesPkpSignResponseData.length}):`, - // JSON.stringify(nodesPkpSignResponseData, null, 2) - // ); - - assertThresholdShares(requestId, threshold, nodesPkpSignResponseData); - - const sharesAfterInitialFilter = nodesPkpSignResponseData - .filter((share) => share.success) - .filter(Boolean); - - const rawShares = sharesAfterInitialFilter.filter((share) => { - const sigShareType = typeof share.signatureShare; - const sigShareIsNull = share.signatureShare === null; - const sigShareIsObjectNonNull = - sigShareType === 'object' && !sigShareIsNull; - return sigShareIsObjectNonNull; - }); - - if (rawShares.length < threshold) { - throw new NoValidShares( - { info: { requestId, rawSharesCount: rawShares.length, threshold } }, - `Not enough processable signature shares after initial filtering: ${rawShares.length} (expected ${threshold})` - ); - } - - const preparedShares: Array<{ - originalRawShare: z.infer< - typeof PKPSignResponseDataSchema - >['values'][number]; - parsedSignatureShareObject: any; - localPSEInput: LocalPKPSignEndpointResponse; - publicKey?: string; - sigType?: string; - }> = []; - - for (const rawShare of rawShares) { - try { - const signatureShareObject = rawShare.signatureShare; - preparedShares.push({ - originalRawShare: rawShare, - parsedSignatureShareObject: signatureShareObject, - localPSEInput: { - success: rawShare.success, - signedData: rawShare.signedData, - signatureShare: signatureShareObject, - }, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error processing rawShare (should be object): ${JSON.stringify( - rawShare.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesAfterParsingAttempt: preparedShares.length, - threshold, - }, - }, - `Not enough shares after object preparation: ${preparedShares.length}` - ); - } - - const parsingResults = parsePkpSignResponse( - preparedShares.map((p) => p.localPSEInput) - ); - - if (preparedShares.length !== parsingResults.length) { - logErrorWithRequestId( - requestId, - `Mismatch in length between prepared shares (${preparedShares.length}) and parsing results (${parsingResults.length})` - ); - throw new Error( - 'Share processing length mismatch after parsePkpSignResponse' - ); - } - preparedShares.forEach((ps, index) => { - const result = parsingResults[index]; - if (result) { - ps.publicKey = result.publicKey; - ps.sigType = result.sigType; - } else { - logErrorWithRequestId( - requestId, - `No parsing result for prepared share at index ${index}` - ); - } - }); - - const sharesForCryptoLib: CryptoPKPSignEndpointResponse[] = preparedShares - .filter((ps) => ps.publicKey && ps.sigType) - .map((ps) => ({ - success: ps.originalRawShare.success, - signedData: new Uint8Array(ps.originalRawShare.signedData as number[]), - signatureShare: ps.parsedSignatureShareObject, - })); - - if (sharesForCryptoLib.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesForCryptoCount: sharesForCryptoLib.length, - threshold, - }, - }, - `Not enough shares for crypto lib: ${sharesForCryptoLib.length}` - ); - } - - const combinedSignature = await combinePKPSignNodeShares(sharesForCryptoLib); - - const successfullyProcessedShares = preparedShares.filter( - (ps) => ps.publicKey && ps.sigType - ); - - const finalPublicKey = mostCommonString( - successfullyProcessedShares - .map((p) => p.publicKey) - .filter(Boolean) as string[] - ); - const finalSigType = mostCommonString( - successfullyProcessedShares - .map((p) => p.sigType) - .filter(Boolean) as string[] - ); - - if (!finalPublicKey || !finalSigType) { - throw new NoValidShares( - { - info: { - requestId, - finalPublicKey, - finalSigType, - pkSigPairsCount: successfullyProcessedShares.length, - }, - }, - 'Could not determine final public key or sig type from parsed shares' - ); - } - - const sigResponse = { - ...combinedSignature, - publicKey: finalPublicKey, - sigType: finalSigType as SigType, - }; - - return sigResponse as LitNodeSignature; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.test.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.test.ts deleted file mode 100644 index f64fe89add..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.test.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { - cleanStringValues, - convertKeysToCamelCase, - snakeToCamel, -} from '@lit-protocol/misc'; -import { PKPSignEndpointResponse } from '@lit-protocol/types'; - -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -describe('parsePkpSignResponse', () => { - it('should parse ECDSA PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - digest: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - bigR: '', - compressedPublicKey: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0x3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0xB1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); - - it('should parse FROST PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - signing_commitments: '', - verifying_share: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[21,126,1,81,188,147,173,138,16,169,115,205,1,224,43,54,73,148,113,48,206,233,7,6,217,224,119,81,249,220,48,41]]', - peer_id: - '77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signature_share: - '["K256Sha256","12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed"]', - signing_commitments: - '["K256Sha256","00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629"]', - verifying_share: - '["K256Sha256","022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[226,183,233,101,218,75,198,127,202,46,107,100,150,15,170,176,229,25,121,33,202,13,26,6,192,49,160,84,130,11,169,174]]', - peer_id: - '8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signature_share: - '["K256Sha256","5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b"]', - signing_commitments: - '["K256Sha256","00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a"]', - verifying_share: - '["K256Sha256","02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - message: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - signingCommitments: '', - verifyingShare: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 21, 126, 1, 81, 188, 147, 173, 138, 16, 169, 115, 205, 1, 224, 43, 54, - 73, 148, 113, 48, 206, 233, 7, 6, 217, 224, 119, 81, 249, 220, 48, 41, - ]), - peerId: - '0x77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signatureShare: - '0x12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed', - signingCommitments: - '0x00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629', - verifyingShare: - '0x022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 226, 183, 233, 101, 218, 75, 198, 127, 202, 46, 107, 100, 150, 15, - 170, 176, 229, 25, 121, 33, 202, 13, 26, 6, 192, 49, 160, 84, 130, 11, - 169, 174, - ]), - peerId: - '0x8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signatureShare: - '0x5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b', - signingCommitments: - '0x00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a', - verifyingShare: - '0x02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('cleanStringValues', () => { - it('should remove double quotes from string values in an object', () => { - const input = { - name: '"Josh"', - age: 18, - city: '"New York"', - }; - - const expectedOutput = { - name: 'Josh', - age: 18, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify non-string values in an object', () => { - const input = { - name: 'John', - age: 25, - city: 'New York', - }; - - const expectedOutput = { - name: 'John', - age: 25, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('convertKeysToCamelCase', () => { - it('should convert keys to camel case', () => { - const input = { - first_name: 'John', - last_name: 'Doe', - age: 25, - city_name: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify keys that are already in camel case', () => { - const input = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('snakeToCamel', () => { - it('should convert snake case to camel case', () => { - const input = 'hello_world'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should convert multiple snake case words to camel case', () => { - const input = 'hello_world_example'; - const expectedOutput = 'helloWorldExample'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify camel case words', () => { - const input = 'helloWorld'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify words without underscores', () => { - const input = 'hello'; - const expectedOutput = 'hello'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.ts deleted file mode 100644 index 8ed910072d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/helper/parse-pkp-sign-response.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - applyTransformations, - cleanArrayValues, - cleanStringValues, - convertKeysToCamelCase, - convertNumberArraysToUint8Arrays, - hexifyStringValues, -} from '@lit-protocol/crypto'; -import { PKPSignEndpointResponse, PKPSignEndpointSharesParsed } from '../types'; - -/** - * Parses the PKP sign response data and transforms it into a standardised format because the raw response contains snake cases and double quotes. - * @param responseData - The response data containing PKP sign shares. - * @returns An array of objects with the signature data. - */ -export const parsePkpSignResponse = ( - responseData: PKPSignEndpointResponse[] -): PKPSignEndpointSharesParsed[] => { - const parsedSignatureShares = responseData.map( - ({ signatureShare }) => { - // Determine if the object is lifted or contains a nested structure - // Example scenarios this logic handles: - // 1. If `signatureShare` is nested (e.g., { EcdsaSignedMessageShare: { ... } }), - // it will extract the nested object (i.e., the value of `EcdsaSignedMessageShare`). - // NOTE: against `f8047310fd4ac97ac01ff07a7cd1213808a3396e` in this case - // 2. If `signatureShare` is directly lifted (e.g., { digest: "...", result: "...", share_id: "..." }), - // it will treat `signatureShare` itself as the resolved object. - // NOTE: against `60318791258d273df8209b912b386680d25d0df3` in this case - // 3. If `signatureShare` is null, not an object, or does not match expected patterns, - // it will throw an error later for invalid structure. - const resolvedShare = - typeof signatureShare === 'object' && - !Array.isArray(signatureShare) && - Object.keys(signatureShare).length === 1 && - typeof signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] === 'object' - ? signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] - : signatureShare; - - if (!resolvedShare || typeof resolvedShare !== 'object') { - throw new Error('Invalid signatureShare structure.'); - } - - const transformations = [ - convertKeysToCamelCase, - cleanArrayValues, - convertNumberArraysToUint8Arrays, - cleanStringValues, - hexifyStringValues, - ]; - const parsedShare = applyTransformations(resolvedShare, transformations); - - // Frost has `message`, Ecdsa has `digest`. Copy both to `dataSigned` - if (parsedShare['digest'] || parsedShare['message']) { - parsedShare['dataSigned'] = - parsedShare['digest'] || parsedShare['message']; - } - - delete parsedShare['result']; - - return parsedShare as unknown as PKPSignEndpointSharesParsed; - } - ); - - return parsedSignatureShares; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.InputSchema.ts deleted file mode 100644 index f0a47da466..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.InputSchema.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - HexPrefixedSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const PKPSignInputSchema = z.object({ - /** - * Picking the chains would use the correct hash function for the signing scheme. - * - * @example - * ethereum -> keccak256() - * bitcoin -> sha256() - */ - chain: SigningChainSchema, - signingScheme: SigningSchemeSchema, - pubKey: HexPrefixedSchema, - toSign: z.any(), - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - userMaxPrice: z.bigint().optional(), -}); - -export const EthereumPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - // signingScheme: z.enum([ - // 'EcdsaK256Sha256', - // 'EcdsaP256Sha256', - // 'EcdsaP384Sha384', - // ]), - }) - .transform((item) => { - return { - ...item, - signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('ethereum'), - }; - }); - -export const BitCoinPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - signingScheme: z.enum([ - 'EcdsaK256Sha256', - 'SchnorrK256Sha256', - 'SchnorrK256Taproot', - ]), - }) - .transform((item) => { - return { - ...item, - // signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('bitcoin'), - }; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts deleted file mode 100644 index 7be045b3e8..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { z } from 'zod'; -import { GenericResultSchemaBuilder } from '@lit-protocol/schemas'; - -// Define the schema for the EcdsaSignedMessageShare object -const EcdsaSignedMessageShareDataSchema = z.object({ - digest: z.string(), - result: z.string(), // Or z.literal('success') if it's always "success" - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - big_r: z.string(), - compressed_public_key: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -// Define the schema for the FrostSignedMessageShare object -const FrostSignedMessageShareDataSchema = z.object({ - message: z.string(), - result: z.string(), // Or z.literal('success') - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - signing_commitments: z.string(), - verifying_share: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -export const PKPSignEncryptedPayloadSchema = z.object({}); - -export const PKPSignResponseDataSchema = GenericResultSchemaBuilder( - z.object({ - success: z.boolean(), - signedData: z.array(z.number()), - signatureShare: z.union([ - z.object({ - EcdsaSignedMessageShare: EcdsaSignedMessageShareDataSchema, - }), - z.object({ - FrostSignedMessageShare: FrostSignedMessageShareDataSchema, - }), - // Add other potential share types here if they exist - // For example: z.object({ SomeOtherShareType: SomeOtherShareSchema }) - ]), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts deleted file mode 100644 index be123802a6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from 'zod'; - -export const SignSessionKeyResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - result: z.string(), - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - curveType: z.string(), - siweMessage: z.string(), - dataSigned: z.string(), - blsRootPubkey: z.string(), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/types.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/types.ts deleted file mode 100644 index e9e8138264..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/types.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { - // BlsSigType - EcdsaSigType, - FrostSigType, -} from '@lit-protocol/constants'; -import { Hex } from '@lit-protocol/types'; - -// See src/p2p_comms/web/models.rs > BlsSignedMessageShare -// Example output: -// "BlsSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "share_id": "\"19a7c43a2b7bbedcea0a40ab17fe0f4a1acf31bdecb9ebeb96c1d3a62e4885f0\"", -// "signature_share": "{\"ProofOfPossession\":{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24\"}}", -// "verifying_share": "{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b\"}", -// "public_key": "\"8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d\"", -// "sig_type": "Bls12381G1ProofOfPossession" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -// export interface BlsSignedMessageShareRaw { -// message: string; -// peer_id: string; -// public_key: string; -// result: string; -// share_id: string; -// sig_type: string; -// signature_share: string; -// verifying_share: string; -// } - -// See src/p2p_comms/web/models.rs > EcdsaSignedMessageShare -// Example output: -// "EcdsaSignedMessageShare": { -// "digest": "74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", -// "result": "success", -// "share_id": "\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\"", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "signature_share": "\"4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B\"", -// "big_r": "\"037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356\"", -// "compressed_public_key": "\"021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce\"", -// "public_key": "\"041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80\"", -// "sig_type": "EcdsaK256Sha256" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface EcdsaSignedMessageShareRaw { - big_r: string; - compressed_public_key: string; - digest: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; -} - -// See src/p2p_comms/web/models.rs > FrostSignedMessageShare -// Example output: -// "FrostSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "share_id": "[\"Ed25519Sha512\",[120,2,187,138,101,21,192,99,172,206,182,184,45,83,216,198,184,93,183,55,83,34,185,90,150,221,88,228,91,232,123,2]]", -// "peer_id": "6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", -// "signature_share": "[\"Ed25519Sha512\",\"c5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b\"]", -// "signing_commitments": "[\"Ed25519Sha512\",\"00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f\"]", -// "verifying_share": "[\"Ed25519Sha512\",\"8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842\"]", -// "public_key": "[\"Ed25519Sha512\",\"87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4\"]", -// "sig_type": "SchnorrEd25519Sha512" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface FrostSignedMessageShareRaw { - message: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; - signing_commitments: string; - verifying_share: string; -} - -type SignatureShare = - // | { - // BlsSignedMessageShare: BlsSignedMessageShareRaw; - // } - | { - EcdsaSignedMessageShare: EcdsaSignedMessageShareRaw; - } - | { - FrostSignedMessageShare: FrostSignedMessageShareRaw; - }; - -/** - * This is what the /web/pkp/sign endpoint returns - */ -export interface PKPSignEndpointResponse { - success: boolean; - signedData: number[]; // Convertible to Uint8Array - signatureShare: SignatureShare; -} - -export interface LitActionClaimData { - signature: string; - derivedKeyId: string; -} - -export interface LitActionSignedData { - publicKey: string; - signatureShare: string; // JSON.stringify(SignatureShare) - sigName: string; - sigType: EcdsaSigType; -} - -/** - * This is what the /web/execute/v2 endpoint returns - */ -export interface ExecuteJsValueResponse { - claimData: Record; - decryptedData: any; // TODO check - logs: string; - response: string; - signedData: Record; - success: boolean; -} - -/** - * This is the cleaned up version of the BlsSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "shareId": Uint8Array(...), - * "signatureShare": "{ProofOfPossession:{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24}}", - * "verifyingShare": "{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b}", - * "publicKey": "0x8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d", - * "sigType": "Bls12381G1ProofOfPossession", - * "dataSigned": "0x0102030405" - * } - */ -// export interface BlsSignedMessageShareParsed { -// dataSigned: Hex; -// message: Hex; -// peerId: Hex; -// publicKey: Hex; -// shareId: Uint8Array; -// signatureShare: Hex; -// signingCommitments: Hex; -// sigType: BlsSigType; -// verifyingShare: Hex; -// } - -/** - * This is the cleaned up version of the EcdsaSignedMessageShareRaw - * - * @example - * { - * "digest": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", - * "shareId": "0x989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "signatureShare": "0x4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B", - * "bigR": "0x037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356", - * "compressedPublicKey": "0x021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce", - * "publicKey": "0x041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80", - * "sigType": "EcdsaK256Sha256", - * "dataSigned": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0" - * } - */ -export interface EcdsaSignedMessageShareParsed { - bigR: Hex; - compressedPublicKey: Hex; - dataSigned: Hex; - digest: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Hex; - signatureShare: Hex; - sigType: EcdsaSigType; -} - -/** - * This is the cleaned up version of the FrostSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "shareId": Uint8Array(...), - * "peerId": "0x6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", - * "signatureShare": "0xc5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b", - * "signingCommitments": "0x00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f", - * "verifyingShare": "0x8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842", - * "publicKey": "0x87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4", - * "sigType": "SchnorrEd25519Sha512", - * "dataSigned": "0x0102030405" - * } - */ -export interface FrostSignedMessageShareParsed { - dataSigned: Hex; - message: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Uint8Array; - signatureShare: Hex; - signingCommitments: Hex; - sigType: FrostSigType; - verifyingShare: Hex; -} - -export type PKPSignEndpointSharesParsed = - // | BlsSignedMessageShareParsed - EcdsaSignedMessageShareParsed | FrostSignedMessageShareParsed; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.spec.ts deleted file mode 100644 index 697df53451..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createChainManager } from './createChainManager'; -import { privateKeyToAccount } from 'viem/accounts'; - -describe('createChainManager', () => { - it('should create a chain manager', () => { - const viemAccount = privateKeyToAccount( - process.env['PRIVATE_KEY']! as `0x${string}` - ); - - const chainManager = createChainManager(viemAccount); - - console.log(chainManager); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.ts index eb5dd957f8..a54eda8fcf 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-staging/chain-manager/createChainManager.ts @@ -1,156 +1,22 @@ -import { privateKeyToAccount } from 'viem/accounts'; -import { api } from '../../../LitChainClient'; -import { getPKPsByAddress } from '../../../LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress'; -import { PkpIdentifierRaw } from '../../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { ExpectedAccountOrWalletClient } from '../../../LitChainClient/contract-manager/createContractsManager'; -import { DefaultNetworkConfig } from '../../../interfaces/NetworkContext'; -import { networkConfig } from '../naga-staging.config'; -import type { PKPStorageProvider } from '../../../../../storage/types'; -import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; +import type { ExpectedAccountOrWalletClient } from '../../../shared/managers/contract-manager/createContractsManager'; +import { + createChainManagerFactory, + createReadOnlyChainManagerFactory, + CreateChainManagerReturn, +} from '../../../shared/factories/BaseChainManagerFactory'; +import { nagaStagingEnvironment } from '../naga-staging.env'; -export type CreateChainManagerReturn = { - api: { - mintWithEoa: ( - req?: Parameters[0] - ) => ReturnType; - mintPKP: ( - req: Parameters[0] - ) => ReturnType; - mintWithMultiAuths: ( - req: Parameters[0] - ) => ReturnType; - pkpPermissionsManager: ( - pkpIdentifier: PkpIdentifierRaw - ) => InstanceType; - paymentManager: () => InstanceType; - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => ReturnType; - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => ReturnType; - pricing: { - getPriceFeedInfo: ( - req: Parameters[0] - ) => ReturnType; - getNodePrices: ( - req: Parameters[0] - ) => ReturnType; - }; - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }) => ReturnType; - }; - }; -}; +export type { CreateChainManagerReturn }; export const createChainManager = ( accountOrWalletClient: ExpectedAccountOrWalletClient ): CreateChainManagerReturn => { - // TODO: This ideally should set to NagaLocalNetworkContext. - const _networkConfig = networkConfig as unknown as DefaultNetworkConfig; - - // Helper to bind the network context to an API function - const bindContext = ( - fn: ( - req: ReqArgType, - ctx: DefaultNetworkConfig, - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => RetType - ) => { - return (req: ReqArgType): RetType => - fn(req, _networkConfig, accountOrWalletClient); - }; - - return { - api: { - mintWithEoa: bindContext(api.mintWithEoa), - mintPKP: bindContext(api.mintPKP), - mintWithMultiAuths: bindContext(api.mintWithMultiAuths), - pkpPermissionsManager: (pkpIdentifier: PkpIdentifierRaw) => { - return new api.PKPPermissionsManager( - pkpIdentifier, - _networkConfig, - accountOrWalletClient - ); - }, - paymentManager: () => { - return new api.PaymentManager(_networkConfig, accountOrWalletClient); - }, - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => { - return api.PKPPermissionsManager.getPKPsByAuthData( - authData, - pagination, - storageProvider, - _networkConfig, - accountOrWalletClient - ); - }, - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => { - // Provide default pagination if not provided - const defaultPagination = { limit: 10, offset: 0 }; - const finalPagination = params.pagination - ? { - limit: params.pagination.limit ?? defaultPagination.limit, - offset: params.pagination.offset ?? defaultPagination.offset, - } - : defaultPagination; - - return getPKPsByAddress( - { - ownerAddress: params.ownerAddress, - pagination: finalPagination, - storageProvider: params.storageProvider, - }, - _networkConfig, - accountOrWalletClient - ); - }, - pricing: { - getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo), - getNodePrices: bindContext(api.pricing.getNodePrices), - }, - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }): ReturnType => { - return api.connection.getConnectionInfo({ - networkCtx: _networkConfig, - accountOrWalletClient: accountOrWalletClient, - nodeProtocol: args?.nodeProtocol, - }); - }, - }, - }, - }; -}; - -export const createReadOnlyChainManager = () => { - // dummy private key for read actions - const dummyAccount = privateKeyToAccount( - DEV_PRIVATE_KEY + return createChainManagerFactory( + nagaStagingEnvironment.getConfig(), + accountOrWalletClient ); - const chainManager = createChainManager(dummyAccount); - return createChainManager(chainManager); }; + +export const createReadOnlyChainManager = createReadOnlyChainManagerFactory( + nagaStagingEnvironment.getConfig() +); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.cjs b/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.cjs deleted file mode 100644 index efc3be044f..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.cjs +++ /dev/null @@ -1,2760 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; - -module.exports = { - signatures, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.js b/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.js deleted file mode 100644 index 12295e2727..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.js +++ /dev/null @@ -1,2756 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.ts deleted file mode 100644 index acac87aa1d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/generated/naga-develop.ts +++ /dev/null @@ -1,2757 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -} as const; -export type Signatures = typeof signatures; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/index.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/index.ts index d1f1a76d0a..0e0b1339c8 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/index.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-staging/index.ts @@ -1,3 +1 @@ -import { nagaStagingModule } from './naga-staging.module'; - -export const nagaStaging = nagaStagingModule; +export { nagaStaging } from './naga-staging.module'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.config.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.config.ts deleted file mode 100644 index 11ab4ce685..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { nagaStagingSignatures } from '@lit-protocol/contracts'; -import * as chainInfo from '../../../../chains/ChronicleYellowstone'; -import { NAGA_ENDPOINT } from '../../endpoints-manager/endpoints'; -import { INetworkConfig } from '../../interfaces/NetworkContext'; - -const NETWORK = 'naga-staging'; -const PROTOCOL = 'https://'; -const MINIMUM_THRESHOLD = 3; - -/** - * TODO: This is a temporary default realm id. There's are two abis functions called 'getAllReservedValidators' and 'numRealms' in the latest lit-assets branch. We need to call that to see how many realms there are. If there's only one realm, then we can use that as the default realm id. Otherwise, we will randomly choose one. - */ -const DEFAULT_REALM_ID = 1n; - -export interface NagaStagingSpecificConfigs { - realmId?: bigint; - // privateKey?: Hex; -} - -export type NagaStagingSignatures = typeof nagaStagingSignatures; - -export const networkConfig: INetworkConfig< - NagaStagingSignatures, - NagaStagingSpecificConfigs -> = { - minimumThreshold: MINIMUM_THRESHOLD, - network: NETWORK, - rpcUrl: chainInfo.RPC_URL, - abiSignatures: nagaStagingSignatures, - chainConfig: chainInfo.viemChainConfig, - httpProtocol: PROTOCOL, - networkSpecificConfigs: { - realmId: DEFAULT_REALM_ID, - }, - endpoints: NAGA_ENDPOINT, - services: { - authServiceBaseUrl: 'http://localhost:3301', - loginServiceBaseUrl: 'https://login.litgateway.com', - }, -}; - -export type NagaStagingNetworkConfig = typeof networkConfig; - -// network object calls the chain client -// LitClient could use the network to figure out diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.env.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.env.ts new file mode 100644 index 0000000000..395da779e4 --- /dev/null +++ b/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.env.ts @@ -0,0 +1,58 @@ +import { nagaStagingSignatures } from '@lit-protocol/contracts'; +import { Chain } from 'viem'; +import * as chainInfo from '../../../../chains/ChronicleYellowstone'; +import { NAGA_ENDPOINT } from '../../shared/managers/endpoints-manager/endpoints'; +import type { NagaEndpointsType } from '../../shared/managers/endpoints-manager/endpoints'; +import { BaseNetworkEnvironment } from '../base/BaseNetworkEnvironment'; + +const NETWORK = 'naga-staging'; +const PROTOCOL = 'https://'; +const MINIMUM_THRESHOLD = 3; +const DEFAULT_REALM_ID = 1n; + +export interface NagaStagingSpecificConfigs { + realmId?: bigint; +} + +export type NagaStagingSignatures = typeof nagaStagingSignatures; + +export class NagaStagingEnvironment extends BaseNetworkEnvironment< + NagaStagingSignatures, + NagaStagingSpecificConfigs +> { + constructor() { + super({ + network: NETWORK, + abiSignatures: nagaStagingSignatures, + networkSpecificConfigs: { + realmId: DEFAULT_REALM_ID, + }, + services: { + authServiceBaseUrl: 'https://naga-auth-service.getlit.dev', + loginServiceBaseUrl: 'https://login.litgateway.com', + }, + minimumThreshold: MINIMUM_THRESHOLD, + httpProtocol: PROTOCOL, + requiredAttestation: true, + }); + } + + protected getRpcUrl(): string { + return chainInfo.RPC_URL; + } + + protected getChainConfig(): Chain { + return chainInfo.viemChainConfig; + } + + protected getEndpoints(): NagaEndpointsType { + return NAGA_ENDPOINT; + } + + protected getDefaultRealmId(): bigint { + return DEFAULT_REALM_ID; + } +} + +// Create singleton instance +export const nagaStagingEnvironment = new NagaStagingEnvironment(); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts index 78b643d95a..21691df038 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-staging/naga-staging.module.ts @@ -1,1373 +1,14 @@ -import { DEV_PRIVATE_KEY, version } from '@lit-protocol/constants'; -import { verifyAndDecryptWithSignatureShares } from '@lit-protocol/crypto'; -import { - AuthData, - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, - GenericResultBuilder, - HexPrefixedSchema, - JsonSignCustomSessionKeyRequestForPkpReturnSchema, - JsonSignSessionKeyRequestForPkpReturnSchema, -} from '@lit-protocol/schemas'; -import { Hex, hexToBytes, stringToBytes } from 'viem'; - -import { z } from 'zod'; -import { LitNetworkModuleBase } from '../../../types'; -import type { ExpectedAccountOrWalletClient } from '../../LitChainClient/contract-manager/createContractsManager'; -import { networkConfig } from './naga-staging.config'; -import { PricingContextSchema } from './pricing-manager/PricingContextSchema'; -import { issueSessionFromContext } from './session-manager/issueSessionFromContext'; -import { createStateManager } from './state-manager/createStateManager'; - -// Import the necessary types for the explicit return type annotation -import { NetworkError } from '@lit-protocol/constants'; -import { - combineSignatureShares, - mostCommonString, - normalizeAndStringify, - ReleaseVerificationConfig, -} from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { - AuthMethod, - AuthSig, - CallbackParams, - KeySet, - LitActionResponseStrategy, - NagaJitContext, - NodeAttestation, - Optional, - OrchestrateHandshakeResponse, - RequestItem, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { computeAddress } from 'ethers/lib/utils'; -import { nacl } from '@lit-protocol/nacl'; -import type { PKPStorageProvider } from '../../../../storage/types'; -import { createRequestId } from '../../../shared/helpers/createRequestId'; -import { handleAuthServerRequest } from '../../../shared/helpers/handleAuthServerRequest'; -import { composeLitUrl } from '../../endpoints-manager/composeLitUrl'; -import { - getNodePrices, - PKPPermissionsManager, -} from '../../LitChainClient/apis/highLevelApis'; -import { PaymentManager } from '../../LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager'; -import { MintWithMultiAuthsRequest } from '../../LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths'; -import { PkpIdentifierRaw } from '../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { GenericTxRes, LitTxRes } from '../../LitChainClient/apis/types'; -import type { PKPData } from '../../LitChainClient/schemas/shared/PKPDataSchema'; -import { ConnectionInfo } from '../../LitChainClient/types'; -import { DecryptCreateRequestParams } from './api-manager/decrypt/decrypt.CreateRequestParams'; -import { DecryptInputSchema } from './api-manager/decrypt/decrypt.InputSchema'; -import { DecryptRequestDataSchema } from './api-manager/decrypt/decrypt.RequestDataSchema'; -import { DecryptResponseDataSchema } from './api-manager/decrypt/decrypt.ResponseDataSchema'; -import { E2EERequestManager } from './api-manager/e2ee-request-manager/E2EERequestManager'; -import { handleResponse as handleExecuteJsResponse } from './api-manager/executeJs'; -import { ExecuteJsCreateRequestParams } from './api-manager/executeJs/executeJs.CreateRequestParams'; -import { ExecuteJsInputSchema } from './api-manager/executeJs/executeJs.InputSchema'; -import { ExecuteJsRequestDataSchema } from './api-manager/executeJs/executeJs.RequestDataSchema'; -import { ExecuteJsResponseDataSchema } from './api-manager/executeJs/executeJs.ResponseDataSchema'; -import { RawHandshakeResponseSchema } from './api-manager/handshake/handshake.schema'; -import { combinePKPSignSignatures } from './api-manager/helper/get-signatures'; -import { PKPSignCreateRequestParams } from './api-manager/pkpSign/pkpSign.CreateRequestParams'; -import { - BitCoinPKPSignInputSchema, - EthereumPKPSignInputSchema, - PKPSignInputSchema, -} from './api-manager/pkpSign/pkpSign.InputSchema'; -import { PKPSignRequestDataSchema } from './api-manager/pkpSign/pkpSign.RequestDataSchema'; -import { PKPSignResponseDataSchema } from './api-manager/pkpSign/pkpSign.ResponseDataSchema'; -import { - createChainManager, - CreateChainManagerReturn, -} from './chain-manager/createChainManager'; -import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct'; -import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice'; -import { privateKeyToAccount } from 'viem/accounts'; - -const MODULE_NAME = 'naga-staging'; - -const _logger = getChildLogger({ - module: `${MODULE_NAME}-module`, +import { createBaseModule } from '../../shared/factories/BaseModuleFactory'; +import { createChainManager } from './chain-manager/createChainManager'; +import { nagaStagingEnvironment } from './naga-staging.env'; +import type { ExpectedAccountOrWalletClient } from '../../shared/managers/contract-manager/createContractsManager'; + +const nagaStaging = createBaseModule({ + networkConfig: nagaStagingEnvironment.getConfig(), + moduleName: 'naga-staging', + createChainManager: (account: ExpectedAccountOrWalletClient) => + createChainManager(account), }); -// Release verification types and constants -interface ReleaseInfo { - status: number; - env: number; - typ: number; - platform: number; - options: { asU32: () => number }; - publicKey: Uint8Array; - idKeyDigest: Uint8Array; -} - -enum ReleaseStatus { - Null = 0, - Active = 1, - Inactive = 2, -} - -// Basic Release Register Contract ABI - only the functions we need -const RELEASE_REGISTER_ABI = [ - { - inputs: [], - name: 'RELEASE_REGISTER_CONTRACT', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -/** - * Extract release ID from attestation data - * @param attestation The node attestation containing release ID - * @returns The release ID string - */ -function extractReleaseId(attestation: NodeAttestation): string { - const releaseId = attestation.data.RELEASE_ID; - if (!releaseId) { - throw new NetworkError( - { info: { attestation } }, - 'Missing RELEASE_ID in attestation data' - ); - } - return Buffer.from(releaseId, 'base64').toString('utf8'); -} - -/** - * Extract subnet ID from release ID - * Based on the Rust implementation: subnet_id_from_release_id - * @param releaseId The release ID string - * @returns The subnet ID - */ -function getSubnetIdFromReleaseId(releaseId: string): string { - // In the Rust code, this extracts the subnet ID from the release ID - // For now, this is a simplified version - you may need to adjust based on actual format - const parts = releaseId.split('-'); - if (parts.length < 2) { - throw new NetworkError( - { info: { releaseId } }, - 'Invalid release ID format' - ); - } - return parts[0]; // First part is typically the subnet ID -} - -/** - * Pad release ID to 32 bytes for contract call - * @param releaseId The release ID string - * @returns Padded bytes32 for contract call - */ -function padReleaseIdToBytes32(releaseId: string): string { - const releaseIdBuffer = Buffer.from(releaseId, 'utf8'); - if (releaseIdBuffer.length > 32) { - throw new NetworkError( - { info: { releaseId } }, - 'Release ID too long for bytes32' - ); - } - const paddedBuffer = Buffer.alloc(32); - releaseIdBuffer.copy(paddedBuffer); - return ethers.utils.hexlify(paddedBuffer); -} - -/** - * Verify release ID against the on-chain release register contract - * This function is provided to the crypto package for dependency injection - * @param attestation The node attestation - * @param config Configuration for release verification - */ -const verifyReleaseId = async ( - attestation: NodeAttestation, - config: ReleaseVerificationConfig -): Promise => { - _logger.info('verifyReleaseId: Starting release verification', { - subnetId: config.subnetId, - environment: config.environment, - }); - - // 1. Extract release ID from attestation - const releaseId = extractReleaseId(attestation); - - // 2. Verify release ID length - if (releaseId.length !== 64) { - // RELEASE_ID_STR_LEN from Rust code - throw new NetworkError( - { - info: { releaseId, expectedLength: 64, actualLength: releaseId.length }, - }, - `Release ID length is incorrect: expected 64, got ${releaseId.length}` - ); - } - - // 3. Extract and verify subnet ID - const releaseSubnetId = getSubnetIdFromReleaseId(releaseId); - if (releaseSubnetId !== config.subnetId) { - throw new NetworkError( - { info: { releaseSubnetId, expectedSubnetId: config.subnetId } }, - `Subnet ID mismatch: expected ${config.subnetId}, got ${releaseSubnetId}` - ); - } - - // 4. Query the release register contract - const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl); - const contract = new ethers.Contract( - config.releaseRegisterContractAddress, - RELEASE_REGISTER_ABI, - provider - ); - - const releaseIdPadded = padReleaseIdToBytes32(releaseId); - - try { - const release = await contract['getReleaseByIdAndSubnetId']( - config.subnetId, - releaseIdPadded - ); - - // 5. Verify release status is active - if (release.status !== ReleaseStatus.Active) { - throw new NetworkError( - { info: { releaseId, status: release.status } }, - `Release is not active: status ${release.status}` - ); - } - - // 6. Verify environment matches - if (release.env !== config.environment) { - throw new NetworkError( - { - info: { - releaseId, - releaseEnv: release.env, - expectedEnv: config.environment, - }, - }, - `Environment mismatch: expected ${config.environment}, got ${release.env}` - ); - } - - _logger.info('verifyReleaseId: Release verification successful', { - releaseId, - status: release.status, - environment: release.env, - }); - } catch (error: any) { - if (error.code === 'CALL_EXCEPTION') { - throw new NetworkError( - { - info: { - releaseId, - contractAddress: config.releaseRegisterContractAddress, - }, - }, - `Release ID ${releaseId} not found on chain` - ); - } - throw error; - } -}; - -// Store response strategy separately for executeJs requests -let executeJsResponseStrategy: LitActionResponseStrategy | undefined; - -// Store secret keys for PKP sign requests to use in handleResponse -// const globalPkpSignSecretKeys: Record> = {}; -// const globalPkpSignNodeKeys: Record> = {}; - -// Define ProcessedBatchResult type (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -// Define the object first -const networkModuleObject = { - id: 'naga', - version: `${version}-naga-staging`, - config: { - requiredAttestation: true, - abortTimeout: 20_000, - minimumThreshold: networkConfig.minimumThreshold, - httpProtocol: networkConfig.httpProtocol, - }, - schemas: { - GenericResponseSchema: GenericResultBuilder, - }, - getNetworkName: () => networkConfig.network, - getHttpProtocol: () => networkConfig.httpProtocol, - getEndpoints: () => networkConfig.endpoints, - getRpcUrl: () => networkConfig.rpcUrl, - getChainConfig: () => networkConfig.chainConfig, - getDefaultAuthServiceBaseUrl: () => networkConfig.services.authServiceBaseUrl, - getDefaultLoginBaseUrl: () => networkConfig.services.loginServiceBaseUrl, - getMinimumThreshold: () => networkConfig.minimumThreshold, - // composeLitUrl: composeLitUrl, - /** - * 🧠 This is the core function that keeps all the network essential information - * up to data, such as: - * - latest blockhash - * - connection info (node urls, epoch, etc.) - it listens for StateChange events - * - orchestrate handshake via callback - */ - createStateManager: async (params: { - callback: (params: CallbackParams) => Promise; - networkModule: M; - }): Promise>>> => { - return await createStateManager({ - networkConfig, - callback: params.callback, - networkModule: params.networkModule as LitNetworkModuleBase, - }); - }, - getMaxPricesForNodeProduct: getMaxPricesForNodeProduct, - getUserMaxPrice: getUserMaxPrice, - getVerifyReleaseId: () => verifyReleaseId, - chainApi: { - getPKPPermissionsManager: async (params: { - pkpIdentifier: PkpIdentifierRaw; - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.pkpPermissionsManager(params.pkpIdentifier); - }, - - /** - * Gets a PaymentManager instance for managing deposits, withdrawals, and balance queries - */ - getPaymentManager: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.paymentManager(); - }, - - /** - * Gets all PKPs associated with specific authentication data - */ - getPKPsByAuthData: async (params: { - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAuthData( - params.authData, - params.pagination, - params.storageProvider - ); - }, - - /** - * Gets all PKPs owned by a specific address - */ - getPKPsByAddress: async (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAddress({ - ownerAddress: params.ownerAddress, - pagination: params.pagination, - storageProvider: params.storageProvider, - }); - }, - - /** - * Mints a PKP using EOA directly - */ - mintWithEoa: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithEoa(); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - /** - * Mints a PKP using Auth Method - */ - mintWithAuth: async (params: { - account: ExpectedAccountOrWalletClient; - authData: Optional; - scopes: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintPKP({ - scopes: params.scopes, - // authMethod: authMethod, - authMethodId: params.authData.authMethodId, - authMethodType: params.authData.authMethodType, - pubkey: params.authData.publicKey, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - mintWithMultiAuths: async ( - params: { - account: ExpectedAccountOrWalletClient; - } & MintWithMultiAuthsRequest - ): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithMultiAuths({ - authMethodIds: params.authMethodIds, - authMethodTypes: params.authMethodTypes, - authMethodScopes: params.authMethodScopes, - pubkeys: params.pubkeys, - addPkpEthAddressAsPermittedAddress: - params.addPkpEthAddressAsPermittedAddress, - sendPkpToItself: params.sendPkpToItself, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - }, - authService: { - pkpMint: async (params: { - authData: AuthData; - authServiceBaseUrl?: string; - scopes?: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }) => { - return await handleAuthServerRequest({ - jobName: 'PKP Minting', - serverUrl: - params.authServiceBaseUrl || - networkConfig.services.authServiceBaseUrl, - path: '/pkp/mint', - body: { - authMethodType: params.authData.authMethodType, - authMethodId: params.authData.authMethodId, - pubkey: params.authData.publicKey, - scopes: params.scopes, - }, - }); - }, - }, - api: { - /** - * The Lit Client and Network Module exchange data in a request-response cycle: - * - * 1. 🟪 The Network Module constructs the request. - * 2. 🟩 The Lit Client sends it to the Lit Network. - * 3. 🟪 The Network Module processes the response. - * - * In some cases, we need to maintain a piece of state that is relevant to both step 1 (request creation) - * and step 3 (response handling). To support this, we introduce a *network-specific context object* - * that can be passed between the Lit Client and Network Module. - * - * One key example is managing a just-in-time (JIT) state for ephemeral secrets or signing keys - * — such as those used in PKP signing — which must persist across the request lifecycle. - */ - createJitContext: async ( - connectionInfo: ConnectionInfo, - handshakeResult: OrchestrateHandshakeResponse - ): Promise => { - const keySet: KeySet = {}; - - // 1. Generate a key set for the JIT context - for (const url of connectionInfo.bootstrapUrls) { - keySet[url] = { - publicKey: hexToBytes( - HexPrefixedSchema.parse( - handshakeResult.serverKeys[url].nodeIdentityKey - ) as `0x${string}` - ), - secretKey: nacl.box.keyPair().secretKey, - }; - } - - // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); - - // 2. Fetch the price feed info - const nodePrices = await getNodePrices( - { - realmId: 1, - networkCtx: networkConfig, - }, - account - ); - - return { keySet, nodePrices }; - }, - handshake: { - schemas: { - Input: { - ResponseData: RawHandshakeResponseSchema, - }, - }, - }, - pkpSign: { - schemas: { - Input: { - raw: PKPSignInputSchema, - ethereum: EthereumPKPSignInputSchema, - bitcoin: BitCoinPKPSignInputSchema, - }, - RequestData: PKPSignRequestDataSchema, - ResponseData: PKPSignResponseDataSchema, - }, - createRequest: async ( - params: PKPSignCreateRequestParams - ): Promise>[]> => { - _logger.info('pkpSign:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('pkpSign:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - - const requests: RequestItem>[] = - []; - - _logger.info('pkpSign:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - // // Reset and store secret keys for this request - // globalPkpSignSecretKeys[_requestId] = {}; - // globalPkpSignNodeKeys[_requestId] = {}; - - for (const url of urls) { - _logger.info('pkpSign:createRequest: Generating request data', { - url, - }); - - const _requestData = PKPSignRequestDataSchema.parse({ - toSign: Array.from(params.signingContext.toSign), - signingScheme: params.signingContext.signingScheme, - pubkey: params.signingContext.pubKey, - authSig: sessionSigs[url], - nodeSet: urls, - - // additional meta to determine hash function, but not - // sent to the node - chain: params.chain, - bypassAutoHashing: params.signingContext.bypassAutoHashing, - epoch: params.connectionInfo.epochState.currentNumber, - }); - - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().PKP_SIGN, - }); - - _logger.info('pkpSign:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'pkpSign:createRequest: No requests generated for pkpSign.' - ); - throw new Error('Failed to generate requests for pkpSign.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'PKP Sign' - ); - } - - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual PKP sign data from the response wrapper - const pkpSignData = decryptedJson.data; - if (!pkpSignData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - wrap in expected format - const wrappedData = { - success: pkpSignData.success, - values: [pkpSignData], // Wrap the individual response in an array - }; - - const responseData = PKPSignResponseDataSchema.parse(wrappedData); - return responseData.values[0]; // Return the individual PKP sign response - } - ); - - const signatures = await combinePKPSignSignatures({ - nodesPkpSignResponseData: decryptedValues, - requestId, - threshold: networkConfig.minimumThreshold, - }); - - return signatures; - }, - }, - decrypt: { - schemas: { - Input: DecryptInputSchema, - RequestData: DecryptRequestDataSchema, - ResponseData: DecryptResponseDataSchema, - }, - createRequest: async (params: DecryptCreateRequestParams) => { - _logger.info('decrypt:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs for decrypt - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('decrypt:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('decrypt:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('decrypt:createRequest: Generating request data', { - url, - }); - - const _requestData = DecryptRequestDataSchema.parse({ - ciphertext: params.ciphertext, - dataToEncryptHash: params.dataToEncryptHash, - accessControlConditions: params.accessControlConditions, - evmContractConditions: params.evmContractConditions, - solRpcConditions: params.solRpcConditions, - unifiedAccessControlConditions: - params.unifiedAccessControlConditions, - authSig: sessionSigs[url], - chain: params.chain, - }); - - // Encrypt the request data using the generic encryption function - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().ENCRYPTION_SIGN, - }); - - _logger.info('decrypt:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'decrypt:createRequest: No requests generated for decrypt.' - ); - throw new Error('Failed to generate requests for decrypt.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - - identityParam: string, - ciphertext: string, - subnetPubKey: string, - jitContext: NagaJitContext - ) => { - _logger.info('decrypt:handleResponse: Processing decrypt response', { - requestId, - }); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Decryption' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual decrypt data from the response wrapper - const decryptData = decryptedJson.data; - if (!decryptData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - const responseData = DecryptResponseDataSchema.parse(decryptData); - return responseData; - } - ); - - _logger.info('decrypt:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // Extract signature shares from decrypted node responses - const signatureShares = decryptedValues.map((nodeResponse: any) => { - return { - ProofOfPossession: { - identifier: - nodeResponse.signatureShare.ProofOfPossession.identifier, - value: nodeResponse.signatureShare.ProofOfPossession.value, - }, - }; - }); - - _logger.info('decrypt:handleResponse: Signature shares extracted', { - signatureShares, - }); - - // Verify and decrypt using signature shares - const decryptedData = await verifyAndDecryptWithSignatureShares( - subnetPubKey, - stringToBytes(identityParam), - ciphertext, - signatureShares - ); - - _logger.info('decrypt:handleResponse: Decryption completed'); - - return { decryptedData }; - }, - }, - signSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - // extract the authMethod from the requestBody - const authMethod = { - authMethodType: requestBody.authData.authMethodType, - accessToken: requestBody.authData.accessToken, - } as AuthMethod; - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [authMethod], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - maxPrice: getUserMaxPrice({ - product: 'SIGN_SESSION_KEY', - }).toString(), - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signSessionKey:createRequest: No requests generated for signSessionKey.' - ); - throw new Error('Failed to generate requests for signSessionKey.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signSessionKey:handleResponse: Processing signSessionKey response' - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signSessionKeyData = decryptedJson.data; - if (!signSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signSessionKey response is the individual response, return it directly - return signSessionKeyData; - } - ); - - _logger.info('signSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signSessionKey responses - const values = decryptedValues; - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info('signSessionKey:handleResponse: BLS combined signature', { - blsCombinedSignature, - }); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - signCustomSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignCustomSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signCustomSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signCustomSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signCustomSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - litActionCode: requestBody.litActionCode, - litActionIpfsId: requestBody.litActionIpfsId, - jsParams: requestBody.jsParams, - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signCustomSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signCustomSessionKey:createRequest: No requests generated for signCustomSessionKey.' - ); - throw new Error( - 'Failed to generate requests for signCustomSessionKey.' - ); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signCustomSessionKey:handleResponse: Processing signCustomSessionKey response' - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signCustomSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signCustomSessionKeyData = decryptedJson.data; - if (!signCustomSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signCustomSessionKey response is the individual response, return it directly - return signCustomSessionKeyData; - } - ); - - _logger.info('signCustomSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signCustomSessionKey responses - const values = decryptedValues; - - _logger.info('signCustomSessionKey:handleResponse: Values', { - values, - }); - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signCustomSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info( - 'signCustomSessionKey:handleResponse: BLS combined signature', - { - blsCombinedSignature, - } - ); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signCustomSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signCustomSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - executeJs: { - schemas: { - Input: ExecuteJsInputSchema, - RequestData: ExecuteJsRequestDataSchema, - ResponseData: ExecuteJsResponseDataSchema, - }, - createRequest: async (params: ExecuteJsCreateRequestParams) => { - _logger.info('executeJs:createRequest: Creating request', { - hasCode: !!params.executionContext.code, - hasIpfsId: !!params.executionContext.ipfsId, - hasJsParams: !!params.executionContext.jsParams, - responseStrategy: params.responseStrategy?.strategy || 'default', - }); - - // Store response strategy for later use in handleResponse - executeJsResponseStrategy = params.responseStrategy; - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('executeJs:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('executeJs:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('executeJs:createRequest: Generating request data', { - url, - }); - - // Base64 encode the code if provided - let encodedCode: string | undefined; - if (params.executionContext.code) { - encodedCode = Buffer.from( - params.executionContext.code, - 'utf-8' - ).toString('base64'); - _logger.info('executeJs:createRequest: Code encoded to base64', { - originalLength: params.executionContext.code.length, - encodedLength: encodedCode.length, - }); - } - - // Build the request data that gets sent to the nodes - const _requestData = ExecuteJsRequestDataSchema.parse({ - authSig: sessionSigs[url], - nodeSet: urls, - ...(encodedCode && { code: encodedCode }), - ...(params.executionContext.ipfsId && { - ipfsId: params.executionContext.ipfsId, - }), - ...(params.executionContext.jsParams && { - jsParams: { - jsParams: params.executionContext.jsParams, - }, - }), - }); - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().EXECUTE_JS, - }); - - _logger.info('executeJs:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'executeJs:createRequest: No requests generated for executeJs.' - ); - throw new Error('Failed to generate requests for executeJs.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'executeJs:handleResponse: Processing executeJs response', - { - requestId, - responseStrategy: executeJsResponseStrategy?.strategy || 'default', - } - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'JS execution' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedResponseValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual executeJs response data from the response wrapper - const executeJsData = decryptedJson.data; - if (!executeJsData) { - throw new Error('Decrypted response missing data field'); - } - - return executeJsData; // Return the executeJs response directly - } - ); - - // The decryptedResponseValues are individual response objects with the correct fields - // Wrap them in the expected batch result format - const batchResponseData = { - success: true, - values: decryptedResponseValues, // These are the individual executeJs responses - }; - - // Create the correctly structured ProcessedBatchResult for handleExecuteJsResponse - const correctProcessedResult: ProcessedBatchResult< - z.infer - > = { - success: true as const, - values: [batchResponseData], // batchResponseData is the ExecuteJsResponseDataSchema structure - }; - - // Use the handleResponse from the executeJs module with response strategy - const executeJsResponse = await handleExecuteJsResponse( - correctProcessedResult, - requestId, - networkConfig.minimumThreshold, - executeJsResponseStrategy - ); - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response processed successfully', - { - requestId, - hasSignatures: - !!executeJsResponse.signatures && - Object.keys(executeJsResponse.signatures).length > 0, - hasResponse: !!executeJsResponse.response, - hasClaims: - !!executeJsResponse.claims && - Object.keys(executeJsResponse.claims).length > 0, - } - ); - - return executeJsResponse; - }, - }, - }, -}; - -// Now define the type by taking the type of the object, but overriding getChainManager -export type NagaStagingModule = Omit< - typeof networkModuleObject, - 'getChainManager' -> & { - getChainManager: ( - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => CreateChainManagerReturn; -}; - -// Export the correctly typed object -export const nagaStagingModule = networkModuleObject as NagaStagingModule; +export type NagaStaging = typeof nagaStaging; +export { nagaStaging }; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getMaxPricesForNodeProduct.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getMaxPricesForNodeProduct.ts deleted file mode 100644 index f657edfe78..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getMaxPricesForNodeProduct.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { MaxPriceTooLow, PRODUCT_ID_VALUES } from '@lit-protocol/constants'; - -interface MaxPricesForNodes { - nodePrices: { url: string; prices: bigint[] }[]; - userMaxPrice: bigint; - productId: PRODUCT_ID_VALUES; - numRequiredNodes?: number; -} - -/** - * Builds an object with updated prices distributed proportionally across nodes. - * Ensures the total cost does not exceed userMaxPrice. - * Operates in the order of lowest priced node to highest. - * - * @param nodePrices - An object where keys are node addresses and values are arrays of prices for different action types. - * @param userMaxPrice - The maximum price the user is willing to pay to execute the request. - * @param productId - The ID of the product to determine which price to consider. - * @param numRequiredNodes - Optional number of nodes required to execute the action. Defaults to all nodes. - * @returns An object with updated prices distributed proportionally. - * @throws A MaxPriceTooLow error if the total price exceeds userMaxPrice - */ -export function getMaxPricesForNodeProduct({ - nodePrices, - userMaxPrice, - productId, - numRequiredNodes, -}: MaxPricesForNodes): { url: string; price: bigint }[] { - // If we don't need all nodes to service the request, only use the cheapest `n` of them - const nodesToConsider = numRequiredNodes - ? nodePrices.slice(0, numRequiredNodes) - : nodePrices; - - let totalBaseCost = 0n; - - // Calculate the base total cost without adjustments - for (const { prices } of nodesToConsider) { - totalBaseCost += prices[productId]; - } - - // Verify that we have a high enough userMaxPrice to fulfill the request - if (totalBaseCost > userMaxPrice) { - throw new MaxPriceTooLow( - { - info: { - totalBaseCost: totalBaseCost.toString(), - userMaxPrice: userMaxPrice.toString(), - }, - }, - `Max price is too low: Minimum required price is ${totalBaseCost.toString()}, got ${userMaxPrice.toString()}.` - ); - } - - /* If the user is willing to pay more than the nodes charge based on our current view of pricing - * then we can provide extra margin to the maxPrice for each node -- making it less likely for - * our request to fail if the price on some of the nodes is higher than we think it was, as long as it's not - * drastically different than we expect it to be - */ - const excessBalance = userMaxPrice - totalBaseCost; - - // Map matching the keys from `nodePrices`, but w/ the per-node maxPrice computed based on `userMaxPrice` - const maxPricesPerNode: { url: string; price: bigint }[] = []; - - for (const { url, prices } of nodesToConsider) { - // For now, we'll distribute the remaining balance equally across nodes - maxPricesPerNode.push({ - url, - price: excessBalance - ? prices[productId] + excessBalance / BigInt(nodesToConsider.length) - : prices[productId], - }); - } - - return maxPricesPerNode; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.spec.ts deleted file mode 100644 index e7d98e4e95..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - getUserMaxPrice, - PRODUCT_IDS, - UNSIGNED_128_MAX, -} from './getUserMaxPrice'; - -describe('getUserMaxPrice', () => { - const expectedMaxPrice = UNSIGNED_128_MAX; - - it('should return the rust U128 max price for DECRYPTION product', () => { - expect(getUserMaxPrice({ product: 'DECRYPTION' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for SIGN product', () => { - expect(getUserMaxPrice({ product: 'SIGN' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for LIT_ACTION product', () => { - expect(getUserMaxPrice({ product: 'LIT_ACTION' })).toBe(expectedMaxPrice); - }); - - // Test with values from PRODUCT_IDS to ensure they are correctly handled - it('should return the rust U128 max price when using PRODUCT_IDS.DECRYPTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.DECRYPTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.SIGN', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.SIGN - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.LIT_ACTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.LIT_ACTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.ts deleted file mode 100644 index 560c17c976..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/getUserMaxPrice.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { PRODUCT_IDS, UNSIGNED_128_MAX } from './pricing.constants'; - -/** - * In the context for Lit pricing model, the U128 value is used as a default "unlimited" - * or maximum price when a specific `userMaxPrice` is not set - */ -export const getUserMaxPrice = (params: { - product: keyof typeof PRODUCT_IDS; -}) => { - /** Tracks the total max price a user is willing to pay for each supported product type - * This must be distributed across all nodes; each node will get a percentage of this price - * - * If the user never sets a max price, it means 'unlimited' - */ - const defaultMaxPriceByProduct: Record = { - DECRYPTION: BigInt(-1), - SIGN: BigInt(-1), - LIT_ACTION: BigInt(-1), - SIGN_SESSION_KEY: BigInt(-1), - }; - - if (defaultMaxPriceByProduct[params.product] === BigInt(-1)) { - return UNSIGNED_128_MAX; - } - - // If the user has set a max price, return that - return defaultMaxPriceByProduct[params.product]; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/pricing.constants.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/pricing.constants.ts deleted file mode 100644 index 7154ce0e6c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/pricing.constants.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Rust U128 max - * See https://cheats.rs/ for more info - */ -export const UNSIGNED_128_MAX = - 340_282_366_920_938_463_463_374_607_431_768_211_455n; - -/** - * Product IDs used for price feed and node selection - * - * - DECRYPTION (0): Used for decryption operations - * - SIGN (1): Used for signing operations - * - LIT_ACTION (2): Used for Lit Actions execution - * - SIGN_SESSION_KEY (3): Used for sign session key operations - */ -export const PRODUCT_IDS = { - DECRYPTION: 0n, // For decryption operations - SIGN: 1n, // For signing operations - LIT_ACTION: 2n, // For Lit Actions execution - SIGN_SESSION_KEY: 3n, // For sign session key operations -} as const; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/scripts/00-generate-abi-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/scripts/00-generate-abi-signatures.ts deleted file mode 100644 index 523fe2b43b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/scripts/00-generate-abi-signatures.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures'; - -const JSON_FILE_PATH = process.env['NETWORK_CONFIG'] as string; - -console.log('JSON_FILE_PATH:', JSON_FILE_PATH); - -if (!JSON_FILE_PATH) { - throw new Error( - '❌ NETWORK_CONFIG is not set. Please set it in your .env file.' - ); -} - -async function main() { - await generateSignaturesFromContext({ - jsonFilePath: JSON_FILE_PATH, - networkName: 'naga-develop', - outputDir: '../generated', - useScriptDirectory: true, - - // @ts-ignore - callerPath: import.meta.url, - }); -} - -// gogogo! -main().catch(console.error); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/AuthContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/AuthContextSchema.ts deleted file mode 100644 index b6090200f7..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/AuthContextSchema.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - AuthSigSchema, - HexPrefixedSchema, - ISessionCapabilityObjectSchema, - LitResourceAbilityRequestSchema, - SessionKeyPairSchema, - AuthConfigSchema, - AuthMethodSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; -import { Account } from 'viem'; - -// { -// pkpPublicKey: "0x04e5603fe1cc5ce207c12950939738583b599f22a152c3672a4c0eee887d75dd405246ac3ed2430283935a99733eac9520581af9923c0fc04fad1d67d60908ce18", -// chain: "ethereum", -// resourceAbilityRequests: [ -// { -// resource: { -// getResourceKey: [Function], -// isValidLitAbility: [Function], -// toString: [Function], -// resourcePrefix: "lit-pkp", -// resource: "*", -// }, -// ability: "pkp-signing", -// } -// ], -// sessionKeyPair: { -// publicKey: "1d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// secretKey: "faa9b3b04f89ef6066f8842ad713a8c1d2d12540b65129f328a1e301366ebc051d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// }, -// sessionCapabilityObject: SessionCapabilityObjectSchema, -// authNeededCallback: [AsyncFunction: authNeededCallback], -// capabilityAuthSigs: [], -// } -// export const AuthContextSchema = z.object({ -// pkpPublicKey: HexPrefixedSchema.optional(), -// // viemAccount: z.custom().optional(), -// // authMethod: AuthMethodSchema.optional(), -// chain: z.string(), -// sessionKeyPair: SessionKeyPairSchema, -// // which one do we need here? -// resourceAbilityRequests: z.array(LitResourceAbilityRequestSchema), -// // which one do we need here? -// sessionCapabilityObject: ISessionCapabilityObjectSchema, -// // which one do we need here? TODO: ❗️ specify the type properly -// siweResources: z.any(), -// authNeededCallback: z.function(), -// capabilityAuthSigs: z.array(AuthSigSchema), -// authConfig: AuthConfigSchema, -// }); - -// export type AuthContext = z.infer; - -// export const EoaAuthContextSchema = z.object({ -// viemAccount: z.custom(), -// authMethod: AuthMethodSchema, -// authNeededCallback: z.function(), -// sessionKeyPair: SessionKeyPairSchema, -// authConfig: AuthConfigSchema, -// }); - -// export const GenericAuthContextSchema = z.union([ -// AuthContextSchema, -// EoaAuthContextSchema, -// ]); - -// export type GenericAuthContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.test.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.test.ts deleted file mode 100644 index 44b8384ad9..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.test.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { formatSessionSigs } from './session-sigs-reader'; - -const MOCK_VALID_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -const MOCK_EXPIRED_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -describe('formatSessionSigs', () => { - it('should format session signatures correctly', () => { - const currentTime = new Date('2022-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_VALID_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2022-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2024-10-16T13:48:18.135Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ✅ Not expired (valid for 1020 days) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2024-10-16T13:48:13.383Z - * Expiration: 2024-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ✅ Not expired (valid for 1026 days) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2024-10-16T13:47:47.000Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ✅ Not expired (valid for 1020 days) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - - expect(formattedSessionSigs).toBe(expectedOutput); - }); - - it('should handle expired session signatures correctly', () => { - const currentTime = new Date('2024-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_EXPIRED_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2024-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2022-10-16T13:48:18.135Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ❌ Expired (expired 440 days ago) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2022-10-16T13:48:13.383Z - * Expiration: 2022-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ❌ Expired (expired 434 days ago) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2022-10-16T13:47:47.000Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ❌ Expired (expired 440 days ago) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - expect(formattedSessionSigs).toBe(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.ts deleted file mode 100644 index 99c66792fd..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-reader.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { InvalidArgumentException } from '@lit-protocol/constants'; -import { logger } from '@lit-protocol/logger'; - -import { parseSignedMessage } from './session-sigs-validator'; - -function formatDuration(start: Date, end: Date): string { - const diff = end.getTime() - start.getTime(); - const days = Math.floor(diff / (1000 * 60 * 60 * 24)); - const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); - const seconds = ((diff % (1000 * 60)) / 1000).toFixed(3); - - let elapsedTime: string; - - if (days > 0) { - elapsedTime = `${days} days`; - } else if (hours > 0) { - elapsedTime = `${hours} hours, ${minutes} minutes, ${seconds} seconds`; - } else { - elapsedTime = `${minutes} minutes, ${seconds} seconds`; - } - - return elapsedTime; -} - -function formatStatus(expirationDate: Date, currentDate: Date): string { - if (expirationDate > currentDate) { - const timeLeft = formatDuration(currentDate, expirationDate); - return `✅ Not expired (valid for ${timeLeft})`; - } else { - const timeAgo = formatDuration(expirationDate, currentDate); - return `❌ Expired (expired ${timeAgo} ago)`; - } -} - -/** - * Convert this format: - * {"lit-ratelimitincrease://25364":{"Auth/Auth":[{"nft_id":["25364"]}]}} - * to human-readable format - */ -function humanReadableAtt(obj: any, indentLevel: number = 0): string { - const indent = ' '.repeat(indentLevel * 2); - let result = ''; - - for (const key in obj) { - result += `${indent}* ${key}\n`; - - if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) { - result += humanReadableAtt(obj[key], indentLevel + 1); - } else if (Array.isArray(obj[key])) { - obj[key].forEach((item: any) => { - if (typeof item === 'object') { - result += humanReadableAtt(item, indentLevel + 1); - } else { - result += `${indent} * ${item}\n`; - } - }); - } else { - result += `${indent} * ${obj[key]}\n`; - } - } - return result; -} - -export function formatSessionSigs( - sessionSigs: string, - currentTime: Date = new Date() -): string { - const parsedSigs = JSON.parse(sessionSigs); - const firstNodeKey = Object.keys(parsedSigs)[0]; - const firstNode = parsedSigs[firstNodeKey]; - let signedMessage; - - try { - signedMessage = JSON.parse(firstNode.signedMessage); - } catch (error: unknown) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - firstNodeSignedMessage: firstNode.signedMessage, - }, - }, - `Invalid JSON format for signedMessage: ${errorMessage}` - ); - } - - const currentDate = new Date(currentTime); - - let result = `The request time is at: ${currentDate.toISOString()}\n`; - - // Outer expiration - let issuedAt, expiration; - try { - issuedAt = new Date(signedMessage.issuedAt); - expiration = new Date(signedMessage.expiration); - } catch (error) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - }, - }, - `Error parsing issuedAt or expiration: ${errorMessage}` - ); - } - - result += '* Outer expiration:\n'; - result += ` * Issued at: ${issuedAt.toISOString()}\n`; - result += ` * Expiration: ${expiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration(issuedAt, expiration)}\n`; - result += ` * Status: ${formatStatus(expiration, currentDate)}\n`; - - // Capabilities - result += '* Capabilities:\n'; - signedMessage.capabilities.forEach((cap: any, index: number) => { - const capType = cap.derivedVia; - const parsedCapMessage = parseSignedMessage(cap.signedMessage); - let attenuation: string = ''; - - try { - const encodedRecap = (parsedCapMessage['- urn'] as string)?.split(':')[1]; - const decodedRecap = atob(encodedRecap); - const jsonRecap = JSON.parse(decodedRecap); - attenuation = humanReadableAtt(jsonRecap.att, 6); - } catch (e) { - // swallow error - logger.info({ - function: 'formatSessionSigs', - msg: 'Error parsing attenuation', - error: e, - }); - } - - const capIssuedAt = new Date(parsedCapMessage['Issued At'] || ''); - const capExpiration = new Date(parsedCapMessage['Expiration Time'] || ''); - - result += ` * Capability ${index + 1} (${capType}):\n`; - result += ` * Issued at: ${capIssuedAt.toISOString()}\n`; - result += ` * Expiration: ${capExpiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration( - capIssuedAt, - capExpiration - )}\n`; - result += ` * Status: ${formatStatus(capExpiration, currentDate)}\n`; - result += ` * Attenuation:\n`; - result += attenuation; - }); - return result; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.spec.ts deleted file mode 100644 index 24a7c1680a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.spec.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { AuthSig } from '@lit-protocol/types'; - -import { validateSessionSigs } from './session-sigs-validator'; - -describe('validateSessionSigs', () => { - // Mock session signature with valid data for reference - const validSessionSig: AuthSig = { - sig: 'valid-sig', - derivedVia: 'some-method', - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: 2099-12-31T23:59:59Z`, - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', // Valid future date - }), - address: '0xValidAddress', - algo: 'ed25519', - }; - - // Helper function to create a SessionSigsMap - function createSessionSigsMap(sigs: { - [key: string]: AuthSig; - }): Record { - return sigs; - } - - // 1. Invalid JSON in signedMessage - it('should handle invalid JSON in signedMessage', () => { - const invalidJsonSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidJsonSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Main signedMessage is not valid JSON." - ); - }); - - // 2. Missing capabilities field - it('should handle missing capabilities field', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.capabilities; // Remove the capabilities field - - const missingCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Capabilities not found in main signedMessage." - ); - }); - - // 3. Empty capabilities array - it('should not accept an empty capabilities array', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities = []; // Set capabilities to empty array - - const emptyCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: emptyCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining('No capabilities found in main signedMessage.') - ); - }); - - // 4. Invalid capability in capabilities - it('should handle invalid capability in capabilities', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities[0].signedMessage = `Capability Signed Message -Expiration Time: invalid-date-format`; // Invalid expiration date in capability - - const invalidCapabilitySessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidCapabilitySessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in capability 0" - ) - ); - }); - - // 5. Missing expiration in main signedMessage - it('should handle missing expiration in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.expiration; // Remove the expiration field - - const missingExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Expiration Time not found in outer signedMessage." - ); - }); - - // 6. Invalid expiration date format in main signedMessage - it('should handle invalid expiration date format in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = 'invalid-date-format'; // Set invalid expiration date - - const invalidExpirationFormatSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidExpirationFormatSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in main signedMessage" - ) - ); - }); - - // 7. Expired expiration date in main signedMessage - it('should handle expired expiration date in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = '2000-01-01T00:00:00Z'; // Past date - - const expiredExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: expiredExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Expired main signedMessage. Expiration Time:" - ) - ); - }); - - // 8. Multiple session signatures, some valid and some invalid - it('should validate multiple session signatures and report errors', () => { - const session1 = validSessionSig; // Valid - const session2: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', // Invalid JSON - }; - const session3: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: invalid-date-format`, // Invalid date format - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', - }), - }; - - const sessionSigs = createSessionSigsMap({ - session1, - session2, - session3, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session2': Main signedMessage is not valid JSON." - ); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session3': Invalid Expiration Time format in capability 0" - ) - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.ts deleted file mode 100644 index 55847d2b8a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/helper/session-sigs-validator.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { - AuthSig, - Capability, - ParsedSessionMessage, - ParsedSignedMessage, - SessionSigsMap, -} from '@lit-protocol/types'; - -interface ValidationResult { - isValid: boolean; - errors: string[]; -} - -// Function to parse a signedMessage string into an object -export function parseSignedMessage(signedMessage: string): ParsedSignedMessage { - const lines = signedMessage.split('\n'); - const parsedData: ParsedSignedMessage = {}; - let currentKey: string | null = null as string | null; - let currentValue = ''; - - lines.forEach((line) => { - // Match lines with 'Key: Value' pattern - const keyValueMatch = line.match(/^([^:]+):\s*(.*)$/); - - if (keyValueMatch) { - // Save the previous key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // Start a new key-value pair - currentKey = keyValueMatch[1]; - currentValue = keyValueMatch[2]; - } else if (line.startsWith('- ')) { - // Handle list items - const item = line.substring(2).trim(); - if (!parsedData[currentKey!]) { - parsedData[currentKey!] = []; - } - (parsedData[currentKey!] as string[]).push(item); - } else if (line.trim() === '') { - // Skip empty lines - } else { - // Continuation of the current value - currentValue += '\n' + line; - } - }); - - // Save the last key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // parsedData: { - // 'localhost wants you to sign in with your Ethereum account': '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - // 'This is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf': "(1) 'Auth': 'Auth' for 'lit-ratelimitincrease://24529'.", - // URI: 'lit:capability:delegation', - // Version: '1', - // 'Chain ID': '1', - // Nonce: '0x921dd92f497527857ee8dda62f1805e56c34c99a6b37691b4e56e6fb171a5a70', - // 'Issued At': '2024-09-19T13:07:33.606Z', - // 'Expiration Time': '2024-09-26T13:07:33.602Z', - // Resources: '', - // '- urn': 'recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjQ1MjkiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjQ1MjkiXSwidXNlcyI6IjIwMCJ9XX19LCJwcmYiOltdfQ' - // } - return parsedData; -} - -// Function to validate expiration date -function validateExpiration( - expirationTimeStr: string, - context: string -): ValidationResult { - const errors: string[] = []; - const expirationTime = new Date(expirationTimeStr); - const currentTime = new Date(); - - if (isNaN(expirationTime.getTime())) { - errors.push( - `Invalid Expiration Time format in ${context}: ${expirationTimeStr}` - ); - } else if (expirationTime < currentTime) { - errors.push( - `Expired ${context}. Expiration Time: ${expirationTime.toISOString()}` - ); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -// Function to parse and validate capabilities -function parseCapabilities(capabilities: Capability[]): ValidationResult { - const errors: string[] = []; - - capabilities.forEach((capability, index) => { - const { signedMessage } = capability; - - // Parse the signedMessage - const parsedCapabilityMessage = parseSignedMessage(signedMessage); - capability.parsedSignedMessage = parsedCapabilityMessage; - - // Extract and validate expiration date - const expirationTimeStr = parsedCapabilityMessage['Expiration Time']; - - if (expirationTimeStr) { - const validationResult = validateExpiration( - expirationTimeStr, - `capability ${index}` - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push( - `Expiration Time not found in capability ${index}'s signedMessage.` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signature. - * - * @param sessionSig - The session signature to validate. - * @returns The validation result, indicating whether the session signature is valid and any errors encountered during validation. - */ -export function validateSessionSig(sessionSig: AuthSig): ValidationResult { - const errors: string[] = []; - - // Parse the main signedMessage - let parsedSignedMessage: ParsedSessionMessage; - try { - parsedSignedMessage = JSON.parse(sessionSig.signedMessage); - } catch (error) { - errors.push('Main signedMessage is not valid JSON.'); - return { isValid: false, errors }; - } - - // Validate capabilities - const capabilities: Capability[] = parsedSignedMessage.capabilities; - - if (!capabilities) { - errors.push('Capabilities not found in main signedMessage.'); - } else if (capabilities.length === 0) { - errors.push('No capabilities found in main signedMessage.'); - } else { - const capabilitiesValidationResult = parseCapabilities(capabilities); - - if (!capabilitiesValidationResult.isValid) { - errors.push(...capabilitiesValidationResult.errors); - } - } - - // Validate outer expiration - const outerExpirationTimeStr = parsedSignedMessage['expiration']; - - if (outerExpirationTimeStr) { - const validationResult = validateExpiration( - outerExpirationTimeStr, - 'main signedMessage' - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push('Expiration Time not found in outer signedMessage.'); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signatures. - * - * @param sessionSigs - The session signatures to validate. - * @returns The validation result, indicating whether the session signatures are valid and any errors encountered during validation. - */ -export function validateSessionSigs( - sessionSigs: SessionSigsMap -): ValidationResult { - const errors: string[] = []; - - Object.entries(sessionSigs).forEach(([key, sessionSig]) => { - const validationResult = validateSessionSig(sessionSig); - - if (!validationResult.isValid) { - errors.push( - `Session Sig '${key}': ${validationResult.errors.join(', ')}` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/issueSessionFromContext.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/issueSessionFromContext.ts deleted file mode 100644 index 8195feb80c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/session-manager/issueSessionFromContext.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { InvalidSessionSigs } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - AuthConfigSchema, -} from '@lit-protocol/schemas'; -import { - LitResourceAbilityRequest, - SessionSigningTemplate, - SessionSigsMap, -} from '@lit-protocol/types'; -import { ed25519 } from '@noble/curves/ed25519'; -import { hexToBytes } from '@noble/hashes/utils'; -import { z } from 'zod'; -import { getMaxPricesForNodeProduct } from '../pricing-manager/getMaxPricesForNodeProduct'; -import { PricingContext } from '../pricing-manager/PricingContextSchema'; -import { validateSessionSigs } from './helper/session-sigs-validator'; - -/** - * Attempts to normalize a string by unescaping it until it can be parsed as a JSON object, - * then stringifies it exactly once. If the input is a regular string that does not represent - * a JSON object or array, the function will return it as is without modification. - * This function is designed to handle cases where strings might be excessively escaped due - * to multiple layers of encoding, ensuring that JSON data is stored in a consistent and - * predictable format, and regular strings are left unchanged. - * - * @param input The potentially excessively escaped string. - * @return A string that is either the JSON.stringify version of the original JSON object - * or the original string if it does not represent a JSON object or array. - */ -export function normalizeAndStringify(input: string): string { - try { - // Directly return the string if it's not in a JSON format - if (!input.startsWith('{') && !input.startsWith('[')) { - return input; - } - - // Attempt to parse the input as JSON - const parsed = JSON.parse(input); - - // If parsing succeeds, return the stringified version of the parsed JSON - return JSON.stringify(parsed); - } catch (error) { - // If parsing fails, it might be due to extra escaping - const unescaped = input.replace(/\\(.)/g, '$1'); - - // If unescaping doesn't change the string, return it as is - if (input === unescaped) { - return input; - } - - // Otherwise, recursively call the function with the unescaped string - return normalizeAndStringify(unescaped); - } -} - -export const issueSessionFromContext = async (params: { - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - pricingContext: PricingContext; - // latestBlockhash: string; -}): Promise => { - const authSig = await params.authContext.authNeededCallback(); - const _authConfig = AuthConfigSchema.parse(params.authContext.authConfig); - - const capabilities = [ - ...(_authConfig?.capabilityAuthSigs || []), // Spreads existing sigs, or an empty array if null/undefined/empty - authSig, - ]; - - // This is the template that will be combined with the node address as a single object, then signed by the session key - // so that the node can verify the session signature - const sessionSigningTemplate = { - sessionKey: params.authContext.sessionKeyPair.publicKey, - resourceAbilityRequests: (_authConfig.resources || - []) as LitResourceAbilityRequest[], - capabilities: capabilities, - issuedAt: new Date().toISOString(), - - // @ts-ignore - adding ! because zod schema has a default so this value will never be undefined - // otherwise, "const toSign" below will throw lint error - expiration: _authConfig.expiration!, - }; - - // console.log('🔄 sessionSigningTemplate', sessionSigningTemplate); - - const sessionSigs: SessionSigsMap = {}; - - const _userMaxPrices = getMaxPricesForNodeProduct({ - nodePrices: params.pricingContext.nodePrices, - userMaxPrice: params.pricingContext.userMaxPrice, - - // @ts-ignore - need to change the MaxPricesForNodes interface - productId: Number(params.pricingContext.product.id), - numRequiredNodes: params.pricingContext.threshold, - }); - - // console.log('🔄 _userMaxPrices', _userMaxPrices); - - _userMaxPrices.forEach(({ url: nodeAddress, price }) => { - const toSign: SessionSigningTemplate = { - ...sessionSigningTemplate, - nodeAddress, - maxPrice: price.toString(), - }; - - // console.log(`Setting maxprice for ${nodeAddress} to `, price.toString()); - - const signedMessage = JSON.stringify(toSign); - - const messageHex = new Uint8Array(Buffer.from(signedMessage, 'utf8')); - - const secretKeyBytes = hexToBytes( - params.authContext.sessionKeyPair.secretKey - ); - const signature = ed25519.sign(messageHex, secretKeyBytes); - - // one of these is essentially what wrapped key service need. - sessionSigs[nodeAddress] = { - sig: Buffer.from(signature).toString('hex'), - derivedVia: 'litSessionSignViaNacl', - signedMessage: signedMessage, - address: params.authContext.sessionKeyPair.publicKey, - algo: 'ed25519', - }; - }); - - const validatedSessionSigs = validateSessionSigs(sessionSigs); - - if (validatedSessionSigs.isValid === false) { - throw new InvalidSessionSigs( - {}, - `Invalid sessionSigs. Errors: ${validatedSessionSigs.errors}` - ); - } - - // make this only log when debug is enabled - // if (typeof process !== 'undefined' && process.env['PINO_LOG_LEVEL']) { - // console.log( - // '💡 PINO_LOG_LEVEL is defined, printing human readable session sigs' - // ); - // console.log(formatSessionSigs(JSON.stringify(sessionSigs))); - // } - - return sessionSigs; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.spec.ts deleted file mode 100644 index 5337321997..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.spec.ts +++ /dev/null @@ -1,348 +0,0 @@ -import { createStateManager } from './createStateManager'; -import { STAKING_STATES } from '@lit-protocol/constants'; -import { createReadOnlyChainManager } from '@nagaDev/ChainManager'; -import { createReadOnlyContractsManager } from '@vNaga/LitChainClient'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { createEvmEventState } from '../../../../shared/StateManager/src/createEvmEventState'; -import { createRefreshedValue } from '../../../../shared/StateManager/src/createRefreshedValue'; -import { getChildLogger } from '@lit-protocol/logger'; - -// Mock dependencies -jest.mock('@nagaDev/ChainManager'); -jest.mock('@vNaga/LitChainClient'); -jest.mock('ethers'); -jest.mock('../../../../shared/StateManager/helpers/fetchBlockchainData'); -jest.mock('../../../../shared/StateManager/src/createEvmEventState'); -jest.mock('../../../../shared/StateManager/src/createRefreshedValue'); -jest.mock('@lit-protocol/logger'); - -const mockGetChildLogger = getChildLogger as jest.Mock; -const mockCreateReadOnlyChainManager = createReadOnlyChainManager as jest.Mock; -const mockCreateReadOnlyContractsManager = - createReadOnlyContractsManager as jest.Mock; -const mockEthersContract = ethers.Contract as jest.Mock; -const mockEthersJsonRpcProvider = ethers.providers.JsonRpcProvider as jest.Mock; -const mockFetchBlockchainData = fetchBlockchainData as jest.Mock; -const mockCreateEvmEventState = createEvmEventState as jest.Mock; -const mockCreateRefreshedValue = createRefreshedValue as jest.Mock; - -describe('createStateManager', () => { - let mockNetworkConfig: any; - let mockLogger: any; - let mockGetConnectionInfo: jest.Mock; - let mockGetOrRefreshAndGet: jest.Mock; - let mockEvmEventStateInstance: { - listen: jest.Mock; - stop: jest.Mock; - onChangeCallback?: (newState: any) => Promise; - }; - - beforeEach(() => { - jest.clearAllMocks(); - - mockLogger = { - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - mockGetChildLogger.mockReturnValue(mockLogger); - - mockGetConnectionInfo = jest.fn(); - mockCreateReadOnlyChainManager.mockReturnValue({ - api: { - connection: { - getConnectionInfo: mockGetConnectionInfo, - }, - }, - }); - - mockCreateReadOnlyContractsManager.mockReturnValue({ - stakingContract: { - address: '0xStakingContractAddress', - abi: [], - }, - }); - - mockEthersContract.mockImplementation(() => ({})); - mockEthersJsonRpcProvider.mockImplementation(() => ({})); - - mockGetOrRefreshAndGet = jest.fn(); - mockCreateRefreshedValue.mockReturnValue({ - getOrRefreshAndGet: mockGetOrRefreshAndGet, - }); - - mockEvmEventStateInstance = { - listen: jest.fn(), - stop: jest.fn(), - }; - mockCreateEvmEventState.mockImplementation(({ onChange }) => { - // Capture the onChange callback to simulate events - mockEvmEventStateInstance.onChangeCallback = onChange; - return mockEvmEventStateInstance; - }); - - mockNetworkConfig = { - rpcUrl: 'http://localhost:8545', - // Add other necessary config properties if your tests need them - }; - }); - - const initialConnectionInfo = { - bootstrapUrls: ['http://node1.com'], - epochInfo: { number: 1, id: 'epoch1' }, - connectedNodes: new Map([['node1', {}]]), - }; - - const updatedConnectionInfo = { - bootstrapUrls: ['http://node2.com', 'http://node3.com'], - epochInfo: { number: 2, id: 'epoch2' }, - connectedNodes: new Map([['node2', {}]]), - }; - - it('should initialize, fetch initial connection info, and start listeners', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - expect(mockGetChildLogger).toHaveBeenCalledWith({ module: 'StateManager' }); - expect(mockCreateReadOnlyChainManager).toHaveBeenCalled(); - expect(mockCreateReadOnlyContractsManager).toHaveBeenCalledWith( - mockNetworkConfig - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockCreateEvmEventState).toHaveBeenCalled(); - expect(mockEvmEventStateInstance.listen).toHaveBeenCalled(); - expect(mockLogger.info).toHaveBeenCalledWith( - 'State manager background processes started.' - ); - }); - - it('should throw an error if initial connection info fetch fails', async () => { - const error = new Error('Failed to connect'); - mockGetConnectionInfo.mockRejectedValueOnce(error); - - await expect( - createStateManager({ networkConfig: mockNetworkConfig }) - ).rejects.toThrow('Failed to initialize state manager connection info.'); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get initial connection info for State Manager', - error - ); - }); - - describe('getLatestBlockhash', () => { - it('should return blockhash from blockhashManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const mockBlockhash = '0x123abc'; - mockGetOrRefreshAndGet.mockResolvedValueOnce(mockBlockhash); - - const blockhash = await stateManager.getLatestBlockhash(); - expect(blockhash).toBe(mockBlockhash); - expect(mockGetOrRefreshAndGet).toHaveBeenCalled(); - }); - - it('should throw error if blockhashManager fails', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const error = new Error('Blockhash fetch failed'); - mockGetOrRefreshAndGet.mockRejectedValueOnce(error); - - await expect(stateManager.getLatestBlockhash()).rejects.toThrow(error); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Error getting latest blockhash', - error - ); - }); - }); - - describe('getLatestConnectionInfo', () => { - it('should return the latest connection info', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - }); - - describe('staking state changes', () => { - it('should refresh connection info, update urls and epoch when state becomes Active and data changed', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo - mockGetConnectionInfo.mockResolvedValueOnce(updatedConnectionInfo); - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); // Initial + Active state - expect(stateManager.getLatestConnectionInfo()).toEqual( - updatedConnectionInfo - ); - expect(mockLogger.warn).toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: initialConnectionInfo.bootstrapUrls, - newUrls: updatedConnectionInfo.bootstrapUrls, - }) - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number updated from 1 to 2' - ); - }); - - it('should refresh connection info but not log warnings if URLs and epoch are the same', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo returns same data - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'BootstrapUrls remain unchanged.' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number 1 remains the same.' - ); - expect(mockLogger.warn).not.toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - }) - ); - }); - - it('should handle error when fetching connection info during Active state', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - const fetchError = new Error('Fetch connection info failed'); - mockGetConnectionInfo.mockRejectedValueOnce(fetchError); // Fail on the second call - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get connection info during staking onChange', - fetchError - ); - // Connection info should remain the initial one - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should not refresh connection info if state is not Active', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Paused); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Paused"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is "Paused", not Active. Connection info not refreshed via event.' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); // Only initial call - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should do nothing if new state is null in onChange', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await createStateManager({ networkConfig: mockNetworkConfig }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(null); - expect(mockLogger.info).not.toHaveBeenCalledWith( - expect.stringContaining('New staking state detected:') - ); - }); - }); - - describe('stop', () => { - it('should call stop on eventStateManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - stateManager.stop(); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'Stopping state manager listeners...' - ); - expect(mockEvmEventStateInstance.stop).toHaveBeenCalled(); - }); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.ts deleted file mode 100644 index ab1c574ac1..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/createStateManager.ts +++ /dev/null @@ -1,285 +0,0 @@ -import { STAKING_STATES, STAKING_STATES_VALUES } from '@lit-protocol/constants'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { - createEvmEventState, - EventState, -} from '../../../../shared/StateManager/src/createEvmEventState'; -import { - createRefreshedValue, - RefreshedValue, -} from '../../../../shared/StateManager/src/createRefreshedValue'; -import { - ConnectionInfo, - createReadOnlyContractsManager, -} from '../../../LitChainClient'; -import { createReadOnlyChainManager } from '../chain-manager/createChainManager'; -import { NagaStagingNetworkConfig } from '../naga-staging.config'; -// Import EpochInfo type (adjust path if necessary based on actual export location) -import { getChildLogger } from '@lit-protocol/logger'; -import type { CallbackParams, EndPoint, EpochInfo } from '@lit-protocol/types'; -import { LitNetworkModuleBase } from '../../../../types'; -import { areStringArraysDifferent } from './helper/areStringArraysDifferent'; - -const _logger = getChildLogger({ - module: 'StateManager', -}); - -const BLOCKHASH_SYNC_INTERVAL = 30_000; - -// export type EndPoint = { -// [key: string]: { -// path: string; -// version: string; -// }; -// }; - -// export type CallbackParams = { -// bootstrapUrls: string[]; -// currentEpoch: number; -// version: string; -// requiredAttestation: boolean; -// minimumThreshold: number; -// abortTimeout: number; -// endpoints: EndPoint[]; -// }; - -/** - * It returns a blockhash manager for latestBlockhash/nonce and event state - * manager for latest connection info. - */ -export const createStateManager = async (params: { - networkConfig: NagaStagingNetworkConfig; - callback: (params: CallbackParams) => Promise; - networkModule: LitNetworkModuleBase; -}) => { - // --- Internal State --- Keep track of the latest known values - let latestBootstrapUrls: string[] = []; - let latestEpochInfo: EpochInfo | null = null; - let latestConnectionInfo: ConnectionInfo | null = null; - let callbackResult: T | null = null; - - // just a test to check on the Lit Client we are getting the latest result - // let counter = 0; - - // --- Internal Managers --- (Not directly exposed) - const blockhashManager: RefreshedValue = createRefreshedValue( - { - fetch: fetchBlockchainData, - ttlMs: BLOCKHASH_SYNC_INTERVAL, - } - ); - - const readOnlyChainManager = createReadOnlyChainManager(); - const contractManager = createReadOnlyContractsManager(params.networkConfig); - - // --- Initial Fetch for Connection Info --- - try { - _logger.info('🔍 About to fetch initial connection info...'); - const initialConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - - _logger.info('🔍 Raw initial connection info:', initialConnectionInfo); - _logger.info( - '🔍 Type of initial connection info:', - typeof initialConnectionInfo - ); - _logger.info( - '🔍 Keys in initial connection info:', - Object.keys(initialConnectionInfo || {}) - ); - - latestBootstrapUrls = initialConnectionInfo.bootstrapUrls; - latestEpochInfo = initialConnectionInfo.epochInfo; // Store initial epoch info - latestConnectionInfo = initialConnectionInfo; // Store initial connection info - - _logger.info({ - msg: 'State Manager Initialized with Connection Info', - initialUrls: latestBootstrapUrls, - initialEpoch: latestEpochInfo?.number, - initialConnectionInfo, - }); - - // --- Initial callback - _logger.info('🔍 About to call initial callback with params:', { - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo?.number, - version: params.networkModule.version, - requiredAttestation: params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - networkModule: params.networkModule, - }); - - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo?.number, - version: params.networkModule.version, - requiredAttestation: params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - // releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - - _logger.info('🔍 Callback completed successfully, result:', callbackResult); - } catch (error: any) { - _logger.error( - 'Failed to get initial connection info for State Manager', - error - ); - _logger.error('🔍 Full error details:', { - message: error.message, - stack: error.stack, - name: error.name, - cause: error.cause, - }); - // Depending on requirements, might want to re-throw or handle differently - throw new Error(error); - } - - // --- Setup Staking Event Listener --- - const stakingContract = new ethers.Contract( - contractManager.stakingContract.address, - contractManager.stakingContract.abi, - new ethers.providers.JsonRpcProvider(params.networkConfig.rpcUrl) - ); - - const eventStateManager: EventState = - createEvmEventState({ - contract: stakingContract, - eventName: 'StateChanged', - initialValue: null, // Initial value of the *event state itself* - transform: (args: any[]): STAKING_STATES_VALUES => { - return args[0] as STAKING_STATES_VALUES; - }, - onChange: async (newState) => { - // 1. check if the new state is valid - if (newState === null) return; - - _logger.info(`New staking state detected: "${newState}"`); - - // 2. If state is Active, refresh connection info - if (newState === (STAKING_STATES.Active as STAKING_STATES_VALUES)) { - try { - _logger.info( - '🖐 Staking state is Active. Fetching latest connection info...' - ); - const newConnectionInfo = - await readOnlyChainManager.api.connection.getConnectionInfo(); - const newBootstrapUrls = newConnectionInfo.bootstrapUrls; - const newEpochInfo = newConnectionInfo.epochInfo; // Get new epoch info - latestConnectionInfo = newConnectionInfo; // Update internal state for connection info - - const bootstrapUrlsChanged = areStringArraysDifferent( - latestBootstrapUrls, - newBootstrapUrls - ); - - if (bootstrapUrlsChanged) { - _logger.warn({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: latestBootstrapUrls, - newUrls: newBootstrapUrls, - }); - latestBootstrapUrls = newBootstrapUrls; // Update internal state - } else { - _logger.info('BootstrapUrls remain unchanged.'); - } - - // Always update epoch info when Active state is processed - if (latestEpochInfo?.number !== newEpochInfo.number) { - _logger.info( - `Epoch number updated from ${latestEpochInfo?.number} to ${newEpochInfo.number}` - ); - latestEpochInfo = newEpochInfo; - } else { - _logger.info( - `Epoch number ${newEpochInfo.number} remains the same.` - ); - } - - // -- callback - callbackResult = await params.callback({ - bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo!.number, - version: params.networkModule.version, - requiredAttestation: - params.networkModule.config.requiredAttestation, - minimumThreshold: params.networkModule.config.minimumThreshold, - abortTimeout: params.networkModule.config.abortTimeout, - endpoints: params.networkModule.getEndpoints(), - releaseVerificationConfig: null, - networkModule: params.networkModule, - }); - } catch (error) { - _logger.error( - 'Failed to get connection info during staking onChange', - error - ); - // Decide how to handle this error - maybe keep old state? - } - } else { - _logger.info( - `Staking state is "${newState}", not Active. Connection info not refreshed via event.` - ); - } - }, - }); - - // --- Start Listeners --- - // Assumes createEvmEventState requires explicit start or returns an interface with listen() - // If createRefreshedValue requires explicit start, call it too. - // Adjust based on actual library API. - eventStateManager.listen(); // Assuming .listen() starts the EVM listener - - _logger.info('State manager background processes started.'); - - // -- Start counter - // const timer = setInterval(() => { - // counter++; - // }, 3000); - - // --- Return the Public Interface --- - return { - /** - * Gets the latest known blockhash, potentially triggering a fetch or refresh if needed. - */ - getLatestBlockhash: async (): Promise => { - try { - return await blockhashManager.getOrRefreshAndGet(); - } catch (error) { - _logger.error('Error getting latest blockhash', error); - throw error; // Re-throw after logging - } - }, - - getCallbackResult: (): T | null => { - return callbackResult; - }, - - // getCounter: (): number => { - // return counter; - // }, - - /** - * Gets the latest known connection info, updated when staking state becomes Active. - */ - getLatestConnectionInfo: (): ConnectionInfo | null => { - // Return a deep copy if ConnectionInfo is mutable, otherwise direct return is fine - return latestConnectionInfo ? { ...latestConnectionInfo } : null; - }, - - /** - * Stops the background listeners (blockhash refresh, event listening). - */ - stop: () => { - _logger.info('Stopping state manager listeners...'); - // RefreshedValue does not have a stop method, only stop the event listener - eventStateManager.stop(); - // clearInterval(timer); - }, - }; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.spec.ts deleted file mode 100644 index 891ae695c5..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { areStringArraysDifferent } from './areStringArraysDifferent'; - -describe('areStringArraysDifferent', () => { - it('should return false for two empty arrays', () => { - expect(areStringArraysDifferent([], [])).toBe(false); - }); - - it('should return false for two arrays with the same elements in the same order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'c'])).toBe( - false - ); - }); - - it('should return false for two arrays with the same elements in a different order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['c', 'a', 'b'])).toBe( - false - ); - }); - - it('should return true for arrays with different lengths (first shorter)', () => { - expect(areStringArraysDifferent(['a', 'b'], ['a', 'b', 'c'])).toBe(true); - }); - - it('should return true for arrays with different lengths (first longer)', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b'])).toBe(true); - }); - - it('should return true for arrays with the same length but different elements', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'd'])).toBe( - true - ); - }); - - it('should return true for one empty array and one non-empty array', () => { - expect(areStringArraysDifferent([], ['a', 'b', 'c'])).toBe(true); - expect(areStringArraysDifferent(['a', 'b', 'c'], [])).toBe(true); - }); - - it('should return false for arrays with duplicate elements that are otherwise the same', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['c', 'a', 'b', 'a']) - ).toBe(false); - }); - - it('should return true for arrays with duplicate elements that make them different', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['a', 'b', 'b', 'c']) - ).toBe(true); - }); - - it("should return true if one array has an element the other doesn't, even if same length", () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'x'])).toBe( - true - ); - }); - - it('should return false for identical arrays with numbers as strings', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '3'])).toBe( - false - ); - }); - - it('should return true for arrays with numbers as strings where one element differs', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '4'])).toBe( - true - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.ts b/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.ts deleted file mode 100644 index 67f7ff04e0..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/state-manager/helper/areStringArraysDifferent.ts +++ /dev/null @@ -1,31 +0,0 @@ -// -- Helper Function (copied from lit-node-client) -- -/** - * Compares two arrays of strings to determine if they are different. - * Two arrays are considered different if they have different lengths, - * or if they do not contain the same elements with the same frequencies, regardless of order. - * - * @param arr1 The first array of strings. - * @param arr2 The second array of strings. - * @returns True if the arrays are different, false otherwise. - */ -export const areStringArraysDifferent = ( - arr1: string[], - arr2: string[] -): boolean => { - if (arr1.length !== arr2.length) { - return true; - } - - // Create sorted copies of the arrays - const sortedArr1 = [...arr1].sort(); - const sortedArr2 = [...arr2].sort(); - - // Compare the sorted arrays element by element - for (let i = 0; i < sortedArr1.length; i++) { - if (sortedArr1[i] !== sortedArr2[i]) { - return true; // Found a difference - } - } - - return false; // Arrays are permutations of each other (same elements, same frequencies) -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.CreateRequestParams.ts deleted file mode 100644 index d7e1ab9a2d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { ConnectionInfo } from '../../../../LitChainClient/types'; -import type { z } from 'zod'; -import type { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import type { NagaJitContext } from '@lit-protocol/types'; - -export type DecryptCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - ciphertext: string; - dataToEncryptHash: string; - accessControlConditions?: any; - evmContractConditions?: any; - solRpcConditions?: any; - unifiedAccessControlConditions?: any; - connectionInfo: ConnectionInfo; - version: string; - chain: string; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.InputSchema.ts deleted file mode 100644 index 51c466a3b6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.InputSchema.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { z } from 'zod'; -import { DecryptRequestSchema } from '@lit-protocol/schemas'; - -export const DecryptInputSchema = DecryptRequestSchema; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.RequestDataSchema.ts deleted file mode 100644 index 2523102a9c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.RequestDataSchema.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { z } from 'zod'; -import { MultipleAccessControlConditionsSchema } from '@lit-protocol/access-control-conditions-schemas'; -import { AuthSigSchema } from '@lit-protocol/schemas'; - -export const DecryptRequestDataSchema = - MultipleAccessControlConditionsSchema.extend({ - ciphertext: z.string(), - dataToEncryptHash: z.string(), - authSig: AuthSigSchema, - chain: z.string(), - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.ResponseDataSchema.ts deleted file mode 100644 index 0a1d70f163..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/decrypt/decrypt.ResponseDataSchema.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { z } from 'zod'; - -export const DecryptResponseDataSchema = z.object({ - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - // Keep backward compatibility fields - share_id: z.string().optional(), - signature_share: z.string().optional(), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/e2ee-request-manager/E2EERequestManager.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/e2ee-request-manager/E2EERequestManager.ts deleted file mode 100644 index 0a4ac18ee1..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/e2ee-request-manager/E2EERequestManager.ts +++ /dev/null @@ -1,196 +0,0 @@ -import { walletDecrypt, walletEncrypt } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { NagaJitContext } from '@lit-protocol/types'; -import { bytesToHex, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, -} from '@lit-protocol/schemas'; - -const _logger = getChildLogger({ - module: 'E2EERequestManager', -}); - -/** - * Generic function to encrypt request data using JIT context - * @param requestData The request data to encrypt - * @param url The node URL to encrypt for - * @param jitContext The JIT context containing key mappings - * @returns Encrypted payload ready to send to the node - */ -const encryptRequestData = ( - requestData: any, - url: string, - jitContext: NagaJitContext -): z.infer => { - if (!jitContext.keySet[url]) { - throw new Error(`No encryption keys found for node URL: ${url}`); - } - - return walletEncrypt( - jitContext.keySet[url].secretKey, // client secret key - jitContext.keySet[url].publicKey, // node public key - stringToBytes(JSON.stringify(requestData)) - ); -}; - -/** - * Generic function to decrypt batch responses using JIT context - * @param encryptedResult The encrypted batch result from nodes - * @param jitContext The JIT context containing key mappings - * @param extractResponseData Function to extract actual response data from decrypted content - * @returns Array of decrypted response values - */ -const decryptBatchResponse = ( - encryptedResult: z.infer, - jitContext: NagaJitContext, - extractResponseData: (decryptedJson: any) => T -): T[] => { - const parsedResult = GenericEncryptedPayloadSchema.parse(encryptedResult); - - if (!parsedResult.success) { - throw new Error(`Batch decryption failed: ${JSON.stringify(parsedResult)}`); - } - - const decryptedValues: T[] = []; - - // Create a reverse mapping: nodePublicKey -> client secret key - const verificationKeyToSecretKey: Record< - string, - { url: string; secretKey: Uint8Array } - > = {}; - - for (const url of Object.keys(jitContext.keySet)) { - // Convert the stored node public key (Uint8Array) to hex string without 0x prefix - const nodePublicKeyHex = bytesToHex( - jitContext.keySet[url].publicKey - ).replace('0x', ''); - verificationKeyToSecretKey[nodePublicKeyHex] = { - url, - secretKey: jitContext.keySet[url].secretKey, - }; - } - - // Decrypt each encrypted payload - for (let i = 0; i < parsedResult.values.length; i++) { - const encryptedResponse = parsedResult.values[i]; - const verificationKey = encryptedResponse.payload.verification_key; - - // Find the correct secret key for this response based on verification key - const keyData = verificationKeyToSecretKey[verificationKey]; - - if (!keyData) { - throw new Error( - `No secret key found for verification key: ${verificationKey}` - ); - } - - try { - const encryptedPayload: z.infer = { - version: encryptedResponse.version, - payload: encryptedResponse.payload, - }; - - const decrypted = walletDecrypt(keyData.secretKey, encryptedPayload); - - // Parse the decrypted content - const decryptedText = new TextDecoder().decode(decrypted); - const parsedData = JSON.parse(decryptedText); - - // Extract the actual response data using the provided function - const responseData = extractResponseData(parsedData); - decryptedValues.push(responseData); - } catch (decryptError) { - const errorMessage = - decryptError instanceof Error ? decryptError.message : 'Unknown error'; - throw new Error( - `Failed to decrypt response ${i} with key from ${keyData.url}: ${errorMessage}` - ); - } - } - - if (decryptedValues.length === 0) { - throw new Error('No responses were successfully decrypted'); - } - - return decryptedValues; -}; - -const handleEncryptedError = ( - errorResult: any, - jitContext: NagaJitContext, - operationName: string -): never => { - if (errorResult.error && errorResult.error.payload) { - // Try to decrypt the error payload to get the actual error message - try { - _logger.info( - `${operationName}: Attempting to decrypt error payload for detailed error information...` - ); - - const errorAsEncryptedPayload = { - success: true, // Fake success so the decryption can proceed - values: [errorResult.error], // Wrap the error payload as if it's a successful response - }; - - const decryptedErrorValues = decryptBatchResponse( - errorAsEncryptedPayload as z.infer< - typeof GenericEncryptedPayloadSchema - >, - jitContext, - (decryptedJson) => { - return decryptedJson.data || decryptedJson; // Return whatever we can get - } - ); - - _logger.error( - `${operationName}: Decrypted error details from nodes:`, - decryptedErrorValues - ); - - // Use the actual error message from the nodes - const firstError = decryptedErrorValues[0]; - if (firstError && firstError.error) { - const errorMessage = firstError.error; - const errorDetails = firstError.errorObject - ? `. Details: ${firstError.errorObject}` - : ''; - throw new Error( - `${operationName} failed. ${errorMessage}${errorDetails}` - ); - } - - // If no specific error field, show the full decrypted response - throw new Error( - `${operationName} failed. ${JSON.stringify(decryptedErrorValues)}` - ); - } catch (decryptError) { - _logger.error( - `${operationName}: Failed to decrypt error payload:`, - decryptError - ); - - // If the decryptError is actually our thrown error with the node's message, re-throw it - if ( - decryptError instanceof Error && - decryptError.message.includes(`${operationName} failed.`) - ) { - throw decryptError; - } - - throw new Error( - `${operationName} failed. The nodes returned an encrypted error response that could not be decrypted. ` + - `This may indicate a configuration or network connectivity issue.` - ); - } - } else { - throw new Error(`${operationName} failed with no error details provided`); - } -}; - -export const E2EERequestManager = { - encryptRequestData, - decryptBatchResponse, - handleEncryptedError, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.CreateRequestParams.ts deleted file mode 100644 index 1992cd2102..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.CreateRequestParams.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy, NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; - -export type ExecuteJsCreateRequestParams = { - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - executionContext: { - code?: string; - ipfsId?: string; - jsParams?: Record; - }; - connectionInfo: ConnectionInfo; - version: string; - useSingleNode?: boolean; - responseStrategy?: LitActionResponseStrategy; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.InputSchema.ts deleted file mode 100644 index 237f35c7f7..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.InputSchema.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { - PKPAuthContextSchema, - EoaAuthContextSchema, -} from '@lit-protocol/schemas'; -import { LitActionResponseStrategy } from '@lit-protocol/types'; -import { z } from 'zod'; - -/** - * ExecuteJs Input Schema - * Based on JsonExecutionSdkParams but following the naga-dev module pattern - */ -export const ExecuteJsInputSchema = z - .object({ - /** - * JS code to run on the nodes - */ - code: z.string().optional(), - - /** - * The IPFS ID of some JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * An object that contains params to expose to the Lit Action. - * These will be injected to the JS runtime before your code runs. - */ - jsParams: z - .union([ - z.any(), - z - .object({ - publicKey: z.string().optional(), - sigName: z.string().optional(), - }) - .catchall(z.any()), - ]) - .optional(), - - /** - * Authentication context - either PKP or EOA based - */ - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - - /** - * User's maximum price they're willing to pay for the request - */ - userMaxPrice: z.bigint().optional(), - - /** - * Only run the action on a single node; this will only work if all code in your action is non-interactive - */ - useSingleNode: z.boolean().optional(), - - /** - * Response strategy for processing Lit Action responses - */ - responseStrategy: z.custom().optional(), - }) - .refine((data) => data.code || data.ipfsId, { - message: "Either 'code' or 'ipfsId' must be provided", - path: ['code'], - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.RequestDataSchema.ts deleted file mode 100644 index 8efc97c999..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.RequestDataSchema.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { AuthSigSchema, NodeSetsFromUrlsSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -/** - * ExecuteJs Request Data Schema - * This defines the structure of the request sent to the nodes for executeJs - * Based on the actual working format - only includes fields sent to nodes - */ -export const ExecuteJsRequestDataSchema = z.object({ - /** - * JS code to run on the nodes (base64 encoded) - */ - code: z.string().optional(), - - /** - * The IPFS ID of JS code to run on the nodes - */ - ipfsId: z.string().optional(), - - /** - * Parameters to expose to the Lit Action - */ - jsParams: z.record(z.any()).optional(), - - /** - * Authentication signature - */ - authSig: AuthSigSchema, - - /** - * Node set for the request - automatically transforms URLs to nodeSet format - */ - nodeSet: NodeSetsFromUrlsSchema, -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ResponseDataSchema.ts deleted file mode 100644 index 99d621e531..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ResponseDataSchema.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { z } from 'zod'; - -/** - * Schema for Lit Action signed data - * This is completely flexible to handle any signature structure that can be returned - * since the structure depends entirely on what the Lit Action code does and what - * sigName(s) are used in the signing operations - */ -const LitActionSignedDataSchema = z.any(); - -/** - * Schema for Lit Action claim data - */ -const LitActionClaimDataSchema = z.object({ - signatures: z.array(z.any()), - derivedKeyId: z.string(), -}); - -/** - * ExecuteJs Response Data Schema - * This defines the structure of responses from nodes for executeJs requests - * Based on ExecuteJsValueResponse interface - */ -export const ExecuteJsResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - /** - * Success status of the execution - */ - success: z.boolean(), - - /** - * Claim data from the Lit Action execution - */ - claimData: z.record(z.string(), LitActionClaimDataSchema), - - /** - * Any decrypted data from the execution - */ - decryptedData: z.any(), - - /** - * Console logs from the Lit Action execution - */ - logs: z.string(), - - /** - * Response data from the Lit Action (usually JSON string) - */ - response: z.string(), - - /** - * Signed data from the Lit Action execution - */ - signedData: z.record(z.string(), LitActionSignedDataSchema), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ts deleted file mode 100644 index d1e258e112..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/executeJs.ts +++ /dev/null @@ -1,529 +0,0 @@ -/** - * ExecuteJs API Implementation for naga-dev - * - * This module provides the executeJs functionality following the same pattern as pkpSign - * but adapted for Lit Action execution with signature combination and response processing. - * - * Features: - * - Handles response aggregation and signature combination - * - Processes claims, logs, and response data - * - Includes response strategy processing (mostCommon, leastCommon, custom) - * - Follows the established naga-dev module pattern - * - * Usage: - * This is used internally by the naga-dev module to handle executeJs responses. - */ - -import { findMostCommonResponse } from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { - ExecuteJsResponse, - LitActionResponseStrategy, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { combineExecuteJSSignatures } from '../helper/get-signatures'; -import { ExecuteJsValueResponse, LitActionClaimData } from '../types'; -import { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; - -const _logger = getChildLogger({ - module: 'executeJs-api', -}); - -// Define ProcessedBatchResult type locally (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -/** - * Find frequency of elements in an array - * @param arr Array of elements to analyze - * @returns Object with min (least common) and max (most common) elements - */ -const _findFrequency = (arr: T[]): { min: T; max: T } => { - const frequency: Map = new Map(); - - // Count frequencies - for (const item of arr) { - const key = JSON.stringify(item); - const existing = frequency.get(key); - if (existing) { - existing.count++; - } else { - frequency.set(key, { count: 1, value: item }); - } - } - - // Find min and max - let minCount = Infinity; - let maxCount = 0; - let minValue = arr[0]; - let maxValue = arr[0]; - - for (const { count, value } of Array.from(frequency.values())) { - if (count < minCount) { - minCount = count; - minValue = value; - } - if (count > maxCount) { - maxCount = count; - maxValue = value; - } - } - - return { min: minValue, max: maxValue }; -}; - -/** - * Process Lit Action response strategy - * @param responses Array of ExecuteJs responses from nodes - * @param strategy Response strategy configuration - * @returns Processed response based on strategy - */ -export const processLitActionResponseStrategy = ( - responses: ExecuteJsValueResponse[], - strategy: LitActionResponseStrategy -) => { - const executionResponses = responses.map((nodeResp) => { - return nodeResp.response; - }); - - const copiedExecutionResponses = executionResponses.map((r) => { - return '' + r; - }); - - if (strategy.strategy === 'custom') { - try { - if (strategy.customFilter) { - const customResponseFilterResult = strategy?.customFilter( - executionResponses as any - ); - return customResponseFilterResult; - } else { - _logger.error( - 'Custom filter specified for response strategy but none found. using most common' - ); - } - } catch (e) { - _logger.error( - 'Error while executing custom response filter, defaulting to most common', - (e as Error).toString() - ); - } - } - - const respFrequency = _findFrequency(copiedExecutionResponses); - if (strategy?.strategy === 'leastCommon') { - _logger.info( - 'strategy found to be least common, taking least common response from execution results' - ); - return respFrequency.min; - } else if (strategy?.strategy === 'mostCommon') { - _logger.info( - 'strategy found to be most common, taking most common response from execution results' - ); - return respFrequency.max; - } else { - _logger.info( - 'no strategy found, using least common response object from execution results' - ); - return respFrequency.min; - } -}; - -/** - * Check if an object contains signature data (r, s, v properties) - * @param obj Object to check - * @returns true if object contains signature properties - */ -const _isSignatureObject = (obj: any): boolean => { - return ( - typeof obj === 'object' && - obj !== null && - 'r' in obj && - 's' in obj && - 'v' in obj - ); -}; - -/** - * Extract signature data from parsed response objects - * @param responses Array of parsed response objects - * @returns Object containing signatures and cleaned responses - */ -const _extractSignaturesFromResponses = ( - responses: ExecuteJsValueResponse[] -): { - hasSignatureData: boolean; - signatureShares: Array<{ signature: any; derivedKeyId?: string }>; - cleanedResponses: ExecuteJsValueResponse[]; -} => { - const signatureShares: Array<{ signature: any; derivedKeyId?: string }> = []; - const cleanedResponses: ExecuteJsValueResponse[] = []; - let hasSignatureData = false; - - for (const nodeResp of responses) { - try { - const parsedResponse = JSON.parse(nodeResp.response as string); - - // Check if response contains signature data - if (parsedResponse && typeof parsedResponse === 'object') { - // Look for direct signature object - if (_isSignatureObject(parsedResponse)) { - hasSignatureData = true; - signatureShares.push({ signature: parsedResponse }); - // For direct signature objects, set response to empty or success message - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify({ success: true }), - }); - } - // Look for signature within response object (like your example) - else if (parsedResponse.signature) { - let signatureObj; - try { - // Handle case where signature is a string that needs parsing - signatureObj = - typeof parsedResponse.signature === 'string' - ? JSON.parse(parsedResponse.signature) - : parsedResponse.signature; - - if (_isSignatureObject(signatureObj)) { - hasSignatureData = true; - signatureShares.push({ signature: signatureObj }); - - // Remove signature from response and keep the rest - const cleanedResponse = { ...parsedResponse }; - delete cleanedResponse.signature; - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // Not a signature object, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse signature, keep response as-is - cleanedResponses.push(nodeResp); - } - } else { - // Check for nested signature objects in response properties - let foundSignature = false; - const cleanedResponse = { ...parsedResponse }; - - for (const [key, value] of Object.entries(parsedResponse)) { - if (_isSignatureObject(value)) { - hasSignatureData = true; - foundSignature = true; - signatureShares.push({ signature: value }); - delete cleanedResponse[key]; - } - } - - if (foundSignature) { - cleanedResponses.push({ - ...nodeResp, - response: JSON.stringify(cleanedResponse), - }); - } else { - // No signature data found, keep as-is - cleanedResponses.push(nodeResp); - } - } - } else { - // Not an object response, keep as-is - cleanedResponses.push(nodeResp); - } - } catch { - // Failed to parse JSON, keep original response - cleanedResponses.push(nodeResp); - } - } - - return { hasSignatureData, signatureShares, cleanedResponses }; -}; - -/** - * Handles the response from executeJs operation - * - * @param result - The batch result from executing the requests - * @param requestId - Request ID for logging - * @param threshold - Minimum number of successful responses required - * @param responseStrategy - Optional response strategy for processing responses - * @returns Promise resolving to the executeJs response - */ -export const handleResponse = async ( - result: ProcessedBatchResult>, - requestId: string, - threshold: number, - responseStrategy?: LitActionResponseStrategy -): Promise => { - _logger.info('executeJs:handleResponse: Processing executeJs response', { - requestId, - threshold, - responseStrategy: responseStrategy?.strategy || 'default', - }); - - if (!result.success) { - _logger.error('executeJs:handleResponse: Batch failed', { - requestId, - error: 'error' in result ? result.error : 'Unknown error', - }); - throw new Error( - `ExecuteJs batch failed: ${JSON.stringify( - 'error' in result ? result.error : 'Unknown error' - )}` - ); - } - - // Extract the ExecuteJsResponseDataSchema from the ProcessedBatchResult - const executeJsResponseData = result.values[0]; - const { values } = ExecuteJsResponseDataSchema.parse(executeJsResponseData); - - _logger.info('executeJs:handleResponse: Response values received', { - requestId, - valueCount: values.length, - successfulValues: values.filter((v) => v.success).length, - }); - - // Filter successful responses - const successfulValues = values.filter((value) => value.success); - - if (successfulValues.length < threshold) { - throw new Error( - `Not enough successful executeJs responses. Expected ${threshold}, got ${successfulValues.length}` - ); - } - - // Convert to ExecuteJsValueResponse format for compatibility with old code - const responseData: ExecuteJsValueResponse[] = successfulValues.map( - (value) => ({ - success: value.success, - response: value.response, - logs: value.logs, - signedData: value.signedData || {}, - claimData: Object.entries(value.claimData || {}).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signature: '', // Convert from signatures array to single signature for compatibility - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ), - decryptedData: value.decryptedData || {}, - }) - ); - - // Check for signature data in responses and extract if found - const { hasSignatureData, signatureShares, cleanedResponses } = - _extractSignaturesFromResponses(responseData); - - // Use cleaned responses for further processing if signatures were extracted - const dataToProcess = hasSignatureData ? cleanedResponses : responseData; - - // Find most common response data using the existing function - const mostCommonResponse = findMostCommonResponse(dataToProcess); - - // Apply response strategy processing - const responseFromStrategy = processLitActionResponseStrategy( - dataToProcess, - responseStrategy ?? { strategy: 'leastCommon' } - ); - mostCommonResponse.response = responseFromStrategy as string; - - const hasSignedData = Object.keys(mostCommonResponse.signedData).length > 0; - const hasClaimData = Object.keys(mostCommonResponse.claimData).length > 0; - - // -- in the case where we are not signing anything on Lit action and using it as purely serverless function - if (!hasSignedData && !hasClaimData && !hasSignatureData) { - return { - success: mostCommonResponse.success, - claims: {}, - signatures: {}, - response: mostCommonResponse.response, - logs: mostCommonResponse.logs, - }; - } - - // ========== Extract shares from response data ========== - - // Combine signatures if any exist - let signatures: Record = {}; - - if (hasSignedData) { - _logger.info( - 'executeJs:handleResponse: Combining signatures from signedData', - { - requestId, - } - ); - - signatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: dataToProcess, - requestId, - threshold, - }); - - _logger.info('executeJs:handleResponse: Signatures combined successfully', { - requestId, - signatureKeys: Object.keys(signatures), - }); - } - - // Handle signatures extracted from response data - if (hasSignatureData) { - _logger.info( - 'executeJs:handleResponse: Processing signatures from response data', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // Check if these are final signatures (with r,s,v) or signature shares that need combining - const firstSignature = signatureShares[0]?.signature; - const isFinalSignature = _isSignatureObject(firstSignature); - - if (isFinalSignature) { - _logger.info( - 'executeJs:handleResponse: Detected final signatures in response, using directly', - { - requestId, - } - ); - - // These are final signatures, not shares - use them directly - // Apply most common strategy to pick the signature to use - const signatureObjects = signatureShares.map((share) => share.signature); - const mostCommonSignature = findMostCommonResponse( - signatureObjects.map((sig) => ({ response: JSON.stringify(sig) })) - ); - - // Convert r,s,v to the expected signature format - const parsedSignature = JSON.parse(mostCommonSignature.response); - const signature = { - r: parsedSignature.r, - s: parsedSignature.s, - recovery: parsedSignature.v, - v: parsedSignature.v, - // Create full signature string if needed - signature: `0x${parsedSignature.r}${ - parsedSignature.s - }${parsedSignature.v.toString(16).padStart(2, '0')}`, - }; - - signatures['response_signature'] = signature; - - _logger.info( - 'executeJs:handleResponse: Final signature processed successfully', - { - requestId, - signatureKeys: ['response_signature'], - } - ); - } else { - _logger.info( - 'executeJs:handleResponse: Detected signature shares, combining them', - { - requestId, - signatureCount: signatureShares.length, - } - ); - - // These are signature shares that need to be combined - // Convert signature shares to the format expected by combineExecuteJSSignatures - const signatureResponseData: ExecuteJsValueResponse[] = - signatureShares.map((share, index) => ({ - success: true, - response: '', - logs: '', - signedData: { - response_signature: { - publicKey: share.derivedKeyId || '', // Use derivedKeyId as publicKey fallback - signatureShare: JSON.stringify(share.signature), - sigName: 'response_signature', - sigType: 'K256' as any, // Default to K256 for ECDSA - }, - }, - claimData: {}, - decryptedData: {}, - })); - - const responseSignatures = await combineExecuteJSSignatures({ - nodesLitActionSignedData: signatureResponseData, - requestId, - threshold, - }); - - // Merge with existing signatures - signatures = { ...signatures, ...responseSignatures }; - - _logger.info( - 'executeJs:handleResponse: Signature shares combined successfully', - { - requestId, - responseSignatureKeys: Object.keys(responseSignatures), - } - ); - } - } - - // Process claims data if present - let claims: Record = {}; - - if (hasClaimData) { - _logger.info('executeJs:handleResponse: Processing claims data', { - requestId, - claimKeys: Object.keys(mostCommonResponse.claimData), - }); - - // Convert claim data to expected format - claims = Object.entries(mostCommonResponse.claimData).reduce( - (acc, [key, claimData]) => { - acc[key] = { - signatures: [claimData.signature], // Convert single signature to array format - derivedKeyId: claimData.derivedKeyId || '', - }; - return acc; - }, - {} as Record - ); - } - - // Try to parse response as JSON if it's a string - let processedResponse: string | object = mostCommonResponse.response || ''; - - if (typeof processedResponse === 'string' && processedResponse.trim()) { - try { - // Attempt to parse as JSON - const parsed = JSON.parse(processedResponse); - // Keep as parsed object if it's valid JSON - processedResponse = parsed; - } catch { - // Keep as string if not valid JSON - // This is expected behaviour for non-JSON responses - } - } - - const executeJsResponse: ExecuteJsResponse = { - success: true, - signatures, - response: processedResponse, - logs: mostCommonResponse.logs || '', - ...(Object.keys(claims).length > 0 && { claims }), - }; - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response created successfully', - { - requestId, - hasSignatures: Object.keys(signatures).length > 0, - hasResponse: !!processedResponse, - hasClaims: Object.keys(claims).length > 0, - } - ); - - return executeJsResponse; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/index.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/index.ts deleted file mode 100644 index 7a6d53f16b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/executeJs/index.ts +++ /dev/null @@ -1,11 +0,0 @@ -/** - * ExecuteJs API Manager Index - * - * Exports the main functions for the executeJs API following the naga-dev module pattern. - */ - -export { handleResponse } from './executeJs'; -export type { ExecuteJsCreateRequestParams } from './executeJs.CreateRequestParams'; -export { ExecuteJsInputSchema } from './executeJs.InputSchema'; -export { ExecuteJsRequestDataSchema } from './executeJs.RequestDataSchema'; -export { ExecuteJsResponseDataSchema } from './executeJs.ResponseDataSchema'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/handshake/handshake.schema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/handshake/handshake.schema.ts deleted file mode 100644 index 205cb629ff..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/handshake/handshake.schema.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { GenericResultBuilder, HexSchema } from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const RawHandshakeResponseSchema = GenericResultBuilder( - z.object({ - serverPublicKey: z.string(), - subnetPublicKey: z.string(), - networkPublicKey: z.string(), - networkPublicKeySet: z.string(), - clientSdkVersion: z.string(), - hdRootPubkeys: z.array(z.string()), - attestation: z.any().optional(), // ❗️ Attestation data if provided by node. -dev version will be null. - latestBlockhash: HexSchema, - nodeIdentityKey: z.string(), - nodeVersion: z.string(), - epoch: z.number(), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.test.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.test.ts deleted file mode 100644 index 3671f6d652..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.test.ts +++ /dev/null @@ -1,438 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - ExecuteJsValueResponse, - LitNodeSignature, - PKPSignEndpointResponse, -} from '@lit-protocol/types'; - -import { - combineExecuteJSSignatures, - combinePKPSignSignatures, -} from './get-signatures'; - -const requestId = 'REQUEST_ID'; -const threshold = 3; - -describe('combineExecuteJSSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: false, - signedData: {}, - decryptedData: {}, - claimData: {}, - response: '', - logs: '', - }, - ]; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: ExecuteJsValueResponse[] = [ - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"3CD32659E13395EA472B5803F441D6336610AE837A64C618FB88A7D52E40F3E6\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\\"","peer_id":"5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a","signature_share":"\\"F462406990EEFC365A04970594A8D28FBAB0C241089A35EDDDE18BA22B5F3E10\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - 'fd50548ca7e4264e834f384d2d53e2194f1c88f56b3d2d72c3d3f6b248f368f47b583a543ee84d1996311e42f2d6ef7d96b2b49be21dbe1af1eb998f3d10a60e1c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"6CA25D6E1FC17CCEABDB39AE60559AC8DD89E088D84589C60F1864EE2327EC25\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03\\"","peer_id":"b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a","signature_share":"\\"F858C082562DBE3D8F3722B046E0648390A7666E795F602194F1D39E73D9A803\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '74d1a74a947b86efac665113323210149e91ef66669951ead4abf056c44553b3596abdcfa5a7a9ee69f12d316bc90033243fd253bb78d59e8ed40122de0a3b2d1b', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - { - success: true, - signedData: { - ethPersonalSignMessageEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"B7AF0DBCE67A07EFDEB38D44491673EF23CC9FF9CBC81399A2C3A3948ED2B1BC\\"","big_r":"\\"0364400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'ethPersonalSignMessageEcdsa', - }, - signEcdsa: { - sigType: 'EcdsaK256Sha256', - signatureShare: - '{"EcdsaSignedMessageShare":{"digest":"7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4","result":"success","share_id":"\\"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3\\"","peer_id":"6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151","signature_share":"\\"2F4376CF77A51A7EFBC604FAFFC56F31A7370B359C559EF56C51EA236C8C3F70\\"","big_r":"\\"035AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A\\"","compressed_public_key":"\\"0250a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da95081\\"","public_key":"\\"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e\\"","sig_type":"EcdsaK256Sha256"}}', - publicKey: - '"0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e"', - sigName: 'signEcdsa', - }, - }, - decryptedData: {}, - claimData: { - claimKey: { - signature: - '266e0aae5b98f78a82c7e11072b0a9cb1284dd1b326c34aa144d44f6c31f48f520fcc05ac9e243aa2596cb8c65ce1e015bc3d690243b9f462cccd8f5600bcc341c', - derivedKeyId: - '8ef1510b2225c2d881221ba953e9ac586c432f75f8052ef56998bd17b4a1f1cb', - }, - }, - response: - '{"signAndCombineEcdsa":"{\\"r\\":\\"b0e2b90cde3357919f4582c4556e437daf94ab48357e7d52c76a4120c8702988\\",\\"s\\":\\"45c37dd91e8eaa16e2d2d2b7d08316f8d8c6186349680b10cf4d699439e75652\\",\\"v\\":0}","signEcdsa":"success","ethPersonalSignMessageEcdsa":"success","foo":"bar"}', - logs: '===== starting\n===== responding\n', - }, - ]; - const combinedSignatures: Record = { - ethPersonalSignMessageEcdsa: { - signature: - '0x64400D1F87B954C788AD6FD25C835E3FA46EBFE23B96763204B8FC8D3265A2AA13250B66E224A3E84AE9F8077BC751575AD904E19F0506A34C669E116F7F34DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x04f09ca42a7f2d7268e756c590c5e29de79dcb28b55b01f8c1211a31438a3e62', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - signEcdsa: { - signature: - '0x5AE42C8D841E45EE956C749038027B12B378BDD5BD9ADEB47DA31C99B8A0076A6FB7EB58D7AA6C7BFE5A2A510B3C237335EC0BCDE15BE1CE2658E265E55918DD', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A0342000450A6083580384CBCDDD0D809165BA8EE53B5E768724C7B6080AE55790DA9508125810F89BAB7D56077E37BE1681463A6262108E50FBA439D94808F3CB1CC704E', - signedData: - '0x7d87c5ea75f7378bb701e404c50639161af3eff66293e9f375b5f17eb50476f4', - recoveryId: 0, - publicKey: - '0x0450a6083580384cbcddd0d809165ba8ee53b5e768724c7b6080ae55790da9508125810f89bab7d56077e37be1681463a6262108e50fba439d94808f3cb1cc704e', - sigType: 'EcdsaK256Sha256', - }, - }; - - await expect( - combineExecuteJSSignatures({ - nodesLitActionSignedData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignatures); - }); -}); - -describe('combinePKPSignSignatures', () => { - it('should throw when threshold is not met', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"3D53B4698F798F98F65D2CB90BFD170278E7014E3DA87E217BCAAEBBB8D5DDF9"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"A0DD6D5EEC9EADACF86E14C8B252344EAEB505B722F5A7C18ECB4F3FFA44A3AE"', - big_r: - '"039EF446668DDE56A9F803F07B371756EEAB3AAF797A8E4EBD7A273CB86874C143"', - compressed_public_key: - '"0366069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29"', - public_key: - '"0466069291e81515949b7659dd00bef10403cbce747404ced4ad72e97690fd1e29bf1741d91941fa1f2407c59445a3c9af78b7c7e94c0782cfd11353c1ee163993"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: false, - signedData: [], - signatureShare: { - EcdsaSignedMessageShare: { - digest: '', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).rejects.toThrow(NoValidShares); - }); - - it('should return the combined signature', async () => { - const shares: PKPSignEndpointResponse[] = [ - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1"', - peer_id: - '5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a', - signature_share: - '"159E02F1F0B5B875FE65A8A534109E0A35DAE0F900FC3CDE2400491289A975FD"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"816E54B265612C92CD87FC32892C024C9E2DD5FA67AA20FED4816A49A560FC03"', - peer_id: - 'b104a1b35585fec58cbb632d17fbe60b10297d7853261ea9054d5e372952936a', - signature_share: - '"F3B8CAAAC28A09D5F9125D6FD0A122E41451CDDCE8E9001C07D8D91F5DBE0F23"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '"B8EF7C21FAF54664646B64869D1B12861F6D905F1F1F095E60F7238806252AE3"', - peer_id: - '6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151', - signature_share: - '"42D2DA7F7E05CBCF927EA934797919D2857AA9D7EB35F3BECAE0C59BC62B81E0"', - big_r: - '"03265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC24"', - compressed_public_key: - '"032e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc7"', - public_key: - '"042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - const combinedSignature: LitNodeSignature = { - signature: - '0x265381E6E2879FF4AA1C0B9991123A3B9E6759A66C3432C60D6F7D8DB7ABAC244C29A81C31458E1B89F6AF497E2ADAC214F87BC725D2907D36E78940DD5CC5BF', - verifyingKey: - '0x3056301006072A8648CE3D020106052B8104000A034200042E0CFE8E42758449DA56EF09669EC4A31C3D8B55F8B28D390C830264D1426DC73BBE2171D83F52483A66922746BFDA297BD1DC69C4D5ED5163A523B0B10D0DB3', - signedData: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - recoveryId: 1, - publicKey: - '0x042e0cfe8e42758449da56ef09669ec4a31c3d8b55f8b28d390c830264d1426dc73bbe2171d83f52483a66922746bfda297bd1dc69c4d5ed5163a523b0b10d0db3', - sigType: 'EcdsaK256Sha256', - }; - - await expect( - combinePKPSignSignatures({ - nodesPkpSignResponseData: shares, - threshold, - requestId, - }) - ).resolves.toEqual(combinedSignature); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.ts deleted file mode 100644 index 891700532b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/get-signatures.ts +++ /dev/null @@ -1,380 +0,0 @@ -import { NoValidShares } from '@lit-protocol/constants'; -import { - applyTransformations, - cleanStringValues, - combineExecuteJsNodeShares, - combinePKPSignNodeShares, - hexifyStringValues, - logErrorWithRequestId, - mostCommonString, -} from '@lit-protocol/crypto'; -import { - PKPSignEndpointResponse as CryptoPKPSignEndpointResponse, - LitNodeSignature, - SigType, -} from '@lit-protocol/types'; -import { z } from 'zod'; -import { PKPSignResponseDataSchema } from '../pkpSign/pkpSign.ResponseDataSchema'; -import { - ExecuteJsValueResponse, - LitActionSignedData, - PKPSignEndpointResponse as LocalPKPSignEndpointResponse, -} from '../types'; -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -function assertThresholdShares( - requestId: string, - threshold: number, - shares: { success: boolean }[] -) { - const successfulShareSources = shares.filter((response) => response.success); - - if (successfulShareSources.length < threshold) { - logErrorWithRequestId( - requestId, - `Not enough successful items. Expected ${threshold}, got ${successfulShareSources.length}` - ); - throw new NoValidShares( - { - info: { - requestId, - itemCount: shares.length, - successfulItems: successfulShareSources.length, - threshold, - }, - }, - `The total number of successful items "${successfulShareSources.length}" does not meet the threshold of "${threshold}"` - ); - } -} - -/** - * Combines signature shares from multiple nodes running a lit action to generate the final signatures. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesLitActionSignedData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combineExecuteJSSignatures = async (params: { - nodesLitActionSignedData: ExecuteJsValueResponse[]; - requestId: string; - threshold: number; -}): Promise> => { - const { threshold, requestId, nodesLitActionSignedData } = params; - - assertThresholdShares(requestId, threshold, nodesLitActionSignedData); - - const sigResponses = {} as Record; - - // Group signature shares by signature name (e.g., "random-sig-name", "sig-identifier", etc.) - const keyedSignedData = nodesLitActionSignedData.reduce< - Record - >((acc, nodeLitActionSignedData) => { - Object.keys(nodeLitActionSignedData.signedData).forEach((signedDataKey) => { - if (!acc[signedDataKey]) { - acc[signedDataKey] = []; - } - - acc[signedDataKey].push( - nodeLitActionSignedData.signedData[signedDataKey] - ); - }); - - return acc; - }, {} as Record); - - const signatureKeys = Object.keys(keyedSignedData); - - await Promise.all( - signatureKeys.map(async (signatureKey) => { - const signatureShares = keyedSignedData[signatureKey]; - - // Parse signature shares similar to PKP sign process - const preparedShares: Array<{ - originalShare: LitActionSignedData; - parsedSignatureShareObject: any; - publicKey?: string; - sigType?: string; - }> = []; - - for (const share of signatureShares) { - try { - // Parse the JSON string in signatureShare field - let parsedSignatureShare; - if (typeof share.signatureShare === 'string') { - parsedSignatureShare = JSON.parse(share.signatureShare); - } else { - parsedSignatureShare = share.signatureShare; - } - - // Extract publicKey and sigType from the share - let publicKey = share.publicKey; - let sigType = share.sigType; - - // If publicKey is a JSON string, parse it - if (typeof publicKey === 'string' && publicKey.startsWith('"')) { - publicKey = JSON.parse(publicKey); - } - - preparedShares.push({ - originalShare: share, - parsedSignatureShareObject: parsedSignatureShare, - publicKey, - sigType, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error parsing signature share for key ${signatureKey}: ${JSON.stringify( - share.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - preparedSharesCount: preparedShares.length, - threshold, - }, - }, - `Not enough valid signature shares for ${signatureKey}: ${preparedShares.length} (expected ${threshold})` - ); - } - - // Get most common public key and sig type - const publicKey = mostCommonString( - preparedShares.map((s) => s.publicKey).filter(Boolean) as string[] - ); - const sigType = mostCommonString( - preparedShares.map((s) => s.sigType).filter(Boolean) as string[] - ); - - if (!publicKey || !sigType) { - throw new NoValidShares( - { - info: { - requestId, - signatureKey, - publicKey, - sigType, - shares: preparedShares, - }, - }, - `Could not get public key or sig type from lit action shares for ${signatureKey}` - ); - } - - // Prepare shares for crypto library (similar to PKP sign process) - const sharesForCryptoLib: LitActionSignedData[] = preparedShares.map( - (ps) => ({ - publicKey: ps.publicKey!, - signatureShare: - typeof ps.originalShare.signatureShare === 'string' - ? ps.originalShare.signatureShare - : JSON.stringify(ps.originalShare.signatureShare), - sigName: ps.originalShare.sigName, - sigType: ps.sigType! as any, // Cast to match EcdsaSigType - }) - ); - - // Combine the signature shares using the crypto library - const combinedSignature = await combineExecuteJsNodeShares( - sharesForCryptoLib - ); - - const sigResponse = applyTransformations( - { - ...combinedSignature, - publicKey, - sigType: sigType as SigType, - }, - [cleanStringValues, hexifyStringValues] - ) as unknown as LitNodeSignature; - - sigResponses[signatureKey] = sigResponse; - }) - ); - - return sigResponses; -}; - -/** - * Combines signature shares from multiple nodes running pkp sign to generate the final signature. - * - * @param {number} params.threshold - The threshold number of nodes - * @param {PKPSignEndpointResponse[]} params.nodesPkpSignResponseData - The array of signature shares from each node. - * @param {string} params.requestId - The request ID, for logging purposes. - * @returns {LitNodeSignature} - The final signatures or an object containing the final signatures. - */ -export const combinePKPSignSignatures = async (params: { - nodesPkpSignResponseData: z.infer['values']; - requestId: string; - threshold: number; -}): Promise => { - const { threshold, requestId, nodesPkpSignResponseData } = params; - - // console.log( - // `[${requestId}] Initial nodesPkpSignResponseData (count: ${nodesPkpSignResponseData.length}):`, - // JSON.stringify(nodesPkpSignResponseData, null, 2) - // ); - - assertThresholdShares(requestId, threshold, nodesPkpSignResponseData); - - const sharesAfterInitialFilter = nodesPkpSignResponseData - .filter((share) => share.success) - .filter(Boolean); - - const rawShares = sharesAfterInitialFilter.filter((share) => { - const sigShareType = typeof share.signatureShare; - const sigShareIsNull = share.signatureShare === null; - const sigShareIsObjectNonNull = - sigShareType === 'object' && !sigShareIsNull; - return sigShareIsObjectNonNull; - }); - - if (rawShares.length < threshold) { - throw new NoValidShares( - { info: { requestId, rawSharesCount: rawShares.length, threshold } }, - `Not enough processable signature shares after initial filtering: ${rawShares.length} (expected ${threshold})` - ); - } - - const preparedShares: Array<{ - originalRawShare: z.infer< - typeof PKPSignResponseDataSchema - >['values'][number]; - parsedSignatureShareObject: any; - localPSEInput: LocalPKPSignEndpointResponse; - publicKey?: string; - sigType?: string; - }> = []; - - for (const rawShare of rawShares) { - try { - const signatureShareObject = rawShare.signatureShare; - preparedShares.push({ - originalRawShare: rawShare, - parsedSignatureShareObject: signatureShareObject, - localPSEInput: { - success: rawShare.success, - signedData: rawShare.signedData, - signatureShare: signatureShareObject, - }, - }); - } catch (e) { - logErrorWithRequestId( - requestId, - `Error processing rawShare (should be object): ${JSON.stringify( - rawShare.signatureShare - )}`, - e - ); - } - } - - if (preparedShares.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesAfterParsingAttempt: preparedShares.length, - threshold, - }, - }, - `Not enough shares after object preparation: ${preparedShares.length}` - ); - } - - const parsingResults = parsePkpSignResponse( - preparedShares.map((p) => p.localPSEInput) - ); - - if (preparedShares.length !== parsingResults.length) { - logErrorWithRequestId( - requestId, - `Mismatch in length between prepared shares (${preparedShares.length}) and parsing results (${parsingResults.length})` - ); - throw new Error( - 'Share processing length mismatch after parsePkpSignResponse' - ); - } - preparedShares.forEach((ps, index) => { - const result = parsingResults[index]; - if (result) { - ps.publicKey = result.publicKey; - ps.sigType = result.sigType; - } else { - logErrorWithRequestId( - requestId, - `No parsing result for prepared share at index ${index}` - ); - } - }); - - const sharesForCryptoLib: CryptoPKPSignEndpointResponse[] = preparedShares - .filter((ps) => ps.publicKey && ps.sigType) - .map((ps) => ({ - success: ps.originalRawShare.success, - signedData: new Uint8Array(ps.originalRawShare.signedData as number[]), - signatureShare: ps.parsedSignatureShareObject, - })); - - if (sharesForCryptoLib.length < threshold) { - throw new NoValidShares( - { - info: { - requestId, - sharesForCryptoCount: sharesForCryptoLib.length, - threshold, - }, - }, - `Not enough shares for crypto lib: ${sharesForCryptoLib.length}` - ); - } - - const combinedSignature = await combinePKPSignNodeShares(sharesForCryptoLib); - - const successfullyProcessedShares = preparedShares.filter( - (ps) => ps.publicKey && ps.sigType - ); - - const finalPublicKey = mostCommonString( - successfullyProcessedShares - .map((p) => p.publicKey) - .filter(Boolean) as string[] - ); - const finalSigType = mostCommonString( - successfullyProcessedShares - .map((p) => p.sigType) - .filter(Boolean) as string[] - ); - - if (!finalPublicKey || !finalSigType) { - throw new NoValidShares( - { - info: { - requestId, - finalPublicKey, - finalSigType, - pkSigPairsCount: successfullyProcessedShares.length, - }, - }, - 'Could not determine final public key or sig type from parsed shares' - ); - } - - const sigResponse = { - ...combinedSignature, - publicKey: finalPublicKey, - sigType: finalSigType as SigType, - }; - - return sigResponse as LitNodeSignature; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.test.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.test.ts deleted file mode 100644 index f64fe89add..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.test.ts +++ /dev/null @@ -1,399 +0,0 @@ -import { - cleanStringValues, - convertKeysToCamelCase, - snakeToCamel, -} from '@lit-protocol/misc'; -import { PKPSignEndpointResponse } from '@lit-protocol/types'; - -import { parsePkpSignResponse } from './parse-pkp-sign-response'; - -describe('parsePkpSignResponse', () => { - it('should parse ECDSA PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - big_r: '', - compressed_public_key: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 125, 135, 197, 234, 117, 247, 55, 139, 183, 1, 228, 4, 197, 6, 57, 22, - 26, 243, 239, 246, 98, 147, 233, 243, 117, 181, 241, 126, 181, 4, 118, - 244, - ], - signatureShare: { - EcdsaSignedMessageShare: { - digest: - '"7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4"', - result: 'success', - share_id: - '"1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937"', - peer_id: - '"800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34"', - signature_share: - '"B1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB"', - big_r: - '"0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B"', - compressed_public_key: - '"0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482"', - public_key: - '"04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726"', - sig_type: 'EcdsaK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - digest: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - bigR: '', - compressedPublicKey: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0x3ED0A844FAE40DF6210A6B2EACB9426E52E8339E243E697E33CF14E0CDE2B827', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - { - digest: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - shareId: - '0x1A0369823607C6EF403D86BA41534DDB1420730C696060EAD7931DE5DB603937', - peerId: - '0x800ca9780644bb7e1908efa6bd1a0686f1095158c3ba6f1649ef9d2d67bfaf34', - signatureShare: - '0xB1AA643E88F8937B71CE2D43DCB73E0180AC96D1E39ECC579F0EC9635F37D4CB', - bigR: '0x0332188F0918B7DEBB0CC846B00B0AAD9300308260C2DAD25A85FDECA671C36B1B', - compressedPublicKey: - '0x0381ff5b9f673837eacd4dca7e9377084250dccfc13ebf13913e662182027d1482', - publicKey: - '0x04156D7E068BF5ED014057B8B6365BF89053D567D38EC24030C699B94065F2D39B4D45F463464F1A138D7149D1C0EF41ACF9B8826050B9E3DCC847DE2127BDB726', - sigType: 'EcdsaK256Sha256', - dataSigned: - '0x7D87C5EA75F7378BB701E404C50639161AF3EFF66293E9F375B5F17EB50476F4', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); - - it('should parse FROST PKP sign response correctly', () => { - const responseData: PKPSignEndpointResponse[] = [ - { - success: false, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: 'fail', - result: 'fail', - share_id: '', - peer_id: '', - signature_share: '', - signing_commitments: '', - verifying_share: '', - public_key: '', - sig_type: '', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[21,126,1,81,188,147,173,138,16,169,115,205,1,224,43,54,73,148,113,48,206,233,7,6,217,224,119,81,249,220,48,41]]', - peer_id: - '77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signature_share: - '["K256Sha256","12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed"]', - signing_commitments: - '["K256Sha256","00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629"]', - verifying_share: - '["K256Sha256","022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - { - success: true, - signedData: [ - 116, 248, 31, 225, 103, 217, 155, 76, 180, 29, 109, 12, 205, 168, 34, - 120, 202, 238, 159, 62, 47, 37, 213, 229, 163, 147, 111, 243, 220, - 236, 96, 208, - ], - signatureShare: { - FrostSignedMessageShare: { - message: - '74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - result: 'success', - share_id: - '["K256Sha256",[226,183,233,101,218,75,198,127,202,46,107,100,150,15,170,176,229,25,121,33,202,13,26,6,192,49,160,84,130,11,169,174]]', - peer_id: - '8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signature_share: - '["K256Sha256","5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b"]', - signing_commitments: - '["K256Sha256","00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a"]', - verifying_share: - '["K256Sha256","02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46"]', - public_key: - '["K256Sha256","02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a"]', - sig_type: 'SchnorrK256Sha256', - }, - }, - }, - ]; - - const expectedOutput = [ - { - message: 'fail', - shareId: '', - peerId: '', - signatureShare: '', - signingCommitments: '', - verifyingShare: '', - publicKey: '', - sigType: '', - dataSigned: 'fail', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 21, 126, 1, 81, 188, 147, 173, 138, 16, 169, 115, 205, 1, 224, 43, 54, - 73, 148, 113, 48, 206, 233, 7, 6, 217, 224, 119, 81, 249, 220, 48, 41, - ]), - peerId: - '0x77b2a2f061adf273b52307fb1c9960137c854382a9ae8d54d60c149e006a0d7c', - signatureShare: - '0x12f86c0d816e98076bdf9cfc39812f7d242f7ac73aefa3638fb7cd1cf63ef7ed', - signingCommitments: - '0x00eed6b1b10396989fe69ba9f582ec87e14a01dcad420ad6fd1ec0ce1a63165f30947dc86fef029f61149ebcbd87868105bebd3582577a3c4b6c6a092c621a8a842940b04d8629', - verifyingShare: - '0x022ba83de8961efba1490d9d3603a51b9d1c0eb17245ce0cbd8295d62ccd7e886c', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - { - message: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - shareId: new Uint8Array([ - 226, 183, 233, 101, 218, 75, 198, 127, 202, 46, 107, 100, 150, 15, - 170, 176, 229, 25, 121, 33, 202, 13, 26, 6, 192, 49, 160, 84, 130, 11, - 169, 174, - ]), - peerId: - '0x8b714aa4b2b8cda1502834522c146d648b1d1eb71910b7064fa3adcb6269a575', - signatureShare: - '0x5e6350c02c361f1ed97865ed57bd395190991c673ea55044c3c291155cc14c9b', - signingCommitments: - '0x00eed6b1b102f72cf9291f23e939db9758123f155da75cf1150526b847c3c788de7e9b2f6e1f035a3db8a5664117f161e9eca110bbf515395a1c44625202aad1311d71b1b5df7a', - verifyingShare: - '0x02b680446e13263aea72c7da159393e64228110d4a4a6db36481bc55c92c616c46', - publicKey: - '0x02c5f80a840bc7d00f26dfb8c2a0075aeffc620df39d2188f3e0237ec42dbe920a', - sigType: 'SchnorrK256Sha256', - dataSigned: - '0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0', - }, - ]; - - const output = parsePkpSignResponse(responseData); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('cleanStringValues', () => { - it('should remove double quotes from string values in an object', () => { - const input = { - name: '"Josh"', - age: 18, - city: '"New York"', - }; - - const expectedOutput = { - name: 'Josh', - age: 18, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify non-string values in an object', () => { - const input = { - name: 'John', - age: 25, - city: 'New York', - }; - - const expectedOutput = { - name: 'John', - age: 25, - city: 'New York', - }; - - const output = cleanStringValues(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('convertKeysToCamelCase', () => { - it('should convert keys to camel case', () => { - const input = { - first_name: 'John', - last_name: 'Doe', - age: 25, - city_name: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); - - it('should not modify keys that are already in camel case', () => { - const input = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const expectedOutput = { - firstName: 'John', - lastName: 'Doe', - age: 25, - cityName: 'New York', - }; - - const output = convertKeysToCamelCase(input); - - expect(output).toEqual(expectedOutput); - }); -}); - -describe('snakeToCamel', () => { - it('should convert snake case to camel case', () => { - const input = 'hello_world'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should convert multiple snake case words to camel case', () => { - const input = 'hello_world_example'; - const expectedOutput = 'helloWorldExample'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify camel case words', () => { - const input = 'helloWorld'; - const expectedOutput = 'helloWorld'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); - - it('should not modify words without underscores', () => { - const input = 'hello'; - const expectedOutput = 'hello'; - const output = snakeToCamel(input); - expect(output).toEqual(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.ts deleted file mode 100644 index 8ed910072d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/helper/parse-pkp-sign-response.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { - applyTransformations, - cleanArrayValues, - cleanStringValues, - convertKeysToCamelCase, - convertNumberArraysToUint8Arrays, - hexifyStringValues, -} from '@lit-protocol/crypto'; -import { PKPSignEndpointResponse, PKPSignEndpointSharesParsed } from '../types'; - -/** - * Parses the PKP sign response data and transforms it into a standardised format because the raw response contains snake cases and double quotes. - * @param responseData - The response data containing PKP sign shares. - * @returns An array of objects with the signature data. - */ -export const parsePkpSignResponse = ( - responseData: PKPSignEndpointResponse[] -): PKPSignEndpointSharesParsed[] => { - const parsedSignatureShares = responseData.map( - ({ signatureShare }) => { - // Determine if the object is lifted or contains a nested structure - // Example scenarios this logic handles: - // 1. If `signatureShare` is nested (e.g., { EcdsaSignedMessageShare: { ... } }), - // it will extract the nested object (i.e., the value of `EcdsaSignedMessageShare`). - // NOTE: against `f8047310fd4ac97ac01ff07a7cd1213808a3396e` in this case - // 2. If `signatureShare` is directly lifted (e.g., { digest: "...", result: "...", share_id: "..." }), - // it will treat `signatureShare` itself as the resolved object. - // NOTE: against `60318791258d273df8209b912b386680d25d0df3` in this case - // 3. If `signatureShare` is null, not an object, or does not match expected patterns, - // it will throw an error later for invalid structure. - const resolvedShare = - typeof signatureShare === 'object' && - !Array.isArray(signatureShare) && - Object.keys(signatureShare).length === 1 && - typeof signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] === 'object' - ? signatureShare[ - Object.keys(signatureShare)[0] as keyof typeof signatureShare - ] - : signatureShare; - - if (!resolvedShare || typeof resolvedShare !== 'object') { - throw new Error('Invalid signatureShare structure.'); - } - - const transformations = [ - convertKeysToCamelCase, - cleanArrayValues, - convertNumberArraysToUint8Arrays, - cleanStringValues, - hexifyStringValues, - ]; - const parsedShare = applyTransformations(resolvedShare, transformations); - - // Frost has `message`, Ecdsa has `digest`. Copy both to `dataSigned` - if (parsedShare['digest'] || parsedShare['message']) { - parsedShare['dataSigned'] = - parsedShare['digest'] || parsedShare['message']; - } - - delete parsedShare['result']; - - return parsedShare as unknown as PKPSignEndpointSharesParsed; - } - ); - - return parsedSignatureShares; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.CreateRequestParams.ts deleted file mode 100644 index 5cc454dc69..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.CreateRequestParams.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - EoaAuthContextSchema, - HexPrefixedSchema, - PKPAuthContextSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { NagaJitContext } from '@lit-protocol/types'; -import { z } from 'zod'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { RawHandshakeResponseSchema } from '../handshake/handshake.schema'; - -export type PKPSignCreateRequestParams = { - serverKeys: Record< - string, - z.infer['data'] - >; - pricingContext: z.input; - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - signingContext: { - pubKey: z.infer; - toSign: any; - signingScheme: z.infer; - bypassAutoHashing?: boolean; - }; - connectionInfo: ConnectionInfo; - version: string; - chain: z.infer; - jitContext: NagaJitContext; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.InputSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.InputSchema.ts deleted file mode 100644 index f0a47da466..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.InputSchema.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - HexPrefixedSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; - -export const PKPSignInputSchema = z.object({ - /** - * Picking the chains would use the correct hash function for the signing scheme. - * - * @example - * ethereum -> keccak256() - * bitcoin -> sha256() - */ - chain: SigningChainSchema, - signingScheme: SigningSchemeSchema, - pubKey: HexPrefixedSchema, - toSign: z.any(), - authContext: z.union([PKPAuthContextSchema, EoaAuthContextSchema]), - userMaxPrice: z.bigint().optional(), -}); - -export const EthereumPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - // signingScheme: z.enum([ - // 'EcdsaK256Sha256', - // 'EcdsaP256Sha256', - // 'EcdsaP384Sha384', - // ]), - }) - .transform((item) => { - return { - ...item, - signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('ethereum'), - }; - }); - -export const BitCoinPKPSignInputSchema = PKPSignInputSchema.omit({ - chain: true, - signingScheme: true, -}) - .extend({ - // chain: z.literal('ethereum'), - signingScheme: z.enum([ - 'EcdsaK256Sha256', - 'SchnorrK256Sha256', - 'SchnorrK256Taproot', - ]), - }) - .transform((item) => { - return { - ...item, - // signingScheme: SigningSchemeSchema.parse('EcdsaK256Sha256'), - chain: SigningChainSchema.parse('bitcoin'), - }; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.RequestDataSchema.ts deleted file mode 100644 index ce17266144..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.RequestDataSchema.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { walletEncrypt } from '@lit-protocol/crypto'; -import { - AuthSigSchema, - BytesArraySchema, - HexPrefixedSchema, - NodeSetsFromUrlsSchema, - SigningChainSchema, -} from '@lit-protocol/schemas'; -import { hexToBytes, stringToBytes } from 'viem'; -import { z } from 'zod'; -import { LitMessageSchema } from '../../../../schemas/LitMessageSchema'; - -// Schema for auth methods in v2 API -const AuthMethodSchema = z.object({ - authMethodType: z.number(), - accessToken: z.string(), -}); - -export const PKPSignRequestDataSchema = z - .object({ - toSign: BytesArraySchema, - signingScheme: SigningSchemeSchema, - // ❗️ THIS FREAKING "pubkey"! "k" is lowercase!! - pubkey: HexPrefixedSchema, - authSig: AuthSigSchema, - nodeSet: NodeSetsFromUrlsSchema, - chain: SigningChainSchema, - bypassAutoHashing: z.boolean().optional(), - - // NEW v2 API fields - epoch: z.number().default(0), - authMethods: z.array(AuthMethodSchema).default([]), - }) - .transform((item) => { - const toSignData = item.bypassAutoHashing - ? item.toSign - : LitMessageSchema.parse({ - toSign: item.toSign, - signingScheme: item.signingScheme, - chain: item.chain, - }); - - const unencrypted = { - toSign: toSignData, - signingScheme: item.signingScheme, - pubkey: item.pubkey, - authSig: item.authSig, - nodeSet: item.nodeSet, - epoch: item.epoch, - authMethods: item.authMethods, - }; - - return unencrypted; - }); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts deleted file mode 100644 index 7be045b3e8..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { SigningSchemeSchema } from '@lit-protocol/constants'; -import { z } from 'zod'; -import { GenericResultSchemaBuilder } from '@lit-protocol/schemas'; - -// Define the schema for the EcdsaSignedMessageShare object -const EcdsaSignedMessageShareDataSchema = z.object({ - digest: z.string(), - result: z.string(), // Or z.literal('success') if it's always "success" - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - big_r: z.string(), - compressed_public_key: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -// Define the schema for the FrostSignedMessageShare object -const FrostSignedMessageShareDataSchema = z.object({ - message: z.string(), - result: z.string(), // Or z.literal('success') - share_id: z.string(), - peer_id: z.string(), - signature_share: z.string(), - signing_commitments: z.string(), - verifying_share: z.string(), - public_key: z.string(), - sig_type: SigningSchemeSchema, // Using the imported enum -}); - -export const PKPSignEncryptedPayloadSchema = z.object({}); - -export const PKPSignResponseDataSchema = GenericResultSchemaBuilder( - z.object({ - success: z.boolean(), - signedData: z.array(z.number()), - signatureShare: z.union([ - z.object({ - EcdsaSignedMessageShare: EcdsaSignedMessageShareDataSchema, - }), - z.object({ - FrostSignedMessageShare: FrostSignedMessageShareDataSchema, - }), - // Add other potential share types here if they exist - // For example: z.object({ SomeOtherShareType: SomeOtherShareSchema }) - ]), - }) -); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts deleted file mode 100644 index be123802a6..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { z } from 'zod'; - -export const SignSessionKeyResponseDataSchema = z.object({ - success: z.boolean(), - values: z.array( - z.object({ - result: z.string(), - signatureShare: z.object({ - ProofOfPossession: z.object({ - identifier: z.string(), - value: z.string(), - }), - }), - shareId: z.string(), - curveType: z.string(), - siweMessage: z.string(), - dataSigned: z.string(), - blsRootPubkey: z.string(), - }) - ), -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/types.ts b/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/types.ts deleted file mode 100644 index e9e8138264..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/api-manager/types.ts +++ /dev/null @@ -1,213 +0,0 @@ -import { - // BlsSigType - EcdsaSigType, - FrostSigType, -} from '@lit-protocol/constants'; -import { Hex } from '@lit-protocol/types'; - -// See src/p2p_comms/web/models.rs > BlsSignedMessageShare -// Example output: -// "BlsSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "share_id": "\"19a7c43a2b7bbedcea0a40ab17fe0f4a1acf31bdecb9ebeb96c1d3a62e4885f0\"", -// "signature_share": "{\"ProofOfPossession\":{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24\"}}", -// "verifying_share": "{\"identifier\":\"f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719\",\"value\":\"911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b\"}", -// "public_key": "\"8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d\"", -// "sig_type": "Bls12381G1ProofOfPossession" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -// export interface BlsSignedMessageShareRaw { -// message: string; -// peer_id: string; -// public_key: string; -// result: string; -// share_id: string; -// sig_type: string; -// signature_share: string; -// verifying_share: string; -// } - -// See src/p2p_comms/web/models.rs > EcdsaSignedMessageShare -// Example output: -// "EcdsaSignedMessageShare": { -// "digest": "74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", -// "result": "success", -// "share_id": "\"989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1\"", -// "peer_id": "5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", -// "signature_share": "\"4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B\"", -// "big_r": "\"037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356\"", -// "compressed_public_key": "\"021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce\"", -// "public_key": "\"041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80\"", -// "sig_type": "EcdsaK256Sha256" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface EcdsaSignedMessageShareRaw { - big_r: string; - compressed_public_key: string; - digest: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; -} - -// See src/p2p_comms/web/models.rs > FrostSignedMessageShare -// Example output: -// "FrostSignedMessageShare": { -// "message": "0102030405", -// "result": "success", -// "share_id": "[\"Ed25519Sha512\",[120,2,187,138,101,21,192,99,172,206,182,184,45,83,216,198,184,93,183,55,83,34,185,90,150,221,88,228,91,232,123,2]]", -// "peer_id": "6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", -// "signature_share": "[\"Ed25519Sha512\",\"c5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b\"]", -// "signing_commitments": "[\"Ed25519Sha512\",\"00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f\"]", -// "verifying_share": "[\"Ed25519Sha512\",\"8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842\"]", -// "public_key": "[\"Ed25519Sha512\",\"87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4\"]", -// "sig_type": "SchnorrEd25519Sha512" -// } -// Notice how some values are double quoted, and some are not. We need to clean this up. -export interface FrostSignedMessageShareRaw { - message: string; - peer_id: string; - public_key: string; - result: string; - share_id: string; - sig_type: string; - signature_share: string; - signing_commitments: string; - verifying_share: string; -} - -type SignatureShare = - // | { - // BlsSignedMessageShare: BlsSignedMessageShareRaw; - // } - | { - EcdsaSignedMessageShare: EcdsaSignedMessageShareRaw; - } - | { - FrostSignedMessageShare: FrostSignedMessageShareRaw; - }; - -/** - * This is what the /web/pkp/sign endpoint returns - */ -export interface PKPSignEndpointResponse { - success: boolean; - signedData: number[]; // Convertible to Uint8Array - signatureShare: SignatureShare; -} - -export interface LitActionClaimData { - signature: string; - derivedKeyId: string; -} - -export interface LitActionSignedData { - publicKey: string; - signatureShare: string; // JSON.stringify(SignatureShare) - sigName: string; - sigType: EcdsaSigType; -} - -/** - * This is what the /web/execute/v2 endpoint returns - */ -export interface ExecuteJsValueResponse { - claimData: Record; - decryptedData: any; // TODO check - logs: string; - response: string; - signedData: Record; - success: boolean; -} - -/** - * This is the cleaned up version of the BlsSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "shareId": Uint8Array(...), - * "signatureShare": "{ProofOfPossession:{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:8a56ee7b1f7c1eb93e1ccfa2ec02c0f344dcbb66d3cb0742ceaad2aa655da431575b70635db1aa6208061ebdc64442e108c6ae49eb996d72f590ac99d4edda180cb4ef4610bf58b00f75910fda6670bd58eb9b4397f38c8ea5886d9914cb2d24}}", - * "verifyingShare": "{identifier:f085482ea6d3c196ebebb9ecbd31cf1a4a0ffe17ab400aeadcbe7b2b3ac4a719,value:911725a46083ac660d283be18965f2fc3c3f817272b8499c4b46477e868a2d515d670f4fb89cb837bc1cd0dc7c00655b}", - * "publicKey": "0x8fb7104e7fcfae43b77646d6ade34b116c7a69aa53cba75167e267fff36150727dd1064ca477b6cd763f8382c737a35d", - * "sigType": "Bls12381G1ProofOfPossession", - * "dataSigned": "0x0102030405" - * } - */ -// export interface BlsSignedMessageShareParsed { -// dataSigned: Hex; -// message: Hex; -// peerId: Hex; -// publicKey: Hex; -// shareId: Uint8Array; -// signatureShare: Hex; -// signingCommitments: Hex; -// sigType: BlsSigType; -// verifyingShare: Hex; -// } - -/** - * This is the cleaned up version of the EcdsaSignedMessageShareRaw - * - * @example - * { - * "digest": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0", - * "shareId": "0x989DD924B8821903330AC0801F99EB27E3E5235EE299B2A06A611780EC0C7AE1", - * "peerId": "0x5d6549a90c835b672953dec25b20f278de72b5a47019c74a2e4e8207e01b684a", - * "signatureShare": "0x4A862E429D8D45F693261D7A7A2003D628C172A3562F8546CD6A4E77B1C3471B", - * "bigR": "0x037AAA9E30F118821CE3831B8218BF6DD0B61AB9B12D64980201E8B396C8168356", - * "compressedPublicKey": "0x021b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce", - * "publicKey": "0x041b11247309045cfa640cae5f75acae6b5b4e79f4990719569fcddbd026918fce13c041bb974c7ba06c78a4454babde69ddf30972ceccde8c9707f997be24cc80", - * "sigType": "EcdsaK256Sha256", - * "dataSigned": "0x74f81fe167d99b4cb41d6d0ccda82278caee9f3e2f25d5e5a3936ff3dcec60d0" - * } - */ -export interface EcdsaSignedMessageShareParsed { - bigR: Hex; - compressedPublicKey: Hex; - dataSigned: Hex; - digest: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Hex; - signatureShare: Hex; - sigType: EcdsaSigType; -} - -/** - * This is the cleaned up version of the FrostSignedMessageShareRaw - * - * @example - * { - * "message": "0x0102030405", - * "shareId": Uint8Array(...), - * "peerId": "0x6555c8c26671f5e21611adba0a3c31b28128443f2d76c2818db169efcff38151", - * "signatureShare": "0xc5903ed6a791874dbb17dc5971a8fc1ce46aee0c1f0fa1decf496eae1a87d10b", - * "signingCommitments": "0x00b169f0da1b70b3886efed232a7965609b5bf485d8d2bc5c2aa529f63f9493ce6de97543247f4730e1fef2e4991d2579ab4b100b72a476c3e77ac6c7808df3e975eba913f", - * "verifyingShare": "0x8f548f118988ef7b27789b60b627df91a50b9c8c522d9a628d89417fc8219842", - * "publicKey": "0x87a64cc4fd848d173619bf5c4af16fd14920e8e3d04b3af03091a707e16f85d4", - * "sigType": "SchnorrEd25519Sha512", - * "dataSigned": "0x0102030405" - * } - */ -export interface FrostSignedMessageShareParsed { - dataSigned: Hex; - message: Hex; - peerId: Hex; - publicKey: Hex; - shareId: Uint8Array; - signatureShare: Hex; - signingCommitments: Hex; - sigType: FrostSigType; - verifyingShare: Hex; -} - -export type PKPSignEndpointSharesParsed = - // | BlsSignedMessageShareParsed - EcdsaSignedMessageShareParsed | FrostSignedMessageShareParsed; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.spec.ts deleted file mode 100644 index 697df53451..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.spec.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createChainManager } from './createChainManager'; -import { privateKeyToAccount } from 'viem/accounts'; - -describe('createChainManager', () => { - it('should create a chain manager', () => { - const viemAccount = privateKeyToAccount( - process.env['PRIVATE_KEY']! as `0x${string}` - ); - - const chainManager = createChainManager(viemAccount); - - console.log(chainManager); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.ts b/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.ts index 434cb1c2b5..7335f8bd8b 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-test/chain-manager/createChainManager.ts @@ -1,156 +1,22 @@ -import { privateKeyToAccount } from 'viem/accounts'; -import { api } from '../../../LitChainClient'; -import { getPKPsByAddress } from '../../../LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress'; -import { PkpIdentifierRaw } from '../../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { ExpectedAccountOrWalletClient } from '../../../LitChainClient/contract-manager/createContractsManager'; -import { DefaultNetworkConfig } from '../../../interfaces/NetworkContext'; -import { networkConfig } from '../naga-test.config'; -import type { PKPStorageProvider } from '../../../../../storage/types'; -import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; +import type { ExpectedAccountOrWalletClient } from '../../../shared/managers/contract-manager/createContractsManager'; +import { + createChainManagerFactory, + createReadOnlyChainManagerFactory, + CreateChainManagerReturn, +} from '../../../shared/factories/BaseChainManagerFactory'; +import { nagaTestEnvironment } from '../naga-test.env'; -export type CreateChainManagerReturn = { - api: { - mintWithEoa: ( - req?: Parameters[0] - ) => ReturnType; - mintPKP: ( - req: Parameters[0] - ) => ReturnType; - mintWithMultiAuths: ( - req: Parameters[0] - ) => ReturnType; - pkpPermissionsManager: ( - pkpIdentifier: PkpIdentifierRaw - ) => InstanceType; - paymentManager: () => InstanceType; - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => ReturnType; - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => ReturnType; - pricing: { - getPriceFeedInfo: ( - req: Parameters[0] - ) => ReturnType; - getNodePrices: ( - req: Parameters[0] - ) => ReturnType; - }; - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }) => ReturnType; - }; - }; -}; +export type { CreateChainManagerReturn }; export const createChainManager = ( accountOrWalletClient: ExpectedAccountOrWalletClient ): CreateChainManagerReturn => { - // TODO: This ideally should set to NagaLocalNetworkContext. - const _networkConfig = networkConfig as unknown as DefaultNetworkConfig; - - // Helper to bind the network context to an API function - const bindContext = ( - fn: ( - req: ReqArgType, - ctx: DefaultNetworkConfig, - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => RetType - ) => { - return (req: ReqArgType): RetType => - fn(req, _networkConfig, accountOrWalletClient); - }; - - return { - api: { - mintWithEoa: bindContext(api.mintWithEoa), - mintPKP: bindContext(api.mintPKP), - mintWithMultiAuths: bindContext(api.mintWithMultiAuths), - pkpPermissionsManager: (pkpIdentifier: PkpIdentifierRaw) => { - return new api.PKPPermissionsManager( - pkpIdentifier, - _networkConfig, - accountOrWalletClient - ); - }, - paymentManager: () => { - return new api.PaymentManager(_networkConfig, accountOrWalletClient); - }, - getPKPsByAuthData: ( - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }, - pagination?: { limit?: number; offset?: number }, - storageProvider?: PKPStorageProvider - ) => { - return api.PKPPermissionsManager.getPKPsByAuthData( - authData, - pagination, - storageProvider, - _networkConfig, - accountOrWalletClient - ); - }, - getPKPsByAddress: (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - }) => { - // Provide default pagination if not provided - const defaultPagination = { limit: 10, offset: 0 }; - const finalPagination = params.pagination - ? { - limit: params.pagination.limit ?? defaultPagination.limit, - offset: params.pagination.offset ?? defaultPagination.offset, - } - : defaultPagination; - - return getPKPsByAddress( - { - ownerAddress: params.ownerAddress, - pagination: finalPagination, - storageProvider: params.storageProvider, - }, - _networkConfig, - accountOrWalletClient - ); - }, - pricing: { - getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo), - getNodePrices: bindContext(api.pricing.getNodePrices), - }, - connection: { - getConnectionInfo: (args?: { - nodeProtocol?: string | null; - }): ReturnType => { - return api.connection.getConnectionInfo({ - networkCtx: _networkConfig, - accountOrWalletClient: accountOrWalletClient, - nodeProtocol: args?.nodeProtocol, - }); - }, - }, - }, - }; -}; - -export const createReadOnlyChainManager = () => { - // dummy private key for read actions - const dummyAccount = privateKeyToAccount( - DEV_PRIVATE_KEY + return createChainManagerFactory( + nagaTestEnvironment.getConfig(), + accountOrWalletClient ); - const chainManager = createChainManager(dummyAccount); - return createChainManager(chainManager); }; + +export const createReadOnlyChainManager = createReadOnlyChainManagerFactory( + nagaTestEnvironment.getConfig() +); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.cjs b/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.cjs deleted file mode 100644 index efc3be044f..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.cjs +++ /dev/null @@ -1,2760 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; - -module.exports = { - signatures, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.js b/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.js deleted file mode 100644 index 12295e2727..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.js +++ /dev/null @@ -1,2756 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.ts b/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.ts deleted file mode 100644 index acac87aa1d..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/generated/naga-develop.ts +++ /dev/null @@ -1,2757 +0,0 @@ -/** - * Generated Contract Method Signatures for naga-develop - * This file is auto-generated. DO NOT EDIT UNLESS YOU KNOW WHAT YOU'RE DOING. - */ - -export const signatures = { - PKPHelper: { - address: '0x04C89607413713Ec9775E14b954286519d836FEf', - methods: { - claimAndMintNextAndAddAuthMethodsWithTypes: { - 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', - }, - mintNextAndAddAuthMethods: { - 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', - }, - }, - events: [ - { - 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', - }, - ], - }, - PKPNFT: { - address: '0x99bbA657f2BbC93c02D617f8bA121cB8Fc104Acf', - methods: { - claimAndMint: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: 'address', - name: 'stakingContractAddress', - type: 'address', - }, - ], - name: 'claimAndMint', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - mintCost: { - inputs: [], - name: 'mintCost', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - mintNext: { - inputs: [ - { - internalType: 'uint256', - name: 'keyType', - type: 'uint256', - }, - ], - name: 'mintNext', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'payable', - type: 'function', - }, - safeTransferFrom: { - 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', - }, - tokenOfOwnerByIndex: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: '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: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - ], - name: 'Withdrew', - type: 'event', - }, - ], - }, - PKPPermissions: { - address: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', - methods: { - addPermittedAction: { - 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', - }, - addPermittedAddress: { - 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', - }, - addPermittedAuthMethodScope: { - 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', - }, - getPermittedActions: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedActions', - outputs: [ - { - internalType: 'bytes[]', - name: '', - type: 'bytes[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAddresses: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPermittedAddresses', - outputs: [ - { - internalType: 'address[]', - name: '', - type: 'address[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPermittedAuthMethodScopes: { - 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', - }, - getPermittedAuthMethods: { - 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', - }, - getTokenIdsForAuthMethod: { - 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', - }, - isPermittedAction: { - 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', - }, - isPermittedAddress: { - 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', - }, - removePermittedAction: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'bytes', - name: 'ipfsCID', - type: 'bytes', - }, - ], - name: 'removePermittedAction', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - { - internalType: 'address', - name: 'user', - type: 'address', - }, - ], - name: 'removePermittedAddress', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - removePermittedAuthMethod: { - 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', - }, - }, - events: [ - { - 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', - }, - { - 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: 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - PubkeyRouter: { - address: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', - methods: { - getEthAddress: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getEthAddress', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - getPubkey: { - inputs: [ - { - internalType: 'uint256', - name: 'tokenId', - type: 'uint256', - }, - ], - name: 'getPubkey', - outputs: [ - { - internalType: 'bytes', - name: '', - type: 'bytes', - }, - ], - stateMutability: 'view', - type: 'function', - }, - deriveEthAddressFromPubkey: { - inputs: [ - { - internalType: 'bytes', - name: 'pubkey', - type: 'bytes', - }, - ], - name: 'deriveEthAddressFromPubkey', - outputs: [ - { - internalType: 'address', - name: '', - type: 'address', - }, - ], - stateMutability: 'pure', - type: 'function', - }, - ethAddressToPkpId: { - inputs: [ - { - internalType: 'address', - name: 'ethAddress', - type: 'address', - }, - ], - name: 'ethAddressToPkpId', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverAddress', - type: 'address', - }, - ], - name: 'ContractResolverAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - ], - name: 'ToggleEvent', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - ], - }, - Staking: { - address: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', - methods: { - getActiveUnkickedValidatorStructsAndCounts: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - ], - name: 'getActiveUnkickedValidatorStructsAndCounts', - outputs: [ - { - components: [ - { - internalType: 'uint256', - name: 'epochLength', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'number', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'rewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'nextRewardEpochNumber', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'endTime', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'retries', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'timeout', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'startTime', - type: 'uint256', - }, - ], - internalType: 'struct LibStakingStorage.Epoch', - name: '', - type: 'tuple', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'ClearOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'dataType', - type: 'uint256', - }, - ], - name: 'CountOfflinePhaseData', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newDevopsAdmin', - type: 'address', - }, - ], - name: 'DevopsAdminSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochEndTime', - type: 'uint256', - }, - ], - name: 'EpochEndTimeSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newEpochLength', - type: 'uint256', - }, - ], - name: 'EpochLengthSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - 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: false, - internalType: 'address', - name: 'newResolverContractAddress', - type: 'address', - }, - ], - name: 'ResolverContractAddressSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'amount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'address', - name: 'stakerAddressClient', - type: 'address', - }, - ], - name: 'StakeRecordCreated', - 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: 'enum LibStakingStorage.States', - name: 'newState', - type: 'uint8', - }, - ], - name: 'StateChanged', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorBanned', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorKickedFromNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'staker', - type: 'address', - }, - ], - name: 'ValidatorRejoinedNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'FixedCostRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'userStakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordRemoved', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - ], - name: 'StakeRecordUpdated', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'recordId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'StakeRewardsClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'rewards', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'fromEpoch', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'toEpoch', - type: 'uint256', - }, - ], - name: 'ValidatorCommissionClaimed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakerAddress', - type: 'address', - }, - ], - name: 'ValidatorRegistered', - 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', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'epochNumber', - type: 'uint256', - }, - ], - name: 'AdvancedEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'staker', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'attestedAddress', - type: 'address', - }, - { - components: [ - { - internalType: 'uint256', - name: 'x', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'y', - type: 'uint256', - }, - ], - indexed: true, - internalType: 'struct LibStakingStorage.UncompressedK256Key', - name: 'attestedPubKey', - type: 'tuple', - }, - ], - name: 'AttestedWalletRegistered', - type: 'event', - }, - { - 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', - }, - { - internalType: 'uint256', - name: 'kickPenaltyDemerits', - 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: 'newMaxPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMinPresignCount', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newPeerCheckingIntervalSecs', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'newMaxPresignConcurrency', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bool', - name: 'newRpcHealthcheckEnabled', - type: 'bool', - }, - ], - name: 'ConfigSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'message', - type: 'string', - }, - { - indexed: false, - internalType: 'address', - name: 'sender', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'value', - type: 'uint256', - }, - ], - name: 'DebugEvent', - 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: '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: true, - internalType: 'address', - name: 'reporter', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'validatorToKickStakerAddress', - type: 'address', - }, - { - indexed: true, - internalType: 'uint256', - name: 'reason', - type: 'uint256', - }, - { - indexed: false, - internalType: 'bytes', - name: 'data', - type: 'bytes', - }, - ], - name: 'VotedToKickValidatorInNextEpoch', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'index', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'realmId', - 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', - }, - ], - }, - PriceFeed: { - address: '0xf953b3A269d80e3eB0F2947630Da976B896A8C5b', - methods: { - getNodesForRequest: { - inputs: [ - { - internalType: 'uint256', - name: 'realmId', - type: 'uint256', - }, - { - internalType: 'uint256[]', - name: 'productIds', - type: 'uint256[]', - }, - ], - name: 'getNodesForRequest', - outputs: [ - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '', - type: 'uint256', - }, - { - components: [ - { - 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: 'uint256', - name: 'lastActiveEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'commissionRate', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpoch', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRealmId', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeAmount', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'delegatedStakeWeight', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedFixedCostRewards', - type: 'uint256', - }, - { - internalType: 'uint256', - name: 'lastRewardEpochClaimedCommission', - type: 'uint256', - }, - { - internalType: 'address', - name: 'operatorAddress', - type: 'address', - }, - { - internalType: 'uint256', - name: 'uniqueDelegatingStakerCount', - type: 'uint256', - }, - { - internalType: 'bool', - name: 'registerAttestedWalletDisabled', - type: 'bool', - }, - ], - internalType: 'struct LibStakingStorage.Validator', - name: 'validator', - type: 'tuple', - }, - { - internalType: 'uint256[]', - name: 'prices', - type: 'uint256[]', - }, - ], - internalType: 'struct LibPriceFeedStorage.NodeInfoAndPrices[]', - name: '', - type: 'tuple[]', - }, - ], - stateMutability: 'view', - type: 'function', - }, - }, - events: [ - { - 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', - }, - { - 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: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'BaseNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'uint256', - name: 'newPrice', - type: 'uint256', - }, - ], - name: 'MaxNetworkPriceSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'address', - name: 'newTrustedForwarder', - type: 'address', - }, - ], - name: 'TrustedForwarderSet', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'stakingAddress', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'usagePercent', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256[]', - name: 'newPrices', - type: 'uint256[]', - }, - ], - name: 'UsageSet', - type: 'event', - }, - ], - }, -} as const; -export type Signatures = typeof signatures; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/index.ts b/packages/networks/src/networks/vNaga/envs/naga-test/index.ts index 742cacb279..b8e50a9a7f 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-test/index.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-test/index.ts @@ -1,3 +1 @@ -import { nagaTestModule } from './naga-test.module'; - -export const nagaTest = nagaTestModule; +export { nagaTest } from './naga-test.module'; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.config.ts b/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.config.ts deleted file mode 100644 index cb1eabf851..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { nagaTestSignatures } from '@lit-protocol/contracts'; -import * as chainInfo from '../../../../chains/ChronicleYellowstone'; -import { NAGA_ENDPOINT } from '../../endpoints-manager/endpoints'; -import { INetworkConfig } from '../../interfaces/NetworkContext'; - -const NETWORK = 'naga-test'; -const PROTOCOL = 'https://'; -const MINIMUM_THRESHOLD = 3; - -/** - * TODO: This is a temporary default realm id. There's are two abis functions called 'getAllReservedValidators' and 'numRealms' in the latest lit-assets branch. We need to call that to see how many realms there are. If there's only one realm, then we can use that as the default realm id. Otherwise, we will randomly choose one. - */ -const DEFAULT_REALM_ID = 1n; - -export interface NagaTestSpecificConfigs { - realmId?: bigint; - // privateKey?: Hex; -} - -export type NagaTestSignatures = typeof nagaTestSignatures; - -export const networkConfig: INetworkConfig< - NagaTestSignatures, - NagaTestSpecificConfigs -> = { - minimumThreshold: MINIMUM_THRESHOLD, - network: NETWORK, - rpcUrl: chainInfo.RPC_URL, - abiSignatures: nagaTestSignatures, - chainConfig: chainInfo.viemChainConfig, - httpProtocol: PROTOCOL, - networkSpecificConfigs: { - realmId: DEFAULT_REALM_ID, - }, - endpoints: NAGA_ENDPOINT, - services: { - authServiceBaseUrl: 'https://naga-test-auth-service.onrender.com', - loginServiceBaseUrl: 'https://login.litgateway.com', - }, -}; - -export type NagaTestNetworkConfig = typeof networkConfig; - -// network object calls the chain client -// LitClient could use the network to figure out diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.env.ts b/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.env.ts new file mode 100644 index 0000000000..d34fb0bdfb --- /dev/null +++ b/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.env.ts @@ -0,0 +1,58 @@ +import { nagaTestSignatures } from '@lit-protocol/contracts'; +import { Chain } from 'viem'; +import * as chainInfo from '../../../../chains/ChronicleYellowstone'; +import { NAGA_ENDPOINT } from '../../shared/managers/endpoints-manager/endpoints'; +import type { NagaEndpointsType } from '../../shared/managers/endpoints-manager/endpoints'; +import { BaseNetworkEnvironment } from '../base/BaseNetworkEnvironment'; + +const NETWORK = 'naga-test'; +const PROTOCOL = 'https://'; +const MINIMUM_THRESHOLD = 3; +const DEFAULT_REALM_ID = 1n; + +export interface NagaTestSpecificConfigs { + realmId?: bigint; +} + +export type NagaTestSignatures = typeof nagaTestSignatures; + +export class NagaTestEnvironment extends BaseNetworkEnvironment< + NagaTestSignatures, + NagaTestSpecificConfigs +> { + constructor() { + super({ + network: NETWORK, + abiSignatures: nagaTestSignatures, + networkSpecificConfigs: { + realmId: DEFAULT_REALM_ID, + }, + services: { + authServiceBaseUrl: 'https://naga-auth-service.getlit.dev', + loginServiceBaseUrl: 'https://login.litgateway.com', + }, + minimumThreshold: MINIMUM_THRESHOLD, + httpProtocol: PROTOCOL, + requiredAttestation: true, + }); + } + + protected getRpcUrl(): string { + return chainInfo.RPC_URL; + } + + protected getChainConfig(): Chain { + return chainInfo.viemChainConfig; + } + + protected getEndpoints(): NagaEndpointsType { + return NAGA_ENDPOINT; + } + + protected getDefaultRealmId(): bigint { + return DEFAULT_REALM_ID; + } +} + +// Create singleton instance +export const nagaTestEnvironment = new NagaTestEnvironment(); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.module.ts b/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.module.ts index a4a1072c2e..1d46268255 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.module.ts +++ b/packages/networks/src/networks/vNaga/envs/naga-test/naga-test.module.ts @@ -1,1372 +1,14 @@ -import { DEV_PRIVATE_KEY, version } from '@lit-protocol/constants'; -import { verifyAndDecryptWithSignatureShares } from '@lit-protocol/crypto'; -import { - AuthData, - EncryptedVersion1Schema, - GenericEncryptedPayloadSchema, - GenericResultBuilder, - HexPrefixedSchema, - JsonSignCustomSessionKeyRequestForPkpReturnSchema, - JsonSignSessionKeyRequestForPkpReturnSchema, -} from '@lit-protocol/schemas'; -import { Hex, hexToBytes, stringToBytes } from 'viem'; - -import { z } from 'zod'; -import { LitNetworkModuleBase } from '../../../types'; -import type { ExpectedAccountOrWalletClient } from '../../LitChainClient/contract-manager/createContractsManager'; -import { networkConfig } from './naga-test.config'; -import { PricingContextSchema } from './pricing-manager/PricingContextSchema'; -import { issueSessionFromContext } from './session-manager/issueSessionFromContext'; -import { createStateManager } from './state-manager/createStateManager'; - -// Import the necessary types for the explicit return type annotation -import { NetworkError } from '@lit-protocol/constants'; -import { - combineSignatureShares, - mostCommonString, - normalizeAndStringify, - ReleaseVerificationConfig, -} from '@lit-protocol/crypto'; -import { getChildLogger } from '@lit-protocol/logger'; -import { nacl } from '@lit-protocol/nacl'; -import { - AuthMethod, - AuthSig, - CallbackParams, - KeySet, - LitActionResponseStrategy, - NagaJitContext, - NodeAttestation, - Optional, - OrchestrateHandshakeResponse, - RequestItem, -} from '@lit-protocol/types'; -import { ethers } from 'ethers'; -import { computeAddress } from 'ethers/lib/utils'; -import type { PKPStorageProvider } from '../../../../storage/types'; -import { createRequestId } from '../../../shared/helpers/createRequestId'; -import { handleAuthServerRequest } from '../../../shared/helpers/handleAuthServerRequest'; -import { composeLitUrl } from '../../endpoints-manager/composeLitUrl'; -import { - getNodePrices, - PKPPermissionsManager, -} from '../../LitChainClient/apis/highLevelApis'; -import { PaymentManager } from '../../LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager'; -import { MintWithMultiAuthsRequest } from '../../LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths'; -import { PkpIdentifierRaw } from '../../LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; -import type { GenericTxRes, LitTxRes } from '../../LitChainClient/apis/types'; -import type { PKPData } from '../../LitChainClient/schemas/shared/PKPDataSchema'; -import { ConnectionInfo } from '../../LitChainClient/types'; -import { DecryptCreateRequestParams } from './api-manager/decrypt/decrypt.CreateRequestParams'; -import { DecryptInputSchema } from './api-manager/decrypt/decrypt.InputSchema'; -import { DecryptRequestDataSchema } from './api-manager/decrypt/decrypt.RequestDataSchema'; -import { DecryptResponseDataSchema } from './api-manager/decrypt/decrypt.ResponseDataSchema'; -import { E2EERequestManager } from './api-manager/e2ee-request-manager/E2EERequestManager'; -import { handleResponse as handleExecuteJsResponse } from './api-manager/executeJs'; -import { ExecuteJsCreateRequestParams } from './api-manager/executeJs/executeJs.CreateRequestParams'; -import { ExecuteJsInputSchema } from './api-manager/executeJs/executeJs.InputSchema'; -import { ExecuteJsRequestDataSchema } from './api-manager/executeJs/executeJs.RequestDataSchema'; -import { ExecuteJsResponseDataSchema } from './api-manager/executeJs/executeJs.ResponseDataSchema'; -import { RawHandshakeResponseSchema } from './api-manager/handshake/handshake.schema'; -import { combinePKPSignSignatures } from './api-manager/helper/get-signatures'; -import { PKPSignCreateRequestParams } from './api-manager/pkpSign/pkpSign.CreateRequestParams'; -import { - BitCoinPKPSignInputSchema, - EthereumPKPSignInputSchema, - PKPSignInputSchema, -} from './api-manager/pkpSign/pkpSign.InputSchema'; -import { PKPSignRequestDataSchema } from './api-manager/pkpSign/pkpSign.RequestDataSchema'; -import { PKPSignResponseDataSchema } from './api-manager/pkpSign/pkpSign.ResponseDataSchema'; -import { - createChainManager, - CreateChainManagerReturn, -} from './chain-manager/createChainManager'; -import { getMaxPricesForNodeProduct } from './pricing-manager/getMaxPricesForNodeProduct'; -import { getUserMaxPrice } from './pricing-manager/getUserMaxPrice'; -import { privateKeyToAccount } from 'viem/accounts'; - -const MODULE_NAME = 'naga-test'; - -const _logger = getChildLogger({ - module: `${MODULE_NAME}-module`, +import { createBaseModule } from '../../shared/factories/BaseModuleFactory'; +import { createChainManager } from './chain-manager/createChainManager'; +import { nagaTestEnvironment } from './naga-test.env'; +import type { ExpectedAccountOrWalletClient } from '../../shared/managers/contract-manager/createContractsManager'; + +const nagaTest = createBaseModule({ + networkConfig: nagaTestEnvironment.getConfig(), + moduleName: nagaTestEnvironment.getNetworkName(), + createChainManager: (account: ExpectedAccountOrWalletClient) => + createChainManager(account), }); -// Release verification types and constants -interface ReleaseInfo { - status: number; - env: number; - typ: number; - platform: number; - options: { asU32: () => number }; - publicKey: Uint8Array; - idKeyDigest: Uint8Array; -} - -enum ReleaseStatus { - Null = 0, - Active = 1, - Inactive = 2, -} - -// Basic Release Register Contract ABI - only the functions we need -const RELEASE_REGISTER_ABI = [ - { - inputs: [], - name: 'RELEASE_REGISTER_CONTRACT', - outputs: [ - { - internalType: 'bytes32', - name: '', - type: 'bytes32', - }, - ], - stateMutability: 'view', - type: 'function', - }, -]; - -/** - * Extract release ID from attestation data - * @param attestation The node attestation containing release ID - * @returns The release ID string - */ -function extractReleaseId(attestation: NodeAttestation): string { - const releaseId = attestation.data.RELEASE_ID; - if (!releaseId) { - throw new NetworkError( - { info: { attestation } }, - 'Missing RELEASE_ID in attestation data' - ); - } - return Buffer.from(releaseId, 'base64').toString('utf8'); -} - -/** - * Extract subnet ID from release ID - * Based on the Rust implementation: subnet_id_from_release_id - * @param releaseId The release ID string - * @returns The subnet ID - */ -function getSubnetIdFromReleaseId(releaseId: string): string { - // In the Rust code, this extracts the subnet ID from the release ID - // For now, this is a simplified version - you may need to adjust based on actual format - const parts = releaseId.split('-'); - if (parts.length < 2) { - throw new NetworkError( - { info: { releaseId } }, - 'Invalid release ID format' - ); - } - return parts[0]; // First part is typically the subnet ID -} - -/** - * Pad release ID to 32 bytes for contract call - * @param releaseId The release ID string - * @returns Padded bytes32 for contract call - */ -function padReleaseIdToBytes32(releaseId: string): string { - const releaseIdBuffer = Buffer.from(releaseId, 'utf8'); - if (releaseIdBuffer.length > 32) { - throw new NetworkError( - { info: { releaseId } }, - 'Release ID too long for bytes32' - ); - } - const paddedBuffer = Buffer.alloc(32); - releaseIdBuffer.copy(paddedBuffer); - return ethers.utils.hexlify(paddedBuffer); -} - -/** - * Verify release ID against the on-chain release register contract - * This function is provided to the crypto package for dependency injection - * @param attestation The node attestation - * @param config Configuration for release verification - */ -const verifyReleaseId = async ( - attestation: NodeAttestation, - config: ReleaseVerificationConfig -): Promise => { - _logger.info('verifyReleaseId: Starting release verification', { - subnetId: config.subnetId, - environment: config.environment, - }); - - // 1. Extract release ID from attestation - const releaseId = extractReleaseId(attestation); - - // 2. Verify release ID length - if (releaseId.length !== 64) { - // RELEASE_ID_STR_LEN from Rust code - throw new NetworkError( - { - info: { releaseId, expectedLength: 64, actualLength: releaseId.length }, - }, - `Release ID length is incorrect: expected 64, got ${releaseId.length}` - ); - } - - // 3. Extract and verify subnet ID - const releaseSubnetId = getSubnetIdFromReleaseId(releaseId); - if (releaseSubnetId !== config.subnetId) { - throw new NetworkError( - { info: { releaseSubnetId, expectedSubnetId: config.subnetId } }, - `Subnet ID mismatch: expected ${config.subnetId}, got ${releaseSubnetId}` - ); - } - - // 4. Query the release register contract - const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl); - const contract = new ethers.Contract( - config.releaseRegisterContractAddress, - RELEASE_REGISTER_ABI, - provider - ); - - const releaseIdPadded = padReleaseIdToBytes32(releaseId); - - try { - const release = await contract['getReleaseByIdAndSubnetId']( - config.subnetId, - releaseIdPadded - ); - - // 5. Verify release status is active - if (release.status !== ReleaseStatus.Active) { - throw new NetworkError( - { info: { releaseId, status: release.status } }, - `Release is not active: status ${release.status}` - ); - } - - // 6. Verify environment matches - if (release.env !== config.environment) { - throw new NetworkError( - { - info: { - releaseId, - releaseEnv: release.env, - expectedEnv: config.environment, - }, - }, - `Environment mismatch: expected ${config.environment}, got ${release.env}` - ); - } - - _logger.info('verifyReleaseId: Release verification successful', { - releaseId, - status: release.status, - environment: release.env, - }); - } catch (error: any) { - if (error.code === 'CALL_EXCEPTION') { - throw new NetworkError( - { - info: { - releaseId, - contractAddress: config.releaseRegisterContractAddress, - }, - }, - `Release ID ${releaseId} not found on chain` - ); - } - throw error; - } -}; - -// Store response strategy separately for executeJs requests -let executeJsResponseStrategy: LitActionResponseStrategy | undefined; - -// Store secret keys for PKP sign requests to use in handleResponse -// const globalPkpSignSecretKeys: Record> = {}; -// const globalPkpSignNodeKeys: Record> = {}; - -// Define ProcessedBatchResult type (mirroring structure from dispatchRequests) -type ProcessedBatchResult = - | { success: true; values: T[] } - | { success: false; error: any; failedNodeUrls?: string[] }; - -// Define the object first -const networkModuleObject = { - id: 'naga', - version: `${version}-naga-test`, - config: { - requiredAttestation: true, - abortTimeout: 20_000, - minimumThreshold: networkConfig.minimumThreshold, - httpProtocol: networkConfig.httpProtocol, - }, - schemas: { - GenericResponseSchema: GenericResultBuilder, - }, - getNetworkName: () => networkConfig.network, - getHttpProtocol: () => networkConfig.httpProtocol, - getEndpoints: () => networkConfig.endpoints, - getRpcUrl: () => networkConfig.rpcUrl, - getChainConfig: () => networkConfig.chainConfig, - getDefaultAuthServiceBaseUrl: () => networkConfig.services.authServiceBaseUrl, - getDefaultLoginBaseUrl: () => networkConfig.services.loginServiceBaseUrl, - getMinimumThreshold: () => networkConfig.minimumThreshold, - // composeLitUrl: composeLitUrl, - /** - * 🧠 This is the core function that keeps all the network essential information - * up to data, such as: - * - latest blockhash - * - connection info (node urls, epoch, etc.) - it listens for StateChange events - * - orchestrate handshake via callback - */ - createStateManager: async (params: { - callback: (params: CallbackParams) => Promise; - networkModule: M; - }): Promise>>> => { - return await createStateManager({ - networkConfig, - callback: params.callback, - networkModule: params.networkModule as LitNetworkModuleBase, - }); - }, - getMaxPricesForNodeProduct: getMaxPricesForNodeProduct, - getUserMaxPrice: getUserMaxPrice, - getVerifyReleaseId: () => verifyReleaseId, - chainApi: { - getPKPPermissionsManager: async (params: { - pkpIdentifier: PkpIdentifierRaw; - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.pkpPermissionsManager(params.pkpIdentifier); - }, - - /** - * Gets a PaymentManager instance for managing deposits, withdrawals, and balance queries - */ - getPaymentManager: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise => { - const chainManager = createChainManager(params.account); - return chainManager.api.paymentManager(); - }, - - /** - * Gets all PKPs associated with specific authentication data - */ - getPKPsByAuthData: async (params: { - authData: { - authMethodType: number | bigint; - authMethodId: string; - accessToken?: string; - }; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAuthData( - params.authData, - params.pagination, - params.storageProvider - ); - }, - - /** - * Gets all PKPs owned by a specific address - */ - getPKPsByAddress: async (params: { - ownerAddress: string; - pagination?: { limit?: number; offset?: number }; - storageProvider?: PKPStorageProvider; - account: ExpectedAccountOrWalletClient; - }) => { - const chainManager = createChainManager(params.account); - return chainManager.api.getPKPsByAddress({ - ownerAddress: params.ownerAddress, - pagination: params.pagination, - storageProvider: params.storageProvider, - }); - }, - - /** - * Mints a PKP using EOA directly - */ - mintWithEoa: async (params: { - account: ExpectedAccountOrWalletClient; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithEoa(); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - /** - * Mints a PKP using Auth Method - */ - mintWithAuth: async (params: { - account: ExpectedAccountOrWalletClient; - authData: Optional; - scopes: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintPKP({ - scopes: params.scopes, - // authMethod: authMethod, - authMethodId: params.authData.authMethodId, - authMethodType: params.authData.authMethodType, - pubkey: params.authData.publicKey, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - - mintWithMultiAuths: async ( - params: { - account: ExpectedAccountOrWalletClient; - } & MintWithMultiAuthsRequest - ): Promise, PKPData>> => { - const chainManager = createChainManager(params.account); - const res = await chainManager.api.mintWithMultiAuths({ - authMethodIds: params.authMethodIds, - authMethodTypes: params.authMethodTypes, - authMethodScopes: params.authMethodScopes, - pubkeys: params.pubkeys, - addPkpEthAddressAsPermittedAddress: - params.addPkpEthAddressAsPermittedAddress, - sendPkpToItself: params.sendPkpToItself, - }); - return { - _raw: res, - txHash: res.hash, - data: res.data, - }; - }, - }, - authService: { - pkpMint: async (params: { - authData: AuthData; - authServiceBaseUrl?: string; - scopes?: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; - }) => { - return await handleAuthServerRequest({ - jobName: 'PKP Minting', - serverUrl: - params.authServiceBaseUrl || - networkConfig.services.authServiceBaseUrl, - path: '/pkp/mint', - body: { - authMethodType: params.authData.authMethodType, - authMethodId: params.authData.authMethodId, - pubkey: params.authData.publicKey, - scopes: params.scopes, - }, - }); - }, - }, - api: { - /** - * The Lit Client and Network Module exchange data in a request-response cycle: - * - * 1. 🟪 The Network Module constructs the request. - * 2. 🟩 The Lit Client sends it to the Lit Network. - * 3. 🟪 The Network Module processes the response. - * - * In some cases, we need to maintain a piece of state that is relevant to both step 1 (request creation) - * and step 3 (response handling). To support this, we introduce a *network-specific context object* - * that can be passed between the Lit Client and Network Module. - * - * One key example is managing a just-in-time (JIT) state for ephemeral secrets or signing keys - * — such as those used in PKP signing — which must persist across the request lifecycle. - */ - createJitContext: async ( - connectionInfo: ConnectionInfo, - handshakeResult: OrchestrateHandshakeResponse - ): Promise => { - const keySet: KeySet = {}; - - // 1. Generate a key set for the JIT context - for (const url of connectionInfo.bootstrapUrls) { - keySet[url] = { - publicKey: hexToBytes( - HexPrefixedSchema.parse( - handshakeResult.serverKeys[url].nodeIdentityKey - ) as `0x${string}` - ), - secretKey: nacl.box.keyPair().secretKey, - }; - } - - // Use read-only account for viewing PKPs - const account = privateKeyToAccount( - DEV_PRIVATE_KEY - ); - - // 2. Fetch the price feed info - const nodePrices = await getNodePrices( - { - realmId: 1, - networkCtx: networkConfig, - }, - account - ); - - return { keySet, nodePrices }; - }, - handshake: { - schemas: { - Input: { - ResponseData: RawHandshakeResponseSchema, - }, - }, - }, - pkpSign: { - schemas: { - Input: { - raw: PKPSignInputSchema, - ethereum: EthereumPKPSignInputSchema, - bitcoin: BitCoinPKPSignInputSchema, - }, - RequestData: PKPSignRequestDataSchema, - ResponseData: PKPSignResponseDataSchema, - }, - createRequest: async ( - params: PKPSignCreateRequestParams - ): Promise>[]> => { - _logger.info('pkpSign:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('pkpSign:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - - const requests: RequestItem>[] = - []; - - _logger.info('pkpSign:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - // // Reset and store secret keys for this request - // globalPkpSignSecretKeys[_requestId] = {}; - // globalPkpSignNodeKeys[_requestId] = {}; - - for (const url of urls) { - _logger.info('pkpSign:createRequest: Generating request data', { - url, - }); - - const _requestData = PKPSignRequestDataSchema.parse({ - toSign: Array.from(params.signingContext.toSign), - signingScheme: params.signingContext.signingScheme, - pubkey: params.signingContext.pubKey, - authSig: sessionSigs[url], - nodeSet: urls, - - // additional meta to determine hash function, but not - // sent to the node - chain: params.chain, - bypassAutoHashing: params.signingContext.bypassAutoHashing, - epoch: params.connectionInfo.epochState.currentNumber, - }); - - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().PKP_SIGN, - }); - - _logger.info('pkpSign:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'pkpSign:createRequest: No requests generated for pkpSign.' - ); - throw new Error('Failed to generate requests for pkpSign.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'PKP Sign' - ); - } - - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual PKP sign data from the response wrapper - const pkpSignData = decryptedJson.data; - if (!pkpSignData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - wrap in expected format - const wrappedData = { - success: pkpSignData.success, - values: [pkpSignData], // Wrap the individual response in an array - }; - - const responseData = PKPSignResponseDataSchema.parse(wrappedData); - return responseData.values[0]; // Return the individual PKP sign response - } - ); - - const signatures = await combinePKPSignSignatures({ - nodesPkpSignResponseData: decryptedValues, - requestId, - threshold: networkConfig.minimumThreshold, - }); - - return signatures; - }, - }, - decrypt: { - schemas: { - Input: DecryptInputSchema, - RequestData: DecryptRequestDataSchema, - ResponseData: DecryptResponseDataSchema, - }, - createRequest: async (params: DecryptCreateRequestParams) => { - _logger.info('decrypt:createRequest: Creating request', { - params, - }); - - // -- 1. generate session sigs for decrypt - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('decrypt:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('decrypt:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('decrypt:createRequest: Generating request data', { - url, - }); - - const _requestData = DecryptRequestDataSchema.parse({ - ciphertext: params.ciphertext, - dataToEncryptHash: params.dataToEncryptHash, - accessControlConditions: params.accessControlConditions, - evmContractConditions: params.evmContractConditions, - solRpcConditions: params.solRpcConditions, - unifiedAccessControlConditions: - params.unifiedAccessControlConditions, - authSig: sessionSigs[url], - chain: params.chain, - }); - - // Encrypt the request data using the generic encryption function - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().ENCRYPTION_SIGN, - }); - - _logger.info('decrypt:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'decrypt:createRequest: No requests generated for decrypt.' - ); - throw new Error('Failed to generate requests for decrypt.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - - identityParam: string, - ciphertext: string, - subnetPubKey: string, - jitContext: NagaJitContext - ) => { - _logger.info('decrypt:handleResponse: Processing decrypt response', { - requestId, - }); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Decryption' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual decrypt data from the response wrapper - const decryptData = decryptedJson.data; - if (!decryptData) { - throw new Error('Decrypted response missing data field'); - } - - // Validate with schema - const responseData = DecryptResponseDataSchema.parse(decryptData); - return responseData; - } - ); - - _logger.info('decrypt:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // Extract signature shares from decrypted node responses - const signatureShares = decryptedValues.map((nodeResponse: any) => { - return { - ProofOfPossession: { - identifier: - nodeResponse.signatureShare.ProofOfPossession.identifier, - value: nodeResponse.signatureShare.ProofOfPossession.value, - }, - }; - }); - - _logger.info('decrypt:handleResponse: Signature shares extracted', { - signatureShares, - }); - - // Verify and decrypt using signature shares - const decryptedData = await verifyAndDecryptWithSignatureShares( - subnetPubKey, - stringToBytes(identityParam), - ciphertext, - signatureShares - ); - - _logger.info('decrypt:handleResponse: Decryption completed'); - - return { decryptedData }; - }, - }, - signSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - // extract the authMethod from the requestBody - const authMethod = { - authMethodType: requestBody.authData.authMethodType, - accessToken: requestBody.authData.accessToken, - } as AuthMethod; - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [authMethod], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - maxPrice: getUserMaxPrice({ - product: 'SIGN_SESSION_KEY', - }).toString(), - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signSessionKey:createRequest: No requests generated for signSessionKey.' - ); - throw new Error('Failed to generate requests for signSessionKey.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signSessionKey:handleResponse: Processing signSessionKey response' - ); - - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signSessionKeyData = decryptedJson.data; - if (!signSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signSessionKey response is the individual response, return it directly - return signSessionKeyData; - } - ); - - _logger.info('signSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signSessionKey responses - const values = decryptedValues; - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info('signSessionKey:handleResponse: BLS combined signature', { - blsCombinedSignature, - }); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - signCustomSessionKey: { - schemas: {}, - createRequest: async ( - requestBody: z.infer< - typeof JsonSignCustomSessionKeyRequestForPkpReturnSchema - >, - httpProtocol: 'http://' | 'https://', - version: string, - jitContext: NagaJitContext - ) => { - _logger.info('signCustomSessionKey:createRequest: Request body', { - requestBody, - }); - - const nodeUrls = requestBody.nodeSet.map( - (node) => `${httpProtocol}${node.socketAddress}` - ); - - _logger.info('signCustomSessionKey:createRequest: Node urls', { - nodeUrls, - }); - - const requests: RequestItem>[] = - []; - const _requestId = createRequestId(); - - for (const url of nodeUrls) { - _logger.info( - 'signCustomSessionKey:createRequest: Generating request data', - { - url, - } - ); - - // Create the request data that will be encrypted - const _requestData = { - sessionKey: requestBody.sessionKey, - authMethods: [], - pkpPublicKey: requestBody.pkpPublicKey, - siweMessage: requestBody.siweMessage, - curveType: 'BLS' as const, - epoch: requestBody.epoch, - nodeSet: requestBody.nodeSet, - litActionCode: requestBody.litActionCode, - litActionIpfsId: requestBody.litActionIpfsId, - jsParams: requestBody.jsParams, - }; - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().SIGN_SESSION_KEY, - }); - - _logger.info( - 'signCustomSessionKey:createRequest: Url with path generated', - { - _urlWithPath, - } - ); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: requestBody.epoch, - version: version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'signCustomSessionKey:createRequest: No requests generated for signCustomSessionKey.' - ); - throw new Error( - 'Failed to generate requests for signCustomSessionKey.' - ); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - pkpPublicKey: Hex | string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'signCustomSessionKey:handleResponse: Processing signCustomSessionKey response' - ); - - // Check if the result indicates failure but has an encrypted error payload - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'Session key signing' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // The signCustomSessionKey response is directly the individual response object, - // not wrapped in a { success, values } structure like other APIs - const signCustomSessionKeyData = decryptedJson.data; - if (!signCustomSessionKeyData) { - throw new Error('Decrypted response missing data field'); - } - - // The signCustomSessionKey response is the individual response, return it directly - return signCustomSessionKeyData; - } - ); - - _logger.info('signCustomSessionKey:handleResponse: Values decrypted', { - valueCount: decryptedValues.length, - }); - - // The decrypted values are already the individual signCustomSessionKey responses - const values = decryptedValues; - - _logger.info('signCustomSessionKey:handleResponse: Values', { - values, - }); - - const signatureShares = values.map((s) => ({ - ProofOfPossession: { - identifier: s.signatureShare.ProofOfPossession.identifier, - value: s.signatureShare.ProofOfPossession.value, - }, - })); - - _logger.info('signCustomSessionKey:handleResponse: Signature shares', { - signatureShares, - }); - - // naga-wasm - // datil-wasm (we could use the existing package for this or - // we should make the current wasm work with Datil too.) - const blsCombinedSignature = await combineSignatureShares( - signatureShares - ); - - _logger.info( - 'signCustomSessionKey:handleResponse: BLS combined signature', - { - blsCombinedSignature, - } - ); - - const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); - - const mostCommonSiweMessage = mostCommonString( - values.map((s) => s.siweMessage) - ); - - const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); - - _logger.info('signCustomSessionKey:handleResponse: Signed message', { - signedMessage, - }); - - const authSig: AuthSig = { - sig: JSON.stringify({ - ProofOfPossession: blsCombinedSignature, - }), - algo: 'LIT_BLS', - derivedVia: 'lit.bls', - signedMessage, - address: computeAddress(_pkpPublicKey), - }; - - _logger.info('signCustomSessionKey:handleResponse: Auth sig', { - authSig, - }); - - return authSig; - }, - }, - executeJs: { - schemas: { - Input: ExecuteJsInputSchema, - RequestData: ExecuteJsRequestDataSchema, - ResponseData: ExecuteJsResponseDataSchema, - }, - createRequest: async (params: ExecuteJsCreateRequestParams) => { - _logger.info('executeJs:createRequest: Creating request', { - hasCode: !!params.executionContext.code, - hasIpfsId: !!params.executionContext.ipfsId, - hasJsParams: !!params.executionContext.jsParams, - responseStrategy: params.responseStrategy?.strategy || 'default', - }); - - // Store response strategy for later use in handleResponse - executeJsResponseStrategy = params.responseStrategy; - - // -- 1. generate session sigs - const sessionSigs = await issueSessionFromContext({ - pricingContext: PricingContextSchema.parse(params.pricingContext), - authContext: params.authContext, - }); - - _logger.info('executeJs:createRequest: Session sigs generated'); - - // -- 2. generate requests - const _requestId = createRequestId(); - const requests: RequestItem>[] = - []; - - _logger.info('executeJs:createRequest: Request id generated'); - - const urls = Object.keys(sessionSigs); - - for (const url of urls) { - _logger.info('executeJs:createRequest: Generating request data', { - url, - }); - - // Base64 encode the code if provided - let encodedCode: string | undefined; - if (params.executionContext.code) { - encodedCode = Buffer.from( - params.executionContext.code, - 'utf-8' - ).toString('base64'); - _logger.info('executeJs:createRequest: Code encoded to base64', { - originalLength: params.executionContext.code.length, - encodedLength: encodedCode.length, - }); - } - - // Build the request data that gets sent to the nodes - const _requestData = ExecuteJsRequestDataSchema.parse({ - authSig: sessionSigs[url], - nodeSet: urls, - ...(encodedCode && { code: encodedCode }), - ...(params.executionContext.ipfsId && { - ipfsId: params.executionContext.ipfsId, - }), - ...(params.executionContext.jsParams && { - jsParams: { - jsParams: params.executionContext.jsParams, - }, - }), - }); - - // Encrypt the request data using the E2EE manager - const encryptedPayload = E2EERequestManager.encryptRequestData( - _requestData, - url, - params.jitContext - ); - - const _urlWithPath = composeLitUrl({ - url, - endpoint: networkModuleObject.getEndpoints().EXECUTE_JS, - }); - - _logger.info('executeJs:createRequest: Url with path generated', { - _urlWithPath, - }); - - requests.push({ - fullPath: _urlWithPath, - data: encryptedPayload, - requestId: _requestId, - epoch: params.connectionInfo.epochState.currentNumber, - version: params.version, - }); - } - - if (!requests || requests.length === 0) { - _logger.error( - 'executeJs:createRequest: No requests generated for executeJs.' - ); - throw new Error('Failed to generate requests for executeJs.'); - } - - return requests; - }, - handleResponse: async ( - result: z.infer, - requestId: string, - jitContext: NagaJitContext - ) => { - _logger.info( - 'executeJs:handleResponse: Processing executeJs response', - { - requestId, - responseStrategy: executeJsResponseStrategy?.strategy || 'default', - } - ); - - // Check if the result indicates failure before attempting decryption - if (!result.success) { - E2EERequestManager.handleEncryptedError( - result, - jitContext, - 'JS execution' - ); - } - - // Decrypt the batch response using the E2EE manager - const decryptedResponseValues = E2EERequestManager.decryptBatchResponse( - result, - jitContext, - (decryptedJson) => { - // Extract the actual executeJs response data from the response wrapper - const executeJsData = decryptedJson.data; - if (!executeJsData) { - throw new Error('Decrypted response missing data field'); - } - - return executeJsData; // Return the executeJs response directly - } - ); - - // The decryptedResponseValues are individual response objects with the correct fields - // Wrap them in the expected batch result format - const batchResponseData = { - success: true, - values: decryptedResponseValues, // These are the individual executeJs responses - }; - - // Create the correctly structured ProcessedBatchResult for handleExecuteJsResponse - const correctProcessedResult: ProcessedBatchResult< - z.infer - > = { - success: true as const, - values: [batchResponseData], // batchResponseData is the ExecuteJsResponseDataSchema structure - }; - - // Use the handleResponse from the executeJs module with response strategy - const executeJsResponse = await handleExecuteJsResponse( - correctProcessedResult, - requestId, - networkConfig.minimumThreshold, - executeJsResponseStrategy - ); - - _logger.info( - 'executeJs:handleResponse: ExecuteJs response processed successfully', - { - requestId, - hasSignatures: - !!executeJsResponse.signatures && - Object.keys(executeJsResponse.signatures).length > 0, - hasResponse: !!executeJsResponse.response, - hasClaims: - !!executeJsResponse.claims && - Object.keys(executeJsResponse.claims).length > 0, - } - ); - - return executeJsResponse; - }, - }, - }, -}; - -// Now define the type by taking the type of the object, but overriding getChainManager -export type NagaTestModule = Omit< - typeof networkModuleObject, - 'getChainManager' -> & { - getChainManager: ( - accountOrWalletClient: ExpectedAccountOrWalletClient - ) => CreateChainManagerReturn; -}; - -// Export the correctly typed object -export const nagaTestModule = networkModuleObject as NagaTestModule; +export type NagaTest = typeof nagaTest; +export { nagaTest }; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/PricingContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/PricingContextSchema.ts deleted file mode 100644 index 6ee852fe2b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/PricingContextSchema.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { z } from 'zod'; -import { getUserMaxPrice } from './getUserMaxPrice'; -import { PRODUCT_IDS } from './pricing.constants'; - -export const PricingContextSchema = z - .object({ - product: z.enum(['DECRYPTION', 'SIGN', 'LIT_ACTION']), - userMaxPrice: z.bigint().optional(), - nodePrices: z.array( - z.object({ url: z.string(), prices: z.array(z.bigint()) }) - ), - threshold: z.number(), - }) - .transform(({ product, userMaxPrice, nodePrices, threshold }) => { - const _userMaxPrice = - userMaxPrice ?? - getUserMaxPrice({ - product: product, - }); - - return { - product: { - id: PRODUCT_IDS[product], - name: product, - }, - userMaxPrice: _userMaxPrice, - nodePrices, - threshold, - }; - }); - -export type PricingContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getMaxPricesForNodeProduct.ts b/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getMaxPricesForNodeProduct.ts deleted file mode 100644 index 5d90c4ed44..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getMaxPricesForNodeProduct.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { MaxPriceTooLow, PRODUCT_ID_VALUES } from '@lit-protocol/constants'; - -/** - * @deprecated - use the one in the type package - */ -export interface MaxPricesForNodes { - nodePrices: { url: string; prices: bigint[] }[]; - userMaxPrice: bigint; - productId: PRODUCT_ID_VALUES; - numRequiredNodes?: number; -} - -/** - * Builds an object with updated prices distributed proportionally across nodes. - * Ensures the total cost does not exceed userMaxPrice. - * Operates in the order of lowest priced node to highest. - * - * @param nodePrices - An object where keys are node addresses and values are arrays of prices for different action types. - * @param userMaxPrice - The maximum price the user is willing to pay to execute the request. - * @param productId - The ID of the product to determine which price to consider. - * @param numRequiredNodes - Optional number of nodes required to execute the action. Defaults to all nodes. - * @returns An object with updated prices distributed proportionally. - * @throws A MaxPriceTooLow error if the total price exceeds userMaxPrice - */ -export function getMaxPricesForNodeProduct({ - nodePrices, - userMaxPrice, - productId, - numRequiredNodes, -}: MaxPricesForNodes): { url: string; price: bigint }[] { - // If we don't need all nodes to service the request, only use the cheapest `n` of them - const nodesToConsider = numRequiredNodes - ? nodePrices.slice(0, numRequiredNodes) - : nodePrices; - - let totalBaseCost = 0n; - - // Calculate the base total cost without adjustments - for (const { prices } of nodesToConsider) { - totalBaseCost += prices[productId]; - } - - // Verify that we have a high enough userMaxPrice to fulfill the request - if (totalBaseCost > userMaxPrice) { - throw new MaxPriceTooLow( - { - info: { - totalBaseCost: totalBaseCost.toString(), - userMaxPrice: userMaxPrice.toString(), - }, - }, - `Max price is too low: Minimum required price is ${totalBaseCost.toString()}, got ${userMaxPrice.toString()}.` - ); - } - - /* If the user is willing to pay more than the nodes charge based on our current view of pricing - * then we can provide extra margin to the maxPrice for each node -- making it less likely for - * our request to fail if the price on some of the nodes is higher than we think it was, as long as it's not - * drastically different than we expect it to be - */ - const excessBalance = userMaxPrice - totalBaseCost; - - // Map matching the keys from `nodePrices`, but w/ the per-node maxPrice computed based on `userMaxPrice` - const maxPricesPerNode: { url: string; price: bigint }[] = []; - - for (const { url, prices } of nodesToConsider) { - // For now, we'll distribute the remaining balance equally across nodes - maxPricesPerNode.push({ - url, - price: excessBalance - ? prices[productId] + excessBalance / BigInt(nodesToConsider.length) - : prices[productId], - }); - } - - return maxPricesPerNode; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.spec.ts deleted file mode 100644 index e7d98e4e95..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.spec.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - getUserMaxPrice, - PRODUCT_IDS, - UNSIGNED_128_MAX, -} from './getUserMaxPrice'; - -describe('getUserMaxPrice', () => { - const expectedMaxPrice = UNSIGNED_128_MAX; - - it('should return the rust U128 max price for DECRYPTION product', () => { - expect(getUserMaxPrice({ product: 'DECRYPTION' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for SIGN product', () => { - expect(getUserMaxPrice({ product: 'SIGN' })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price for LIT_ACTION product', () => { - expect(getUserMaxPrice({ product: 'LIT_ACTION' })).toBe(expectedMaxPrice); - }); - - // Test with values from PRODUCT_IDS to ensure they are correctly handled - it('should return the rust U128 max price when using PRODUCT_IDS.DECRYPTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.DECRYPTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.SIGN', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.SIGN - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); - - it('should return the rust U128 max price when using PRODUCT_IDS.LIT_ACTION', () => { - const productKey = Object.keys(PRODUCT_IDS).find( - (key) => - PRODUCT_IDS[key as keyof typeof PRODUCT_IDS] === PRODUCT_IDS.LIT_ACTION - ) as keyof typeof PRODUCT_IDS; - expect(getUserMaxPrice({ product: productKey })).toBe(expectedMaxPrice); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.ts b/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.ts deleted file mode 100644 index 560c17c976..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/getUserMaxPrice.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { PRODUCT_IDS, UNSIGNED_128_MAX } from './pricing.constants'; - -/** - * In the context for Lit pricing model, the U128 value is used as a default "unlimited" - * or maximum price when a specific `userMaxPrice` is not set - */ -export const getUserMaxPrice = (params: { - product: keyof typeof PRODUCT_IDS; -}) => { - /** Tracks the total max price a user is willing to pay for each supported product type - * This must be distributed across all nodes; each node will get a percentage of this price - * - * If the user never sets a max price, it means 'unlimited' - */ - const defaultMaxPriceByProduct: Record = { - DECRYPTION: BigInt(-1), - SIGN: BigInt(-1), - LIT_ACTION: BigInt(-1), - SIGN_SESSION_KEY: BigInt(-1), - }; - - if (defaultMaxPriceByProduct[params.product] === BigInt(-1)) { - return UNSIGNED_128_MAX; - } - - // If the user has set a max price, return that - return defaultMaxPriceByProduct[params.product]; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/pricing.constants.ts b/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/pricing.constants.ts deleted file mode 100644 index 7154ce0e6c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/pricing-manager/pricing.constants.ts +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Rust U128 max - * See https://cheats.rs/ for more info - */ -export const UNSIGNED_128_MAX = - 340_282_366_920_938_463_463_374_607_431_768_211_455n; - -/** - * Product IDs used for price feed and node selection - * - * - DECRYPTION (0): Used for decryption operations - * - SIGN (1): Used for signing operations - * - LIT_ACTION (2): Used for Lit Actions execution - * - SIGN_SESSION_KEY (3): Used for sign session key operations - */ -export const PRODUCT_IDS = { - DECRYPTION: 0n, // For decryption operations - SIGN: 1n, // For signing operations - LIT_ACTION: 2n, // For Lit Actions execution - SIGN_SESSION_KEY: 3n, // For sign session key operations -} as const; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/scripts/00-generate-abi-signatures.ts b/packages/networks/src/networks/vNaga/envs/naga-test/scripts/00-generate-abi-signatures.ts deleted file mode 100644 index 523fe2b43b..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/scripts/00-generate-abi-signatures.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures'; - -const JSON_FILE_PATH = process.env['NETWORK_CONFIG'] as string; - -console.log('JSON_FILE_PATH:', JSON_FILE_PATH); - -if (!JSON_FILE_PATH) { - throw new Error( - '❌ NETWORK_CONFIG is not set. Please set it in your .env file.' - ); -} - -async function main() { - await generateSignaturesFromContext({ - jsonFilePath: JSON_FILE_PATH, - networkName: 'naga-develop', - outputDir: '../generated', - useScriptDirectory: true, - - // @ts-ignore - callerPath: import.meta.url, - }); -} - -// gogogo! -main().catch(console.error); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/AuthContextSchema.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/AuthContextSchema.ts deleted file mode 100644 index b6090200f7..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/AuthContextSchema.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { - AuthSigSchema, - HexPrefixedSchema, - ISessionCapabilityObjectSchema, - LitResourceAbilityRequestSchema, - SessionKeyPairSchema, - AuthConfigSchema, - AuthMethodSchema, -} from '@lit-protocol/schemas'; -import { z } from 'zod'; -import { Account } from 'viem'; - -// { -// pkpPublicKey: "0x04e5603fe1cc5ce207c12950939738583b599f22a152c3672a4c0eee887d75dd405246ac3ed2430283935a99733eac9520581af9923c0fc04fad1d67d60908ce18", -// chain: "ethereum", -// resourceAbilityRequests: [ -// { -// resource: { -// getResourceKey: [Function], -// isValidLitAbility: [Function], -// toString: [Function], -// resourcePrefix: "lit-pkp", -// resource: "*", -// }, -// ability: "pkp-signing", -// } -// ], -// sessionKeyPair: { -// publicKey: "1d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// secretKey: "faa9b3b04f89ef6066f8842ad713a8c1d2d12540b65129f328a1e301366ebc051d8e32983aa1fb77db9f21b6d53e73db671b886e72e914c67e8602cc4d8b3699", -// }, -// sessionCapabilityObject: SessionCapabilityObjectSchema, -// authNeededCallback: [AsyncFunction: authNeededCallback], -// capabilityAuthSigs: [], -// } -// export const AuthContextSchema = z.object({ -// pkpPublicKey: HexPrefixedSchema.optional(), -// // viemAccount: z.custom().optional(), -// // authMethod: AuthMethodSchema.optional(), -// chain: z.string(), -// sessionKeyPair: SessionKeyPairSchema, -// // which one do we need here? -// resourceAbilityRequests: z.array(LitResourceAbilityRequestSchema), -// // which one do we need here? -// sessionCapabilityObject: ISessionCapabilityObjectSchema, -// // which one do we need here? TODO: ❗️ specify the type properly -// siweResources: z.any(), -// authNeededCallback: z.function(), -// capabilityAuthSigs: z.array(AuthSigSchema), -// authConfig: AuthConfigSchema, -// }); - -// export type AuthContext = z.infer; - -// export const EoaAuthContextSchema = z.object({ -// viemAccount: z.custom(), -// authMethod: AuthMethodSchema, -// authNeededCallback: z.function(), -// sessionKeyPair: SessionKeyPairSchema, -// authConfig: AuthConfigSchema, -// }); - -// export const GenericAuthContextSchema = z.union([ -// AuthContextSchema, -// EoaAuthContextSchema, -// ]); - -// export type GenericAuthContext = z.infer; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.test.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.test.ts deleted file mode 100644 index 44b8384ad9..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.test.ts +++ /dev/null @@ -1,250 +0,0 @@ -import { formatSessionSigs } from './session-sigs-reader'; - -const MOCK_VALID_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:48:13.383Z\\nExpiration Time: 2024-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2024-10-16T13:47:47Z\\nExpiration Time: 2024-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2024-10-16T13:48:18.135Z","expiration":"2024-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -const MOCK_EXPIRED_SESSION_SIGS = { - 'https://51.255.59.58:443': { - sig: '80c9a32ea9bc027f4dfffeb8236c3a6acc5548c3f730feb39151d4711ade2f94e660358679d0be8fb6117efaf06a77d5f262649f687d319cf8430a787f67bd0c', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://51.255.59.58:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://173.208.48.215:443': { - sig: '8cd8e12fdac591888f564d942a5745d7704749b5c2651e4a5360643a919bc24c00887b0d9ca885ac5f716a5d21436a7d4cdd172ba9b3ac0833cc1b4ca2a67207', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://173.208.48.215:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.108.66:443': { - sig: '3683aeb96f59be4f6bc077ec77c4008905f82b1a5436ff0554697d33c7ed0deb7ae91e6c5bf810e7f6fde40cc49e5b423d73d19d5763d835b4819c50bc90da0f', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.108.66:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.202:443': { - sig: 'f5541138424b81172ca314278750be24f87c86cef3593e5f18dc77737e814ea1dead6291fdffb699b3a550543fb7968a7fbfaf3e9f5b3f768dc347ab95bf160a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.202:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://158.69.163.138:443': { - sig: '5f84a6ec4baa73341146be9239b43d7848e6d657fd121b3934a5496d4a117f164baab1796904305fb2a0fefc5a1fa4dd1297540c8ff5d544ca62a89b7f64d902', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://158.69.163.138:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://147.135.61.242:443': { - sig: '11428a4bf4364ceb0a4cbad9c01445c146c20a9aee0e71dcec580231ddbbde71da08bc0d6ceed4b26fab72b4a107d37236c738734058f55854758da70b70b804', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://147.135.61.242:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://199.115.117.115:443': { - sig: '5c71bf6752510ef0fb15d9db968e0a179122f92d220d0f3f789b7b8159b5daf7c56cad6a6e0b82aa3bf6e8d31106b769e05da798be6b4d7832457d13a65ed201', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://199.115.117.115:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://167.114.17.201:443': { - sig: '00cc6e45412caf5ffe29e7169a29bc1ddf9023a1d9efa08cf1b8d0ee1eb32decb7920efa569618dcfc3954d3a75efed699c98bb2b2ae538933cfb462caebc101', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://167.114.17.201:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, - 'https://207.244.72.175:443': { - sig: '579ead535757f22937e30c0ce77e3e79e40d468d220114cf7ad040b91dbf368069483ecb2cafe64669780b2535139b909d9b0cfb08190654355819f10d60320a', - derivedVia: 'litSessionSignViaNacl', - signedMessage: - '{"sessionKey":"8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da","resourceAbilityRequests":[{"resource":{"resource":"*","resourcePrefix":"lit-pkp"},"ability":"pkp-signing"},{"resource":{"resource":"*","resourcePrefix":"lit-litaction"},"ability":"lit-action-execution"}],"capabilities":[{"sig":"0x886ccec901d14a8eea6ba293e97588c070682e6cd987ee43678c3df466851f14795c027b3006887c6071f7e89122ca062a900803044d6e6b59aa16323ffb775f1b","derivedVia":"web3.eth.personal.sign","signedMessage":"localhost wants you to sign in with your Ethereum account:\\n0x5D467fe98ff120fe0C85F2217bC61732571b28EC\\n\\nThis is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf: (1) \'Auth\': \'Auth\' for \'lit-ratelimitincrease://25364\'.\\n\\nURI: lit:capability:delegation\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:48:13.383Z\\nExpiration Time: 2022-10-23T13:48:13.380Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjUzNjQiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjUzNjQiXX1dfX0sInByZiI6W119","address":"0x5D467fe98ff120fe0C85F2217bC61732571b28EC"},{"sig":"{\\"ProofOfPossession\\":\\"b868bcc867277cd160a60778acf0316a0c89c6b17127c5c2577ead9c25d073f6eefe4a1f7c342cd2b4e49648964354860813897273df3b78f2fe7cf00bbaad8e8586ef14c03f018c155827496f8ac385fc49fad21833dcd225bf8de53b2dd712\\"}","algo":"LIT_BLS","derivedVia":"lit.bls","signedMessage":"litprotocol.com wants you to sign in with your Ethereum account:\\n0x4F92B988dfF23a7A476C256E621206F120f92337\\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:8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da\\nVersion: 1\\nChain ID: 1\\nNonce: 0xfba8cfeb4e933e68851e7b993e17cc7be919373ff0afce1d44db8ae4fe03436a\\nIssued At: 2022-10-16T13:47:47Z\\nExpiration Time: 2022-10-17T13:48:16.466Z\\nResources:\\n- urn:recap:eyJhdHQiOnsibGl0LWxpdGFjdGlvbjovLyoiOnsiVGhyZXNob2xkL0V4ZWN1dGlvbiI6W3t9XX0sImxpdC1wa3A6Ly8qIjp7IlRocmVzaG9sZC9TaWduaW5nIjpbe31dfSwibGl0LXJlc29sdmVkYXV0aGNvbnRleHQ6Ly8qIjp7IkF1dGgvQXV0aCI6W3siYXV0aF9jb250ZXh0Ijp7ImFjdGlvbklwZnNJZHMiOlsiUW1TSjN3NVRvck1xMnl2OEpkTVhKR1ZhZFdEZTN5Y3RHV3VqWmRjN3NGODhndCJdLCJhdXRoTWV0aG9kQ29udGV4dHMiOltdLCJhdXRoU2lnQWRkcmVzcyI6bnVsbCwiY3VzdG9tQXV0aFJlc291cmNlIjoiXCIodHJ1ZSwge1xcXCJNT1xcXCI6XFxcIkZPXFxcIixcXFwicHJpdmF0ZUtleVxcXCI6XFxcIjB4MzE5NGM0ZmYwMTQ4YWU1YzgzZTk0NGU0ZTY1NGIwM2JkNjYzYWRkNmM4NmY5MjIwNTUzNjZjNmYyMzA2YjFhN1xcXCJ9KVwiIiwicmVzb3VyY2VzIjpbXX19XX19LCJwcmYiOltdfQ","address":"0x4F92B988dfF23a7A476C256E621206F120f92337"}],"issuedAt":"2022-10-16T13:48:18.135Z","expiration":"2022-10-17T13:48:16.466Z","nodeAddress":"https://207.244.72.175:443"}', - address: '8356d1e28349e2c8d1e7b3b85d7fa2913ad0c6961a39a5227c943839898870da', - algo: 'ed25519', - }, -}; - -describe('formatSessionSigs', () => { - it('should format session signatures correctly', () => { - const currentTime = new Date('2022-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_VALID_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2022-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2024-10-16T13:48:18.135Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ✅ Not expired (valid for 1020 days) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2024-10-16T13:48:13.383Z - * Expiration: 2024-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ✅ Not expired (valid for 1026 days) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2024-10-16T13:47:47.000Z - * Expiration: 2024-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ✅ Not expired (valid for 1020 days) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - - expect(formattedSessionSigs).toBe(expectedOutput); - }); - - it('should handle expired session signatures correctly', () => { - const currentTime = new Date('2024-01-01T06:00:00Z'); - const formattedSessionSigs = formatSessionSigs( - JSON.stringify(MOCK_EXPIRED_SESSION_SIGS), - currentTime - ); - - const expectedOutput = `The request time is at: 2024-01-01T06:00:00.000Z -* Outer expiration: - * Issued at: 2022-10-16T13:48:18.135Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 23 hours, 59 minutes, 58.331 seconds - * Status: ❌ Expired (expired 440 days ago) -* Capabilities: - * Capability 1 (web3.eth.personal.sign): - * Issued at: 2022-10-16T13:48:13.383Z - * Expiration: 2022-10-23T13:48:13.380Z - * Duration: 6 days - * Status: ❌ Expired (expired 434 days ago) - * Attenuation: - * lit-ratelimitincrease://25364 - * Auth/Auth - * nft_id - * 25364 - * Capability 2 (lit.bls): - * Issued at: 2022-10-16T13:47:47.000Z - * Expiration: 2022-10-17T13:48:16.466Z - * Duration: 1 days - * Status: ❌ Expired (expired 440 days ago) - * Attenuation: - * lit-litaction://* - * Threshold/Execution - * lit-pkp://* - * Threshold/Signing - * lit-resolvedauthcontext://* - * Auth/Auth - * auth_context - * actionIpfsIds - * QmSJ3w5TorMq2yv8JdMXJGVadWDe3yctGWujZdc7sF88gt - * authMethodContexts - * authSigAddress - * customAuthResource - * "(true, {\\"MO\\":\\"FO\\",\\"privateKey\\":\\"0x3194c4ff0148ae5c83e944e4e654b03bd663add6c86f922055366c6f2306b1a7\\"})" - * resources -`; - expect(formattedSessionSigs).toBe(expectedOutput); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.ts deleted file mode 100644 index 99c66792fd..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-reader.ts +++ /dev/null @@ -1,154 +0,0 @@ -import { InvalidArgumentException } from '@lit-protocol/constants'; -import { logger } from '@lit-protocol/logger'; - -import { parseSignedMessage } from './session-sigs-validator'; - -function formatDuration(start: Date, end: Date): string { - const diff = end.getTime() - start.getTime(); - const days = Math.floor(diff / (1000 * 60 * 60 * 24)); - const hours = Math.floor((diff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60)); - const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60)); - const seconds = ((diff % (1000 * 60)) / 1000).toFixed(3); - - let elapsedTime: string; - - if (days > 0) { - elapsedTime = `${days} days`; - } else if (hours > 0) { - elapsedTime = `${hours} hours, ${minutes} minutes, ${seconds} seconds`; - } else { - elapsedTime = `${minutes} minutes, ${seconds} seconds`; - } - - return elapsedTime; -} - -function formatStatus(expirationDate: Date, currentDate: Date): string { - if (expirationDate > currentDate) { - const timeLeft = formatDuration(currentDate, expirationDate); - return `✅ Not expired (valid for ${timeLeft})`; - } else { - const timeAgo = formatDuration(expirationDate, currentDate); - return `❌ Expired (expired ${timeAgo} ago)`; - } -} - -/** - * Convert this format: - * {"lit-ratelimitincrease://25364":{"Auth/Auth":[{"nft_id":["25364"]}]}} - * to human-readable format - */ -function humanReadableAtt(obj: any, indentLevel: number = 0): string { - const indent = ' '.repeat(indentLevel * 2); - let result = ''; - - for (const key in obj) { - result += `${indent}* ${key}\n`; - - if (typeof obj[key] === 'object' && !Array.isArray(obj[key])) { - result += humanReadableAtt(obj[key], indentLevel + 1); - } else if (Array.isArray(obj[key])) { - obj[key].forEach((item: any) => { - if (typeof item === 'object') { - result += humanReadableAtt(item, indentLevel + 1); - } else { - result += `${indent} * ${item}\n`; - } - }); - } else { - result += `${indent} * ${obj[key]}\n`; - } - } - return result; -} - -export function formatSessionSigs( - sessionSigs: string, - currentTime: Date = new Date() -): string { - const parsedSigs = JSON.parse(sessionSigs); - const firstNodeKey = Object.keys(parsedSigs)[0]; - const firstNode = parsedSigs[firstNodeKey]; - let signedMessage; - - try { - signedMessage = JSON.parse(firstNode.signedMessage); - } catch (error: unknown) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - firstNodeSignedMessage: firstNode.signedMessage, - }, - }, - `Invalid JSON format for signedMessage: ${errorMessage}` - ); - } - - const currentDate = new Date(currentTime); - - let result = `The request time is at: ${currentDate.toISOString()}\n`; - - // Outer expiration - let issuedAt, expiration; - try { - issuedAt = new Date(signedMessage.issuedAt); - expiration = new Date(signedMessage.expiration); - } catch (error) { - const errorMessage = - error instanceof Error ? error.message : 'Unknown error'; - throw new InvalidArgumentException( - { - info: { - signedMessage, - }, - }, - `Error parsing issuedAt or expiration: ${errorMessage}` - ); - } - - result += '* Outer expiration:\n'; - result += ` * Issued at: ${issuedAt.toISOString()}\n`; - result += ` * Expiration: ${expiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration(issuedAt, expiration)}\n`; - result += ` * Status: ${formatStatus(expiration, currentDate)}\n`; - - // Capabilities - result += '* Capabilities:\n'; - signedMessage.capabilities.forEach((cap: any, index: number) => { - const capType = cap.derivedVia; - const parsedCapMessage = parseSignedMessage(cap.signedMessage); - let attenuation: string = ''; - - try { - const encodedRecap = (parsedCapMessage['- urn'] as string)?.split(':')[1]; - const decodedRecap = atob(encodedRecap); - const jsonRecap = JSON.parse(decodedRecap); - attenuation = humanReadableAtt(jsonRecap.att, 6); - } catch (e) { - // swallow error - logger.info({ - function: 'formatSessionSigs', - msg: 'Error parsing attenuation', - error: e, - }); - } - - const capIssuedAt = new Date(parsedCapMessage['Issued At'] || ''); - const capExpiration = new Date(parsedCapMessage['Expiration Time'] || ''); - - result += ` * Capability ${index + 1} (${capType}):\n`; - result += ` * Issued at: ${capIssuedAt.toISOString()}\n`; - result += ` * Expiration: ${capExpiration.toISOString()}\n`; - result += ` * Duration: ${formatDuration( - capIssuedAt, - capExpiration - )}\n`; - result += ` * Status: ${formatStatus(capExpiration, currentDate)}\n`; - result += ` * Attenuation:\n`; - result += attenuation; - }); - return result; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.spec.ts deleted file mode 100644 index 24a7c1680a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.spec.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { AuthSig } from '@lit-protocol/types'; - -import { validateSessionSigs } from './session-sigs-validator'; - -describe('validateSessionSigs', () => { - // Mock session signature with valid data for reference - const validSessionSig: AuthSig = { - sig: 'valid-sig', - derivedVia: 'some-method', - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: 2099-12-31T23:59:59Z`, - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', // Valid future date - }), - address: '0xValidAddress', - algo: 'ed25519', - }; - - // Helper function to create a SessionSigsMap - function createSessionSigsMap(sigs: { - [key: string]: AuthSig; - }): Record { - return sigs; - } - - // 1. Invalid JSON in signedMessage - it('should handle invalid JSON in signedMessage', () => { - const invalidJsonSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidJsonSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Main signedMessage is not valid JSON." - ); - }); - - // 2. Missing capabilities field - it('should handle missing capabilities field', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.capabilities; // Remove the capabilities field - - const missingCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Capabilities not found in main signedMessage." - ); - }); - - // 3. Empty capabilities array - it('should not accept an empty capabilities array', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities = []; // Set capabilities to empty array - - const emptyCapabilitiesSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: emptyCapabilitiesSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining('No capabilities found in main signedMessage.') - ); - }); - - // 4. Invalid capability in capabilities - it('should handle invalid capability in capabilities', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.capabilities[0].signedMessage = `Capability Signed Message -Expiration Time: invalid-date-format`; // Invalid expiration date in capability - - const invalidCapabilitySessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidCapabilitySessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in capability 0" - ) - ); - }); - - // 5. Missing expiration in main signedMessage - it('should handle missing expiration in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - delete parsedMessage.expiration; // Remove the expiration field - - const missingExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: missingExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session1': Expiration Time not found in outer signedMessage." - ); - }); - - // 6. Invalid expiration date format in main signedMessage - it('should handle invalid expiration date format in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = 'invalid-date-format'; // Set invalid expiration date - - const invalidExpirationFormatSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: invalidExpirationFormatSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Invalid Expiration Time format in main signedMessage" - ) - ); - }); - - // 7. Expired expiration date in main signedMessage - it('should handle expired expiration date in main signedMessage', () => { - const parsedMessage = JSON.parse(validSessionSig.signedMessage); - parsedMessage.expiration = '2000-01-01T00:00:00Z'; // Past date - - const expiredExpirationSessionSig: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify(parsedMessage), - }; - - const sessionSigs = createSessionSigsMap({ - session1: expiredExpirationSessionSig, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session1': Expired main signedMessage. Expiration Time:" - ) - ); - }); - - // 8. Multiple session signatures, some valid and some invalid - it('should validate multiple session signatures and report errors', () => { - const session1 = validSessionSig; // Valid - const session2: AuthSig = { - ...validSessionSig, - signedMessage: '{ invalid JSON }', // Invalid JSON - }; - const session3: AuthSig = { - ...validSessionSig, - signedMessage: JSON.stringify({ - capabilities: [ - { - sig: 'valid-capability-sig', - signedMessage: `Capability Signed Message -Expiration Time: invalid-date-format`, // Invalid date format - address: '0xValidAddress', - }, - ], - expiration: '2099-12-31T23:59:59Z', - }), - }; - - const sessionSigs = createSessionSigsMap({ - session1, - session2, - session3, - }); - - const validationResult = validateSessionSigs(sessionSigs); - - expect(validationResult.isValid).toBe(false); - expect(validationResult.errors).toContain( - "Session Sig 'session2': Main signedMessage is not valid JSON." - ); - expect(validationResult.errors).toContainEqual( - expect.stringContaining( - "Session Sig 'session3': Invalid Expiration Time format in capability 0" - ) - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.ts deleted file mode 100644 index 55847d2b8a..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/helper/session-sigs-validator.ts +++ /dev/null @@ -1,208 +0,0 @@ -import { - AuthSig, - Capability, - ParsedSessionMessage, - ParsedSignedMessage, - SessionSigsMap, -} from '@lit-protocol/types'; - -interface ValidationResult { - isValid: boolean; - errors: string[]; -} - -// Function to parse a signedMessage string into an object -export function parseSignedMessage(signedMessage: string): ParsedSignedMessage { - const lines = signedMessage.split('\n'); - const parsedData: ParsedSignedMessage = {}; - let currentKey: string | null = null as string | null; - let currentValue = ''; - - lines.forEach((line) => { - // Match lines with 'Key: Value' pattern - const keyValueMatch = line.match(/^([^:]+):\s*(.*)$/); - - if (keyValueMatch) { - // Save the previous key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // Start a new key-value pair - currentKey = keyValueMatch[1]; - currentValue = keyValueMatch[2]; - } else if (line.startsWith('- ')) { - // Handle list items - const item = line.substring(2).trim(); - if (!parsedData[currentKey!]) { - parsedData[currentKey!] = []; - } - (parsedData[currentKey!] as string[]).push(item); - } else if (line.trim() === '') { - // Skip empty lines - } else { - // Continuation of the current value - currentValue += '\n' + line; - } - }); - - // Save the last key-value pair - if (currentKey !== null) { - parsedData[currentKey.trim()] = currentValue.trim(); - } - - // parsedData: { - // 'localhost wants you to sign in with your Ethereum account': '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', - // 'This is a test statement. You can put anything you want here. I further authorize the stated URI to perform the following actions on my behalf': "(1) 'Auth': 'Auth' for 'lit-ratelimitincrease://24529'.", - // URI: 'lit:capability:delegation', - // Version: '1', - // 'Chain ID': '1', - // Nonce: '0x921dd92f497527857ee8dda62f1805e56c34c99a6b37691b4e56e6fb171a5a70', - // 'Issued At': '2024-09-19T13:07:33.606Z', - // 'Expiration Time': '2024-09-26T13:07:33.602Z', - // Resources: '', - // '- urn': 'recap:eyJhdHQiOnsibGl0LXJhdGVsaW1pdGluY3JlYXNlOi8vMjQ1MjkiOnsiQXV0aC9BdXRoIjpbeyJuZnRfaWQiOlsiMjQ1MjkiXSwidXNlcyI6IjIwMCJ9XX19LCJwcmYiOltdfQ' - // } - return parsedData; -} - -// Function to validate expiration date -function validateExpiration( - expirationTimeStr: string, - context: string -): ValidationResult { - const errors: string[] = []; - const expirationTime = new Date(expirationTimeStr); - const currentTime = new Date(); - - if (isNaN(expirationTime.getTime())) { - errors.push( - `Invalid Expiration Time format in ${context}: ${expirationTimeStr}` - ); - } else if (expirationTime < currentTime) { - errors.push( - `Expired ${context}. Expiration Time: ${expirationTime.toISOString()}` - ); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -// Function to parse and validate capabilities -function parseCapabilities(capabilities: Capability[]): ValidationResult { - const errors: string[] = []; - - capabilities.forEach((capability, index) => { - const { signedMessage } = capability; - - // Parse the signedMessage - const parsedCapabilityMessage = parseSignedMessage(signedMessage); - capability.parsedSignedMessage = parsedCapabilityMessage; - - // Extract and validate expiration date - const expirationTimeStr = parsedCapabilityMessage['Expiration Time']; - - if (expirationTimeStr) { - const validationResult = validateExpiration( - expirationTimeStr, - `capability ${index}` - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push( - `Expiration Time not found in capability ${index}'s signedMessage.` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signature. - * - * @param sessionSig - The session signature to validate. - * @returns The validation result, indicating whether the session signature is valid and any errors encountered during validation. - */ -export function validateSessionSig(sessionSig: AuthSig): ValidationResult { - const errors: string[] = []; - - // Parse the main signedMessage - let parsedSignedMessage: ParsedSessionMessage; - try { - parsedSignedMessage = JSON.parse(sessionSig.signedMessage); - } catch (error) { - errors.push('Main signedMessage is not valid JSON.'); - return { isValid: false, errors }; - } - - // Validate capabilities - const capabilities: Capability[] = parsedSignedMessage.capabilities; - - if (!capabilities) { - errors.push('Capabilities not found in main signedMessage.'); - } else if (capabilities.length === 0) { - errors.push('No capabilities found in main signedMessage.'); - } else { - const capabilitiesValidationResult = parseCapabilities(capabilities); - - if (!capabilitiesValidationResult.isValid) { - errors.push(...capabilitiesValidationResult.errors); - } - } - - // Validate outer expiration - const outerExpirationTimeStr = parsedSignedMessage['expiration']; - - if (outerExpirationTimeStr) { - const validationResult = validateExpiration( - outerExpirationTimeStr, - 'main signedMessage' - ); - if (!validationResult.isValid) { - errors.push(...validationResult.errors); - } - } else { - errors.push('Expiration Time not found in outer signedMessage.'); - } - - return { - isValid: errors.length === 0, - errors, - }; -} - -/** - * Validates the session signatures. - * - * @param sessionSigs - The session signatures to validate. - * @returns The validation result, indicating whether the session signatures are valid and any errors encountered during validation. - */ -export function validateSessionSigs( - sessionSigs: SessionSigsMap -): ValidationResult { - const errors: string[] = []; - - Object.entries(sessionSigs).forEach(([key, sessionSig]) => { - const validationResult = validateSessionSig(sessionSig); - - if (!validationResult.isValid) { - errors.push( - `Session Sig '${key}': ${validationResult.errors.join(', ')}` - ); - } - }); - - return { - isValid: errors.length === 0, - errors, - }; -} diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/issueSessionFromContext.ts b/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/issueSessionFromContext.ts deleted file mode 100644 index 8195feb80c..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/session-manager/issueSessionFromContext.ts +++ /dev/null @@ -1,147 +0,0 @@ -import { InvalidSessionSigs } from '@lit-protocol/constants'; -import { - PKPAuthContextSchema, - EoaAuthContextSchema, - AuthConfigSchema, -} from '@lit-protocol/schemas'; -import { - LitResourceAbilityRequest, - SessionSigningTemplate, - SessionSigsMap, -} from '@lit-protocol/types'; -import { ed25519 } from '@noble/curves/ed25519'; -import { hexToBytes } from '@noble/hashes/utils'; -import { z } from 'zod'; -import { getMaxPricesForNodeProduct } from '../pricing-manager/getMaxPricesForNodeProduct'; -import { PricingContext } from '../pricing-manager/PricingContextSchema'; -import { validateSessionSigs } from './helper/session-sigs-validator'; - -/** - * Attempts to normalize a string by unescaping it until it can be parsed as a JSON object, - * then stringifies it exactly once. If the input is a regular string that does not represent - * a JSON object or array, the function will return it as is without modification. - * This function is designed to handle cases where strings might be excessively escaped due - * to multiple layers of encoding, ensuring that JSON data is stored in a consistent and - * predictable format, and regular strings are left unchanged. - * - * @param input The potentially excessively escaped string. - * @return A string that is either the JSON.stringify version of the original JSON object - * or the original string if it does not represent a JSON object or array. - */ -export function normalizeAndStringify(input: string): string { - try { - // Directly return the string if it's not in a JSON format - if (!input.startsWith('{') && !input.startsWith('[')) { - return input; - } - - // Attempt to parse the input as JSON - const parsed = JSON.parse(input); - - // If parsing succeeds, return the stringified version of the parsed JSON - return JSON.stringify(parsed); - } catch (error) { - // If parsing fails, it might be due to extra escaping - const unescaped = input.replace(/\\(.)/g, '$1'); - - // If unescaping doesn't change the string, return it as is - if (input === unescaped) { - return input; - } - - // Otherwise, recursively call the function with the unescaped string - return normalizeAndStringify(unescaped); - } -} - -export const issueSessionFromContext = async (params: { - authContext: z.input< - typeof PKPAuthContextSchema | typeof EoaAuthContextSchema - >; - pricingContext: PricingContext; - // latestBlockhash: string; -}): Promise => { - const authSig = await params.authContext.authNeededCallback(); - const _authConfig = AuthConfigSchema.parse(params.authContext.authConfig); - - const capabilities = [ - ...(_authConfig?.capabilityAuthSigs || []), // Spreads existing sigs, or an empty array if null/undefined/empty - authSig, - ]; - - // This is the template that will be combined with the node address as a single object, then signed by the session key - // so that the node can verify the session signature - const sessionSigningTemplate = { - sessionKey: params.authContext.sessionKeyPair.publicKey, - resourceAbilityRequests: (_authConfig.resources || - []) as LitResourceAbilityRequest[], - capabilities: capabilities, - issuedAt: new Date().toISOString(), - - // @ts-ignore - adding ! because zod schema has a default so this value will never be undefined - // otherwise, "const toSign" below will throw lint error - expiration: _authConfig.expiration!, - }; - - // console.log('🔄 sessionSigningTemplate', sessionSigningTemplate); - - const sessionSigs: SessionSigsMap = {}; - - const _userMaxPrices = getMaxPricesForNodeProduct({ - nodePrices: params.pricingContext.nodePrices, - userMaxPrice: params.pricingContext.userMaxPrice, - - // @ts-ignore - need to change the MaxPricesForNodes interface - productId: Number(params.pricingContext.product.id), - numRequiredNodes: params.pricingContext.threshold, - }); - - // console.log('🔄 _userMaxPrices', _userMaxPrices); - - _userMaxPrices.forEach(({ url: nodeAddress, price }) => { - const toSign: SessionSigningTemplate = { - ...sessionSigningTemplate, - nodeAddress, - maxPrice: price.toString(), - }; - - // console.log(`Setting maxprice for ${nodeAddress} to `, price.toString()); - - const signedMessage = JSON.stringify(toSign); - - const messageHex = new Uint8Array(Buffer.from(signedMessage, 'utf8')); - - const secretKeyBytes = hexToBytes( - params.authContext.sessionKeyPair.secretKey - ); - const signature = ed25519.sign(messageHex, secretKeyBytes); - - // one of these is essentially what wrapped key service need. - sessionSigs[nodeAddress] = { - sig: Buffer.from(signature).toString('hex'), - derivedVia: 'litSessionSignViaNacl', - signedMessage: signedMessage, - address: params.authContext.sessionKeyPair.publicKey, - algo: 'ed25519', - }; - }); - - const validatedSessionSigs = validateSessionSigs(sessionSigs); - - if (validatedSessionSigs.isValid === false) { - throw new InvalidSessionSigs( - {}, - `Invalid sessionSigs. Errors: ${validatedSessionSigs.errors}` - ); - } - - // make this only log when debug is enabled - // if (typeof process !== 'undefined' && process.env['PINO_LOG_LEVEL']) { - // console.log( - // '💡 PINO_LOG_LEVEL is defined, printing human readable session sigs' - // ); - // console.log(formatSessionSigs(JSON.stringify(sessionSigs))); - // } - - return sessionSigs; -}; diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.spec.ts deleted file mode 100644 index 5337321997..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.spec.ts +++ /dev/null @@ -1,348 +0,0 @@ -import { createStateManager } from './createStateManager'; -import { STAKING_STATES } from '@lit-protocol/constants'; -import { createReadOnlyChainManager } from '@nagaDev/ChainManager'; -import { createReadOnlyContractsManager } from '@vNaga/LitChainClient'; -import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; -import { createEvmEventState } from '../../../../shared/StateManager/src/createEvmEventState'; -import { createRefreshedValue } from '../../../../shared/StateManager/src/createRefreshedValue'; -import { getChildLogger } from '@lit-protocol/logger'; - -// Mock dependencies -jest.mock('@nagaDev/ChainManager'); -jest.mock('@vNaga/LitChainClient'); -jest.mock('ethers'); -jest.mock('../../../../shared/StateManager/helpers/fetchBlockchainData'); -jest.mock('../../../../shared/StateManager/src/createEvmEventState'); -jest.mock('../../../../shared/StateManager/src/createRefreshedValue'); -jest.mock('@lit-protocol/logger'); - -const mockGetChildLogger = getChildLogger as jest.Mock; -const mockCreateReadOnlyChainManager = createReadOnlyChainManager as jest.Mock; -const mockCreateReadOnlyContractsManager = - createReadOnlyContractsManager as jest.Mock; -const mockEthersContract = ethers.Contract as jest.Mock; -const mockEthersJsonRpcProvider = ethers.providers.JsonRpcProvider as jest.Mock; -const mockFetchBlockchainData = fetchBlockchainData as jest.Mock; -const mockCreateEvmEventState = createEvmEventState as jest.Mock; -const mockCreateRefreshedValue = createRefreshedValue as jest.Mock; - -describe('createStateManager', () => { - let mockNetworkConfig: any; - let mockLogger: any; - let mockGetConnectionInfo: jest.Mock; - let mockGetOrRefreshAndGet: jest.Mock; - let mockEvmEventStateInstance: { - listen: jest.Mock; - stop: jest.Mock; - onChangeCallback?: (newState: any) => Promise; - }; - - beforeEach(() => { - jest.clearAllMocks(); - - mockLogger = { - info: jest.fn(), - warn: jest.fn(), - error: jest.fn(), - }; - mockGetChildLogger.mockReturnValue(mockLogger); - - mockGetConnectionInfo = jest.fn(); - mockCreateReadOnlyChainManager.mockReturnValue({ - api: { - connection: { - getConnectionInfo: mockGetConnectionInfo, - }, - }, - }); - - mockCreateReadOnlyContractsManager.mockReturnValue({ - stakingContract: { - address: '0xStakingContractAddress', - abi: [], - }, - }); - - mockEthersContract.mockImplementation(() => ({})); - mockEthersJsonRpcProvider.mockImplementation(() => ({})); - - mockGetOrRefreshAndGet = jest.fn(); - mockCreateRefreshedValue.mockReturnValue({ - getOrRefreshAndGet: mockGetOrRefreshAndGet, - }); - - mockEvmEventStateInstance = { - listen: jest.fn(), - stop: jest.fn(), - }; - mockCreateEvmEventState.mockImplementation(({ onChange }) => { - // Capture the onChange callback to simulate events - mockEvmEventStateInstance.onChangeCallback = onChange; - return mockEvmEventStateInstance; - }); - - mockNetworkConfig = { - rpcUrl: 'http://localhost:8545', - // Add other necessary config properties if your tests need them - }; - }); - - const initialConnectionInfo = { - bootstrapUrls: ['http://node1.com'], - epochInfo: { number: 1, id: 'epoch1' }, - connectedNodes: new Map([['node1', {}]]), - }; - - const updatedConnectionInfo = { - bootstrapUrls: ['http://node2.com', 'http://node3.com'], - epochInfo: { number: 2, id: 'epoch2' }, - connectedNodes: new Map([['node2', {}]]), - }; - - it('should initialize, fetch initial connection info, and start listeners', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - expect(mockGetChildLogger).toHaveBeenCalledWith({ module: 'StateManager' }); - expect(mockCreateReadOnlyChainManager).toHaveBeenCalled(); - expect(mockCreateReadOnlyContractsManager).toHaveBeenCalledWith( - mockNetworkConfig - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockCreateEvmEventState).toHaveBeenCalled(); - expect(mockEvmEventStateInstance.listen).toHaveBeenCalled(); - expect(mockLogger.info).toHaveBeenCalledWith( - 'State manager background processes started.' - ); - }); - - it('should throw an error if initial connection info fetch fails', async () => { - const error = new Error('Failed to connect'); - mockGetConnectionInfo.mockRejectedValueOnce(error); - - await expect( - createStateManager({ networkConfig: mockNetworkConfig }) - ).rejects.toThrow('Failed to initialize state manager connection info.'); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get initial connection info for State Manager', - error - ); - }); - - describe('getLatestBlockhash', () => { - it('should return blockhash from blockhashManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const mockBlockhash = '0x123abc'; - mockGetOrRefreshAndGet.mockResolvedValueOnce(mockBlockhash); - - const blockhash = await stateManager.getLatestBlockhash(); - expect(blockhash).toBe(mockBlockhash); - expect(mockGetOrRefreshAndGet).toHaveBeenCalled(); - }); - - it('should throw error if blockhashManager fails', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - const error = new Error('Blockhash fetch failed'); - mockGetOrRefreshAndGet.mockRejectedValueOnce(error); - - await expect(stateManager.getLatestBlockhash()).rejects.toThrow(error); - expect(mockLogger.error).toHaveBeenCalledWith( - 'Error getting latest blockhash', - error - ); - }); - }); - - describe('getLatestConnectionInfo', () => { - it('should return the latest connection info', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - }); - - describe('staking state changes', () => { - it('should refresh connection info, update urls and epoch when state becomes Active and data changed', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo - mockGetConnectionInfo.mockResolvedValueOnce(updatedConnectionInfo); - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); // Initial + Active state - expect(stateManager.getLatestConnectionInfo()).toEqual( - updatedConnectionInfo - ); - expect(mockLogger.warn).toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - oldUrls: initialConnectionInfo.bootstrapUrls, - newUrls: updatedConnectionInfo.bootstrapUrls, - }) - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number updated from 1 to 2' - ); - }); - - it('should refresh connection info but not log warnings if URLs and epoch are the same', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - // Ensure onChangeCallback is defined - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - // Simulate second call to getConnectionInfo returns same data - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Active"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is Active. Fetching latest connection info...' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(2); - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'BootstrapUrls remain unchanged.' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Epoch number 1 remains the same.' - ); - expect(mockLogger.warn).not.toHaveBeenCalledWith( - expect.objectContaining({ - msg: 'Bootstrap URLs changed. Updating internal state.', - }) - ); - }); - - it('should handle error when fetching connection info during Active state', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - const fetchError = new Error('Fetch connection info failed'); - mockGetConnectionInfo.mockRejectedValueOnce(fetchError); // Fail on the second call - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Active); - - expect(mockLogger.error).toHaveBeenCalledWith( - 'Failed to get connection info during staking onChange', - fetchError - ); - // Connection info should remain the initial one - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should not refresh connection info if state is not Active', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(STAKING_STATES.Paused); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'New staking state detected: "Paused"' - ); - expect(mockLogger.info).toHaveBeenCalledWith( - 'Staking state is "Paused", not Active. Connection info not refreshed via event.' - ); - expect(mockGetConnectionInfo).toHaveBeenCalledTimes(1); // Only initial call - expect(stateManager.getLatestConnectionInfo()).toEqual( - initialConnectionInfo - ); - }); - - it('should do nothing if new state is null in onChange', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - await createStateManager({ networkConfig: mockNetworkConfig }); - - if (!mockEvmEventStateInstance.onChangeCallback) { - throw new Error( - 'onChangeCallback was not set on mockEvmEventStateInstance' - ); - } - - await mockEvmEventStateInstance.onChangeCallback(null); - expect(mockLogger.info).not.toHaveBeenCalledWith( - expect.stringContaining('New staking state detected:') - ); - }); - }); - - describe('stop', () => { - it('should call stop on eventStateManager', async () => { - mockGetConnectionInfo.mockResolvedValueOnce(initialConnectionInfo); - const stateManager = await createStateManager({ - networkConfig: mockNetworkConfig, - }); - - stateManager.stop(); - - expect(mockLogger.info).toHaveBeenCalledWith( - 'Stopping state manager listeners...' - ); - expect(mockEvmEventStateInstance.stop).toHaveBeenCalled(); - }); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.spec.ts b/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.spec.ts deleted file mode 100644 index 891ae695c5..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { areStringArraysDifferent } from './areStringArraysDifferent'; - -describe('areStringArraysDifferent', () => { - it('should return false for two empty arrays', () => { - expect(areStringArraysDifferent([], [])).toBe(false); - }); - - it('should return false for two arrays with the same elements in the same order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'c'])).toBe( - false - ); - }); - - it('should return false for two arrays with the same elements in a different order', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['c', 'a', 'b'])).toBe( - false - ); - }); - - it('should return true for arrays with different lengths (first shorter)', () => { - expect(areStringArraysDifferent(['a', 'b'], ['a', 'b', 'c'])).toBe(true); - }); - - it('should return true for arrays with different lengths (first longer)', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b'])).toBe(true); - }); - - it('should return true for arrays with the same length but different elements', () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'd'])).toBe( - true - ); - }); - - it('should return true for one empty array and one non-empty array', () => { - expect(areStringArraysDifferent([], ['a', 'b', 'c'])).toBe(true); - expect(areStringArraysDifferent(['a', 'b', 'c'], [])).toBe(true); - }); - - it('should return false for arrays with duplicate elements that are otherwise the same', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['c', 'a', 'b', 'a']) - ).toBe(false); - }); - - it('should return true for arrays with duplicate elements that make them different', () => { - expect( - areStringArraysDifferent(['a', 'a', 'b', 'c'], ['a', 'b', 'b', 'c']) - ).toBe(true); - }); - - it("should return true if one array has an element the other doesn't, even if same length", () => { - expect(areStringArraysDifferent(['a', 'b', 'c'], ['a', 'b', 'x'])).toBe( - true - ); - }); - - it('should return false for identical arrays with numbers as strings', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '3'])).toBe( - false - ); - }); - - it('should return true for arrays with numbers as strings where one element differs', () => { - expect(areStringArraysDifferent(['1', '2', '3'], ['1', '2', '4'])).toBe( - true - ); - }); -}); diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.ts b/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.ts deleted file mode 100644 index 67f7ff04e0..0000000000 --- a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/helper/areStringArraysDifferent.ts +++ /dev/null @@ -1,31 +0,0 @@ -// -- Helper Function (copied from lit-node-client) -- -/** - * Compares two arrays of strings to determine if they are different. - * Two arrays are considered different if they have different lengths, - * or if they do not contain the same elements with the same frequencies, regardless of order. - * - * @param arr1 The first array of strings. - * @param arr2 The second array of strings. - * @returns True if the arrays are different, false otherwise. - */ -export const areStringArraysDifferent = ( - arr1: string[], - arr2: string[] -): boolean => { - if (arr1.length !== arr2.length) { - return true; - } - - // Create sorted copies of the arrays - const sortedArr1 = [...arr1].sort(); - const sortedArr2 = [...arr2].sort(); - - // Compare the sorted arrays element by element - for (let i = 0; i < sortedArr1.length; i++) { - if (sortedArr1[i] !== sortedArr2[i]) { - return true; // Found a difference - } - } - - return false; // Arrays are permutations of each other (same elements, same frequencies) -}; diff --git a/packages/networks/src/networks/vNaga/index.ts b/packages/networks/src/networks/vNaga/index.ts index 8f3bd2bfae..7cbd9f11a6 100644 --- a/packages/networks/src/networks/vNaga/index.ts +++ b/packages/networks/src/networks/vNaga/index.ts @@ -1,15 +1,15 @@ // Naga Local export { nagaLocal } from './envs/naga-local'; -export type { NagaLocalModule } from './envs/naga-local/naga-local.module'; +export type { NagaLocal as NagaLocalModule } from './envs/naga-local/naga-local.module'; // Naga Dev export { nagaDev } from './envs/naga-dev'; -export type { NagaDevModule } from './envs/naga-dev/naga-dev.module'; +export type { NagaDevUnifiedModule as NagaDevModule } from './envs/naga-dev/naga-dev.module'; // Naga Test export { nagaTest } from './envs/naga-test'; -export type { NagaTestModule } from './envs/naga-test/naga-test.module'; +export type { NagaTest as NagaTestModule } from './envs/naga-test/naga-test.module'; // Naga Staging export { nagaStaging } from './envs/naga-staging'; -export type { NagaStagingModule } from './envs/naga-staging/naga-staging.module'; +export type { NagaStaging as NagaStagingModule } from './envs/naga-staging/naga-staging.module'; diff --git a/packages/networks/src/networks/vNaga/shared/factories/BaseChainManagerFactory.ts b/packages/networks/src/networks/vNaga/shared/factories/BaseChainManagerFactory.ts new file mode 100644 index 0000000000..68c7d54bae --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/factories/BaseChainManagerFactory.ts @@ -0,0 +1,166 @@ +import { privateKeyToAccount } from 'viem/accounts'; +import { api } from '../managers/LitChainClient'; +import { getPKPsByAddress } from '../managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress'; +import { PkpIdentifierRaw } from '../managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; +import type { ExpectedAccountOrWalletClient } from '../managers/contract-manager/createContractsManager'; +import { + DefaultNetworkConfig, + INetworkConfig, +} from '../interfaces/NetworkContext'; +import type { PKPStorageProvider } from '../../../../storage/types'; +import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; + +export type CreateChainManagerReturn = { + api: { + mintWithEoa: ( + req?: Parameters[0] + ) => ReturnType; + mintPKP: ( + req: Parameters[0] + ) => ReturnType; + mintWithMultiAuths: ( + req: Parameters[0] + ) => ReturnType; + pkpPermissionsManager: ( + pkpIdentifier: PkpIdentifierRaw + ) => InstanceType; + paymentManager: () => InstanceType; + getPKPsByAuthData: ( + authData: { + authMethodType: number | bigint; + authMethodId: string; + accessToken?: string; + }, + pagination?: { limit?: number; offset?: number }, + storageProvider?: PKPStorageProvider + ) => ReturnType; + getPKPsByAddress: (params: { + ownerAddress: string; + pagination?: { limit?: number; offset?: number }; + storageProvider?: PKPStorageProvider; + }) => ReturnType; + pricing: { + getPriceFeedInfo: ( + req: Parameters[0] + ) => ReturnType; + getNodePrices: ( + req: Parameters[0] + ) => ReturnType; + }; + connection: { + getConnectionInfo: (args?: { + nodeProtocol?: string | null; + }) => ReturnType; + }; + }; +}; + +/** + * Factory function that creates a chain manager for any environment + * This eliminates code duplication by providing a single implementation + * that can be configured with different network configurations + */ +export const createChainManagerFactory = ( + networkConfig: INetworkConfig, + accountOrWalletClient: ExpectedAccountOrWalletClient +): CreateChainManagerReturn => { + const _networkConfig = networkConfig as unknown as DefaultNetworkConfig; + + // Helper to bind the network context to an API function + const bindContext = ( + fn: ( + req: ReqArgType, + ctx: DefaultNetworkConfig, + accountOrWalletClient: ExpectedAccountOrWalletClient + ) => RetType + ) => { + return (req: ReqArgType): RetType => + fn(req, _networkConfig, accountOrWalletClient); + }; + + return { + api: { + mintWithEoa: bindContext(api.mintWithEoa), + mintPKP: bindContext(api.mintPKP), + mintWithMultiAuths: bindContext(api.mintWithMultiAuths), + pkpPermissionsManager: (pkpIdentifier: PkpIdentifierRaw) => { + return new api.PKPPermissionsManager( + pkpIdentifier, + _networkConfig, + accountOrWalletClient + ); + }, + paymentManager: () => { + return new api.PaymentManager(_networkConfig, accountOrWalletClient); + }, + getPKPsByAuthData: ( + authData: { + authMethodType: number | bigint; + authMethodId: string; + accessToken?: string; + }, + pagination?: { limit?: number; offset?: number }, + storageProvider?: PKPStorageProvider + ) => { + return api.PKPPermissionsManager.getPKPsByAuthData( + authData, + pagination, + storageProvider, + _networkConfig, + accountOrWalletClient + ); + }, + getPKPsByAddress: (params: { + ownerAddress: string; + pagination?: { limit?: number; offset?: number }; + storageProvider?: PKPStorageProvider; + }) => { + // Provide default pagination if not provided + const defaultPagination = { limit: 10, offset: 0 }; + const finalPagination = params.pagination + ? { + limit: params.pagination.limit ?? defaultPagination.limit, + offset: params.pagination.offset ?? defaultPagination.offset, + } + : defaultPagination; + + return getPKPsByAddress( + { + ownerAddress: params.ownerAddress, + pagination: finalPagination, + storageProvider: params.storageProvider, + }, + _networkConfig, + accountOrWalletClient + ); + }, + pricing: { + getPriceFeedInfo: bindContext(api.pricing.getPriceFeedInfo), + getNodePrices: bindContext(api.pricing.getNodePrices), + }, + connection: { + getConnectionInfo: (args?: { + nodeProtocol?: string | null; + }): ReturnType => { + return api.connection.getConnectionInfo({ + networkCtx: _networkConfig, + accountOrWalletClient: accountOrWalletClient, + nodeProtocol: args?.nodeProtocol, + }); + }, + }, + }, + }; +}; + +/** + * Creates a read-only chain manager using the factory pattern + * This is used for operations that don't require a specific user account + */ +export const createReadOnlyChainManagerFactory = (networkConfig: any) => { + return () => { + // dummy private key for read actions + const dummyAccount = privateKeyToAccount(DEV_PRIVATE_KEY); + return createChainManagerFactory(networkConfig, dummyAccount); + }; +}; diff --git a/packages/networks/src/networks/vNaga/shared/factories/BaseModuleFactory.ts b/packages/networks/src/networks/vNaga/shared/factories/BaseModuleFactory.ts new file mode 100644 index 0000000000..cfb1a5f9e1 --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/factories/BaseModuleFactory.ts @@ -0,0 +1,1088 @@ +import { DEV_PRIVATE_KEY, version } from '@lit-protocol/constants'; +import { verifyAndDecryptWithSignatureShares } from '@lit-protocol/crypto'; +import { + AuthData, + EncryptedVersion1Schema, + GenericEncryptedPayloadSchema, + GenericResultBuilder, + HexPrefixedSchema, + JsonSignCustomSessionKeyRequestForPkpReturnSchema, + JsonSignSessionKeyRequestForPkpReturnSchema, +} from '@lit-protocol/schemas'; +import { Hex, hexToBytes, stringToBytes } from 'viem'; +import { z } from 'zod'; + +// Base types +import { LitNetworkModuleBase } from '../../../types'; +import type { ExpectedAccountOrWalletClient } from '../managers/contract-manager/createContractsManager'; +import type { INetworkConfig } from '../interfaces/NetworkContext'; + +// Shared utilities +import { NetworkError } from '@lit-protocol/constants'; +import { + combineSignatureShares, + mostCommonString, + normalizeAndStringify, + ReleaseVerificationConfig, +} from '@lit-protocol/crypto'; +import { getChildLogger } from '@lit-protocol/logger'; +import { + AuthMethod, + AuthSig, + CallbackParams, + KeySet, + LitActionResponseStrategy, + NagaJitContext, + NodeAttestation, + Optional, + OrchestrateHandshakeResponse, + RequestItem, +} from '@lit-protocol/types'; +import { ethers } from 'ethers'; +import { computeAddress } from 'ethers/lib/utils'; +import { nacl } from '@lit-protocol/nacl'; +import type { PKPStorageProvider } from '../../../../storage/types'; + +// Shared managers and utilities +import { createRequestId } from '../helpers/createRequestId'; +import { handleAuthServerRequest } from '../../../shared/helpers/handleAuthServerRequest'; +import { composeLitUrl } from '../managers/endpoints-manager/composeLitUrl'; +import { + getNodePrices, + PKPPermissionsManager, +} from '../managers/LitChainClient/apis/highLevelApis'; +import { PaymentManager } from '../managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager'; +import { MintWithMultiAuthsRequest } from '../managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths'; +import { PkpIdentifierRaw } from '../managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId'; +import type { + GenericTxRes, + LitTxRes, +} from '../managers/LitChainClient/apis/types'; +import type { PKPData } from '../managers/LitChainClient/schemas/shared/PKPDataSchema'; +import { ConnectionInfo } from '../managers/LitChainClient/types'; +import { privateKeyToAccount } from 'viem/accounts'; + +// Shared API components +import { E2EERequestManager } from '../managers/api-manager/e2ee-request-manager/E2EERequestManager'; +import { PricingContextSchema } from '../managers/pricing-manager/schema'; +import { issueSessionFromContext } from '../managers/session-manager/issueSessionFromContext'; +import { createStateManager } from '../managers/state-manager/createStateManager'; +import { getMaxPricesForNodeProduct } from '../managers/pricing-manager/getMaxPricesForNodeProduct'; +import { getUserMaxPrice } from '../managers/pricing-manager/getUserMaxPrice'; +import { combinePKPSignSignatures } from '../managers/api-manager/helper/get-signatures'; + +// Shared schemas - import from shared location +import { DecryptCreateRequestParams } from '../managers/api-manager/decrypt/decrypt.CreateRequestParams'; +import { DecryptInputSchema } from '../managers/api-manager/decrypt/decrypt.InputSchema'; +import { DecryptRequestDataSchema } from '../managers/api-manager/decrypt/decrypt.RequestDataSchema'; +import { DecryptResponseDataSchema } from '../managers/api-manager/decrypt/decrypt.ResponseDataSchema'; + +import { ExecuteJsCreateRequestParams } from '../managers/api-manager/executeJs/executeJs.CreateRequestParams'; +import { ExecuteJsInputSchema } from '../managers/api-manager/executeJs/executeJs.InputSchema'; +import { ExecuteJsRequestDataSchema } from '../managers/api-manager/executeJs/executeJs.RequestDataSchema'; +import { ExecuteJsResponseDataSchema } from '../managers/api-manager/executeJs/executeJs.ResponseDataSchema'; +import { handleResponse as handleExecuteJsResponse } from '../managers/api-manager/executeJs'; + +import { PKPSignCreateRequestParams } from '../managers/api-manager/pkpSign/pkpSign.CreateRequestParams'; +import { + BitCoinPKPSignInputSchema, + EthereumPKPSignInputSchema, + PKPSignInputSchema, +} from '../managers/api-manager/pkpSign/pkpSign.InputSchema'; +import { PKPSignRequestDataSchema } from '../managers/api-manager/pkpSign/pkpSign.RequestDataSchema'; +import { PKPSignResponseDataSchema } from '../managers/api-manager/pkpSign/pkpSign.ResponseDataSchema'; +import { RawHandshakeResponseSchema } from '../managers/api-manager/handshake/handshake.schema'; + +// Configuration interface for environment-specific settings +export interface BaseModuleConfig { + networkConfig: INetworkConfig; + moduleName: string; + createChainManager: (account: ExpectedAccountOrWalletClient) => any; + verifyReleaseId?: ( + attestation: NodeAttestation, + config: ReleaseVerificationConfig + ) => Promise; +} + +// Release verification constants and types +// interface ReleaseInfo { +// status: number; +// env: number; +// typ: number; +// platform: number; +// options: { asU32: () => number }; +// publicKey: Uint8Array; +// idKeyDigest: Uint8Array; +// } + +enum ReleaseStatus { + Null = 0, + Active = 1, + Inactive = 2, +} + +const RELEASE_REGISTER_ABI = [ + { + inputs: [], + name: 'RELEASE_REGISTER_CONTRACT', + outputs: [ + { + internalType: 'bytes32', + name: '', + type: 'bytes32', + }, + ], + stateMutability: 'view', + type: 'function', + }, +]; + +// Utility functions for release verification +function extractReleaseId(attestation: NodeAttestation): string { + const releaseId = attestation.data.RELEASE_ID; + if (!releaseId) { + throw new NetworkError( + { info: { attestation } }, + 'Missing RELEASE_ID in attestation data' + ); + } + return Buffer.from(releaseId, 'base64').toString('utf8'); +} + +function getSubnetIdFromReleaseId(releaseId: string): string { + const parts = releaseId.split('-'); + if (parts.length < 2) { + throw new NetworkError( + { info: { releaseId } }, + 'Invalid release ID format' + ); + } + return parts[0]; +} + +function padReleaseIdToBytes32(releaseId: string): string { + const releaseIdBuffer = Buffer.from(releaseId, 'utf8'); + if (releaseIdBuffer.length > 32) { + throw new NetworkError( + { info: { releaseId } }, + 'Release ID too long for bytes32' + ); + } + const paddedBuffer = Buffer.alloc(32); + releaseIdBuffer.copy(paddedBuffer); + return ethers.utils.hexlify(paddedBuffer); +} + +// Default release verification implementation +const defaultVerifyReleaseId = async ( + attestation: NodeAttestation, + config: ReleaseVerificationConfig +): Promise => { + const releaseId = extractReleaseId(attestation); + + if (releaseId.length !== 64) { + throw new NetworkError( + { + info: { releaseId, expectedLength: 64, actualLength: releaseId.length }, + }, + `Release ID length is incorrect: expected 64, got ${releaseId.length}` + ); + } + + const releaseSubnetId = getSubnetIdFromReleaseId(releaseId); + if (releaseSubnetId !== config.subnetId) { + throw new NetworkError( + { info: { releaseSubnetId, expectedSubnetId: config.subnetId } }, + `Subnet ID mismatch: expected ${config.subnetId}, got ${releaseSubnetId}` + ); + } + + const provider = new ethers.providers.JsonRpcProvider(config.rpcUrl); + const contract = new ethers.Contract( + config.releaseRegisterContractAddress, + RELEASE_REGISTER_ABI, + provider + ); + + const releaseIdPadded = padReleaseIdToBytes32(releaseId); + + try { + const release = await contract['getReleaseByIdAndSubnetId']( + config.subnetId, + releaseIdPadded + ); + + if (release.status !== ReleaseStatus.Active) { + throw new NetworkError( + { info: { releaseId, status: release.status } }, + `Release is not active: status ${release.status}` + ); + } + + if (release.env !== config.environment) { + throw new NetworkError( + { + info: { + releaseId, + releaseEnv: release.env, + expectedEnv: config.environment, + }, + }, + `Environment mismatch: expected ${config.environment}, got ${release.env}` + ); + } + } catch (error: any) { + if (error.code === 'CALL_EXCEPTION') { + throw new NetworkError( + { + info: { + releaseId, + contractAddress: config.releaseRegisterContractAddress, + }, + }, + `Release ID ${releaseId} not found on chain` + ); + } + throw error; + } +}; + +// Type for processed batch results +type ProcessedBatchResult = + | { success: true; values: T[] } + | { success: false; error: any; failedNodeUrls?: string[] }; + +/** + * Factory function that creates a complete network module for any environment + * This eliminates code duplication by providing a single implementation + * that can be configured for different environments + */ +export function createBaseModule(config: BaseModuleConfig) { + const { networkConfig, moduleName, createChainManager } = config; + const _logger = getChildLogger({ module: `${moduleName}-module` }); + + // Store response strategy for executeJs requests + let executeJsResponseStrategy: LitActionResponseStrategy | undefined; + + // Create the base module object with all shared functionality + const baseModule = { + id: 'naga', + version: `${version}-${moduleName}`, + config: { + requiredAttestation: networkConfig.requiredAttestation, + abortTimeout: 20_000, + minimumThreshold: networkConfig.minimumThreshold, + httpProtocol: networkConfig.httpProtocol, + }, + schemas: { + GenericResponseSchema: GenericResultBuilder, + }, + + // Basic getters - all environments need these + getNetworkName: () => networkConfig.network, + getHttpProtocol: () => networkConfig.httpProtocol, + getEndpoints: () => networkConfig.endpoints, + getRpcUrl: () => networkConfig.rpcUrl, + getChainConfig: () => networkConfig.chainConfig, + getDefaultAuthServiceBaseUrl: () => + networkConfig.services.authServiceBaseUrl, + getDefaultLoginBaseUrl: () => networkConfig.services.loginServiceBaseUrl, + getMinimumThreshold: () => networkConfig.minimumThreshold, + + // State management - shared implementation + createStateManager: async (params: { + callback: (params: CallbackParams) => Promise; + networkModule: ModuleT; + }): Promise>>> => { + const createReadOnlyChainManager = () => { + const dummyAccount = privateKeyToAccount(DEV_PRIVATE_KEY); + return createChainManager(dummyAccount); + }; + + return await createStateManager({ + networkConfig, + callback: params.callback, + networkModule: params.networkModule as LitNetworkModuleBase, + createReadOnlyChainManager, + }); + }, + + // Pricing - shared implementation + getMaxPricesForNodeProduct: getMaxPricesForNodeProduct, + getUserMaxPrice: getUserMaxPrice, + getVerifyReleaseId: () => config.verifyReleaseId || defaultVerifyReleaseId, + + // Chain API - shared implementation with environment-specific chain manager + chainApi: { + getPKPPermissionsManager: async (params: { + pkpIdentifier: PkpIdentifierRaw; + account: ExpectedAccountOrWalletClient; + }): Promise => { + const chainManager = createChainManager(params.account); + return chainManager.api.pkpPermissionsManager(params.pkpIdentifier); + }, + + getPaymentManager: async (params: { + account: ExpectedAccountOrWalletClient; + }): Promise => { + const chainManager = createChainManager(params.account); + return chainManager.api.paymentManager(); + }, + + getPKPsByAuthData: async (params: { + authData: { + authMethodType: number | bigint; + authMethodId: string; + accessToken?: string; + }; + pagination?: { limit?: number; offset?: number }; + storageProvider?: PKPStorageProvider; + account: ExpectedAccountOrWalletClient; + }) => { + const chainManager = createChainManager(params.account); + return chainManager.api.getPKPsByAuthData( + params.authData, + params.pagination, + params.storageProvider + ); + }, + + getPKPsByAddress: async (params: { + ownerAddress: string; + pagination?: { limit?: number; offset?: number }; + storageProvider?: PKPStorageProvider; + account: ExpectedAccountOrWalletClient; + }) => { + const chainManager = createChainManager(params.account); + return chainManager.api.getPKPsByAddress({ + ownerAddress: params.ownerAddress, + pagination: params.pagination, + storageProvider: params.storageProvider, + }); + }, + + mintWithEoa: async (params: { + account: ExpectedAccountOrWalletClient; + }): Promise, PKPData>> => { + const chainManager = createChainManager(params.account); + const res = await chainManager.api.mintWithEoa(); + return { + _raw: res, + txHash: res.hash, + data: res.data, + }; + }, + + mintWithAuth: async (params: { + account: ExpectedAccountOrWalletClient; + authData: Optional; + scopes: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; + }): Promise, PKPData>> => { + const chainManager = createChainManager(params.account); + const res = await chainManager.api.mintPKP({ + scopes: params.scopes, + authMethodId: params.authData.authMethodId, + authMethodType: params.authData.authMethodType, + pubkey: params.authData.publicKey, + }); + return { + _raw: res, + txHash: res.hash, + data: res.data, + }; + }, + + mintWithMultiAuths: async ( + params: { + account: ExpectedAccountOrWalletClient; + } & MintWithMultiAuthsRequest + ): Promise, PKPData>> => { + const chainManager = createChainManager(params.account); + const res = await chainManager.api.mintWithMultiAuths({ + authMethodIds: params.authMethodIds, + authMethodTypes: params.authMethodTypes, + authMethodScopes: params.authMethodScopes, + pubkeys: params.pubkeys, + addPkpEthAddressAsPermittedAddress: + params.addPkpEthAddressAsPermittedAddress, + sendPkpToItself: params.sendPkpToItself, + }); + return { + _raw: res, + txHash: res.hash, + data: res.data, + }; + }, + }, + + // Auth service - shared implementation + authService: { + pkpMint: async (params: { + authData: AuthData; + authServiceBaseUrl?: string; + scopes?: ('sign-anything' | 'personal-sign' | 'no-permissions')[]; + }) => { + return await handleAuthServerRequest({ + jobName: 'PKP Minting', + serverUrl: + params.authServiceBaseUrl || + networkConfig.services.authServiceBaseUrl, + path: '/pkp/mint', + body: { + authMethodType: params.authData.authMethodType, + authMethodId: params.authData.authMethodId, + pubkey: params.authData.publicKey, + scopes: params.scopes, + }, + }); + }, + }, + + // Main API implementation - all shared + api: { + /** + * Creates JIT context for network operations + */ + createJitContext: async ( + connectionInfo: ConnectionInfo, + handshakeResult: OrchestrateHandshakeResponse + ): Promise => { + const keySet: KeySet = {}; + + for (const url of connectionInfo.bootstrapUrls) { + keySet[url] = { + publicKey: hexToBytes( + HexPrefixedSchema.parse( + handshakeResult.serverKeys[url].nodeIdentityKey + ) as `0x${string}` + ), + secretKey: nacl.box.keyPair().secretKey, + }; + } + + // Use read-only account for viewing PKPs + const account = privateKeyToAccount(DEV_PRIVATE_KEY); + + // Fetch the price feed info + const nodePrices = await getNodePrices( + { + realmId: 1, + networkCtx: networkConfig, + }, + account + ); + + return { keySet, nodePrices }; + }, + + /** + * Handshake API + */ + handshake: { + schemas: { + Input: { + ResponseData: RawHandshakeResponseSchema, + }, + }, + }, + + /** + * PKP Sign API - shared implementation + */ + pkpSign: { + schemas: { + Input: { + raw: PKPSignInputSchema, + ethereum: EthereumPKPSignInputSchema, + bitcoin: BitCoinPKPSignInputSchema, + }, + RequestData: PKPSignRequestDataSchema, + ResponseData: PKPSignResponseDataSchema, + }, + createRequest: async ( + params: PKPSignCreateRequestParams + ): Promise>[]> => { + _logger.info('pkpSign:createRequest: Creating request', { params }); + + // Generate session sigs + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + _logger.info('pkpSign:createRequest: Session sigs generated'); + + // Generate requests + const _requestId = createRequestId(); + const requests: RequestItem< + z.infer + >[] = []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + _logger.info('pkpSign:createRequest: Generating request data', { + url, + }); + + const _requestData = PKPSignRequestDataSchema.parse({ + toSign: Array.from(params.signingContext.toSign), + signingScheme: params.signingContext.signingScheme, + pubkey: params.signingContext.pubKey, + authSig: sessionSigs[url], + nodeSet: urls, + chain: params.chain, + bypassAutoHashing: params.signingContext.bypassAutoHashing, + epoch: params.connectionInfo.epochState.currentNumber, + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: baseModule.getEndpoints().PKP_SIGN, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + if (!requests || requests.length === 0) { + throw new Error('Failed to generate requests for pkpSign.'); + } + + return requests; + }, + handleResponse: async ( + result: z.infer, + requestId: string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'PKP Sign' + ); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const pkpSignData = decryptedJson.data; + if (!pkpSignData) { + throw new Error('Decrypted response missing data field'); + } + + const wrappedData = { + success: pkpSignData.success, + values: [pkpSignData], + }; + + const responseData = PKPSignResponseDataSchema.parse(wrappedData); + return responseData.values[0]; + } + ); + + const signatures = await combinePKPSignSignatures({ + nodesPkpSignResponseData: decryptedValues, + requestId, + threshold: networkConfig.minimumThreshold, + }); + + return signatures; + }, + }, + + /** + * Decrypt API - shared implementation + */ + decrypt: { + schemas: { + Input: DecryptInputSchema, + RequestData: DecryptRequestDataSchema, + ResponseData: DecryptResponseDataSchema, + }, + createRequest: async (params: DecryptCreateRequestParams) => { + _logger.info('decrypt:createRequest: Creating request', { params }); + + // Generate session sigs for decrypt + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + _logger.info('decrypt:createRequest: Session sigs generated'); + + // Generate requests + const _requestId = createRequestId(); + const requests: RequestItem< + z.infer + >[] = []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + const _requestData = DecryptRequestDataSchema.parse({ + ciphertext: params.ciphertext, + dataToEncryptHash: params.dataToEncryptHash, + accessControlConditions: params.accessControlConditions, + evmContractConditions: params.evmContractConditions, + solRpcConditions: params.solRpcConditions, + unifiedAccessControlConditions: + params.unifiedAccessControlConditions, + authSig: sessionSigs[url], + chain: params.chain, + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: baseModule.getEndpoints().ENCRYPTION_SIGN, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + return requests; + }, + handleResponse: async ( + result: z.infer, + requestId: string, + identityParam: string, + ciphertext: string, + subnetPubKey: string, + jitContext: NagaJitContext + ) => { + _logger.info('decrypt:handleResponse: Processing decrypt response', { + requestId, + }); + + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'Decryption' + ); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const decryptData = decryptedJson.data; + if (!decryptData) { + throw new Error('Decrypted response missing data field'); + } + const responseData = DecryptResponseDataSchema.parse(decryptData); + return responseData; + } + ); + + // Extract signature shares from decrypted node responses + const signatureShares = decryptedValues.map((nodeResponse: any) => { + return { + ProofOfPossession: { + identifier: + nodeResponse.signatureShare.ProofOfPossession.identifier, + value: nodeResponse.signatureShare.ProofOfPossession.value, + }, + }; + }); + + // Verify and decrypt using signature shares + const decryptedData = await verifyAndDecryptWithSignatureShares( + subnetPubKey, + stringToBytes(identityParam), + ciphertext, + signatureShares + ); + + return { decryptedData }; + }, + }, + + /** + * Session Key Signing APIs - shared implementation + */ + signSessionKey: { + schemas: {}, + createRequest: async ( + requestBody: z.infer< + typeof JsonSignSessionKeyRequestForPkpReturnSchema + >, + httpProtocol: 'http://' | 'https://', + version: string, + jitContext: NagaJitContext + ) => { + const nodeUrls = requestBody.nodeSet.map( + (node) => `${httpProtocol}${node.socketAddress}` + ); + + const authMethod = { + authMethodType: requestBody.authData.authMethodType, + accessToken: requestBody.authData.accessToken, + } as AuthMethod; + + const requests: RequestItem< + z.infer + >[] = []; + const _requestId = createRequestId(); + + for (const url of nodeUrls) { + const _requestData = { + sessionKey: requestBody.sessionKey, + authMethods: [authMethod], + pkpPublicKey: requestBody.pkpPublicKey, + siweMessage: requestBody.siweMessage, + curveType: 'BLS' as const, + epoch: requestBody.epoch, + nodeSet: requestBody.nodeSet, + maxPrice: getUserMaxPrice({ + product: 'SIGN_SESSION_KEY', + }).toString(), + }; + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: baseModule.getEndpoints().SIGN_SESSION_KEY, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: requestBody.epoch, + version: version, + }); + } + + return requests; + }, + handleResponse: async ( + result: z.infer, + pkpPublicKey: Hex | string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'Session key signing' + ); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const signSessionKeyData = decryptedJson.data; + if (!signSessionKeyData) { + throw new Error('Decrypted response missing data field'); + } + return signSessionKeyData; + } + ); + + const values = decryptedValues; + const signatureShares = values.map((s) => ({ + ProofOfPossession: { + identifier: s.signatureShare.ProofOfPossession.identifier, + value: s.signatureShare.ProofOfPossession.value, + }, + })); + + const blsCombinedSignature = await combineSignatureShares( + signatureShares + ); + const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); + const mostCommonSiweMessage = mostCommonString( + values.map((s) => s.siweMessage) + ); + const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); + + const authSig: AuthSig = { + sig: JSON.stringify({ ProofOfPossession: blsCombinedSignature }), + algo: 'LIT_BLS', + derivedVia: 'lit.bls', + signedMessage, + address: computeAddress(_pkpPublicKey), + }; + + return authSig; + }, + }, + + signCustomSessionKey: { + schemas: {}, + createRequest: async ( + requestBody: z.infer< + typeof JsonSignCustomSessionKeyRequestForPkpReturnSchema + >, + httpProtocol: 'http://' | 'https://', + version: string, + jitContext: NagaJitContext + ) => { + const nodeUrls = requestBody.nodeSet.map( + (node) => `${httpProtocol}${node.socketAddress}` + ); + + const requests: RequestItem< + z.infer + >[] = []; + const _requestId = createRequestId(); + + for (const url of nodeUrls) { + const _requestData = { + sessionKey: requestBody.sessionKey, + authMethods: [], + pkpPublicKey: requestBody.pkpPublicKey, + siweMessage: requestBody.siweMessage, + curveType: 'BLS' as const, + epoch: requestBody.epoch, + nodeSet: requestBody.nodeSet, + litActionCode: requestBody.litActionCode, + litActionIpfsId: requestBody.litActionIpfsId, + jsParams: requestBody.jsParams, + }; + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: baseModule.getEndpoints().SIGN_SESSION_KEY, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: requestBody.epoch, + version: version, + }); + } + + return requests; + }, + handleResponse: async ( + result: z.infer, + pkpPublicKey: Hex | string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'Session key signing' + ); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const signCustomSessionKeyData = decryptedJson.data; + if (!signCustomSessionKeyData) { + throw new Error('Decrypted response missing data field'); + } + return signCustomSessionKeyData; + } + ); + + const values = decryptedValues; + const signatureShares = values.map((s) => ({ + ProofOfPossession: { + identifier: s.signatureShare.ProofOfPossession.identifier, + value: s.signatureShare.ProofOfPossession.value, + }, + })); + + const blsCombinedSignature = await combineSignatureShares( + signatureShares + ); + const _pkpPublicKey = HexPrefixedSchema.parse(pkpPublicKey); + const mostCommonSiweMessage = mostCommonString( + values.map((s) => s.siweMessage) + ); + const signedMessage = normalizeAndStringify(mostCommonSiweMessage!); + + const authSig: AuthSig = { + sig: JSON.stringify({ ProofOfPossession: blsCombinedSignature }), + algo: 'LIT_BLS', + derivedVia: 'lit.bls', + signedMessage, + address: computeAddress(_pkpPublicKey), + }; + + return authSig; + }, + }, + + /** + * Execute JS API - shared implementation + */ + executeJs: { + schemas: { + Input: ExecuteJsInputSchema, + RequestData: ExecuteJsRequestDataSchema, + ResponseData: ExecuteJsResponseDataSchema, + }, + createRequest: async (params: ExecuteJsCreateRequestParams) => { + _logger.info('executeJs:createRequest: Creating request', { + hasCode: !!params.executionContext.code, + hasIpfsId: !!params.executionContext.ipfsId, + hasJsParams: !!params.executionContext.jsParams, + responseStrategy: params.responseStrategy?.strategy || 'default', + }); + + // Store response strategy for later use in handleResponse + executeJsResponseStrategy = params.responseStrategy; + + // Generate session sigs + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + // Generate requests + const _requestId = createRequestId(); + const requests: RequestItem< + z.infer + >[] = []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + // Base64 encode the code if provided + let encodedCode: string | undefined; + if (params.executionContext.code) { + encodedCode = Buffer.from( + params.executionContext.code, + 'utf-8' + ).toString('base64'); + } + + const _requestData = ExecuteJsRequestDataSchema.parse({ + authSig: sessionSigs[url], + nodeSet: urls, + ...(encodedCode && { code: encodedCode }), + ...(params.executionContext.ipfsId && { + ipfsId: params.executionContext.ipfsId, + }), + ...(params.executionContext.jsParams && { + jsParams: { jsParams: params.executionContext.jsParams }, + }), + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: baseModule.getEndpoints().EXECUTE_JS, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + return requests; + }, + handleResponse: async ( + result: z.infer, + requestId: string, + jitContext: NagaJitContext + ) => { + _logger.info( + 'executeJs:handleResponse: Processing executeJs response', + { + requestId, + responseStrategy: + executeJsResponseStrategy?.strategy || 'default', + } + ); + + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'JS execution' + ); + } + + const decryptedResponseValues = + E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const executeJsData = decryptedJson.data; + if (!executeJsData) { + throw new Error('Decrypted response missing data field'); + } + return executeJsData; + } + ); + + const batchResponseData = { + success: true, + values: decryptedResponseValues, + }; + + const correctProcessedResult: ProcessedBatchResult< + z.infer + > = { + success: true as const, + values: [batchResponseData], + }; + + const executeJsResponse = await handleExecuteJsResponse( + correctProcessedResult, + requestId, + networkConfig.minimumThreshold, + executeJsResponseStrategy + ); + + return executeJsResponse; + }, + }, + }, + }; + + return baseModule; +} diff --git a/packages/networks/src/networks/vNaga/shared/helpers/createRequestId.ts b/packages/networks/src/networks/vNaga/shared/helpers/createRequestId.ts new file mode 100644 index 0000000000..d38ed1428a --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/helpers/createRequestId.ts @@ -0,0 +1,6 @@ +/** + * Creates a unique request ID for tracking requests + */ +export function createRequestId(): string { + return `lit_${Date.now()}_${Math.random().toString(36).substring(2, 15)}`; +} diff --git a/packages/networks/src/networks/vNaga/shared/index.ts b/packages/networks/src/networks/vNaga/shared/index.ts new file mode 100644 index 0000000000..7f36044ec6 --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/index.ts @@ -0,0 +1,43 @@ +// API Manager exports +export * from './managers/api-manager/types'; +export { E2EERequestManager } from './managers/api-manager/e2ee-request-manager/E2EERequestManager'; + +// Schema exports +export { DecryptInputSchema } from './managers/api-manager/decrypt/decrypt.InputSchema'; +export { DecryptRequestDataSchema } from './managers/api-manager/decrypt/decrypt.RequestDataSchema'; +export { DecryptResponseDataSchema } from './managers/api-manager/decrypt/decrypt.ResponseDataSchema'; +export type { DecryptCreateRequestParams } from './managers/api-manager/decrypt/decrypt.CreateRequestParams'; + +export { ExecuteJsInputSchema } from './managers/api-manager/executeJs/executeJs.InputSchema'; +export { ExecuteJsRequestDataSchema } from './managers/api-manager/executeJs/executeJs.RequestDataSchema'; +export { ExecuteJsResponseDataSchema } from './managers/api-manager/executeJs/executeJs.ResponseDataSchema'; +export type { ExecuteJsCreateRequestParams } from './managers/api-manager/executeJs/executeJs.CreateRequestParams'; + +export { + PKPSignInputSchema, + EthereumPKPSignInputSchema, + BitCoinPKPSignInputSchema, +} from './managers/api-manager/pkpSign/pkpSign.InputSchema'; +export { PKPSignRequestDataSchema } from './managers/api-manager/pkpSign/pkpSign.RequestDataSchema'; +export { PKPSignResponseDataSchema } from './managers/api-manager/pkpSign/pkpSign.ResponseDataSchema'; +export type { PKPSignCreateRequestParams } from './managers/api-manager/pkpSign/pkpSign.CreateRequestParams'; + +export { RawHandshakeResponseSchema } from './managers/api-manager/handshake/handshake.schema'; + +// Helper exports +export { combinePKPSignSignatures } from './managers/api-manager/helper/get-signatures'; + +// Pricing Manager exports +export { PricingContextSchema } from './managers/pricing-manager/schema'; +export { getMaxPricesForNodeProduct } from './managers/pricing-manager/getMaxPricesForNodeProduct'; +export { getUserMaxPrice } from './managers/pricing-manager/getUserMaxPrice'; + +// Session Manager exports +export { AuthContextSchema } from './managers/session-manager/AuthContextSchema'; +export { issueSessionFromContext } from './managers/session-manager/issueSessionFromContext'; + +// State Manager exports +export { createStateManager } from './managers/state-manager/createStateManager'; + +// Shared types +export * from './types'; diff --git a/packages/networks/src/networks/vNaga/interfaces/NetworkContext.ts b/packages/networks/src/networks/vNaga/shared/interfaces/NetworkContext.ts similarity index 76% rename from packages/networks/src/networks/vNaga/interfaces/NetworkContext.ts rename to packages/networks/src/networks/vNaga/shared/interfaces/NetworkContext.ts index 27c381b93d..d1a4c6391d 100644 --- a/packages/networks/src/networks/vNaga/interfaces/NetworkContext.ts +++ b/packages/networks/src/networks/vNaga/shared/interfaces/NetworkContext.ts @@ -1,6 +1,6 @@ import { Chain } from 'viem'; -import { NagaEndpointsType } from '../endpoints-manager/endpoints'; -import { signatures as localDevSignatures } from '../envs/naga-local/generated/naga-develop'; +import { NagaEndpointsType } from '../managers/endpoints-manager/endpoints'; +import { signatures as localDevSignatures } from '../../envs/naga-local/generated/naga-develop'; const HTTP = 'http://' as const; const HTTPS = 'https://' as const; @@ -20,6 +20,7 @@ export interface INetworkConfig { authServiceBaseUrl: string; loginServiceBaseUrl: string; }; + requiredAttestation: boolean; } // TODO: we should use a stablised network config as the default network config diff --git a/packages/networks/src/networks/vNaga/LitChainClient/README.md b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/README.md similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/README.md rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/README.md diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.test.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts similarity index 98% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts index d037c57d80..b76d0b7512 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/PKPPermissionsManager.ts @@ -53,10 +53,10 @@ import { removePermittedAddressByIdentifier } from './handlers/removePermittedAd import { removePermittedAuthMethodByIdentifier } from './handlers/removePermittedAuthMethodByIdentifier'; import { removePermittedAuthMethodScopeByIdentifier } from './handlers/removePermittedAuthMethodScopeByIdentifier'; -import type { PKPStorageProvider } from '../../../../../../storage/types'; -import { logger } from '../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import type { PKPStorageProvider } from '../../../../../../../../storage/types'; +import { logger } from '../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { ScopeString } from '../../../schemas/shared/ScopeSchema'; import { AuthMethod } from '../../rawContractApis/permissions/read/getPermittedAuthMethods'; import { LitTxVoid } from '../../types'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/README.md b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/README.md similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/README.md rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/README.md diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts similarity index 88% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts index b9948db8ec..6ed1345fc9 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedActionByIdentifier.ts @@ -1,5 +1,5 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; import { z } from 'zod'; import { ScopeStringSchema } from '../../../../schemas/shared/ScopeSchema'; import { @@ -8,7 +8,7 @@ import { } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { addPermittedAction } from '../../../rawContractApis/permissions/write/addPermittedAction'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const addPermittedActionByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts similarity index 91% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts index 6e3bcefeb0..0fc8e3f499 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAddressByIdentifier.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { ScopeStringSchema } from '../../../../schemas/shared/ScopeSchema'; import { PkpIdentifierRaw, @@ -7,7 +7,7 @@ import { } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { addPermittedAddress } from '../../../rawContractApis/permissions/write/addPermittedAddress'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const addPermittedAddressByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts similarity index 92% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts index 7d84ed58c1..f2ee701b78 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodByIdentifier.ts @@ -1,5 +1,5 @@ import { z } from 'zod'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { ScopeStringSchema } from '../../../../schemas/shared/ScopeSchema'; import { PkpIdentifierRaw, @@ -7,7 +7,7 @@ import { } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { addPermittedAuthMethod } from '../../../rawContractApis/permissions/write/addPermittedAuthMethod'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const addPermittedAuthMethodByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts index 1eaf12b3ac..ef09f5e219 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/addPermittedAuthMethodScopeByIdentifier.ts @@ -1,13 +1,13 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { z } from 'zod'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { addPermittedAuthMethodScope } from '../../../rawContractApis/permissions/write/addPermittedAuthMethodScope'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const addPermittedAuthMethodScopeByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts similarity index 97% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts index febc00d8e6..9a224fe2c0 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAddress.ts @@ -1,13 +1,13 @@ import type { PKPInfo } from '@lit-protocol/types'; import { getAddress } from 'viem'; import { z } from 'zod'; -import type { PKPStorageProvider } from '../../../../../../../storage/types'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import type { PKPStorageProvider } from '../../../../../../../../../storage/types'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { getPubkeyByTokenId } from '../../../rawContractApis/pkp/read/getPubkeyByTokenId'; import { tokenOfOwnerByIndex } from '../../../rawContractApis/pkp/read/tokenOfOwnerByIndex'; import { PaginatedPKPsResponse } from './getPKPsByAuthMethod'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts similarity index 97% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts index b8f0fd12e1..61bdbc594e 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPKPsByAuthMethod.ts @@ -1,14 +1,14 @@ import { getAddress } from 'viem'; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { getPubkeyByTokenId } from '../../../rawContractApis/pkp/read/getPubkeyByTokenId'; import { getTokenIdsForAuthMethod } from '../../../rawContractApis/pkp/read/getTokenIdsForAuthMethod'; -import type { PKPStorageProvider } from '../../../../../../../storage/types'; +import type { PKPStorageProvider } from '../../../../../../../../../storage/types'; import type { PKPInfo } from '@lit-protocol/types'; // Schema for auth data (matching the structure from ViemAccountAuthenticator) diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts similarity index 96% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts index 10e4b28792..458c519a1f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermissionsContext.ts @@ -1,8 +1,8 @@ import bs58 from 'bs58'; import { fromHex } from 'viem'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { getPermittedActions } from '../../../rawContractApis/permissions/read/getPermittedActions'; import { getPermittedAddresses } from '../../../rawContractApis/permissions/read/getPermittedAddresses'; import { diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts similarity index 84% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts index 2fac42558d..fa25c98622 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedActionsByIdentifier.ts @@ -1,6 +1,6 @@ -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { getPermittedActions } from '../../../rawContractApis/permissions/read/getPermittedActions'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts similarity index 84% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts index 64b74fddc3..4cfbe3b221 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAddressesByIdentifier.ts @@ -1,6 +1,6 @@ -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { getPermittedAddresses } from '../../../rawContractApis/permissions/read/getPermittedAddresses'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts similarity index 88% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts index 44099ef073..13d876e318 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodScopesByIdentifier.ts @@ -1,6 +1,6 @@ -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { getPermittedAuthMethodScopes } from '../../../rawContractApis/permissions/read/getPermittedAuthMethodScopes'; import { PkpIdentifierRaw, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts similarity index 84% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts index cb89d5aac3..1ac55799d4 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/getPermittedAuthMethodsByIdentifier.ts @@ -1,6 +1,6 @@ -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { AuthMethod, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts similarity index 85% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts index cef44b2c1d..ee77fe914c 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedActionByIdentifier.ts @@ -1,13 +1,13 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { isPermittedAction } from '../../../rawContractApis/permissions/read/isPermittedAction'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request parameters const isPermittedActionByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts index fb42d816fe..5f43dd93c7 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/isPermittedAddressByIdentifier.ts @@ -1,12 +1,12 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { isPermittedAddress } from '../../../rawContractApis/permissions/read/isPermittedAddress'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request parameters const isPermittedAddressByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts similarity index 87% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts index 9d269507a7..fe31b9e990 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedActionByIdentifier.ts @@ -1,13 +1,13 @@ import { z } from 'zod'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { removePermittedAction } from '../../../rawContractApis/permissions/write/removePermittedAction'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const removePermittedActionByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts similarity index 91% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts index 8b881f26bd..be8c17eb9d 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAddressByIdentifier.ts @@ -1,12 +1,12 @@ import { z } from 'zod'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { removePermittedAddress } from '../../../rawContractApis/permissions/write/removePermittedAddress'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const removePermittedAddressByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts similarity index 92% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts index dc062a1bbc..7360ec46c2 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts @@ -1,12 +1,12 @@ import { z } from 'zod'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { removePermittedAuthMethod } from '../../../rawContractApis/permissions/write/removePermittedAuthMethod'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const removePermittedAuthMethodByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts similarity index 93% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts index a9b57aac22..ce00c9c457 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts @@ -1,12 +1,12 @@ import { z } from 'zod'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { PkpIdentifierRaw, resolvePkpTokenId, } from '../../../rawContractApis/permissions/utils/resolvePkpTokenId'; import { removePermittedAuthMethodScope } from '../../../rawContractApis/permissions/write/removePermittedAuthMethodScope'; import { LitTxVoid } from '../../../types'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for the request const removePermittedAuthMethodScopeByIdentifierSchema = z.intersection( diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/index.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/index.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PKPPermissionsManager/index.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts similarity index 98% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts index 7ad519c268..06d5a7af9d 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/PaymentManager/PaymentManager.ts @@ -24,9 +24,9 @@ */ import { formatEther, parseEther } from 'viem'; -import { logger } from '../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { getBalance } from '../../rawContractApis/ledger/read/getBalance'; import { getStableBalance } from '../../rawContractApis/ledger/read/getStableBalance'; import { diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/README.md b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/README.md similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/README.md rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/README.md diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts similarity index 95% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts index b1ed04ceb6..051483a4b8 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/connection/getConnectionInfo.ts @@ -1,5 +1,5 @@ -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { GetActiveUnkickedValidatorStructsAndCountsTransformed } from '../../../schemas/GetActiveUnkickedValidatorStructsAndCountsSchema'; import { ConnectionInfo } from '../../../types'; import { getActiveUnkickedValidatorStructsAndCounts } from '../../rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/index.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/index.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/index.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/MintPKPSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/MintPKPSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/MintPKPSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/MintPKPSchema.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts similarity index 88% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts index a28c1062f4..0c9eb2495d 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintPKP.ts @@ -1,6 +1,6 @@ -import { logger } from '../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { PKPData } from '../../../schemas/shared/PKPDataSchema'; import { mintNextAndAddAuthMethods } from '../../rawContractApis/pkp/write/mintNextAndAddAuthMethods'; import { LitTxRes } from '../../types'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts similarity index 70% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts index 6226fbc825..e7406adbd4 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithEoa.ts @@ -1,5 +1,5 @@ -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { PKPData } from '../../../schemas/shared/PKPDataSchema'; import { mintNext } from '../../rawContractApis/pkp/write/mintNext'; import { LitTxRes } from '../../types'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts similarity index 95% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts index 7a2000b51c..3dd4f026c3 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/mintPKP/mintWithMultiAuths.ts @@ -2,9 +2,9 @@ import { AUTH_METHOD_TYPE } from '@lit-protocol/constants'; import { HexPrefixedSchema } from '@lit-protocol/schemas'; import { Hex } from 'viem'; import { z } from 'zod'; -import { logger } from '../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; -import { ExpectedAccountOrWalletClient } from '../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; import { PKPData } from '../../../schemas/shared/PKPDataSchema'; import { ScopeSchemaRaw } from '../../../schemas/shared/ScopeSchema'; import { mintNextAndAddAuthMethods } from '../../rawContractApis/pkp/write/mintNextAndAddAuthMethods'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/README.md b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/README.md similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/README.md rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/README.md diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/index.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/index.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/index.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts similarity index 96% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts index 74c7aa7c92..846b448796 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/highLevelApis/priceFeed/priceFeedApi.ts @@ -28,12 +28,12 @@ const _logger = getChildLogger({ }); import { NodePrices } from '@lit-protocol/types'; -import { ExpectedAccountOrWalletClient } from '../../../../LitChainClient/contract-manager/createContractsManager'; -import { INetworkConfig } from '../../../../interfaces/NetworkContext'; +import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { INetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; import { getNodesForRequest, PRODUCT_IDS, -} from '../../../apis/rawContractApis/pricing/getNodesForRequest'; +} from '../../rawContractApis/pricing/getNodesForRequest'; import { getChildLogger } from '@lit-protocol/logger'; // Configuration constants diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/index.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/index.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/index.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/README.md b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/README.md similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/README.md rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/README.md diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts similarity index 74% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts index c39fc13713..de7551d19c 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getBalance.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getBalanceSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts similarity index 75% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts index 9e05b5e3a3..9963b49817 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getStableBalance.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getStableBalanceSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts similarity index 64% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts index b30537cb15..b8852e9a7e 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getUserWithdrawDelay.ts @@ -1,7 +1,7 @@ -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; /** * Get user withdraw delay from the Ledger contract diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts similarity index 78% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts index 2310fe1646..670b76a2bd 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/read/getWithdrawRequest.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getWithdrawRequestSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts similarity index 80% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts index 2ddf1fe60b..a055607708 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/deposit.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts similarity index 82% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts index 72168bcb50..76a8c4f182 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/depositForUser.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts similarity index 80% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts index 48990bd945..077f9a9a07 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/requestWithdraw.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts similarity index 80% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts index d6173f18cd..f4259e4d34 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/ledger/write/withdraw.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts similarity index 74% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts index efa9dcef5d..ef57f6f72f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayers.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getPayersSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts similarity index 80% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts index fb91f5871c..1441f52017 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getPayersAndRestrictions.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { Restriction } from './getRestriction'; // Schema for validating the request diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts similarity index 77% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts index 789999074e..fc29da3a06 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getRestriction.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getRestrictionSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts similarity index 74% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts index 7b13f11a4e..957202a1bb 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/read/getUsers.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; // Schema for validating the request const getUsersSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts similarity index 81% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts index 97e7b70001..6190a7eafd 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePayments.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts similarity index 82% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts index ed7d488e31..ece2e07395 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/delegatePaymentsBatch.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts similarity index 81% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts index 537d175ed6..b571672323 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/setRestriction.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts similarity index 81% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts index 2bfb65dbb0..1af2b9fb4e 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePayments.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts similarity index 82% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts index b58d309635..32bbc64fea 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/paymentDelegation/write/undelegatePaymentsBatch.ts @@ -1,8 +1,8 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; -import { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; +import { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts similarity index 82% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts index 71620afc98..5854544dd0 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedActions.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const getPermittedActionsSchema = z.object({ tokenId: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts similarity index 82% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts index 8748a49a28..8b27dbdede 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAddresses.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const getPermittedAddressesSchema = z.object({ tokenId: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts similarity index 87% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts index 62a7ad784e..3b27d87fb3 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethodScopes.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const getPermittedAuthMethodScopesSchema = z.object({ tokenId: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts similarity index 84% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts index dd36d439d4..914ca2c573 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/getPermittedAuthMethods.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const getPermittedAuthMethodsSchema = z.object({ tokenId: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts similarity index 77% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts index 9ad0b838d4..0e310d312e 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAction.ts @@ -1,14 +1,14 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { ipfsCidV0ToHex } from '../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { ipfsCidV0ToHex } from '../../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const isPermittedActionSchema = z .object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts similarity index 84% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts index bf9b98bbe6..20e7ecea3e 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/read/isPermittedAddress.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; const isPermittedAddressSchema = z.object({ tokenId: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/utils/pubkeyToTokenId.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/pubkeyToTokenId.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/utils/pubkeyToTokenId.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/pubkeyToTokenId.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts index d292da74b3..04f5be5951 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/utils/resolvePkpTokenId.ts @@ -4,16 +4,16 @@ */ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; +import { logger } from '../../../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { pubkeyToTokenId } from './pubkeyToTokenId'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { isEthAddress } from '../../../../../../shared/utils/z-validate'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { isEthAddress } from '../../../../../../../../shared/utils/z-validate'; // Input validation schema export const PkpIdentifierSchema = z.discriminatedUnion('field', [ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts similarity index 80% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts index 790e8681e2..26873f5b34 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAction.ts @@ -1,17 +1,17 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { ipfsCidV0ToHex } from '../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { ipfsCidV0ToHex } from '../../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { decodeLogs } from '../../../utils/decodeLogs'; const addPermittedActionSchema = z diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts similarity index 88% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts index 1ea3e1e6d4..bbf51b587f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAddress.ts @@ -1,12 +1,12 @@ // import { networkContext } from "../../../_config"; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts similarity index 90% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts index c486a27ecc..d7e19fbb00 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethod.ts @@ -5,14 +5,14 @@ * This allows the authentication method to control the PKP. */ -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { ScopeSchemaRaw } from '../../../../schemas/shared/ScopeSchema'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts index 29fd78a14f..7e56c2a3d9 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/addPermittedAuthMethodScope.ts @@ -6,13 +6,13 @@ */ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts similarity index 81% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts index e890fc0afc..a7bf79815b 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAction.ts @@ -1,15 +1,15 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; +import { logger } from '../../../../../../../../shared/logger'; -import { ipfsCidV0ToHex } from '../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { isIpfsCidV0 } from '../../../../../../shared/utils/z-validate'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { ipfsCidV0ToHex } from '../../../../../../../../shared/utils/transformers/ipfsCidV0ToHex'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { isIpfsCidV0 } from '../../../../../../../../shared/utils/z-validate'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts similarity index 88% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts index f24d8a34a1..8cc31ce844 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAddress.ts @@ -1,14 +1,14 @@ // import { networkContext } from "../../../_config"; import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { decodeLogs } from '../../../utils/decodeLogs'; const removePermittedAddressSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts index df4f4de49d..3b09ecbc43 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethod.ts @@ -6,13 +6,13 @@ */ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts similarity index 90% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts index 6b08a0c5ff..40d1406e68 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/permissions/write/removePermittedAuthMethodScope.ts @@ -6,13 +6,13 @@ */ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { toBigInt } from '../../../../../../shared/utils/z-transformers'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { toBigInt } from '../../../../../../../../shared/utils/z-transformers'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts similarity index 85% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts index 4966388598..b23685f20f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getPubkeyByTokenId.ts @@ -1,10 +1,10 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { z } from 'zod'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; -import { logger } from '../../../../../../shared/logger'; +} from '../../../../../contract-manager/createContractsManager'; +import { logger } from '../../../../../../../../shared/logger'; // Schema for the request const getPubkeyByTokenIdSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts similarity index 90% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts index f51d8662ef..06ed417e1f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/getTokenIdsForAuthMethod.ts @@ -1,10 +1,10 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; // Schema for the request const getTokenIdsForAuthMethodSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts similarity index 90% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts index afdf7afeea..42da44db2a 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/read/tokenOfOwnerByIndex.ts @@ -1,10 +1,10 @@ import { z } from 'zod'; -import { logger } from '../../../../../../shared/logger'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { logger } from '../../../../../../../../shared/logger'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; // Schema for the request const tokenOfOwnerByIndexSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts similarity index 91% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts index 85f6e431fa..2da2f8e51f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMint.ts @@ -1,8 +1,8 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { ClaimAndMintRaw, ClaimAndMintSchema, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts similarity index 95% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts index 2de499bb8d..6c8cbba5f9 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/claimAndMintNextAndAddAuthMethodsWithTypes.ts @@ -1,8 +1,8 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../../contract-manager/createContractsManager'; +} from '../../../../../contract-manager/createContractsManager'; import { ClaimRequestRaw, ClaimRequestSchema, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts similarity index 86% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts index 56c550b714..581f8e3f4d 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNext.ts @@ -1,6 +1,6 @@ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import type { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import type { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; import { PKPData, PKPDataSchema, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts similarity index 94% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts index da4fd42fd3..de9dbb881a 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/mintNextAndAddAuthMethods.ts @@ -1,6 +1,6 @@ -import type { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; +import type { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; import { MintRequestRaw, MintRequestSchema, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts similarity index 89% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts index 66fef27af4..f8bb5f7a7f 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pkp/write/safeTransfer.ts @@ -15,9 +15,9 @@ * ``` */ -import { DefaultNetworkConfig } from '../../../../../interfaces/NetworkContext'; -import type { ExpectedAccountOrWalletClient } from '../../../../contract-manager/createContractsManager'; -import { createContractsManager } from '../../../../contract-manager/createContractsManager'; +import { DefaultNetworkConfig } from '../../../../../../../shared/interfaces/NetworkContext'; +import type { ExpectedAccountOrWalletClient } from '../../../../../contract-manager/createContractsManager'; +import { createContractsManager } from '../../../../../contract-manager/createContractsManager'; import { LitTxVoid } from '../../../types'; import { callWithAdjustedOverrides } from '../../../utils/callWithAdjustedOverrides'; import { decodeLogs } from '../../../utils/decodeLogs'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts similarity index 91% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts index eca6c1310e..8f39f5d5a4 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/pricing/getNodesForRequest.ts @@ -1,13 +1,13 @@ import { z } from 'zod'; -import { generateValidatorURLs } from '../../../../../shared/utils/transformers'; +import { generateValidatorURLs } from '../../../../../../../shared/utils/transformers'; import { DefaultNetworkConfig, INetworkConfig, -} from '../../../../interfaces/NetworkContext'; +} from '../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../contract-manager/createContractsManager'; +} from '../../../../contract-manager/createContractsManager'; /** * Product IDs used for price feed and node selection diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.spec.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts similarity index 90% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts index 5bf495b980..f9ac0d48f9 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/rawContractApis/staking/getActiveUnkickedValidatorStructsAndCounts.ts @@ -1,8 +1,8 @@ -import { DefaultNetworkConfig } from '../../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../../contract-manager/createContractsManager'; +} from '../../../../contract-manager/createContractsManager'; import { GetActiveUnkickedValidatorStructsAndCountsSchema } from '../../../schemas/GetActiveUnkickedValidatorStructsAndCountsSchema'; // const REALM_ID = 1n; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/types.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/types.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/types.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/types.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/utils/callWithAdjustedOverrides.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/utils/callWithAdjustedOverrides.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/utils/callWithAdjustedOverrides.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/utils/callWithAdjustedOverrides.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/apis/utils/decodeLogs.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/utils/decodeLogs.ts similarity index 93% rename from packages/networks/src/networks/vNaga/LitChainClient/apis/utils/decodeLogs.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/utils/decodeLogs.ts index 96f36aed68..8c4fca78bc 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/apis/utils/decodeLogs.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/apis/utils/decodeLogs.ts @@ -1,9 +1,9 @@ import { decodeEventLog, Log } from 'viem'; -import { DefaultNetworkConfig } from '../../../interfaces/NetworkContext'; +import { DefaultNetworkConfig } from '../../../../../shared/interfaces/NetworkContext'; import { createContractsManager, ExpectedAccountOrWalletClient, -} from '../../contract-manager/createContractsManager'; +} from '../../../contract-manager/createContractsManager'; export type DecodedLog = { eventName: string; diff --git a/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/index.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/index.ts new file mode 100644 index 0000000000..2f8802a9b5 --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/index.ts @@ -0,0 +1,2 @@ +export * from './apis/index'; +export * from './types'; diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimAndMintSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimAndMintSchema.ts similarity index 91% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimAndMintSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimAndMintSchema.ts index 938c4fe5dc..eec461d8c4 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimAndMintSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimAndMintSchema.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; import { SignatureDataSchema } from './shared/SignatureDataSchema'; -import { toHexString } from '../../../shared/utils/z-transformers'; +import { toHexString } from '../../../../../shared/utils/z-transformers'; export const ClaimAndMintSchema = z.object({ derivedKeyId: toHexString, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimRequestSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimRequestSchema.ts similarity index 93% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimRequestSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimRequestSchema.ts index 7055dc1398..fd37ccb942 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/schemas/ClaimRequestSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/ClaimRequestSchema.ts @@ -1,6 +1,9 @@ import { t } from 'elysia'; import { z } from 'zod'; -import { toBigInt, toHexString } from '../../../shared/utils/z-transformers'; +import { + toBigInt, + toHexString, +} from '../../../../../shared/utils/z-transformers'; import { SignatureDataSchema } from './shared/SignatureDataSchema'; export const ClaimRequestSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts similarity index 93% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts index cb5318dfa7..9bab63a356 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/GetActiveUnkickedValidatorStructsAndCountsSchema.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; -import { generateValidatorURLs } from '../../../shared/utils/transformers'; -import { toNumber } from '../../../shared/utils/z-transformers'; +import { generateValidatorURLs } from '../../../../../shared/utils/transformers'; +import { toNumber } from '../../../../../shared/utils/z-transformers'; const EpochInfoSchema = z.object({ epochLength: toNumber, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/MintRequestSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema.ts similarity index 96% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/MintRequestSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema.ts index b32fd46582..77ce533822 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/schemas/MintRequestSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/MintRequestSchema.ts @@ -6,7 +6,7 @@ import { toBigIntMatrix, toBoolean, toHexStringArray, -} from '../../../shared/utils/z-transformers'; +} from '../../../../../shared/utils/z-transformers'; export const MintRequestSchema = z.object({ keyType: toBigInt, diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/AuthMethodSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/AuthMethodSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/AuthMethodSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/AuthMethodSchema.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/PKPDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/PKPDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/PKPDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/PKPDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/ScopeSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/ScopeSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/ScopeSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/ScopeSchema.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/SignatureDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/SignatureDataSchema.ts similarity index 62% rename from packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/SignatureDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/SignatureDataSchema.ts index bb869b65e6..193e758df4 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/schemas/shared/SignatureDataSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/schemas/shared/SignatureDataSchema.ts @@ -1,4 +1,4 @@ -import { toHexString } from '../../../../shared/utils/z-transformers'; +import { toHexString } from '../../../../../../shared/utils/z-transformers'; import { z } from 'zod'; export const SignatureDataSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/LitChainClient/types.ts b/packages/networks/src/networks/vNaga/shared/managers/LitChainClient/types.ts similarity index 100% rename from packages/networks/src/networks/vNaga/LitChainClient/types.ts rename to packages/networks/src/networks/vNaga/shared/managers/LitChainClient/types.ts diff --git a/packages/networks/src/networks/vNaga/shared/managers/api-manager/APIFactory.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/APIFactory.ts new file mode 100644 index 0000000000..bd0d269df7 --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/managers/api-manager/APIFactory.ts @@ -0,0 +1,315 @@ +import { getChildLogger } from '@lit-protocol/logger'; +import { z } from 'zod'; +import { + EncryptedVersion1Schema, + GenericEncryptedPayloadSchema, + GenericResultBuilder, +} from '@lit-protocol/schemas'; +import { RequestItem, NagaJitContext } from '@lit-protocol/types'; + +import { E2EERequestManager } from './e2ee-request-manager/E2EERequestManager'; +import { composeLitUrl } from '../endpoints-manager/composeLitUrl'; +import { createRequestId } from '../../helpers/createRequestId'; +import { issueSessionFromContext } from '../session-manager/issueSessionFromContext'; +import { PricingContextSchema } from '../pricing-manager/schema'; +import { combinePKPSignSignatures } from './helper/get-signatures'; + +import type { INetworkConfig } from '../../interfaces/NetworkContext'; +import type { PKPSignCreateRequestParams } from './pkpSign/pkpSign.CreateRequestParams'; +import type { DecryptCreateRequestParams } from './decrypt/decrypt.CreateRequestParams'; +import type { ExecuteJsCreateRequestParams } from './executeJs/executeJs.CreateRequestParams'; + +import { PKPSignRequestDataSchema } from './pkpSign/pkpSign.RequestDataSchema'; +import { PKPSignResponseDataSchema } from './pkpSign/pkpSign.ResponseDataSchema'; +import { DecryptRequestDataSchema } from './decrypt/decrypt.RequestDataSchema'; +import { DecryptResponseDataSchema } from './decrypt/decrypt.ResponseDataSchema'; +import { ExecuteJsRequestDataSchema } from './executeJs/executeJs.RequestDataSchema'; +import { ExecuteJsResponseDataSchema } from './executeJs/executeJs.ResponseDataSchema'; + +const _logger = getChildLogger({ + module: 'APIFactory', +}); + +export function createPKPSignAPI(networkConfig: INetworkConfig) { + return { + createRequest: async ( + params: PKPSignCreateRequestParams + ): Promise>[]> => { + _logger.info('pkpSign:createRequest: Creating request', { params }); + + // Generate session sigs + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + _logger.info('pkpSign:createRequest: Session sigs generated'); + + // Generate requests + const _requestId = createRequestId(); + const requests: RequestItem>[] = + []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + _logger.info('pkpSign:createRequest: Generating request data', { url }); + + const _requestData = PKPSignRequestDataSchema.parse({ + toSign: Array.from(params.signingContext.toSign), + signingScheme: params.signingContext.signingScheme, + pubkey: params.signingContext.pubKey, + authSig: sessionSigs[url], + nodeSet: urls, + chain: params.chain, + bypassAutoHashing: params.signingContext.bypassAutoHashing, + epoch: params.connectionInfo.epochState.currentNumber, + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: networkConfig.endpoints.PKP_SIGN, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + if (!requests || requests.length === 0) { + throw new Error('Failed to generate requests for pkpSign.'); + } + + return requests; + }, + + handleResponse: async ( + result: z.infer, + requestId: string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError(result, jitContext, 'PKP Sign'); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const pkpSignData = decryptedJson.data; + if (!pkpSignData) { + throw new Error('Decrypted response missing data field'); + } + + const wrappedData = { + success: pkpSignData.success, + values: [pkpSignData], + }; + + const responseData = PKPSignResponseDataSchema.parse(wrappedData); + return responseData.values[0]; + } + ); + + const signatures = await combinePKPSignSignatures({ + nodesPkpSignResponseData: decryptedValues, + requestId, + threshold: networkConfig.minimumThreshold, + }); + + return signatures; + }, + }; +} + +export function createDecryptAPI(networkConfig: INetworkConfig) { + return { + createRequest: async (params: DecryptCreateRequestParams) => { + _logger.info('decrypt:createRequest: Creating request', { params }); + + // Generate session sigs for decrypt + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + const _requestId = createRequestId(); + const requests: RequestItem>[] = + []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + const _requestData = DecryptRequestDataSchema.parse({ + ciphertext: params.ciphertext, + dataToEncryptHash: params.dataToEncryptHash, + accessControlConditions: params.accessControlConditions, + evmContractConditions: params.evmContractConditions, + solRpcConditions: params.solRpcConditions, + unifiedAccessControlConditions: params.unifiedAccessControlConditions, + authSig: sessionSigs[url], + chain: params.chain, + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: networkConfig.endpoints.ENCRYPTION_SIGN, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + return requests; + }, + + handleResponse: async ( + result: z.infer, + requestId: string, + identityParam: string, + ciphertext: string, + subnetPubKey: string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'Decryption' + ); + } + + const decryptedValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const decryptData = decryptedJson.data; + if (!decryptData) { + throw new Error('Decrypted response missing data field'); + } + return DecryptResponseDataSchema.parse(decryptData); + } + ); + + // Implementation would continue with signature verification + // Simplified for now + return { decryptedData: 'Implementation pending' }; + }, + }; +} + +export function createExecuteJsAPI(networkConfig: INetworkConfig) { + return { + createRequest: async (params: ExecuteJsCreateRequestParams) => { + _logger.info('executeJs:createRequest: Creating request', { params }); + + // Generate session sigs + const sessionSigs = await issueSessionFromContext({ + pricingContext: PricingContextSchema.parse(params.pricingContext), + authContext: params.authContext, + }); + + const _requestId = createRequestId(); + const requests: RequestItem>[] = + []; + const urls = Object.keys(sessionSigs); + + for (const url of urls) { + // Base64 encode the code if provided + let encodedCode: string | undefined; + if (params.executionContext.code) { + encodedCode = Buffer.from( + params.executionContext.code, + 'utf-8' + ).toString('base64'); + } + + const _requestData = ExecuteJsRequestDataSchema.parse({ + authSig: sessionSigs[url], + nodeSet: urls, + ...(encodedCode && { code: encodedCode }), + ...(params.executionContext.ipfsId && { + ipfsId: params.executionContext.ipfsId, + }), + ...(params.executionContext.jsParams && { + jsParams: { jsParams: params.executionContext.jsParams }, + }), + }); + + const encryptedPayload = E2EERequestManager.encryptRequestData( + _requestData, + url, + params.jitContext + ); + + const _urlWithPath = composeLitUrl({ + url, + endpoint: networkConfig.endpoints.EXECUTE_JS, + }); + + requests.push({ + fullPath: _urlWithPath, + data: encryptedPayload, + requestId: _requestId, + epoch: params.connectionInfo.epochState.currentNumber, + version: params.version, + }); + } + + return requests; + }, + + handleResponse: async ( + result: z.infer, + requestId: string, + jitContext: NagaJitContext + ) => { + if (!result.success) { + E2EERequestManager.handleEncryptedError( + result, + jitContext, + 'JS execution' + ); + } + + const decryptedResponseValues = E2EERequestManager.decryptBatchResponse( + result, + jitContext, + (decryptedJson) => { + const executeJsData = decryptedJson.data; + if (!executeJsData) { + throw new Error('Decrypted response missing data field'); + } + return executeJsData; + } + ); + + // Simplified response handling + return { + success: true, + signatures: {}, + response: decryptedResponseValues[0]?.response || '', + claims: {}, + }; + }, + }; +} diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.CreateRequestParams.ts similarity index 88% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.CreateRequestParams.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.CreateRequestParams.ts index d7e1ab9a2d..95c83c3f68 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.CreateRequestParams.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.CreateRequestParams.ts @@ -1,6 +1,6 @@ -import type { ConnectionInfo } from '../../../../LitChainClient/types'; +import type { ConnectionInfo } from '../../LitChainClient/types'; import type { z } from 'zod'; -import type { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; +import type { PricingContextSchema } from '../../pricing-manager/schema'; import { PKPAuthContextSchema, EoaAuthContextSchema, diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.InputSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.InputSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.InputSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.InputSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.RequestDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.RequestDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.RequestDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.ResponseDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/decrypt/decrypt.ResponseDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/decrypt/decrypt.ResponseDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/e2ee-request-manager/E2EERequestManager.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/e2ee-request-manager/E2EERequestManager.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/e2ee-request-manager/E2EERequestManager.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/e2ee-request-manager/E2EERequestManager.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.CreateRequestParams.ts similarity index 81% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.CreateRequestParams.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.CreateRequestParams.ts index 1992cd2102..1a5c613876 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.CreateRequestParams.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.CreateRequestParams.ts @@ -4,8 +4,8 @@ import { } from '@lit-protocol/schemas'; import { LitActionResponseStrategy, NagaJitContext } from '@lit-protocol/types'; import { z } from 'zod'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; +import { PricingContextSchema } from '../../pricing-manager/schema'; +import { ConnectionInfo } from '../../LitChainClient/types'; export type ExecuteJsCreateRequestParams = { pricingContext: z.input; diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.InputSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.InputSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.InputSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.InputSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.RequestDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.RequestDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.RequestDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.ResponseDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.ResponseDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.ResponseDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/executeJs.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/executeJs.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/index.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/executeJs/index.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/executeJs/index.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/handshake/handshake.schema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/handshake/handshake.schema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/handshake/handshake.schema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/handshake/handshake.schema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/get-signatures.test.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/get-signatures.test.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/get-signatures.test.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/get-signatures.test.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/get-signatures.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/get-signatures.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/get-signatures.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/get-signatures.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/parse-pkp-sign-response.test.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/parse-pkp-sign-response.test.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/parse-pkp-sign-response.test.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/parse-pkp-sign-response.test.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/parse-pkp-sign-response.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/parse-pkp-sign-response.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/helper/parse-pkp-sign-response.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/helper/parse-pkp-sign-response.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.CreateRequestParams.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.CreateRequestParams.ts similarity index 86% rename from packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.CreateRequestParams.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.CreateRequestParams.ts index 5cc454dc69..df1daeab0a 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.CreateRequestParams.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.CreateRequestParams.ts @@ -7,8 +7,8 @@ import { } from '@lit-protocol/schemas'; import { NagaJitContext } from '@lit-protocol/types'; import { z } from 'zod'; -import { ConnectionInfo } from '../../../../LitChainClient/types'; -import { PricingContextSchema } from '../../pricing-manager/PricingContextSchema'; +import { ConnectionInfo } from '../../LitChainClient/types'; +import { PricingContextSchema } from '../../pricing-manager/schema'; import { RawHandshakeResponseSchema } from '../handshake/handshake.schema'; export type PKPSignCreateRequestParams = { diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.InputSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.InputSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.InputSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.InputSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.RequestDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.RequestDataSchema.ts similarity index 94% rename from packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.RequestDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.RequestDataSchema.ts index ce17266144..47dc84acaf 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/api-manager/pkpSign/pkpSign.RequestDataSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.RequestDataSchema.ts @@ -9,7 +9,7 @@ import { } from '@lit-protocol/schemas'; import { hexToBytes, stringToBytes } from 'viem'; import { z } from 'zod'; -import { LitMessageSchema } from '../../../../schemas/LitMessageSchema'; +import { LitMessageSchema } from '../../../../shared/schemas/LitMessageSchema'; // Schema for auth methods in v2 API const AuthMethodSchema = z.object({ diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/pkpSign/pkpSign.ResponseDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/signSessionKey/signSessionKey.ResponseDataSchema.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/types.ts b/packages/networks/src/networks/vNaga/shared/managers/api-manager/types.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/api-manager/types.ts rename to packages/networks/src/networks/vNaga/shared/managers/api-manager/types.ts diff --git a/packages/networks/src/networks/vNaga/LitChainClient/contract-manager/createContractsManager.ts b/packages/networks/src/networks/vNaga/shared/managers/contract-manager/createContractsManager.ts similarity index 97% rename from packages/networks/src/networks/vNaga/LitChainClient/contract-manager/createContractsManager.ts rename to packages/networks/src/networks/vNaga/shared/managers/contract-manager/createContractsManager.ts index b469d9a858..a770b428c2 100644 --- a/packages/networks/src/networks/vNaga/LitChainClient/contract-manager/createContractsManager.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/contract-manager/createContractsManager.ts @@ -9,11 +9,12 @@ import { WalletClient, } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; -// import { signatures } from '../../envs/naga-local/generated/naga-develop'; -import { nagaDevSignatures } from '@lit-protocol/contracts'; import { INetworkConfig } from '../../interfaces/NetworkContext'; import { DEV_PRIVATE_KEY } from '@lit-protocol/constants'; +// ❗️ NOTE: This could be any network's signatures assuming they all have the same ABI signatures +// import { signatures } from '../../envs/naga-local/generated/naga-develop'; +import { nagaDevSignatures } from '@lit-protocol/contracts'; type Signatures = typeof nagaDevSignatures; export type ExpectedAccountOrWalletClient = @@ -54,9 +55,7 @@ export const createReadOnlyContractsManager = ( networkConfig: INetworkConfig ) => { // dummy private key for read actions - const dummyAccount = privateKeyToAccount( - DEV_PRIVATE_KEY - ); + const dummyAccount = privateKeyToAccount(DEV_PRIVATE_KEY); return createContractsManager(networkConfig, dummyAccount); }; diff --git a/packages/networks/src/networks/vNaga/shared/managers/contract-manager/index.ts b/packages/networks/src/networks/vNaga/shared/managers/contract-manager/index.ts new file mode 100644 index 0000000000..e1c5aebf6a --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/managers/contract-manager/index.ts @@ -0,0 +1,2 @@ +export { createContractsManager } from './createContractsManager'; +export { createReadOnlyContractsManager } from './createContractsManager'; diff --git a/packages/networks/src/networks/vNaga/endpoints-manager/composeLitUrl.ts b/packages/networks/src/networks/vNaga/shared/managers/endpoints-manager/composeLitUrl.ts similarity index 100% rename from packages/networks/src/networks/vNaga/endpoints-manager/composeLitUrl.ts rename to packages/networks/src/networks/vNaga/shared/managers/endpoints-manager/composeLitUrl.ts diff --git a/packages/networks/src/networks/vNaga/endpoints-manager/endpoints.ts b/packages/networks/src/networks/vNaga/shared/managers/endpoints-manager/endpoints.ts similarity index 100% rename from packages/networks/src/networks/vNaga/endpoints-manager/endpoints.ts rename to packages/networks/src/networks/vNaga/shared/managers/endpoints-manager/endpoints.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/pricing.constants.ts b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/constants.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/pricing.constants.ts rename to packages/networks/src/networks/vNaga/shared/managers/pricing-manager/constants.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getMaxPricesForNodeProduct.ts b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getMaxPricesForNodeProduct.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getMaxPricesForNodeProduct.ts rename to packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getMaxPricesForNodeProduct.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getUserMaxPrice.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/pricing-manager/getUserMaxPrice.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice.spec.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.ts b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice.ts similarity index 92% rename from packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.ts rename to packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice.ts index 560c17c976..70d842f6f0 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-local/pricing-manager/getUserMaxPrice.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/getUserMaxPrice.ts @@ -1,4 +1,4 @@ -import { PRODUCT_IDS, UNSIGNED_128_MAX } from './pricing.constants'; +import { PRODUCT_IDS, UNSIGNED_128_MAX } from './constants'; /** * In the context for Lit pricing model, the U128 value is used as a default "unlimited" diff --git a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/PricingContextSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/schema.ts similarity index 93% rename from packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/PricingContextSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/pricing-manager/schema.ts index 6ee852fe2b..4a62484ad2 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-staging/pricing-manager/PricingContextSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/pricing-manager/schema.ts @@ -1,6 +1,6 @@ import { z } from 'zod'; import { getUserMaxPrice } from './getUserMaxPrice'; -import { PRODUCT_IDS } from './pricing.constants'; +import { PRODUCT_IDS } from './constants'; export const PricingContextSchema = z .object({ diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/AuthContextSchema.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/AuthContextSchema.ts similarity index 65% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/AuthContextSchema.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/AuthContextSchema.ts index b6090200f7..35c5eca838 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/AuthContextSchema.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/session-manager/AuthContextSchema.ts @@ -5,10 +5,8 @@ import { LitResourceAbilityRequestSchema, SessionKeyPairSchema, AuthConfigSchema, - AuthMethodSchema, } from '@lit-protocol/schemas'; import { z } from 'zod'; -import { Account } from 'viem'; // { // pkpPublicKey: "0x04e5603fe1cc5ce207c12950939738583b599f22a152c3672a4c0eee887d75dd405246ac3ed2430283935a99733eac9520581af9923c0fc04fad1d67d60908ce18", @@ -33,24 +31,24 @@ import { Account } from 'viem'; // authNeededCallback: [AsyncFunction: authNeededCallback], // capabilityAuthSigs: [], // } -// export const AuthContextSchema = z.object({ -// pkpPublicKey: HexPrefixedSchema.optional(), -// // viemAccount: z.custom().optional(), -// // authMethod: AuthMethodSchema.optional(), -// chain: z.string(), -// sessionKeyPair: SessionKeyPairSchema, -// // which one do we need here? -// resourceAbilityRequests: z.array(LitResourceAbilityRequestSchema), -// // which one do we need here? -// sessionCapabilityObject: ISessionCapabilityObjectSchema, -// // which one do we need here? TODO: ❗️ specify the type properly -// siweResources: z.any(), -// authNeededCallback: z.function(), -// capabilityAuthSigs: z.array(AuthSigSchema), -// authConfig: AuthConfigSchema, -// }); +export const AuthContextSchema = z.object({ + pkpPublicKey: HexPrefixedSchema.optional(), + // viemAccount: z.custom().optional(), + // authMethod: AuthMethodSchema.optional(), + chain: z.string(), + sessionKeyPair: SessionKeyPairSchema, + // which one do we need here? + resourceAbilityRequests: z.array(LitResourceAbilityRequestSchema), + // which one do we need here? + sessionCapabilityObject: ISessionCapabilityObjectSchema, + // which one do we need here? TODO: ❗️ specify the type properly + siweResources: z.any(), + authNeededCallback: z.function(), + capabilityAuthSigs: z.array(AuthSigSchema), + authConfig: AuthConfigSchema, +}); -// export type AuthContext = z.infer; +export type AuthContext = z.infer; // export const EoaAuthContextSchema = z.object({ // viemAccount: z.custom(), diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-reader.test.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-reader.test.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-reader.test.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-reader.test.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-reader.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-reader.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-reader.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-reader.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-validator.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-validator.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-validator.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-validator.spec.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-validator.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-validator.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/helper/session-sigs-validator.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/helper/session-sigs-validator.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/issueSessionFromContext.ts b/packages/networks/src/networks/vNaga/shared/managers/session-manager/issueSessionFromContext.ts similarity index 98% rename from packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/issueSessionFromContext.ts rename to packages/networks/src/networks/vNaga/shared/managers/session-manager/issueSessionFromContext.ts index 8195feb80c..718ba62657 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-dev/session-manager/issueSessionFromContext.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/session-manager/issueSessionFromContext.ts @@ -13,7 +13,7 @@ import { ed25519 } from '@noble/curves/ed25519'; import { hexToBytes } from '@noble/hashes/utils'; import { z } from 'zod'; import { getMaxPricesForNodeProduct } from '../pricing-manager/getMaxPricesForNodeProduct'; -import { PricingContext } from '../pricing-manager/PricingContextSchema'; +import { PricingContext } from '../pricing-manager/schema'; import { validateSessionSigs } from './helper/session-sigs-validator'; /** diff --git a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/createStateManager.ts similarity index 86% rename from packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/createStateManager.ts index 67f74b2c14..4c9371fe55 100644 --- a/packages/networks/src/networks/vNaga/envs/naga-test/state-manager/createStateManager.ts +++ b/packages/networks/src/networks/vNaga/shared/managers/state-manager/createStateManager.ts @@ -1,57 +1,38 @@ import { STAKING_STATES, STAKING_STATES_VALUES } from '@lit-protocol/constants'; import { ethers } from 'ethers'; -import { fetchBlockchainData } from '../../../../shared/StateManager/helpers/fetchBlockchainData'; +import { getChildLogger } from '@lit-protocol/logger'; +import type { CallbackParams, EpochInfo } from '@lit-protocol/types'; +import { ConnectionInfo } from '../LitChainClient'; +import { LitNetworkModuleBase } from '../../../../types'; +import type { INetworkConfig } from '../../interfaces/NetworkContext'; +import { areStringArraysDifferent } from './utils/areStringArraysDifferent'; +import { fetchBlockchainData } from './helpers/fetchBlockchainData'; import { createEvmEventState, EventState, -} from '../../../../shared/StateManager/src/createEvmEventState'; +} from './state-types/createEvmEventState'; import { createRefreshedValue, RefreshedValue, -} from '../../../../shared/StateManager/src/createRefreshedValue'; -import { - ConnectionInfo, - createReadOnlyContractsManager, -} from '../../../LitChainClient'; -import { createReadOnlyChainManager } from '../chain-manager/createChainManager'; -import { NagaTestNetworkConfig } from '../naga-test.config'; -// Import EpochInfo type (adjust path if necessary based on actual export location) -import { getChildLogger } from '@lit-protocol/logger'; -import type { CallbackParams, EndPoint, EpochInfo } from '@lit-protocol/types'; -import { LitNetworkModuleBase } from '../../../../types'; -import { areStringArraysDifferent } from './helper/areStringArraysDifferent'; +} from './state-types/createRefreshedValue'; +import { createReadOnlyContractsManager } from '../contract-manager'; const _logger = getChildLogger({ module: 'StateManager', }); +// Constants const BLOCKHASH_SYNC_INTERVAL = 30_000; -// export type EndPoint = { -// [key: string]: { -// path: string; -// version: string; -// }; -// }; - -// export type CallbackParams = { -// bootstrapUrls: string[]; -// currentEpoch: number; -// version: string; -// requiredAttestation: boolean; -// minimumThreshold: number; -// abortTimeout: number; -// endpoints: EndPoint[]; -// }; - /** * It returns a blockhash manager for latestBlockhash/nonce and event state * manager for latest connection info. */ export const createStateManager = async (params: { - networkConfig: NagaTestNetworkConfig; + networkConfig: INetworkConfig; callback: (params: CallbackParams) => Promise; networkModule: LitNetworkModuleBase; + createReadOnlyChainManager: () => any; }) => { // --- Internal State --- Keep track of the latest known values let latestBootstrapUrls: string[] = []; @@ -70,7 +51,7 @@ export const createStateManager = async (params: { } ); - const readOnlyChainManager = createReadOnlyChainManager(); + const readOnlyChainManager = params.createReadOnlyChainManager(); const contractManager = createReadOnlyContractsManager(params.networkConfig); // --- Initial Fetch for Connection Info --- @@ -90,7 +71,7 @@ export const createStateManager = async (params: { // --- Initial callback callbackResult = await params.callback({ bootstrapUrls: latestBootstrapUrls, - currentEpoch: latestEpochInfo?.number, + currentEpoch: latestEpochInfo?.number || 0, version: params.networkModule.version, requiredAttestation: params.networkModule.config.requiredAttestation, minimumThreshold: params.networkModule.config.minimumThreshold, @@ -123,7 +104,7 @@ export const createStateManager = async (params: { transform: (args: any[]): STAKING_STATES_VALUES => { return args[0] as STAKING_STATES_VALUES; }, - onChange: async (newState) => { + onChange: async (newState: STAKING_STATES_VALUES | null) => { // 1. check if the new state is valid if (newState === null) return; diff --git a/packages/networks/src/networks/shared/StateManager/helpers/fetchBlockchainData.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/helpers/fetchBlockchainData.spec.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/helpers/fetchBlockchainData.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/helpers/fetchBlockchainData.spec.ts diff --git a/packages/networks/src/networks/shared/StateManager/helpers/fetchBlockchainData.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/helpers/fetchBlockchainData.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/helpers/fetchBlockchainData.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/helpers/fetchBlockchainData.ts diff --git a/packages/networks/src/networks/shared/StateManager/src/createEvmEventState.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createEvmEventState.spec.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/src/createEvmEventState.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createEvmEventState.spec.ts diff --git a/packages/networks/src/networks/shared/StateManager/src/createEvmEventState.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createEvmEventState.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/src/createEvmEventState.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createEvmEventState.ts diff --git a/packages/networks/src/networks/shared/StateManager/src/createRefreshedValue.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createRefreshedValue.spec.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/src/createRefreshedValue.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createRefreshedValue.spec.ts diff --git a/packages/networks/src/networks/shared/StateManager/src/createRefreshedValue.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createRefreshedValue.ts similarity index 100% rename from packages/networks/src/networks/shared/StateManager/src/createRefreshedValue.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/state-types/createRefreshedValue.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/helper/areStringArraysDifferent.spec.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/utils/areStringArraysDifferent.spec.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/helper/areStringArraysDifferent.spec.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/utils/areStringArraysDifferent.spec.ts diff --git a/packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/helper/areStringArraysDifferent.ts b/packages/networks/src/networks/vNaga/shared/managers/state-manager/utils/areStringArraysDifferent.ts similarity index 100% rename from packages/networks/src/networks/vNaga/envs/naga-dev/state-manager/helper/areStringArraysDifferent.ts rename to packages/networks/src/networks/vNaga/shared/managers/state-manager/utils/areStringArraysDifferent.ts diff --git a/packages/networks/src/networks/vNaga/schemas/LitMessageSchema.ts b/packages/networks/src/networks/vNaga/shared/schemas/LitMessageSchema.ts similarity index 100% rename from packages/networks/src/networks/vNaga/schemas/LitMessageSchema.ts rename to packages/networks/src/networks/vNaga/shared/schemas/LitMessageSchema.ts diff --git a/packages/networks/src/networks/vNaga/schemas/index.ts b/packages/networks/src/networks/vNaga/shared/schemas/index.ts similarity index 100% rename from packages/networks/src/networks/vNaga/schemas/index.ts rename to packages/networks/src/networks/vNaga/shared/schemas/index.ts diff --git a/packages/networks/src/networks/vNaga/shared/scripts/generate-abi-signatures.ts b/packages/networks/src/networks/vNaga/shared/scripts/generate-abi-signatures.ts new file mode 100644 index 0000000000..98a8c5011e --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/scripts/generate-abi-signatures.ts @@ -0,0 +1,44 @@ +// Command: NETWORK_CONFIG=/lit-assets/blockchain/contracts/networkContext.json bun run gen:local-network-context + +import { generateSignaturesFromContext } from '@lit-protocol/contracts/custom-network-signatures'; + +const NETWORK_CONFIG = process.env['NETWORK_CONFIG'] as string; +const NETWORK_NAME = process.env['NETWORK_NAME'] as string; +const DIRECTORY_NAME = process.env['DIRECTORY_NAME'] as string; + +if (!NETWORK_CONFIG) { + throw new Error( + '❌ NETWORK_CONFIG is not set. Please set it in your .env file. This is where your locally generated networkContext.json is located, usually in ./lit-assets/blockchain/contracts/networkContext.json.' + ); +} + +if (!NETWORK_NAME) { + throw new Error( + '❌ NETWORK_NAME is not set. Please set it in your .env file. Usually it is `naga-develop` for local development.' + ); +} + +if (!DIRECTORY_NAME) { + throw new Error( + '❌ DIRECTORY_NAME is not set. Please set it in your .env file. Usually this is inside the ./env directory inside your network (eg. vNaga) directory.' + ); +} + +console.log('✅ NETWORK_CONFIG:', NETWORK_CONFIG); +console.log('✅ NETWORK_NAME:', NETWORK_NAME); +console.log('✅ DIRECTORY_NAME:', DIRECTORY_NAME); + +async function main() { + await generateSignaturesFromContext({ + jsonFilePath: NETWORK_CONFIG, + networkName: NETWORK_NAME, + outputDir: `../../envs/${DIRECTORY_NAME}/generated`, + useScriptDirectory: true, + + // @ts-ignore + callerPath: import.meta.url, + }); +} + +// gogogo! +main().catch(console.error); diff --git a/packages/networks/src/networks/vNaga/shared/types.ts b/packages/networks/src/networks/vNaga/shared/types.ts new file mode 100644 index 0000000000..065e04443a --- /dev/null +++ b/packages/networks/src/networks/vNaga/shared/types.ts @@ -0,0 +1,35 @@ +import type { INetworkConfig } from './interfaces/NetworkContext'; + +export interface SharedManagerDependencies { + networkConfig: INetworkConfig; +} + +export interface PricingContext { + product: string; + realmId?: bigint; +} + +export interface AuthContext { + authMethodType: number; + authMethodId: string; + publicKey?: string; + accessToken?: string; +} + +export interface ConnectionInfo { + bootstrapUrls: string[]; + epochState: { + currentNumber: number; + }; +} + +export interface JitContext { + keySet: Record< + string, + { + publicKey: Uint8Array; + secretKey: Uint8Array; + } + >; + nodePrices: any; +} diff --git a/packages/schemas/CHANGELOG.md b/packages/schemas/CHANGELOG.md index 2909cf69ee..14982a93ea 100644 --- a/packages/schemas/CHANGELOG.md +++ b/packages/schemas/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/schemas +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/schemas/package.json b/packages/schemas/package.json index 79ae04ce6d..93add6eda7 100644 --- a/packages/schemas/package.json +++ b/packages/schemas/package.json @@ -26,7 +26,7 @@ "tags": [ "universal" ], - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts" } diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 9620536e29..55705384f3 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/types +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/types/package.json b/packages/types/package.json index 0500d191fe..0f01853b22 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -23,7 +23,7 @@ "buildOptions": { "genReact": false }, - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts", "dependencies": { diff --git a/packages/wasm/CHANGELOG.md b/packages/wasm/CHANGELOG.md index 6e32f20a11..a0c1972070 100644 --- a/packages/wasm/CHANGELOG.md +++ b/packages/wasm/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/wasm +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/wasm/package.json b/packages/wasm/package.json index e64387e7b9..673787f50a 100644 --- a/packages/wasm/package.json +++ b/packages/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@lit-protocol/wasm", - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "type": "commonjs", "homepage": "https://github.com/Lit-Protocol/js-sdk", "repository": { diff --git a/packages/wrapped-keys-lit-actions/CHANGELOG.md b/packages/wrapped-keys-lit-actions/CHANGELOG.md index e175a6e6cd..fc2e2830d5 100644 --- a/packages/wrapped-keys-lit-actions/CHANGELOG.md +++ b/packages/wrapped-keys-lit-actions/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/wrapped-keys-lit-actions +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/wrapped-keys-lit-actions/package.json b/packages/wrapped-keys-lit-actions/package.json index 0779f4239e..d251d3ebb9 100644 --- a/packages/wrapped-keys-lit-actions/package.json +++ b/packages/wrapped-keys-lit-actions/package.json @@ -26,7 +26,7 @@ "scripts": { "generate-lit-actions": "yarn node ./esbuild.config.js" }, - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts" } diff --git a/packages/wrapped-keys/CHANGELOG.md b/packages/wrapped-keys/CHANGELOG.md index cd236c618a..74c0a43310 100644 --- a/packages/wrapped-keys/CHANGELOG.md +++ b/packages/wrapped-keys/CHANGELOG.md @@ -1,5 +1,12 @@ # @lit-protocol/wrapped-keys +## 8.0.0-beta.1 + +### Patch Changes + +- a48fbfb: Initial version after networks unification +- Initial release for networks unification + ## 8.0.0-beta.0 ### Major Changes diff --git a/packages/wrapped-keys/package.json b/packages/wrapped-keys/package.json index e658c361f4..174a576191 100644 --- a/packages/wrapped-keys/package.json +++ b/packages/wrapped-keys/package.json @@ -23,7 +23,7 @@ "buildOptions": { "genReact": false }, - "version": "8.0.0-beta.0", + "version": "8.0.0-beta.1", "main": "./src/index.js", "typings": "./src/index.d.ts" }