From 650095ecccc42dda62bdd4b8cbed02a6b10a5e08 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 17:56:08 -0300 Subject: [PATCH 01/27] feat: integrate Lit Protocol with enhanced testing and configuration updates - Updated package.json to include new Lit Protocol dependencies and modified start command for request-node. - Added integration tests for Lit Protocol in the integration-test package, covering encryption and decryption functionalities. - Refactored LitProvider to streamline client initialization and improve error handling. - Updated CircleCI configuration to utilize the new start command. - Adjusted request-node configuration for Lit Protocol network settings. - Enhanced yarn.lock with new dependencies and versions for Lit Protocol packages. --- .circleci/config.yml | 4 +- package.json | 2 +- packages/integration-test/package.json | 5 +- .../test/lit-protocol.test.ts | 241 ++++++++++++++++++ .../src/lit-protocol-cipher-provider.ts | 87 ++----- .../lit-protocol-cipher/test/index.test.ts | 94 ++++++- packages/request-node/package.json | 1 + packages/request-node/src/config.ts | 3 +- .../getLitCapacityDelegationAuthSig.ts | 37 +-- yarn.lock | 19 ++ 10 files changed, 400 insertions(+), 93 deletions(-) create mode 100644 packages/integration-test/test/lit-protocol.test.ts diff --git a/.circleci/config.yml b/.circleci/config.yml index d5fd8e7682..6d637c8b75 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -391,7 +391,7 @@ jobs: - run: *step_graph_deploy - run: name: 'Start request-node' - command: 'yarn workspace @requestnetwork/request-node run start' + command: 'yarn start:request-node' background: true - run: *step_wait_for_node - run: @@ -496,7 +496,7 @@ jobs: - run: *step_graph_deploy - run: name: 'Start request-node' - command: 'yarn workspace @requestnetwork/request-node run start' + command: 'start:request-node' background: true - run: *step_wait_for_node - run: diff --git a/package.json b/package.json index dcd3d64c08..f768083144 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ "publish-manual-prerelease": "lerna publish prerelease --conventional-commits --exact", "publish-prerelease": "yarn lerna publish --preid development --skip-git --yes --canary", "deploy:contracts": "yarn workspace @requestnetwork/smart-contracts deploy", - "start:request-node": "yarn workspace @requestnetwork/request-node start", + "start:request-node": "LIT_PROTOCOL_NETWORK=datil-dev yarn workspace @requestnetwork/request-node start", "test": "lerna run test --concurrency=1", "format": "prettier . -w", "format:check": "prettier . -c", diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index b3a7407fbd..f9ba4ea135 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -29,7 +29,7 @@ "build": "tsc -b tsconfig.build.json", "clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo", "lint": "eslint \"test/**/*.ts\"", - "test": "run-s test:node test:layers", + "test": "run-s test:node test:layers test:lit", "test:scheduled": "run-s test:erc20 test:any test:erc777 test:eth test:btc ", "test:layers": "jest test/layers.test.ts --forceExit", "test:node": "jest test/node-client.test.ts --forceExit", @@ -37,7 +37,8 @@ "test:eth": "jest test/scheduled/eth*.test.ts --forceExit", "test:erc20": "jest test/scheduled/erc20*.test.ts --forceExit", "test:erc777": "jest test/scheduled/erc777*.test.ts --forceExit", - "test:btc": "jest test/scheduled/btc.test.ts --forceExit" + "test:btc": "jest test/scheduled/btc.test.ts --forceExit", + "test:lit": "jest test/lit-protocol.test.ts --forceExit" }, "devDependencies": { "@requestnetwork/advanced-logic": "0.47.0", diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts new file mode 100644 index 0000000000..baaa9ae7ee --- /dev/null +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -0,0 +1,241 @@ +import { EthereumPrivateKeySignatureProvider } from '@requestnetwork/epk-signature'; +import { LitProtocolProvider } from '@requestnetwork/lit-protocol-cipher'; +import { RequestNetwork, Types, Utils } from '@requestnetwork/request-client.js'; +import { ethers } from 'ethers'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; + +const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 1000): Promise { + let attempts = 0; + while (attempts < maxAttempts) { + try { + const data = await request.getData(); + if ( + data.state === Types.RequestLogic.STATE.CREATED || + data.state === Types.RequestLogic.STATE.PENDING + ) { + console.log(`Request confirmed with state: ${data.state}`); + return; + } + console.log( + `Attempt ${attempts + 1}: Request not confirmed yet. Current state: ${data.state}`, + ); + } catch (error) { + console.log(`Attempt ${attempts + 1} failed:`, error); + } + await sleep(delayMs); + attempts++; + } + throw new Error(`Request not confirmed after ${maxAttempts} attempts`); +} + +describe('Lit Protocol Integration Tests', () => { + let requestNetwork: RequestNetwork; + let litProvider: LitProtocolProvider; + let epkSignatureProvider: EthereumPrivateKeySignatureProvider; + let userWallet: ethers.Wallet; + let litClient: LitNodeClient; + + const nodeConnectionConfig = { + baseURL: 'http://localhost:3000', + headers: { + 'Content-Type': 'application/json', + }, + }; + + beforeAll(async () => { + // Create wallet + userWallet = new ethers.Wallet( + '0x7b595b2bb732edddc4d4fe758ae528c7a748c40f0f6220f4494e214f15c5bfeb', + ); + + // Initialize signature provider + epkSignatureProvider = new EthereumPrivateKeySignatureProvider({ + method: Types.Signature.METHOD.ECDSA, + privateKey: userWallet.privateKey, + }); + + // Initialize Lit Protocol client + litClient = new LitNodeClient({ + litNetwork: 'datil-dev', + alertWhenUnauthorized: false, + debug: false, + }); + + // Initialize Lit Protocol provider + litProvider = new LitProtocolProvider(litClient, nodeConnectionConfig); + await litProvider.initializeClient(); + await litProvider.enableDecryption(true); + await litProvider.getSessionSignatures(userWallet, userWallet.address); + + // Initialize Request Network client + requestNetwork = new RequestNetwork({ + nodeConnectionConfig, + signatureProvider: epkSignatureProvider, + cipherProvider: litProvider, + }); + }, 30000); + + afterAll(async () => { + try { + // Get all pending promises + const promises = []; + if (litProvider) { + promises.push(litProvider.disconnectClient()); + promises.push(litProvider.disconnectWallet()); + } + if (litClient) { + promises.push(litClient.disconnect()); + } + + // Wait for all cleanup operations to complete + await Promise.all(promises); + } catch (error) { + console.error('Cleanup error:', error); + } + }); + + it('should encrypt and decrypt data directly', async () => { + const testData = 'test encryption'; + const encryptionParams = [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ]; + + const encrypted = await litProvider.encrypt(testData, { encryptionParams }); + expect(encrypted).toBeDefined(); + expect(encrypted?.ciphertext).toBeDefined(); + expect(encrypted?.dataToEncryptHash).toBeDefined(); + + const decrypted = await litProvider.decrypt(encrypted!, { encryptionParams }); + expect(decrypted).toBe(testData); + }); + + it('should create and encrypt a request', async () => { + const requestParams = { + requestInfo: { + currency: { + type: Types.RequestLogic.CURRENCY.ETH, + value: '0x0000000000000000000000000000000000000000', + network: 'sepolia', + }, + expectedAmount: ethers.utils.parseEther('0.1').toString(), + payee: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: userWallet.address, + }, + payer: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: '0xb07D2398d2004378cad234DA0EF14f1c94A530e4', + }, + timestamp: Utils.getCurrentTimestampInSecond(), + }, + paymentNetwork: { + id: Types.Extension.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT, + parameters: { + paymentNetworkName: 'sepolia', + paymentAddress: userWallet.address, + feeAddress: '0x0000000000000000000000000000000000000000', + feeAmount: '0', + tokenAddress: '0x0000000000000000000000000000000000000000', + }, + }, + contentData: { + meta: { + format: 'rnf_invoice', + version: '0.0.3', + }, + creationDate: new Date().toISOString(), + invoiceNumber: 'INV-2023-001', + invoiceItems: [ + { + name: 'Test Service', + quantity: 1, + unitPrice: ethers.utils.parseEther('0.1').toString(), + discount: '0', + tax: { + type: 'percentage', + amount: '0', + }, + currency: 'ETH', + }, + ], + }, + signer: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: userWallet.address, + }, + }; + + const encryptionParams = [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ]; + + const encryptedRequest = await requestNetwork._createEncryptedRequest( + requestParams as Types.ICreateRequestParameters, + encryptionParams, + ); + + await waitForConfirmation(encryptedRequest, 15, 2000); + + const requestData = await encryptedRequest.getData(); + expect(requestData).toBeDefined(); + expect([Types.RequestLogic.STATE.CREATED, Types.RequestLogic.STATE.PENDING]).toContain( + requestData.state, + ); + + // Wait for any pending operations to complete + await new Promise((resolve) => setTimeout(resolve, 1000)); + }); + + it('should handle encryption errors gracefully', async () => { + const invalidEncryptionParams = [ + { + key: '', + method: Types.Encryption.METHOD.KMS, + }, + ]; + + // Mock the validation function to throw an error + const originalValidation = litProvider['getLitAccessControlConditions']; + try { + litProvider['getLitAccessControlConditions'] = jest.fn().mockImplementation(() => { + throw new Error('Invalid encryption parameter at index 0: missing key'); + }); + + await expect(async () => { + await litProvider.encrypt('test data', { encryptionParams: invalidEncryptionParams }); + }).rejects.toThrow('Invalid encryption parameter at index 0: missing key'); + } finally { + // Restore original validation + litProvider['getLitAccessControlConditions'] = originalValidation; + } + }); + + it('should handle decryption errors gracefully', async () => { + const invalidEncryptedData = { + ciphertext: 'invalid-ciphertext', + dataToEncryptHash: 'invalid-hash', + }; + + await expect( + litProvider.decrypt(invalidEncryptedData, { + encryptionParams: [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ], + }), + ).rejects.toThrow(); + + // Wait for any pending operations to complete + await new Promise((resolve) => setTimeout(resolve, 1000)); + }); +}); diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index ceaf650065..5054bc8459 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -6,9 +6,7 @@ import { EncryptResponse, AccsDefaultParams, AuthSig, - LIT_NETWORKS_KEYS, AuthCallbackParams, - StorageProvider, } from '@lit-protocol/types'; import { LitAccessControlConditionResource, @@ -17,8 +15,8 @@ import { } from '@lit-protocol/auth-helpers'; import { Signer } from 'ethers'; import { LIT_ABILITY } from '@lit-protocol/constants'; -import { disconnectWeb3, LitNodeClient } from '@lit-protocol/lit-node-client'; -import type { LitNodeClientNodeJs } from '@lit-protocol/lit-node-client'; +import { disconnectWeb3 } from '@lit-protocol/lit-node-client'; +import type { LitNodeClientNodeJs, LitNodeClient } from '@lit-protocol/lit-node-client'; /** * @class LitProvider @@ -32,11 +30,6 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider */ private chain: string; - /** - * @property {string} network - The network to use for access control conditions. - */ - private network: LIT_NETWORKS_KEYS; - /** * @property {DataAccessTypes.IDataAccess} dataAccess - The data access layer for Request Network. */ @@ -50,17 +43,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider /** * @property {LitNodeClient|LitNodeClientNodeJs|null} client - The Lit Protocol client instance. */ - private client: LitNodeClient | LitNodeClientNodeJs | null = null; - - /** - * @property {any} storageProvider - The storage provider for the Node.js Lit client. - */ - private nodeJsStorageProvider: StorageProvider | undefined; - - /** - * @property {boolean} debug - A boolean indicating if debug mode is enabled. - */ - private debug: boolean; + private litClient: LitNodeClient | LitNodeClientNodeJs | null = null; /** * @property {boolean} isDecryptionOn - A boolean indicating if decryption is enabled. @@ -73,17 +56,13 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider * @throws {Error} Throws an error if the provided Lit client is invalid. */ constructor( - chain: string, - network: LIT_NETWORKS_KEYS, + litClient: LitNodeClient | LitNodeClientNodeJs, nodeConnectionConfig: NodeConnectionConfig, - debug?: boolean, - nodeJsStorageProvider?: StorageProvider, + chain?: string, ) { - this.chain = chain; - this.network = network; + this.litClient = litClient; + this.chain = chain || 'ethereum'; this.dataAccess = new HttpDataAccess({ nodeConnectionConfig }); - this.debug = debug || false; - this.nodeJsStorageProvider = nodeJsStorageProvider; } /** @@ -94,23 +73,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider */ public async initializeClient(): Promise { try { - // Using process.browser instead of typeof window - if (typeof window !== 'undefined') { - this.client = new LitNodeClient({ - litNetwork: this.network, - debug: this.debug, - }); - await this.client.connect(); - } else { - const { LitNodeClientNodeJs } = await import('@lit-protocol/lit-node-client'); - this.client = new LitNodeClientNodeJs({ - litNetwork: this.network, - storageProvider: this.nodeJsStorageProvider, - debug: this.debug, - }); - - await this.client.connect(); - } + await this.litClient?.connect(); } catch (error) { throw new Error(`Failed to initialize Lit client: ${error.message}`); } @@ -126,9 +89,6 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider disconnectWeb3(); } this.sessionSigs = null; - if (this.nodeJsStorageProvider) { - this.nodeJsStorageProvider.provider.clear(); - } } /** @@ -138,8 +98,8 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider * @returns {Promise} */ public async disconnectClient(): Promise { - if (this.client) { - await this.client.disconnect(); + if (this.litClient) { + await this.litClient.disconnect(); } } @@ -152,7 +112,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider * @returns {Promise} */ public async getSessionSignatures(signer: Signer, walletAddress: string): Promise { - if (!this.client) { + if (!this.litClient) { throw new Error('Lit client not initialized'); } if (this.sessionSigs) { @@ -164,7 +124,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider : ({} as AuthSig); // Get the latest blockhash - const latestBlockhash = await this.client?.getLatestBlockhash(); + const latestBlockhash = await this.litClient?.getLatestBlockhash(); // Define the authNeededCallback function const authNeededCallback = async (params: AuthCallbackParams) => { @@ -186,7 +146,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider resources: params.resourceAbilityRequests, walletAddress: walletAddress, nonce: latestBlockhash || '', - litNodeClient: this.client, + litNodeClient: this.litClient, }); // Generate the authSig @@ -203,7 +163,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider // Get the session signatures this.sessionSigs = - (await this.client?.getSessionSigs({ + (await this.litClient?.getSessionSigs({ chain: this.chain, capabilityAuthSigs: [capacityDelegationAuthSig], resourceAbilityRequests: [ @@ -231,6 +191,13 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider throw new Error('encryptionParams cannot be empty'); } + // Add validation for required encryption parameter fields + encryptionParams.forEach((param, index) => { + if (!param.key) { + throw new Error(`Invalid encryption parameter at index ${index}: missing key`); + } + }); + const accessControlConditions = []; accessControlConditions.push({ @@ -288,7 +255,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider * @returns {boolean} A boolean indicating if encryption is available. */ public isEncryptionAvailable(): boolean { - return this.client !== null; + return this.litClient !== null; } /** @@ -307,7 +274,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider encryptionParams: EncryptionTypes.IEncryptionParameters[]; }, ): Promise { - if (!this.client) { + if (!this.litClient) { throw new Error('Lit client not initialized'); } @@ -317,7 +284,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider options.encryptionParams, ); - return await this.client.encrypt({ + return await this.litClient.encrypt({ accessControlConditions: accessControlConditions, dataToEncrypt: new TextEncoder().encode(stringifiedData), }); @@ -329,7 +296,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider * @returns {boolean} A boolean indicating if decryption is available. */ public isDecryptionAvailable(): boolean { - return this.client !== null && this.sessionSigs !== null && this.decryptionEnabled; + return this.litClient !== null && this.sessionSigs !== null && this.decryptionEnabled; } /** @@ -349,7 +316,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider encryptionParams: EncryptionTypes.IEncryptionParameters[]; }, ): Promise { - if (!this.client) { + if (!this.litClient) { throw new Error('Lit client not initialized'); } @@ -361,7 +328,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider options.encryptionParams, ); - const { decryptedData } = await this.client.decrypt({ + const { decryptedData } = await this.litClient.decrypt({ accessControlConditions: accessControlConditions, chain: this.chain, ciphertext: encryptedData.ciphertext, diff --git a/packages/lit-protocol-cipher/test/index.test.ts b/packages/lit-protocol-cipher/test/index.test.ts index 618fdd312c..fe1f17af61 100644 --- a/packages/lit-protocol-cipher/test/index.test.ts +++ b/packages/lit-protocol-cipher/test/index.test.ts @@ -15,21 +15,20 @@ jest.mock('@lit-protocol/encryption'); describe('LitProvider', () => { let litProvider: LitProvider; - let mockLitClient: jest.Mocked; // Use Node.js client + let mockLitClient: jest.Mocked; let mockSigner: jest.Mocked; - const mockChain = 'ethereum'; - const mockNetwork = 'datil-test'; const mockNodeConnectionConfig: NodeConnectionConfig = { baseURL: 'http://localhost:3000', headers: {}, }; const mockWalletAddress = '0x1234567890abcdef'; + const mockChain = 'ethereum'; const mockEncryptionParams: EncryptionTypes.IEncryptionParameters[] = [ { key: mockWalletAddress, - method: EncryptionTypes.METHOD.KMS, // Use the enum + method: EncryptionTypes.METHOD.KMS, }, ]; @@ -41,8 +40,17 @@ describe('LitProvider', () => { disconnect: jest.fn().mockReturnValue(Promise.resolve()), getLatestBlockhash: jest.fn().mockReturnValue(Promise.resolve('mock-blockhash')), getSessionSigs: jest.fn().mockReturnValue(Promise.resolve({ 'mock-session': 'mock-sig' })), - encrypt: jest.fn().mockReturnValue(Promise.resolve('mock-encrypted-data')), - decrypt: jest.fn().mockReturnValue(Promise.resolve('mock-decrypted-data')), + encrypt: jest.fn().mockReturnValue( + Promise.resolve({ + ciphertext: 'mock-encrypted-data', + dataToEncryptHash: 'mock-hash', + }), + ), + decrypt: jest.fn().mockReturnValue( + Promise.resolve({ + decryptedData: new TextEncoder().encode('mock-decrypted-data'), + }), + ), } as unknown as jest.Mocked; (LitNodeClientNodeJs as unknown as jest.Mock).mockImplementation(() => mockLitClient); @@ -52,9 +60,7 @@ describe('LitProvider', () => { signMessage: jest.fn().mockReturnValue(Promise.resolve('mock-signature')), } as unknown as jest.Mocked; - const debug = false; - - litProvider = new LitProvider(mockChain, mockNetwork, mockNodeConnectionConfig, debug); + litProvider = new LitProvider(mockLitClient, mockNodeConnectionConfig, mockChain); await litProvider.initializeClient(); }); @@ -65,6 +71,11 @@ describe('LitProvider', () => { nodeConnectionConfig: mockNodeConnectionConfig, }); }); + + it('should use default chain if not provided', () => { + const providerWithDefaultChain = new LitProvider(mockLitClient, mockNodeConnectionConfig); + expect(providerWithDefaultChain['chain']).toBe('ethereum'); + }); }); describe('disconnectWallet', () => { @@ -88,6 +99,49 @@ describe('LitProvider', () => { }); }); + describe('encryption and decryption state', () => { + it('should manage decryption state correctly', () => { + expect(litProvider.isDecryptionEnabled()).toBe(false); + + litProvider.enableDecryption(true); + expect(litProvider.isDecryptionEnabled()).toBe(true); + + litProvider.enableDecryption(false); + expect(litProvider.isDecryptionEnabled()).toBe(false); + }); + + it('should check encryption availability', () => { + expect(litProvider.isEncryptionAvailable()).toBe(true); + + // Test when client is null + litProvider['litClient'] = null; + expect(litProvider.isEncryptionAvailable()).toBe(false); + }); + + it('should check decryption availability', () => { + litProvider.enableDecryption(true); + litProvider['sessionSigs'] = { + 'mock-session': { + sig: 'mock-sig', + derivedVia: 'mock', + signedMessage: 'mock', + address: 'mock-address', + }, + }; + expect(litProvider.isDecryptionAvailable()).toBe(true); + + litProvider.enableDecryption(false); + expect(litProvider.isDecryptionAvailable()).toBe(false); + + litProvider.enableDecryption(true); + litProvider['sessionSigs'] = null; + expect(litProvider.isDecryptionAvailable()).toBe(false); + + litProvider['litClient'] = null; + expect(litProvider.isDecryptionAvailable()).toBe(false); + }); + }); + describe('getSessionSignatures', () => { it('should get session signatures successfully', async () => { const mockAuthSig = { @@ -149,7 +203,27 @@ describe('LitProvider', () => { ); }); - // ... (rest of your encrypt tests with necessary adjustments) + it('should encrypt object data successfully', async () => { + const objectData = { test: 'data' }; + const result = await litProvider.encrypt(objectData, { + encryptionParams: mockEncryptionParams, + }); + + expect(result).toEqual(mockEncryptResponse); + expect(mockLitClient.encrypt).toHaveBeenCalledWith( + expect.objectContaining({ + dataToEncrypt: new TextEncoder().encode(JSON.stringify(objectData)), + accessControlConditions: expect.any(Array), + }), + ); + }); + + it('should throw error if client is not initialized', async () => { + litProvider['litClient'] = null; + await expect( + litProvider.encrypt(mockData, { encryptionParams: mockEncryptionParams }), + ).rejects.toThrow('Lit client not initialized'); + }); }); describe('decrypt', () => { diff --git a/packages/request-node/package.json b/packages/request-node/package.json index c9a8a10280..8e050b7173 100644 --- a/packages/request-node/package.json +++ b/packages/request-node/package.json @@ -46,6 +46,7 @@ "@lit-protocol/contracts": "0.0.74", "@lit-protocol/contracts-sdk": "7.0.0", "@lit-protocol/lit-node-client": "7.0.0", + "@lit-protocol/types": "7.0.1", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", "@requestnetwork/ethereum-storage": "0.38.0", diff --git a/packages/request-node/src/config.ts b/packages/request-node/src/config.ts index 48640e077b..94724e663e 100644 --- a/packages/request-node/src/config.ts +++ b/packages/request-node/src/config.ts @@ -5,7 +5,6 @@ import { BigNumber } from 'ethers'; import { LogTypes } from '@requestnetwork/types'; import { LogMode } from './logger'; -import { LIT_NETWORK } from '@lit-protocol/constants'; const argv = yargs.option('help', { alias: 'h', type: 'boolean' }).parseSync(); @@ -47,7 +46,7 @@ const defaultValues = { wallet: { mnemonic: 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat', }, - litProtocolNetwork: LIT_NETWORK.Datil, + litProtocolNetwork: 'datil', litProtocolRPC: 'https://yellowstone-rpc.litprotocol.com', litProtocolCapacityCreditsUsage: '1', litProtocolCapacityCreditsExpirationInSeconds: 10 * 60, // 10 minutes diff --git a/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts b/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts index fb95d036d8..c2eeb4e354 100644 --- a/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts +++ b/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts @@ -6,7 +6,7 @@ import { StatusCodes } from 'http-status-codes'; import * as config from '../config'; import { LitContracts } from '@lit-protocol/contracts-sdk'; import { utils } from 'ethers'; - +import { LIT_NETWORKS_KEYS } from '@lit-protocol/types'; /** * Handles getLitCapacityDelegationAuthSigHandler. * @@ -30,31 +30,36 @@ export default class GetLitCapacityDelegationAuthSigHandler { const ethersSigner = Wallet.fromMnemonic(config.getMnemonic()).connect( new providers.JsonRpcProvider(config.getLitProtocolRPC()), ); + let tokenId = '0'; + if (config.getLitProtocolNetwork() === 'datil-dev') { + tokenId = '0'; + } else { + const litContractClient = new LitContracts({ + signer: ethersSigner, + network: config.getLitProtocolNetwork() as LIT_NETWORKS_KEYS, + }); + await litContractClient.connect(); - const litContractClient = new LitContracts({ - signer: ethersSigner, - network: config.getLitProtocolNetwork(), - }); - await litContractClient.connect(); - - const existingTokens: { tokenId: string }[] = - await litContractClient.rateLimitNftContractUtils.read.getTokensByOwnerAddress( - await ethersSigner.getAddress(), - ); + const existingTokens: { tokenId: string }[] = + await litContractClient.rateLimitNftContractUtils.read.getTokensByOwnerAddress( + await ethersSigner.getAddress(), + ); - if (existingTokens.length === 0) { - serverResponse.status(StatusCodes.UNPROCESSABLE_ENTITY).send('No existing tokens'); - return; + if (existingTokens.length === 0) { + serverResponse.status(StatusCodes.UNPROCESSABLE_ENTITY).send('No existing tokens'); + return; + } + tokenId = `${existingTokens[existingTokens.length - 1].tokenId}`; } const litNodeClient = new LitNodeClientNodeJs({ - litNetwork: config.getLitProtocolNetwork(), + litNetwork: config.getLitProtocolNetwork() as LIT_NETWORKS_KEYS, debug: false, }); await litNodeClient.connect(); const { capacityDelegationAuthSig } = await litNodeClient.createCapacityDelegationAuthSig({ - capacityTokenId: `${existingTokens[existingTokens.length - 1].tokenId}`, + capacityTokenId: tokenId, dAppOwnerWallet: ethersSigner, delegateeAddresses: [`${delegateeAddress}`], uses: `${config.getLitProtocolCapacityCreditsUsage()}`, diff --git a/yarn.lock b/yarn.lock index 8744c4dcbc..aef8f55915 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3391,6 +3391,13 @@ dependencies: ajv "^8.12.0" +"@lit-protocol/accs-schemas@^0.0.20": + version "0.0.20" + resolved "https://registry.yarnpkg.com/@lit-protocol/accs-schemas/-/accs-schemas-0.0.20.tgz#64d1151002f63aa0a54ba2be92bf44edefb0eb1e" + integrity sha512-JHHX0q45nq1uQ4olkg4VIGLW9lzMnRRldeTDuOrOaoPVztz+2iSOjwzb+QmuSuKFQpP5SOej2zoQB+K8b22KDw== + dependencies: + ajv "^8.12.0" + "@lit-protocol/auth-browser@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@lit-protocol/auth-browser/-/auth-browser-7.0.0.tgz#67fe2c9748f9199ef50dcae3cadf916af4d134bd" @@ -3726,6 +3733,18 @@ siwe "^2.3.2" tslib "1.14.1" +"@lit-protocol/types@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/types/-/types-7.0.1.tgz#a8675442992eb104390870f610bd65e6d9ddfa59" + integrity sha512-CpAYgn797PgB6DjhPU2+PUTFud+mnm3UfqBpZqgvUC1WureqZ4tW1SdQvSmYrMQzHsJIdUOkMnoyO4dBrVOq0A== + dependencies: + "@ethersproject/abstract-provider" "5.7.0" + "@lit-protocol/accs-schemas" "^0.0.20" + depd "^2.0.0" + ethers "^5.7.1" + siwe "^2.3.2" + tslib "1.14.1" + "@lit-protocol/uint8arrays@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@lit-protocol/uint8arrays/-/uint8arrays-7.0.0.tgz#26fe8b56409db7b63a7ac9bc6e1f62959b6be22a" From 153667e6774101e2b889e9b9a45797b19b79f6b4 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 20:26:40 -0300 Subject: [PATCH 02/27] fix: readme --- packages/lit-protocol-cipher/README.md | 27 ++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/lit-protocol-cipher/README.md b/packages/lit-protocol-cipher/README.md index 2ce1a92978..1629463d04 100644 --- a/packages/lit-protocol-cipher/README.md +++ b/packages/lit-protocol-cipher/README.md @@ -1,8 +1,8 @@ # @requestnetwork/lit-protocol-cipher -Lit Protocol Provider. +Lit Protocol Provider for Request Network. -`@requestnetwork/lit-protocol-cipher` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork). +`@requestnetwork/lit-protocol-cipher` is a typescript library part of the [Request Network protocol](https://github.com/RequestNetwork/requestNetwork) that provides encryption and decryption capabilities using the Lit Protocol. ## Installation @@ -12,22 +12,30 @@ npm install @requestnetwork/lit-protocol-cipher ## Usage -The `LitProvider` class provides encryption and decryption capabilities using the Lit Protocol. Here's how to implement and use it: +The `LitProtocolProvider` class provides encryption and decryption capabilities using the Lit Protocol. Here's how to implement and use it: ```typescript import { ethers } from 'ethers'; -import LitProvider from './LitProvider'; +import { LitProtocolProvider } from '@requestnetwork/lit-protocol-cipher'; import { LIT_NETWORKS } from '@lit-protocol/types'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; // Initialize the provider -const litProvider = new LitProvider( - 'ethereum', // chain - LIT_NETWORKS.MAINNET, // network +const litProvider = new LitProtocolProvider( + new LitNodeClient({ + litNetwork: LIT_NETWORKS.datil, + }), { - nodeUrl: 'https://your-request-network-node.com', + baseURL: 'https://your-request-network-node.com', + headers: { + 'Content-Type': 'application/json', + }, }, // nodeConnectionConfig ); +// Initialize the client +await litProvider.initializeClient(); + // Example usage with wallet connection async function example() { try { @@ -75,6 +83,9 @@ async function example() { await litProvider.disconnectWallet(); } catch (error) { console.error('Error:', error); + } finally { + // Disconnect wallet when done + await litProvider.disconnectWallet(); } } From 0a4a75d81735bdbff7f13157af7db1446e3ae2d6 Mon Sep 17 00:00:00 2001 From: Rodrigo Serviuc Pavezi Date: Thu, 5 Dec 2024 20:28:17 -0300 Subject: [PATCH 03/27] Update .circleci/config.yml Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 6d637c8b75..625f7ff200 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -496,7 +496,7 @@ jobs: - run: *step_graph_deploy - run: name: 'Start request-node' - command: 'start:request-node' + command: 'yarn start:request-node' background: true - run: *step_wait_for_node - run: From a64801f2679d5c2fa27914cf2795732aa90c9217 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 20:41:05 -0300 Subject: [PATCH 04/27] fix: build --- .circleci/config.yml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 625f7ff200..658aba9386 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -76,23 +76,8 @@ jobs: paths: - ~/.cache/yarn - run: - name: Build types - command: yarn workspace @requestnetwork/types run build - - run: - name: Build utils - command: yarn workspace @requestnetwork/utils run build - - run: - name: Build currency - command: yarn workspace @requestnetwork/currency run build - - run: - name: Generate Smart Contract types - command: yarn workspace @requestnetwork/smart-contracts run build - - run: - name: Generate Payment Detection queries - command: yarn workspace @requestnetwork/payment-detection run codegen - - run: - name: Build all packages (tsc) - command: yarn build:tsc + name: Build all packages + command: yarn build --skip-nx-cache - persist_to_workspace: root: *working_directory From 7eb71e1e9c5a603656f0c3f8bffa9f6e1e499bf3 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 20:46:59 -0300 Subject: [PATCH 05/27] fix: build giving more memory --- .circleci/config.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 658aba9386..4a6aba8c8d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,6 +6,8 @@ references: image_name: &image_name 'cimg/python:3.7' node_image: &node_image image: cimg/node:18.18 + environment: + NODE_OPTIONS: '--max-old-space-size=4096' ipfs_image: &ipfs_image image: requestnetwork/request-ipfs:v0.13.0 ganache_image: &ganache_image From 1b3f85e67643d0034d36a27271d05093e4feaca7 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 20:56:55 -0300 Subject: [PATCH 06/27] fix: memory issu --- .circleci/config.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4a6aba8c8d..47de3de412 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ references: node_image: &node_image image: cimg/node:18.18 environment: - NODE_OPTIONS: '--max-old-space-size=4096' + NODE_OPTIONS: '--max-old-space-size=8192' ipfs_image: &ipfs_image image: requestnetwork/request-ipfs:v0.13.0 ganache_image: &ganache_image @@ -79,7 +79,7 @@ jobs: - ~/.cache/yarn - run: name: Build all packages - command: yarn build --skip-nx-cache + command: yarn build - persist_to_workspace: root: *working_directory From 11a4e861daa181c032f7328248744ba6e5d6e3a2 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 5 Dec 2024 21:34:02 -0300 Subject: [PATCH 07/27] fix: out of memory issue --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 47de3de412..ff654a689d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -62,6 +62,7 @@ jobs: build: docker: - *node_image + resource_class: large working_directory: *working_directory steps: - checkout @@ -79,7 +80,7 @@ jobs: - ~/.cache/yarn - run: name: Build all packages - command: yarn build + command: yarn build --skip-nx-cache - persist_to_workspace: root: *working_directory From 0229d47afa77f62844cd46e6b7b6237674cbc30a Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 6 Dec 2024 09:29:49 -0300 Subject: [PATCH 08/27] chore: upgrade lit protocol sdk version --- package.json | 6 +- packages/lit-protocol-cipher/package.json | 12 +- packages/request-node/package.json | 6 +- packages/types/package.json | 2 +- yarn.lock | 354 +++++++++++----------- 5 files changed, 188 insertions(+), 192 deletions(-) diff --git a/package.json b/package.json index f768083144..5100cdc1fc 100644 --- a/package.json +++ b/package.json @@ -31,8 +31,10 @@ "test": "lerna run test --concurrency=1", "format": "prettier . -w", "format:check": "prettier . -c", - "link:all": "for d in packages/*; do cd $d; yarn link; cd -; done", - "unlink:all": "for d in packages/*; do cd $d; yarn unlink; cd -; done" + "link:all-npm": "for d in packages/*; do cd $d; npm link; cd -; done", + "unlink:all-npm": "for d in packages/*; do cd $d; npm unlink; cd -; done", + "link:all-yarn": "for d in packages/*; do cd $d; yarn link; cd -; done", + "unlink:all-yarn": "for d in packages/*; do cd $d; yarn unlink; cd -; done" }, "devDependencies": { "@typescript-eslint/eslint-plugin": "4.18.0", diff --git a/packages/lit-protocol-cipher/package.json b/packages/lit-protocol-cipher/package.json index 78c211451a..b60e547aaa 100644 --- a/packages/lit-protocol-cipher/package.json +++ b/packages/lit-protocol-cipher/package.json @@ -40,13 +40,13 @@ "test:watch": "yarn test --watch" }, "dependencies": { - "@lit-protocol/auth-helpers": "7.0.0", - "@lit-protocol/constants": "7.0.0", + "@lit-protocol/auth-helpers": "7.0.1", + "@lit-protocol/constants": "7.0.1", "@lit-protocol/contracts": "0.0.74", - "@lit-protocol/encryption": "7.0.0", - "@lit-protocol/lit-node-client": "7.0.0", - "@lit-protocol/lit-node-client-nodejs": "7.0.0", - "@lit-protocol/types": "7.0.0", + "@lit-protocol/encryption": "7.0.1", + "@lit-protocol/lit-node-client": "7.0.1", + "@lit-protocol/lit-node-client-nodejs": "7.0.1", + "@lit-protocol/types": "7.0.1", "@requestnetwork/request-client.js": "0.52.0", "@requestnetwork/types": "0.47.0", "@walletconnect/modal": "2.7.0", diff --git a/packages/request-node/package.json b/packages/request-node/package.json index 8e050b7173..0abc970ffe 100644 --- a/packages/request-node/package.json +++ b/packages/request-node/package.json @@ -42,11 +42,11 @@ }, "dependencies": { "@ethersproject/experimental": "5.7.0", - "@lit-protocol/constants": "7.0.0", + "@lit-protocol/constants": "7.0.1", "@lit-protocol/contracts": "0.0.74", - "@lit-protocol/contracts-sdk": "7.0.0", - "@lit-protocol/lit-node-client": "7.0.0", "@lit-protocol/types": "7.0.1", + "@lit-protocol/contracts-sdk": "7.0.1", + "@lit-protocol/lit-node-client": "7.0.1", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", "@requestnetwork/ethereum-storage": "0.38.0", diff --git a/packages/types/package.json b/packages/types/package.json index 7f39f6e5c2..7dbb1fc1b7 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -38,7 +38,7 @@ "prepare": "yarn run build" }, "dependencies": { - "@lit-protocol/types": "7.0.0", + "@lit-protocol/types": "7.0.1", "ethers": "5.7.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index aef8f55915..eaed3c961f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3361,20 +3361,21 @@ resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.1.tgz#2f3a8f1d688935c704dbc89132394a41029acbb8" integrity sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ== -"@lit-protocol/access-control-conditions@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/access-control-conditions/-/access-control-conditions-7.0.0.tgz#9e2c783f87aef3525ed012bab71c6eb1a9a29ee4" - integrity sha512-HzsiJlPQiJEa00syX9r+9ful0NPurgp2i/V0bwe17IyFdg71ENNLRSzCA+O8Yrnox+J6aqMFLwTgTvPXICyZeQ== +"@lit-protocol/access-control-conditions@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/access-control-conditions/-/access-control-conditions-7.0.1.tgz#998ee0ef80364b74f34eff60dbbdb27258c88193" + integrity sha512-OxyVZgI79YyrOOC4ngc3hkFNWwq514Xpm9ODAiapp8FPLAsbOYt7lhoeHbAQQxVpawJA4C4xkdXzvKDEuCSGZA== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3384,13 +3385,6 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/accs-schemas@^0.0.15": - version "0.0.15" - resolved "https://registry.yarnpkg.com/@lit-protocol/accs-schemas/-/accs-schemas-0.0.15.tgz#00e31c6959834da6387049cf52bce29c84f0f9da" - integrity sha512-GYF8BolqrU2H/uXr3D39TUbgFN/3u2d68oHHNfwg926iEsCEHwGmUOPvi4EMprV5lJR3EVn9IQODY/4eokJ6Rg== - dependencies: - ajv "^8.12.0" - "@lit-protocol/accs-schemas@^0.0.20": version "0.0.20" resolved "https://registry.yarnpkg.com/@lit-protocol/accs-schemas/-/accs-schemas-0.0.20.tgz#64d1151002f63aa0a54ba2be92bf44edefb0eb1e" @@ -3398,10 +3392,10 @@ dependencies: ajv "^8.12.0" -"@lit-protocol/auth-browser@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/auth-browser/-/auth-browser-7.0.0.tgz#67fe2c9748f9199ef50dcae3cadf916af4d134bd" - integrity sha512-DYoucBiTXCv1sdtUCTbYC4DApuezrtLXTK3bdW0KLLIY9aBBq0C9i4FwIPQjkz9e7S0rXUwI7d0QL3HV5NnK7Q== +"@lit-protocol/auth-browser@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/auth-browser/-/auth-browser-7.0.1.tgz#038719aaa73ae4a54fca44616b3dcee0b3533fe9" + integrity sha512-EqR/NOtmFE/0W1kXNbbm6YD46fOL6Uin22Ro0HI1lUqWzGAA1y92IPLCBzFWUECb02IkVygfviONMgvnLCUKkg== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/bytes" "5.7.0" @@ -3409,13 +3403,13 @@ "@ethersproject/providers" "5.7.2" "@ethersproject/strings" "5.7.0" "@ethersproject/wallet" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/misc-browser" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/misc-browser" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3423,21 +3417,22 @@ ethers "^5.7.1" tslib "1.14.1" -"@lit-protocol/auth-helpers@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/auth-helpers/-/auth-helpers-7.0.0.tgz#96081f573082f8d1113fa28e0c5eee549dd6b251" - integrity sha512-7psSirXq6aNJhauzgHgMRFPcBOTZ8BYkaYc70sL70yxVcbjXaoye4pNCyNYNqmvZ8SSxcAaFcwPc5V1SHKNSBw== +"@lit-protocol/auth-helpers@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/auth-helpers/-/auth-helpers-7.0.1.tgz#d755d8e9104654434b05a8beb44767eec7bddeab" + integrity sha512-5vFOtjyombztC1lyItSoREVve1A1kA/aJGX53wbnU3F/NBbR61g0ypoexqrzb8pZz1aH73bMzcSsObla5NOTDA== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/access-control-conditions" "7.0.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" + "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3448,34 +3443,36 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/constants@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/constants/-/constants-7.0.0.tgz#de18cf1392af9de116b3057a20fde900844740ff" - integrity sha512-pIxhY+fTswqWWM/DNRYOOLEYOWE+aQiacvJMl/MXvLk2MjG87AIWdpv5ZNpho5qy6MSfF7ig4WTgv4rjvNwfgA== +"@lit-protocol/constants@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/constants/-/constants-7.0.1.tgz#9af207ba83791d060c5ea04399d3ef4be5d3a8ab" + integrity sha512-KOyAy2n34migXbHBwQKcE50bNEyyDBdoWe1z/i1+Xb1rsE1iBuR5hmDZocRuqV7tT2iDlsJND0qorUptGnVHYg== dependencies: "@ethersproject/abstract-provider" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/types" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/types" "7.0.1" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/contracts-sdk@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/contracts-sdk/-/contracts-sdk-7.0.0.tgz#7b8ecedb8b532cdf1e0f78e38180e712275cee8b" - integrity sha512-lgNQsyZ0K8W3msW9fDPGF7nx7isQtdAq3dE4S0xUz9FzaOWzO88/z/UpQ4eIABhhCZddZLA2c9397keErl8SnQ== +"@lit-protocol/contracts-sdk@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/contracts-sdk/-/contracts-sdk-7.0.1.tgz#a8fa483e3677f53578edde8c720b5088a0bbeabe" + integrity sha512-5MsdQ2AracbyJ939WupUHtzbhhdxY1XKIfZnIY00ZO13+Hz210zBfP3UieqWbD580MHDJu0MKI5YxYHa/86w3Q== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/types" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/types" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3487,31 +3484,32 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/contracts@0.0.74": +"@lit-protocol/contracts@0.0.74", "@lit-protocol/contracts@^0.0.74": version "0.0.74" resolved "https://registry.yarnpkg.com/@lit-protocol/contracts/-/contracts-0.0.74.tgz#e726a9190c86b10cc6df3a392cd04d19057be27d" integrity sha512-8uV038gzBp7ew7a4884SVt9Zhu8CtiTb+A8dKNnByxVoT1kFt4O4DmsaniV8p9AGjNR13IWfpU1NFChmPHVIpQ== -"@lit-protocol/core@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/core/-/core-7.0.0.tgz#50735e41df9e432f358380ea241e9acd80853cbb" - integrity sha512-O8plnz6jRDus9sF23rjkZ1ANJLUV3tAD/PUWqlcCJsFzuh0Cl62hZx7bRvpMz41wX9P/DPQnSksVEJUq0gM79w== +"@lit-protocol/core@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/core/-/core-7.0.1.tgz#76e8ef86b775ff5691cbc0011ce8fd9beacaef98" + integrity sha512-Kq7YHfZPwjt0ygZj9cQC1DtCWxBlTAbVOLBBJyfZcoiWm/f7/waGjgd9BE+iQbtxLxWt32vkT44qw51psPcPHA== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/access-control-conditions" "7.0.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/contracts-sdk" "7.0.0" - "@lit-protocol/crypto" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/nacl" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" - "@lit-protocol/wasm" "7.0.0" + "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/contracts-sdk" "7.0.1" + "@lit-protocol/crypto" "7.0.1" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/nacl" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/wasm" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3526,22 +3524,23 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/crypto@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/crypto/-/crypto-7.0.0.tgz#edba7706118b3ca348d6e87aaa640bc81ec55603" - integrity sha512-QJPqLkuli/QBxX0en1gSRU0Q9GZfUkFiXdYwclWKhYZFBTXeOWvd0bFIYTzDhU2FpMCtPi12Qw+p7FjHAURdXw== +"@lit-protocol/crypto@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/crypto/-/crypto-7.0.1.tgz#cc596ff7a1b2693e8214aeed9d517ccd6fdf905d" + integrity sha512-0ZC2PE/rzZoUyjw9aoM6ZbNt0UV5DValqwwcyuteiT8FU7lzlt6V7jOJFWTgEyvLpiE8EfWJaBwSV2Y/wH7eWQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/nacl" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" - "@lit-protocol/wasm" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/nacl" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/wasm" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3552,20 +3551,21 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/encryption@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/encryption/-/encryption-7.0.0.tgz#b41734fb277b57d6305116be503d8ff5ff593395" - integrity sha512-Ip0+ukmCVYLF5rSMnFWPSIPus05ZP3eAes2iu8Gb4rn7GsTTGnK7qkQ8KFi15D5DYPYu+8x/qARSz1KZPB6tXw== +"@lit-protocol/encryption@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/encryption/-/encryption-7.0.1.tgz#815b7bdeb2d63749bf44d265ec5237479af2cf0a" + integrity sha512-pqWQz+h57t04rHVugKSEp9LtnZS+C2+D7a+bO1HfKbOxU4hctqoMsJ8E8De8HWITSMwD7KO5jxZCuHcKgsvelg== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3575,30 +3575,31 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/lit-node-client-nodejs@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client-nodejs/-/lit-node-client-nodejs-7.0.0.tgz#e23f4851981fcc32563e1ca1a6009fd97c1d2113" - integrity sha512-15aCAwZSekZagoHk7ne1DsoB+hFP0y9TR4JhaWQlLExcXrUTcoHdkebmO52XghxxWFLbCRQOpBrv9lBEmx4NWA== +"@lit-protocol/lit-node-client-nodejs@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client-nodejs/-/lit-node-client-nodejs-7.0.1.tgz#f5795887bb73373427c0a3df4bf22c1753d49133" + integrity sha512-voLc9QqpUlLdHCzyzQJ4LwvZ7hwtsg5WkRkSkqxEWfnqpeoJkgsrYEPdV4/vW83BYoIS4Hc0EeSvYEYzwGbJXw== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@ethersproject/transactions" "5.7.0" - "@lit-protocol/access-control-conditions" "7.0.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/auth-helpers" "7.0.0" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/contracts-sdk" "7.0.0" - "@lit-protocol/core" "7.0.0" - "@lit-protocol/crypto" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/misc-browser" "7.0.0" - "@lit-protocol/nacl" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" - "@lit-protocol/wasm" "7.0.0" + "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/auth-helpers" "7.0.1" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/contracts-sdk" "7.0.1" + "@lit-protocol/core" "7.0.1" + "@lit-protocol/crypto" "7.0.1" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/misc-browser" "7.0.1" + "@lit-protocol/nacl" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/wasm" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3615,10 +3616,10 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/lit-node-client@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client/-/lit-node-client-7.0.0.tgz#d5c705a93b2215991e87019fddb20a81687935db" - integrity sha512-qn9DN3bkdWZegmAguGT5WN1IGlWpHuKqgUMjf3rCbQUoJ94sjFW3QCTPEOMCc4AX9yI6e+514/B38+MWAcF+eg== +"@lit-protocol/lit-node-client@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client/-/lit-node-client-7.0.1.tgz#a2ea39d29256893a8efa71df019f0c3901df343b" + integrity sha512-ADEWAra5KzlKpLFy4tM15q2ExQUrFBZgzzvntOGESHx34b2J6acRGw0FWSowYj9UhMeTdO0RY3Ff8McOGUipmg== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" @@ -3628,22 +3629,23 @@ "@ethersproject/strings" "5.7.0" "@ethersproject/transactions" "5.7.0" "@ethersproject/wallet" "5.7.0" - "@lit-protocol/access-control-conditions" "7.0.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/auth-browser" "7.0.0" - "@lit-protocol/auth-helpers" "7.0.0" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/contracts-sdk" "7.0.0" - "@lit-protocol/core" "7.0.0" - "@lit-protocol/crypto" "7.0.0" - "@lit-protocol/lit-node-client-nodejs" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/misc" "7.0.0" - "@lit-protocol/misc-browser" "7.0.0" - "@lit-protocol/nacl" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" - "@lit-protocol/wasm" "7.0.0" + "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/auth-browser" "7.0.1" + "@lit-protocol/auth-helpers" "7.0.1" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/contracts-sdk" "7.0.1" + "@lit-protocol/core" "7.0.1" + "@lit-protocol/crypto" "7.0.1" + "@lit-protocol/lit-node-client-nodejs" "7.0.1" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/misc" "7.0.1" + "@lit-protocol/misc-browser" "7.0.1" + "@lit-protocol/nacl" "7.0.1" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/wasm" "7.0.1" "@openagenda/verror" "^3.1.4" "@walletconnect/ethereum-provider" "2.9.2" ajv "^8.12.0" @@ -3662,49 +3664,52 @@ tweetnacl-util "^0.15.1" util "0.12.5" -"@lit-protocol/logger@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/logger/-/logger-7.0.0.tgz#856f91dd62b338be78948c126ad87e1a2d50f422" - integrity sha512-gI/bK+Ea97a8CKMzd4MUoRFSy7eoEMzh6RsJ1lrkgod1tDrW91ktVc0qmzgvwNdwuOM45g+2T77DBDqaaB75iw== +"@lit-protocol/logger@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/logger/-/logger-7.0.1.tgz#24dd097f202de78d518705ca091d574d722e4ab1" + integrity sha512-cm0bqSr+0WTTL823yJ38/l7KWv5c3BYegXjifBMLt4+0g/7aLOYmeH7q9rbBlmzt/njT/3jMPd9EQvY3vDCbQA== dependencies: "@ethersproject/abstract-provider" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/types" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/types" "7.0.1" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/misc-browser@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/misc-browser/-/misc-browser-7.0.0.tgz#c5b1616a01b0761131cd145d961fbae7d02cd8ab" - integrity sha512-x54F4FRhIlugDB5LdErHBZCSlAF8I+Q9qCGObwddut77spYafOuVPsrtrLE/oDLYRcaAFOX7wWKYSxsZpOc53g== +"@lit-protocol/misc-browser@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/misc-browser/-/misc-browser-7.0.1.tgz#653ee5d396db2072b3f109ae3e7cb943aefd16e1" + integrity sha512-esO8V3wyo0fD7WTtCEg4H5Y3Wzp0B4kmQMvq1DFSRIaFjsrLoED6rGZr92aMNyyZOCA1PXbH5buKpXEwGbmTYg== dependencies: "@ethersproject/abstract-provider" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/types" "7.0.0" - "@lit-protocol/uint8arrays" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/types" "7.0.1" + "@lit-protocol/uint8arrays" "7.0.1" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/misc@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/misc/-/misc-7.0.0.tgz#996f6443bb8884bac8e33f3a9086bd06d2261a55" - integrity sha512-5BDKukR/QzzFjoaYBUdpVM7R/GWIoOuQRzwM3myUjF+d4OR9imcRIeq9k8oQBAEPc+AoTimgn1aWxpEQMFrrGQ== +"@lit-protocol/misc@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/misc/-/misc-7.0.1.tgz#e90f5c8b97ae60a056a95b7ec5dcd5b12963f023" + integrity sha512-MJSq3xMz+5Rbjaj7te/yiQKBo7eKrD3KvkGT1Ka8zGGKO7P+jZ2GQZ4qatyXqpQ9xFd2DD+JL4EERvIk1OfUZg== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/logger" "7.0.0" - "@lit-protocol/types" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/logger" "7.0.1" + "@lit-protocol/types" "7.0.1" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3714,23 +3719,11 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/nacl@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/nacl/-/nacl-7.0.0.tgz#a85352050efa9a49d8bad6e08c45b1517ed1fcb6" - integrity sha512-tkcT4pf6kKJKT2h+8tH/qqf/Yi1Wug7lUodbiAxWMM859vjzKc2IKozfw5bcQ7UZsz9+xrHvDnD+d7dD1kHqMQ== - dependencies: - tslib "1.14.1" - -"@lit-protocol/types@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/types/-/types-7.0.0.tgz#a37ee86814bbe55e4f0853e956858a22acf9010e" - integrity sha512-QEHeumd5rsfh9XJp7SpCT1b0xy4vzjt0UKssTzsymvBAGkjTXGtNkshO8GHgNm+nf32NmXhncTqTnIGACJw1Ew== +"@lit-protocol/nacl@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/nacl/-/nacl-7.0.1.tgz#a1d493a1db310779d8886519d70ad2c04a7e21eb" + integrity sha512-HrfncvJSdK4stAxZDkfZ0/p7U2e26NUTEEdqy+hMF63+2ZQelq0TaZjZpYxPdZpoJJyaY1LYJbUIiD0mj7ET0g== dependencies: - "@ethersproject/abstract-provider" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - depd "^2.0.0" - ethers "^5.7.1" - siwe "^2.3.2" tslib "1.14.1" "@lit-protocol/types@7.0.1": @@ -3745,25 +3738,26 @@ siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/uint8arrays@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/uint8arrays/-/uint8arrays-7.0.0.tgz#26fe8b56409db7b63a7ac9bc6e1f62959b6be22a" - integrity sha512-oFZ0nokC67Qd+ilbG2+2V/EnE+1+4NugqWdaMcY7cuBB943D1oC6n6xLiNQcI1wpmB4cAvfvemGJ8toz+JQpZQ== +"@lit-protocol/uint8arrays@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/uint8arrays/-/uint8arrays-7.0.1.tgz#aa9fbf89b067752816a54f4facedf8b54682fbe9" + integrity sha512-IYTtWiYXY3X5RwcH5z0vfL/K2N6Co/tyAIn1w4aTHBddhL54zeLqtJNHwCP/Uf33rh0v0HfzBXn+4On6/efD5w== dependencies: "@ethersproject/abstract-provider" "5.7.0" - "@lit-protocol/accs-schemas" "^0.0.15" - "@lit-protocol/constants" "7.0.0" - "@lit-protocol/types" "7.0.0" + "@lit-protocol/accs-schemas" "^0.0.20" + "@lit-protocol/constants" "7.0.1" + "@lit-protocol/contracts" "^0.0.74" + "@lit-protocol/types" "7.0.1" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/wasm@7.0.0": - version "7.0.0" - resolved "https://registry.yarnpkg.com/@lit-protocol/wasm/-/wasm-7.0.0.tgz#e26bd21818ad09281b41418cc4d7d5e92cdb4dfe" - integrity sha512-YaADtQ4h/nQ56PRqzDm7sbnJkbdtQkQ27FJfEVtOiUvVRuoaCypLgulcxLbh+7VuNuEZ9ASMVQ0JLqES/+XFDg== +"@lit-protocol/wasm@7.0.1": + version "7.0.1" + resolved "https://registry.yarnpkg.com/@lit-protocol/wasm/-/wasm-7.0.1.tgz#8531c1420a46141c43e2a4c1106e38c7cbb0f81c" + integrity sha512-at3QwXMsEc8lTJhhU+UBbhRbNVH61buPpK4G2KbKX9KWug+WgOJv8rC+1/MC9Va5CAbgdHcbL+0z4Y0NjVXyaw== dependencies: ethers "^5.7.1" pako "^2.1.0" From b95325892f3a4dcca66a14098d587b6ec4fa32e0 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 6 Dec 2024 09:48:30 -0300 Subject: [PATCH 09/27] fix: package lint --- packages/request-node/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/request-node/package.json b/packages/request-node/package.json index 0abc970ffe..7a92badcf8 100644 --- a/packages/request-node/package.json +++ b/packages/request-node/package.json @@ -44,9 +44,9 @@ "@ethersproject/experimental": "5.7.0", "@lit-protocol/constants": "7.0.1", "@lit-protocol/contracts": "0.0.74", - "@lit-protocol/types": "7.0.1", "@lit-protocol/contracts-sdk": "7.0.1", "@lit-protocol/lit-node-client": "7.0.1", + "@lit-protocol/types": "7.0.1", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", "@requestnetwork/ethereum-storage": "0.38.0", From c48b7f69e69d45431607d2450bc5989c19f62128 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 6 Dec 2024 11:51:20 -0300 Subject: [PATCH 10/27] fix: as per review --- packages/integration-test/test/lit-protocol.test.ts | 4 +--- packages/lit-protocol-cipher/README.md | 3 +++ packages/request-node/src/config.ts | 3 ++- .../src/request/getLitCapacityDelegationAuthSig.ts | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index baaa9ae7ee..5e7ed12848 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -46,9 +46,7 @@ describe('Lit Protocol Integration Tests', () => { beforeAll(async () => { // Create wallet - userWallet = new ethers.Wallet( - '0x7b595b2bb732edddc4d4fe758ae528c7a748c40f0f6220f4494e214f15c5bfeb', - ); + userWallet = ethers.Wallet.createRandom(); // Initialize signature provider epkSignatureProvider = new EthereumPrivateKeySignatureProvider({ diff --git a/packages/lit-protocol-cipher/README.md b/packages/lit-protocol-cipher/README.md index 1629463d04..4766fb8e86 100644 --- a/packages/lit-protocol-cipher/README.md +++ b/packages/lit-protocol-cipher/README.md @@ -36,6 +36,9 @@ const litProvider = new LitProtocolProvider( // Initialize the client await litProvider.initializeClient(); +// Enable decryption +await litProvider.enableDecryption(true); + // Example usage with wallet connection async function example() { try { diff --git a/packages/request-node/src/config.ts b/packages/request-node/src/config.ts index 94724e663e..48640e077b 100644 --- a/packages/request-node/src/config.ts +++ b/packages/request-node/src/config.ts @@ -5,6 +5,7 @@ import { BigNumber } from 'ethers'; import { LogTypes } from '@requestnetwork/types'; import { LogMode } from './logger'; +import { LIT_NETWORK } from '@lit-protocol/constants'; const argv = yargs.option('help', { alias: 'h', type: 'boolean' }).parseSync(); @@ -46,7 +47,7 @@ const defaultValues = { wallet: { mnemonic: 'candy maple cake sugar pudding cream honey rich smooth crumble sweet treat', }, - litProtocolNetwork: 'datil', + litProtocolNetwork: LIT_NETWORK.Datil, litProtocolRPC: 'https://yellowstone-rpc.litprotocol.com', litProtocolCapacityCreditsUsage: '1', litProtocolCapacityCreditsExpirationInSeconds: 10 * 60, // 10 minutes diff --git a/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts b/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts index c2eeb4e354..6f77a9a82a 100644 --- a/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts +++ b/packages/request-node/src/request/getLitCapacityDelegationAuthSig.ts @@ -7,6 +7,7 @@ import * as config from '../config'; import { LitContracts } from '@lit-protocol/contracts-sdk'; import { utils } from 'ethers'; import { LIT_NETWORKS_KEYS } from '@lit-protocol/types'; +import { LIT_NETWORK } from '@lit-protocol/constants'; /** * Handles getLitCapacityDelegationAuthSigHandler. * @@ -31,7 +32,7 @@ export default class GetLitCapacityDelegationAuthSigHandler { new providers.JsonRpcProvider(config.getLitProtocolRPC()), ); let tokenId = '0'; - if (config.getLitProtocolNetwork() === 'datil-dev') { + if ((config.getLitProtocolNetwork() as LIT_NETWORKS_KEYS) === LIT_NETWORK.DatilDev) { tokenId = '0'; } else { const litContractClient = new LitContracts({ From 14a6aed95c9557b208dc20c142ec1876f454c9de Mon Sep 17 00:00:00 2001 From: Rodrigo Serviuc Pavezi Date: Fri, 6 Dec 2024 18:49:46 -0300 Subject: [PATCH 11/27] Update packages/lit-protocol-cipher/README.md Co-authored-by: MantisClone --- packages/lit-protocol-cipher/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lit-protocol-cipher/README.md b/packages/lit-protocol-cipher/README.md index 4766fb8e86..94d9f766b2 100644 --- a/packages/lit-protocol-cipher/README.md +++ b/packages/lit-protocol-cipher/README.md @@ -26,7 +26,7 @@ const litProvider = new LitProtocolProvider( litNetwork: LIT_NETWORKS.datil, }), { - baseURL: 'https://your-request-network-node.com', + baseURL: 'https://gnosis.gateway.request.network', headers: { 'Content-Type': 'application/json', }, From e1d6c4975ff82ca09447fbf9e9d24fa16c47676c Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Mon, 9 Dec 2024 14:46:15 -0300 Subject: [PATCH 12/27] fix: revert memory change --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ff654a689d..698b5ad720 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -7,7 +7,7 @@ references: node_image: &node_image image: cimg/node:18.18 environment: - NODE_OPTIONS: '--max-old-space-size=8192' + NODE_OPTIONS: '--max-old-space-size=4096' ipfs_image: &ipfs_image image: requestnetwork/request-ipfs:v0.13.0 ganache_image: &ganache_image From 42c83d52abf3e40741966fbfedbed1a28211da72 Mon Sep 17 00:00:00 2001 From: Rodrigo Serviuc Pavezi Date: Mon, 9 Dec 2024 17:20:55 -0300 Subject: [PATCH 13/27] Update packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts Co-authored-by: MantisClone --- .../lit-protocol-cipher/src/lit-protocol-cipher-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index 5054bc8459..dcb2eb3466 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -43,7 +43,7 @@ export default class LitProvider implements CipherProviderTypes.ICipherProvider /** * @property {LitNodeClient|LitNodeClientNodeJs|null} client - The Lit Protocol client instance. */ - private litClient: LitNodeClient | LitNodeClientNodeJs | null = null; + private litClient: LitNodeClient | LitNodeClientNodeJs; /** * @property {boolean} isDecryptionOn - A boolean indicating if decryption is enabled. From 50aca1ada8af19c0498758adc01cfcc93a6ee3f4 Mon Sep 17 00:00:00 2001 From: Rodrigo Serviuc Pavezi Date: Mon, 9 Dec 2024 17:24:03 -0300 Subject: [PATCH 14/27] Update README.md --- packages/lit-protocol-cipher/README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/lit-protocol-cipher/README.md b/packages/lit-protocol-cipher/README.md index 94d9f766b2..587e369ce3 100644 --- a/packages/lit-protocol-cipher/README.md +++ b/packages/lit-protocol-cipher/README.md @@ -82,8 +82,6 @@ async function example() { console.log('Decrypted data:', parsedData); } - // Disconnect wallet when done - await litProvider.disconnectWallet(); } catch (error) { console.error('Error:', error); } finally { From e64f15b7b0ef13f821289702e754fff157a43da6 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Mon, 9 Dec 2024 18:17:15 -0300 Subject: [PATCH 15/27] fix: rename LitProtocolCipherProvider --- packages/integration-test/test/lit-protocol.test.ts | 6 +++--- packages/lit-protocol-cipher/README.md | 7 +++---- packages/lit-protocol-cipher/src/index.ts | 2 +- .../test/unit/transactions-factory.test.ts | 6 +++--- .../test/unit/transactions-parser.test.ts | 11 +++++++---- .../transaction-manager/test/unit/utils/test-data.ts | 6 +++--- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index 5e7ed12848..f4e4bb4aeb 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -1,5 +1,5 @@ import { EthereumPrivateKeySignatureProvider } from '@requestnetwork/epk-signature'; -import { LitProtocolProvider } from '@requestnetwork/lit-protocol-cipher'; +import { LitProtocolCipherProvider } from '@requestnetwork/lit-protocol-cipher'; import { RequestNetwork, Types, Utils } from '@requestnetwork/request-client.js'; import { ethers } from 'ethers'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; @@ -32,7 +32,7 @@ async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 100 describe('Lit Protocol Integration Tests', () => { let requestNetwork: RequestNetwork; - let litProvider: LitProtocolProvider; + let litProvider: LitProtocolCipherProvider; let epkSignatureProvider: EthereumPrivateKeySignatureProvider; let userWallet: ethers.Wallet; let litClient: LitNodeClient; @@ -62,7 +62,7 @@ describe('Lit Protocol Integration Tests', () => { }); // Initialize Lit Protocol provider - litProvider = new LitProtocolProvider(litClient, nodeConnectionConfig); + litProvider = new LitProtocolCipherProvider(litClient, nodeConnectionConfig); await litProvider.initializeClient(); await litProvider.enableDecryption(true); await litProvider.getSessionSignatures(userWallet, userWallet.address); diff --git a/packages/lit-protocol-cipher/README.md b/packages/lit-protocol-cipher/README.md index 587e369ce3..6af641635f 100644 --- a/packages/lit-protocol-cipher/README.md +++ b/packages/lit-protocol-cipher/README.md @@ -12,16 +12,16 @@ npm install @requestnetwork/lit-protocol-cipher ## Usage -The `LitProtocolProvider` class provides encryption and decryption capabilities using the Lit Protocol. Here's how to implement and use it: +The `LitProtocolCipherProvider` class provides encryption and decryption capabilities using the Lit Protocol. Here's how to implement and use it: ```typescript import { ethers } from 'ethers'; -import { LitProtocolProvider } from '@requestnetwork/lit-protocol-cipher'; +import { LitProtocolCipherProvider } from '@requestnetwork/lit-protocol-cipher'; import { LIT_NETWORKS } from '@lit-protocol/types'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; // Initialize the provider -const litProvider = new LitProtocolProvider( +const litProvider = new LitProtocolCipherProvider( new LitNodeClient({ litNetwork: LIT_NETWORKS.datil, }), @@ -81,7 +81,6 @@ async function example() { const parsedData = JSON.parse(decryptedData); console.log('Decrypted data:', parsedData); } - } catch (error) { console.error('Error:', error); } finally { diff --git a/packages/lit-protocol-cipher/src/index.ts b/packages/lit-protocol-cipher/src/index.ts index f50bf965d3..4139b73daf 100644 --- a/packages/lit-protocol-cipher/src/index.ts +++ b/packages/lit-protocol-cipher/src/index.ts @@ -1 +1 @@ -export { default as LitProtocolProvider } from './lit-protocol-cipher-provider'; +export { default as LitProtocolCipherProvider } from './lit-protocol-cipher-provider'; diff --git a/packages/transaction-manager/test/unit/transactions-factory.test.ts b/packages/transaction-manager/test/unit/transactions-factory.test.ts index f91a0a8bcb..1ced9a5727 100644 --- a/packages/transaction-manager/test/unit/transactions-factory.test.ts +++ b/packages/transaction-manager/test/unit/transactions-factory.test.ts @@ -78,7 +78,7 @@ describe('transaction-factory', () => { TestData.kmsRaw2.encryptionParams, TestData.kmsRaw3.encryptionParams, ], - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); // eslint-disable-next-line no-magic-numbers @@ -180,7 +180,7 @@ describe('transaction-factory', () => { data, channelKey, undefined, - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); // eslint-disable-next-line no-magic-numbers @@ -216,7 +216,7 @@ describe('transaction-factory', () => { TestData.kmsRaw2.encryptionParams, TestData.kmsRaw3.encryptionParams, ], - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); // eslint-disable-next-line no-magic-numbers diff --git a/packages/transaction-manager/test/unit/transactions-parser.test.ts b/packages/transaction-manager/test/unit/transactions-parser.test.ts index 6094b680ab..7564603f43 100644 --- a/packages/transaction-manager/test/unit/transactions-parser.test.ts +++ b/packages/transaction-manager/test/unit/transactions-parser.test.ts @@ -226,7 +226,10 @@ describe('transaction-parser', () => { describe('parse encrypted persisted transaction with LitProtocol', () => { beforeEach(() => { - transactionParser = new TransactionsParser(undefined, TestData.fakeLitProtocolProvider); + transactionParser = new TransactionsParser( + undefined, + TestData.fakeLitProtocolCipherProvider, + ); }); it('can parse encrypted transaction on an unknown channel', async () => { const encryptedParsedTx = await TransactionsFactory.createEncryptedTransactionInNewChannel( @@ -236,7 +239,7 @@ describe('transaction-parser', () => { TestData.kmsRaw2.encryptionParams, TestData.kmsRaw3.encryptionParams, ], - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); const ret = await transactionParser.parsePersistedTransaction( @@ -269,7 +272,7 @@ describe('transaction-parser', () => { const encryptedParsedTx = await TransactionsFactory.createEncryptedTransactionInNewChannel( data, [TestData.kmsRaw1.encryptionParams], - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); const addRaw1Formatted = `20${TestData.kmsRaw1.encryptionParams.key.slice(2)}`; @@ -298,7 +301,7 @@ describe('transaction-parser', () => { const encryptedParsedTx = await TransactionsFactory.createEncryptedTransactionInNewChannel( data, [TestData.kmsRaw1.encryptionParams, TestData.kmsRaw2.encryptionParams], - TestData.fakeLitProtocolProvider, + TestData.fakeLitProtocolCipherProvider, ); await expect( transactionParser.parsePersistedTransaction( diff --git a/packages/transaction-manager/test/unit/utils/test-data.ts b/packages/transaction-manager/test/unit/utils/test-data.ts index e72e99d0b7..453d126aa6 100644 --- a/packages/transaction-manager/test/unit/utils/test-data.ts +++ b/packages/transaction-manager/test/unit/utils/test-data.ts @@ -176,7 +176,7 @@ export const id3DecryptionProvider: DecryptionProviderTypes.IDecryptionProvider supportedMethods: [EncryptionTypes.METHOD.ECIES], }; -export class FakeLitProtocolProvider implements CipherProviderTypes.ICipherProvider { +export class FakeLitProtocolCipherProvider implements CipherProviderTypes.ICipherProvider { private storedRawData: string; constructor() { @@ -228,5 +228,5 @@ export class FakeLitProtocolProvider implements CipherProviderTypes.ICipherProvi } } -export const fakeLitProtocolProvider: CipherProviderTypes.ICipherProvider = - new FakeLitProtocolProvider(); +export const fakeLitProtocolCipherProvider: CipherProviderTypes.ICipherProvider = + new FakeLitProtocolCipherProvider(); From c73fb440e957318eab35973a65444a9a2dfe8118 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Mon, 9 Dec 2024 18:31:43 -0300 Subject: [PATCH 16/27] fix: update lit integration test --- .../integration-test/lit-protocol.test.ts | 230 ++++++++++++++++++ packages/integration-test/package.json | 1 + 2 files changed, 231 insertions(+) create mode 100644 packages/integration-test/lit-protocol.test.ts diff --git a/packages/integration-test/lit-protocol.test.ts b/packages/integration-test/lit-protocol.test.ts new file mode 100644 index 0000000000..0329f7ce8a --- /dev/null +++ b/packages/integration-test/lit-protocol.test.ts @@ -0,0 +1,230 @@ +import { EthereumPrivateKeySignatureProvider } from '@requestnetwork/epk-signature'; +import { LitProtocolCipherProvider } from '@requestnetwork/lit-protocol-cipher'; +import { RequestNetwork, Types, Utils } from '@requestnetwork/request-client.js'; +import { ethers } from 'ethers'; +import { LitNodeClient } from '@lit-protocol/lit-node-client'; + +const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 1000): Promise { + let attempts = 0; + while (attempts < maxAttempts) { + try { + const data = await request.getData(); + if ( + data.state === Types.RequestLogic.STATE.CREATED || + data.state === Types.RequestLogic.STATE.PENDING + ) { + console.log(`Request confirmed with state: ${data.state}`); + return; + } + console.log( + `Attempt ${attempts + 1}: Request not confirmed yet. Current state: ${data.state}`, + ); + } catch (error) { + console.log(`Attempt ${attempts + 1} failed:`, error); + } + await sleep(delayMs); + attempts++; + } + throw new Error(`Request not confirmed after ${maxAttempts} attempts`); +} + +describe('Lit Protocol Integration Tests', () => { + let requestNetwork: RequestNetwork; + let litProvider: LitProtocolCipherProvider; + let epkSignatureProvider: EthereumPrivateKeySignatureProvider; + let userWallet: ethers.Wallet; + let litClient: LitNodeClient; + + const nodeConnectionConfig = { + baseURL: 'http://localhost:3000', + headers: { + 'Content-Type': 'application/json', + }, + }; + + beforeAll(async () => { + // Create wallet + userWallet = new ethers.Wallet( + '0x7b595b2bb732edddc4d4fe758ae528c7a748c40f0f6220f4494e214f15c5bfeb', + ); + + // Initialize signature provider + epkSignatureProvider = new EthereumPrivateKeySignatureProvider({ + method: Types.Signature.METHOD.ECDSA, + privateKey: userWallet.privateKey, + }); + + // Initialize Lit Protocol client + litClient = new LitNodeClient({ + litNetwork: 'datil-dev', + alertWhenUnauthorized: false, + debug: false, + }); + + // Initialize Lit Protocol provider + litProvider = new LitProtocolCipherProvider(litClient, nodeConnectionConfig); + await litProvider.initializeClient(); + await litProvider.enableDecryption(true); + await litProvider.getSessionSignatures(userWallet, userWallet.address); + + // Initialize Request Network client + requestNetwork = new RequestNetwork({ + nodeConnectionConfig, + signatureProvider: epkSignatureProvider, + cipherProvider: litProvider, + }); + }, 30000); + + afterAll(async () => { + try { + // Get all pending promises + const promises = []; + if (litProvider) { + promises.push(litProvider.disconnectClient()); + promises.push(litProvider.disconnectWallet()); + } + if (litClient) { + promises.push(litClient.disconnect()); + } + + // Wait for all cleanup operations to complete + await Promise.all(promises); + } catch (error) { + console.error('Cleanup error:', error); + } + }); + + it('should encrypt and decrypt data directly', async () => { + const testData = 'test encryption'; + const encryptionParams = [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ]; + + const encrypted = await litProvider.encrypt(testData, { encryptionParams }); + expect(encrypted).toBeDefined(); + expect(encrypted?.ciphertext).toBeDefined(); + expect(encrypted?.dataToEncryptHash).toBeDefined(); + + const decrypted = await litProvider.decrypt(encrypted!, { encryptionParams }); + expect(decrypted).toBe(testData); + }); + + it('should create and encrypt a request', async () => { + const requestParams = { + requestInfo: { + currency: { + type: Types.RequestLogic.CURRENCY.ETH, + value: '0x0000000000000000000000000000000000000000', + network: 'sepolia', + }, + expectedAmount: ethers.utils.parseEther('0.1').toString(), + payee: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: userWallet.address, + }, + payer: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: '0xb07D2398d2004378cad234DA0EF14f1c94A530e4', + }, + timestamp: Utils.getCurrentTimestampInSecond(), + }, + paymentNetwork: { + id: Types.Extension.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT, + parameters: { + paymentNetworkName: 'sepolia', + paymentAddress: userWallet.address, + feeAddress: '0x0000000000000000000000000000000000000000', + feeAmount: '0', + tokenAddress: '0x0000000000000000000000000000000000000000', + }, + }, + contentData: { + meta: { + format: 'rnf_invoice', + version: '0.0.3', + }, + creationDate: new Date().toISOString(), + invoiceNumber: 'INV-2023-001', + invoiceItems: [ + { + name: 'Test Service', + quantity: 1, + unitPrice: ethers.utils.parseEther('0.1').toString(), + discount: '0', + tax: { + type: 'percentage', + amount: '0', + }, + currency: 'ETH', + }, + ], + }, + signer: { + type: Types.Identity.TYPE.ETHEREUM_ADDRESS, + value: userWallet.address, + }, + }; + + const encryptionParams = [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ]; + + const encryptedRequest = await requestNetwork._createEncryptedRequest( + requestParams as Types.ICreateRequestParameters, + encryptionParams, + ); + + await waitForConfirmation(encryptedRequest, 15, 2000); + + const requestData = await encryptedRequest.getData(); + expect(requestData).toBeDefined(); + expect([Types.RequestLogic.STATE.CREATED, Types.RequestLogic.STATE.PENDING]).toContain( + requestData.state, + ); + + // Wait for any pending operations to complete + await new Promise((resolve) => setTimeout(resolve, 1000)); + }); + + it('should handle encryption errors gracefully', async () => { + const invalidEncryptionParams = [ + { + key: '', + method: Types.Encryption.METHOD.KMS, + }, + ]; + + await expect( + litProvider.encrypt('test data', { encryptionParams: invalidEncryptionParams }), + ).rejects.toThrow(/invalid.*key/i); + }); + + it('should handle decryption errors gracefully', async () => { + const invalidEncryptedData = { + ciphertext: 'invalid-ciphertext', + dataToEncryptHash: 'invalid-hash', + }; + + await expect( + litProvider.decrypt(invalidEncryptedData, { + encryptionParams: [ + { + key: userWallet.address, + method: Types.Encryption.METHOD.KMS, + }, + ], + }), + ).rejects.toThrow(); + + // Wait for any pending operations to complete + await new Promise((resolve) => setTimeout(resolve, 1000)); + }); +}); diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index f9ba4ea135..00d45eb2f6 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -41,6 +41,7 @@ "test:lit": "jest test/lit-protocol.test.ts --forceExit" }, "devDependencies": { + "@lit-protocol/lit-node-client": "7.0.1", "@requestnetwork/advanced-logic": "0.47.0", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", From c216c24bbd2e6a4b52e8d3a722acb14b37579b70 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Tue, 10 Dec 2024 07:19:23 -0300 Subject: [PATCH 17/27] fix: duplicate files --- .../integration-test/lit-protocol.test.ts | 230 ------------------ .../test/lit-protocol.test.ts | 21 +- 2 files changed, 6 insertions(+), 245 deletions(-) delete mode 100644 packages/integration-test/lit-protocol.test.ts diff --git a/packages/integration-test/lit-protocol.test.ts b/packages/integration-test/lit-protocol.test.ts deleted file mode 100644 index 0329f7ce8a..0000000000 --- a/packages/integration-test/lit-protocol.test.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { EthereumPrivateKeySignatureProvider } from '@requestnetwork/epk-signature'; -import { LitProtocolCipherProvider } from '@requestnetwork/lit-protocol-cipher'; -import { RequestNetwork, Types, Utils } from '@requestnetwork/request-client.js'; -import { ethers } from 'ethers'; -import { LitNodeClient } from '@lit-protocol/lit-node-client'; - -const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); - -async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 1000): Promise { - let attempts = 0; - while (attempts < maxAttempts) { - try { - const data = await request.getData(); - if ( - data.state === Types.RequestLogic.STATE.CREATED || - data.state === Types.RequestLogic.STATE.PENDING - ) { - console.log(`Request confirmed with state: ${data.state}`); - return; - } - console.log( - `Attempt ${attempts + 1}: Request not confirmed yet. Current state: ${data.state}`, - ); - } catch (error) { - console.log(`Attempt ${attempts + 1} failed:`, error); - } - await sleep(delayMs); - attempts++; - } - throw new Error(`Request not confirmed after ${maxAttempts} attempts`); -} - -describe('Lit Protocol Integration Tests', () => { - let requestNetwork: RequestNetwork; - let litProvider: LitProtocolCipherProvider; - let epkSignatureProvider: EthereumPrivateKeySignatureProvider; - let userWallet: ethers.Wallet; - let litClient: LitNodeClient; - - const nodeConnectionConfig = { - baseURL: 'http://localhost:3000', - headers: { - 'Content-Type': 'application/json', - }, - }; - - beforeAll(async () => { - // Create wallet - userWallet = new ethers.Wallet( - '0x7b595b2bb732edddc4d4fe758ae528c7a748c40f0f6220f4494e214f15c5bfeb', - ); - - // Initialize signature provider - epkSignatureProvider = new EthereumPrivateKeySignatureProvider({ - method: Types.Signature.METHOD.ECDSA, - privateKey: userWallet.privateKey, - }); - - // Initialize Lit Protocol client - litClient = new LitNodeClient({ - litNetwork: 'datil-dev', - alertWhenUnauthorized: false, - debug: false, - }); - - // Initialize Lit Protocol provider - litProvider = new LitProtocolCipherProvider(litClient, nodeConnectionConfig); - await litProvider.initializeClient(); - await litProvider.enableDecryption(true); - await litProvider.getSessionSignatures(userWallet, userWallet.address); - - // Initialize Request Network client - requestNetwork = new RequestNetwork({ - nodeConnectionConfig, - signatureProvider: epkSignatureProvider, - cipherProvider: litProvider, - }); - }, 30000); - - afterAll(async () => { - try { - // Get all pending promises - const promises = []; - if (litProvider) { - promises.push(litProvider.disconnectClient()); - promises.push(litProvider.disconnectWallet()); - } - if (litClient) { - promises.push(litClient.disconnect()); - } - - // Wait for all cleanup operations to complete - await Promise.all(promises); - } catch (error) { - console.error('Cleanup error:', error); - } - }); - - it('should encrypt and decrypt data directly', async () => { - const testData = 'test encryption'; - const encryptionParams = [ - { - key: userWallet.address, - method: Types.Encryption.METHOD.KMS, - }, - ]; - - const encrypted = await litProvider.encrypt(testData, { encryptionParams }); - expect(encrypted).toBeDefined(); - expect(encrypted?.ciphertext).toBeDefined(); - expect(encrypted?.dataToEncryptHash).toBeDefined(); - - const decrypted = await litProvider.decrypt(encrypted!, { encryptionParams }); - expect(decrypted).toBe(testData); - }); - - it('should create and encrypt a request', async () => { - const requestParams = { - requestInfo: { - currency: { - type: Types.RequestLogic.CURRENCY.ETH, - value: '0x0000000000000000000000000000000000000000', - network: 'sepolia', - }, - expectedAmount: ethers.utils.parseEther('0.1').toString(), - payee: { - type: Types.Identity.TYPE.ETHEREUM_ADDRESS, - value: userWallet.address, - }, - payer: { - type: Types.Identity.TYPE.ETHEREUM_ADDRESS, - value: '0xb07D2398d2004378cad234DA0EF14f1c94A530e4', - }, - timestamp: Utils.getCurrentTimestampInSecond(), - }, - paymentNetwork: { - id: Types.Extension.PAYMENT_NETWORK_ID.ETH_FEE_PROXY_CONTRACT, - parameters: { - paymentNetworkName: 'sepolia', - paymentAddress: userWallet.address, - feeAddress: '0x0000000000000000000000000000000000000000', - feeAmount: '0', - tokenAddress: '0x0000000000000000000000000000000000000000', - }, - }, - contentData: { - meta: { - format: 'rnf_invoice', - version: '0.0.3', - }, - creationDate: new Date().toISOString(), - invoiceNumber: 'INV-2023-001', - invoiceItems: [ - { - name: 'Test Service', - quantity: 1, - unitPrice: ethers.utils.parseEther('0.1').toString(), - discount: '0', - tax: { - type: 'percentage', - amount: '0', - }, - currency: 'ETH', - }, - ], - }, - signer: { - type: Types.Identity.TYPE.ETHEREUM_ADDRESS, - value: userWallet.address, - }, - }; - - const encryptionParams = [ - { - key: userWallet.address, - method: Types.Encryption.METHOD.KMS, - }, - ]; - - const encryptedRequest = await requestNetwork._createEncryptedRequest( - requestParams as Types.ICreateRequestParameters, - encryptionParams, - ); - - await waitForConfirmation(encryptedRequest, 15, 2000); - - const requestData = await encryptedRequest.getData(); - expect(requestData).toBeDefined(); - expect([Types.RequestLogic.STATE.CREATED, Types.RequestLogic.STATE.PENDING]).toContain( - requestData.state, - ); - - // Wait for any pending operations to complete - await new Promise((resolve) => setTimeout(resolve, 1000)); - }); - - it('should handle encryption errors gracefully', async () => { - const invalidEncryptionParams = [ - { - key: '', - method: Types.Encryption.METHOD.KMS, - }, - ]; - - await expect( - litProvider.encrypt('test data', { encryptionParams: invalidEncryptionParams }), - ).rejects.toThrow(/invalid.*key/i); - }); - - it('should handle decryption errors gracefully', async () => { - const invalidEncryptedData = { - ciphertext: 'invalid-ciphertext', - dataToEncryptHash: 'invalid-hash', - }; - - await expect( - litProvider.decrypt(invalidEncryptedData, { - encryptionParams: [ - { - key: userWallet.address, - method: Types.Encryption.METHOD.KMS, - }, - ], - }), - ).rejects.toThrow(); - - // Wait for any pending operations to complete - await new Promise((resolve) => setTimeout(resolve, 1000)); - }); -}); diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index f4e4bb4aeb..0329f7ce8a 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -46,7 +46,9 @@ describe('Lit Protocol Integration Tests', () => { beforeAll(async () => { // Create wallet - userWallet = ethers.Wallet.createRandom(); + userWallet = new ethers.Wallet( + '0x7b595b2bb732edddc4d4fe758ae528c7a748c40f0f6220f4494e214f15c5bfeb', + ); // Initialize signature provider epkSignatureProvider = new EthereumPrivateKeySignatureProvider({ @@ -200,20 +202,9 @@ describe('Lit Protocol Integration Tests', () => { }, ]; - // Mock the validation function to throw an error - const originalValidation = litProvider['getLitAccessControlConditions']; - try { - litProvider['getLitAccessControlConditions'] = jest.fn().mockImplementation(() => { - throw new Error('Invalid encryption parameter at index 0: missing key'); - }); - - await expect(async () => { - await litProvider.encrypt('test data', { encryptionParams: invalidEncryptionParams }); - }).rejects.toThrow('Invalid encryption parameter at index 0: missing key'); - } finally { - // Restore original validation - litProvider['getLitAccessControlConditions'] = originalValidation; - } + await expect( + litProvider.encrypt('test data', { encryptionParams: invalidEncryptionParams }), + ).rejects.toThrow(/invalid.*key/i); }); it('should handle decryption errors gracefully', async () => { From e48d2ee3bdf09bda864d930ec648608769883b95 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Tue, 10 Dec 2024 13:37:01 -0300 Subject: [PATCH 18/27] fix: tests --- packages/lit-protocol-cipher/test/index.test.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/lit-protocol-cipher/test/index.test.ts b/packages/lit-protocol-cipher/test/index.test.ts index fe1f17af61..9e4b6aa44b 100644 --- a/packages/lit-protocol-cipher/test/index.test.ts +++ b/packages/lit-protocol-cipher/test/index.test.ts @@ -111,11 +111,17 @@ describe('LitProvider', () => { }); it('should check encryption availability', () => { + // First verify it's true with a valid client expect(litProvider.isEncryptionAvailable()).toBe(true); - // Test when client is null - litProvider['litClient'] = null; + // Mock the implementation to simulate no client + jest.spyOn(litProvider, 'isEncryptionAvailable').mockImplementation(() => false); + + // Now it should return false expect(litProvider.isEncryptionAvailable()).toBe(false); + + // Restore the original implementation + jest.restoreAllMocks(); }); it('should check decryption availability', () => { @@ -137,7 +143,7 @@ describe('LitProvider', () => { litProvider['sessionSigs'] = null; expect(litProvider.isDecryptionAvailable()).toBe(false); - litProvider['litClient'] = null; + litProvider['litClient']; expect(litProvider.isDecryptionAvailable()).toBe(false); }); }); @@ -219,7 +225,7 @@ describe('LitProvider', () => { }); it('should throw error if client is not initialized', async () => { - litProvider['litClient'] = null; + litProvider['litClient'] = undefined as unknown as LitNodeClientNodeJs; await expect( litProvider.encrypt(mockData, { encryptionParams: mockEncryptionParams }), ).rejects.toThrow('Lit client not initialized'); From 605154e36aa9b6b7a9681dd530ddcb858f12c040 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Tue, 10 Dec 2024 21:31:13 -0300 Subject: [PATCH 19/27] refactor: add lit-protocol-cipher tsconfig and rename provider class - Added a new tsconfig reference for the lit-protocol-cipher package in the integration test configuration. - Renamed the class from `LitProvider` to `LitProtocolCipherProvider` for better clarity and consistency in naming. --- packages/integration-test/tsconfig.build.json | 1 + .../lit-protocol-cipher/src/lit-protocol-cipher-provider.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/integration-test/tsconfig.build.json b/packages/integration-test/tsconfig.build.json index a04a35939e..63a328bca3 100644 --- a/packages/integration-test/tsconfig.build.json +++ b/packages/integration-test/tsconfig.build.json @@ -12,6 +12,7 @@ { "path": "../ethereum-storage/tsconfig.build.json" }, { "path": "../epk-decryption/tsconfig.build.json" }, { "path": "../epk-signature/tsconfig.build.json" }, + { "path": "../lit-protocol-cipher/tsconfig.build.json" }, { "path": "../multi-format/tsconfig.build.json" }, { "path": "../payment-processor/tsconfig.build.json" }, { "path": "../request-logic/tsconfig.build.json" }, diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index dcb2eb3466..49a0ab2ce4 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -19,12 +19,12 @@ import { disconnectWeb3 } from '@lit-protocol/lit-node-client'; import type { LitNodeClientNodeJs, LitNodeClient } from '@lit-protocol/lit-node-client'; /** - * @class LitProvider + * @class LitProtocolCipherProvider * @description A provider class that simplifies the usage of Lit Protocol for encryption and decryption. * This class can be used with both client-side and Node.js Lit clients. * It implements the `IKmsProvider` interface for a standardized KMS provider structure. */ -export default class LitProvider implements CipherProviderTypes.ICipherProvider { +export default class LitProtocolCipherProvider implements CipherProviderTypes.ICipherProvider { /** * @property {string} chain - The blockchain to use for access control conditions. */ From 7fb3baee4350572f166f0e99a182b68a6e60d5e1 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 12 Dec 2024 23:00:54 -0300 Subject: [PATCH 20/27] refactor: enhance encryption parameter validation and condition creation - Improved validation for encryption parameters by ensuring keys are present. - Added sorting of encryption parameters by key to meet protocol requirements. - Simplified the creation of access control conditions using a helper function and reduced the complexity of the conditions array generation. --- .../src/lit-protocol-cipher-provider.ts | 37 +++++++------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index 49a0ab2ce4..e70eab04a9 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -191,16 +191,17 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC throw new Error('encryptionParams cannot be empty'); } - // Add validation for required encryption parameter fields + // Validate params and sort by key encryptionParams.forEach((param, index) => { - if (!param.key) { + if (!param.key) throw new Error(`Invalid encryption parameter at index ${index}: missing key`); - } }); - const accessControlConditions = []; + // Sort by key as lit protocol requires the keys to be in the same order for decryption and encryption + encryptionParams.sort((a, b) => a.key.localeCompare(b.key)); - accessControlConditions.push({ + // Create base condition object + const createCondition = (key: string) => ({ contractAddress: '', standardContractType: '' as AccsDefaultParams['standardContractType'], chain: this.chain as AccsDefaultParams['chain'], @@ -208,28 +209,16 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC parameters: [':userAddress'], returnValueTest: { comparator: '=' as AccsDefaultParams['returnValueTest']['comparator'], - value: encryptionParams[0].key, + value: key, }, }); - for (let i = 1; i < encryptionParams.length; i++) { - accessControlConditions.push( - { operator: 'or' }, - { - contractAddress: '', - standardContractType: '' as AccsDefaultParams['standardContractType'], - chain: this.chain as AccsDefaultParams['chain'], - method: '', - parameters: [':userAddress'], - returnValueTest: { - comparator: '=' as AccsDefaultParams['returnValueTest']['comparator'], - value: encryptionParams[i].key, - }, - }, - ); - } - - return accessControlConditions; + // Build conditions array with 'or' operators between each condition + return encryptionParams.reduce((acc, param, index) => { + if (index > 0) acc.push({ operator: 'or' }); + acc.push(createCondition(param.key)); + return acc; + }, [] as AccessControlConditions); } /** From 5b89facb2ddbc35381cb96c24d8914d41737a094 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 12 Dec 2024 23:37:35 -0300 Subject: [PATCH 21/27] chore: update @lit-protocol packages to version 7.0.2 - Upgraded multiple @lit-protocol packages to version 7.0.2 in yarn.lock and package.json files across various packages. - Updated the default chain parameter in LitProtocolCipherProvider constructor to 'ethereum'. - Ensured consistency in dependency versions across integration-test, lit-protocol-cipher, request-node, and types packages. --- packages/integration-test/package.json | 2 +- packages/lit-protocol-cipher/package.json | 12 +- .../src/lit-protocol-cipher-provider.ts | 4 +- packages/request-node/package.json | 8 +- packages/types/package.json | 2 +- yarn.lock | 300 +++++++++--------- 6 files changed, 164 insertions(+), 164 deletions(-) diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index 00d45eb2f6..05eef3fd2a 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -41,7 +41,7 @@ "test:lit": "jest test/lit-protocol.test.ts --forceExit" }, "devDependencies": { - "@lit-protocol/lit-node-client": "7.0.1", + "@lit-protocol/lit-node-client": "7.0.2", "@requestnetwork/advanced-logic": "0.47.0", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", diff --git a/packages/lit-protocol-cipher/package.json b/packages/lit-protocol-cipher/package.json index 8cca9d60d4..f7d04cbe5d 100644 --- a/packages/lit-protocol-cipher/package.json +++ b/packages/lit-protocol-cipher/package.json @@ -40,13 +40,13 @@ "test:watch": "yarn test --watch" }, "dependencies": { - "@lit-protocol/auth-helpers": "7.0.1", - "@lit-protocol/constants": "7.0.1", + "@lit-protocol/auth-helpers": "7.0.2", + "@lit-protocol/constants": "7.0.2", "@lit-protocol/contracts": "0.0.74", - "@lit-protocol/encryption": "7.0.1", - "@lit-protocol/lit-node-client": "7.0.1", - "@lit-protocol/lit-node-client-nodejs": "7.0.1", - "@lit-protocol/types": "7.0.1", + "@lit-protocol/encryption": "7.0.2", + "@lit-protocol/lit-node-client": "7.0.2", + "@lit-protocol/lit-node-client-nodejs": "7.0.2", + "@lit-protocol/types": "7.0.2", "@requestnetwork/request-client.js": "0.52.0", "@requestnetwork/types": "0.47.0", "@walletconnect/modal": "2.7.0", diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index e70eab04a9..0d4777e126 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -58,10 +58,10 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC constructor( litClient: LitNodeClient | LitNodeClientNodeJs, nodeConnectionConfig: NodeConnectionConfig, - chain?: string, + chain = 'ethereum', ) { this.litClient = litClient; - this.chain = chain || 'ethereum'; + this.chain = chain; this.dataAccess = new HttpDataAccess({ nodeConnectionConfig }); } diff --git a/packages/request-node/package.json b/packages/request-node/package.json index 7a92badcf8..0ba2097195 100644 --- a/packages/request-node/package.json +++ b/packages/request-node/package.json @@ -42,11 +42,11 @@ }, "dependencies": { "@ethersproject/experimental": "5.7.0", - "@lit-protocol/constants": "7.0.1", + "@lit-protocol/constants": "7.0.2", "@lit-protocol/contracts": "0.0.74", - "@lit-protocol/contracts-sdk": "7.0.1", - "@lit-protocol/lit-node-client": "7.0.1", - "@lit-protocol/types": "7.0.1", + "@lit-protocol/contracts-sdk": "7.0.2", + "@lit-protocol/lit-node-client": "7.0.2", + "@lit-protocol/types": "7.0.2", "@requestnetwork/currency": "0.21.0", "@requestnetwork/data-access": "0.38.0", "@requestnetwork/ethereum-storage": "0.38.0", diff --git a/packages/types/package.json b/packages/types/package.json index 7dbb1fc1b7..fa405f533b 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -38,7 +38,7 @@ "prepare": "yarn run build" }, "dependencies": { - "@lit-protocol/types": "7.0.1", + "@lit-protocol/types": "7.0.2", "ethers": "5.7.2" }, "devDependencies": { diff --git a/yarn.lock b/yarn.lock index eaed3c961f..7ce47847eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3361,21 +3361,21 @@ resolved "https://registry.yarnpkg.com/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.2.1.tgz#2f3a8f1d688935c704dbc89132394a41029acbb8" integrity sha512-wx4aBmgeGvFmOKucFKY+8VFJSYZxs9poN3SDNQFF6lT6NrQUnHiPB2PWz2sc4ieEcAaYYzN+1uWahEeTq2aRIQ== -"@lit-protocol/access-control-conditions@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/access-control-conditions/-/access-control-conditions-7.0.1.tgz#998ee0ef80364b74f34eff60dbbdb27258c88193" - integrity sha512-OxyVZgI79YyrOOC4ngc3hkFNWwq514Xpm9ODAiapp8FPLAsbOYt7lhoeHbAQQxVpawJA4C4xkdXzvKDEuCSGZA== +"@lit-protocol/access-control-conditions@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/access-control-conditions/-/access-control-conditions-7.0.2.tgz#086e61827c356dd4ba02a7d8933d21dba2eecbd0" + integrity sha512-didWaPND1kCGzGNPI8S9lvQriMf2wIKZHCJIecofAT3JLolrcNk6LqXfIBgPSeZbyOAbH91kpHKN7PI0zyQtEQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3392,10 +3392,10 @@ dependencies: ajv "^8.12.0" -"@lit-protocol/auth-browser@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/auth-browser/-/auth-browser-7.0.1.tgz#038719aaa73ae4a54fca44616b3dcee0b3533fe9" - integrity sha512-EqR/NOtmFE/0W1kXNbbm6YD46fOL6Uin22Ro0HI1lUqWzGAA1y92IPLCBzFWUECb02IkVygfviONMgvnLCUKkg== +"@lit-protocol/auth-browser@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/auth-browser/-/auth-browser-7.0.2.tgz#0e23869c8147fa0739e194ada6bace1d1cd7aeac" + integrity sha512-zXNxJTmQle2rzede2x8L9m0ai72yRwtfye1ugJMBptSaiWMhkZHN3kiwBvXWusy35COOeq08NDVdvr2nsf9pGw== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/bytes" "5.7.0" @@ -3404,12 +3404,12 @@ "@ethersproject/strings" "5.7.0" "@ethersproject/wallet" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/misc-browser" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/constants" "7.0.2" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/misc-browser" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3417,22 +3417,22 @@ ethers "^5.7.1" tslib "1.14.1" -"@lit-protocol/auth-helpers@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/auth-helpers/-/auth-helpers-7.0.1.tgz#d755d8e9104654434b05a8beb44767eec7bddeab" - integrity sha512-5vFOtjyombztC1lyItSoREVve1A1kA/aJGX53wbnU3F/NBbR61g0ypoexqrzb8pZz1aH73bMzcSsObla5NOTDA== +"@lit-protocol/auth-helpers@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/auth-helpers/-/auth-helpers-7.0.2.tgz#a9a08c89e11d5c757e245b3e1d5fe5020f5574b5" + integrity sha512-8917XgmuAEzXWPsyYSQcAlzmDWJ4xKabMroGObduY1RtsD0yq1o3azt+8kW0J7YDLmGRBGTGvVh2c1IQpCzXfQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/access-control-conditions" "7.0.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3443,36 +3443,36 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/constants@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/constants/-/constants-7.0.1.tgz#9af207ba83791d060c5ea04399d3ef4be5d3a8ab" - integrity sha512-KOyAy2n34migXbHBwQKcE50bNEyyDBdoWe1z/i1+Xb1rsE1iBuR5hmDZocRuqV7tT2iDlsJND0qorUptGnVHYg== +"@lit-protocol/constants@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/constants/-/constants-7.0.2.tgz#2c642aa7feff0b667cef06a8cbb59c7044ef3801" + integrity sha512-A2tpsB7pCGHiC+VrPAHBaEGyb/9crCkcSIj8BtGPrLRszFZO8EHKWziM7WiMM2c2mYb+B4dKtGGUkxxCAarqaQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/types" "7.0.1" + "@lit-protocol/types" "7.0.2" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/contracts-sdk@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/contracts-sdk/-/contracts-sdk-7.0.1.tgz#a8fa483e3677f53578edde8c720b5088a0bbeabe" - integrity sha512-5MsdQ2AracbyJ939WupUHtzbhhdxY1XKIfZnIY00ZO13+Hz210zBfP3UieqWbD580MHDJu0MKI5YxYHa/86w3Q== +"@lit-protocol/contracts-sdk@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/contracts-sdk/-/contracts-sdk-7.0.2.tgz#5192071b32f54cceb11aff6b8661e5cbbf3864f2" + integrity sha512-EQs0l3v+tRdItuRamo675obkAPHGmQnef0WZ1cY0nNn97zRBGbkYPfkHMBxrUoGwbcsFQPMHDynrGTzAiUM7Zw== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/types" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/types" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3489,27 +3489,27 @@ resolved "https://registry.yarnpkg.com/@lit-protocol/contracts/-/contracts-0.0.74.tgz#e726a9190c86b10cc6df3a392cd04d19057be27d" integrity sha512-8uV038gzBp7ew7a4884SVt9Zhu8CtiTb+A8dKNnByxVoT1kFt4O4DmsaniV8p9AGjNR13IWfpU1NFChmPHVIpQ== -"@lit-protocol/core@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/core/-/core-7.0.1.tgz#76e8ef86b775ff5691cbc0011ce8fd9beacaef98" - integrity sha512-Kq7YHfZPwjt0ygZj9cQC1DtCWxBlTAbVOLBBJyfZcoiWm/f7/waGjgd9BE+iQbtxLxWt32vkT44qw51psPcPHA== +"@lit-protocol/core@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/core/-/core-7.0.2.tgz#9629ce28a6e33165188a0928207af0b17ba52ac4" + integrity sha512-BANcnKQyqBD5ZGfDAPEJBhtzhc4bYuka8xyb2/ueCleaWOe0NgwW/z/CJ6Q/eSysO9smi0Z7bQy5a4xDBGNjHA== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" - "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/access-control-conditions" "7.0.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/contracts-sdk" "7.0.1" - "@lit-protocol/crypto" "7.0.1" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/nacl" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" - "@lit-protocol/wasm" "7.0.1" + "@lit-protocol/contracts-sdk" "7.0.2" + "@lit-protocol/crypto" "7.0.2" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/nacl" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" + "@lit-protocol/wasm" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3524,23 +3524,23 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/crypto@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/crypto/-/crypto-7.0.1.tgz#cc596ff7a1b2693e8214aeed9d517ccd6fdf905d" - integrity sha512-0ZC2PE/rzZoUyjw9aoM6ZbNt0UV5DValqwwcyuteiT8FU7lzlt6V7jOJFWTgEyvLpiE8EfWJaBwSV2Y/wH7eWQ== +"@lit-protocol/crypto@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/crypto/-/crypto-7.0.2.tgz#68306d131ecc51526fd4ba85b5cfd8a7594bd006" + integrity sha512-zgnOo3+LnRkIxGHro3QSsDmS3PPIH6nLrkBDp/+DigHL41H0zehdQbHMGxTQqzxtqpMFt9FARdAN0/CfHm/9Ow== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/nacl" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" - "@lit-protocol/wasm" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/nacl" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" + "@lit-protocol/wasm" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3551,21 +3551,21 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/encryption@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/encryption/-/encryption-7.0.1.tgz#815b7bdeb2d63749bf44d265ec5237479af2cf0a" - integrity sha512-pqWQz+h57t04rHVugKSEp9LtnZS+C2+D7a+bO1HfKbOxU4hctqoMsJ8E8De8HWITSMwD7KO5jxZCuHcKgsvelg== +"@lit-protocol/encryption@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/encryption/-/encryption-7.0.2.tgz#ecf3ffac5a17345a3018e0ff7ffac5cca63dd3d0" + integrity sha512-OeHDPkvVMiY86vkQ1LTNog06QLXmKXMleaz+WmJy4Qc6GkOARuuJtJW/1uZjOcwcaCGzvPSWjBasb8O1K6t4FQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3575,31 +3575,31 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/lit-node-client-nodejs@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client-nodejs/-/lit-node-client-nodejs-7.0.1.tgz#f5795887bb73373427c0a3df4bf22c1753d49133" - integrity sha512-voLc9QqpUlLdHCzyzQJ4LwvZ7hwtsg5WkRkSkqxEWfnqpeoJkgsrYEPdV4/vW83BYoIS4Hc0EeSvYEYzwGbJXw== +"@lit-protocol/lit-node-client-nodejs@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client-nodejs/-/lit-node-client-nodejs-7.0.2.tgz#a744d86919a6719dba20fdfc83356e08411b92b6" + integrity sha512-HUPCKRFxObK+XM9lPlWtbx+PqQoQl4OrRN7Lw/sIXew+wdozYgcMAMEbrB/xlCmJB+eFccu/06V4URSXQ22jXQ== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@ethersproject/transactions" "5.7.0" - "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/access-control-conditions" "7.0.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/auth-helpers" "7.0.1" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/auth-helpers" "7.0.2" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/contracts-sdk" "7.0.1" - "@lit-protocol/core" "7.0.1" - "@lit-protocol/crypto" "7.0.1" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/misc-browser" "7.0.1" - "@lit-protocol/nacl" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" - "@lit-protocol/wasm" "7.0.1" + "@lit-protocol/contracts-sdk" "7.0.2" + "@lit-protocol/core" "7.0.2" + "@lit-protocol/crypto" "7.0.2" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/misc-browser" "7.0.2" + "@lit-protocol/nacl" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" + "@lit-protocol/wasm" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3616,10 +3616,10 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/lit-node-client@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client/-/lit-node-client-7.0.1.tgz#a2ea39d29256893a8efa71df019f0c3901df343b" - integrity sha512-ADEWAra5KzlKpLFy4tM15q2ExQUrFBZgzzvntOGESHx34b2J6acRGw0FWSowYj9UhMeTdO0RY3Ff8McOGUipmg== +"@lit-protocol/lit-node-client@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/lit-node-client/-/lit-node-client-7.0.2.tgz#5d53fbf1ee62c167ec5be03ae05195057994c3f9" + integrity sha512-8zESXAA9HdRBLsjyljLuIpS2yzDv7jspW0MUe54XmHYHo87WE4G/q4WCjkKwRnKaeG0Jh5+/kb6j81AnLpWKFQ== dependencies: "@ethersproject/abi" "5.7.0" "@ethersproject/abstract-provider" "5.7.0" @@ -3629,23 +3629,23 @@ "@ethersproject/strings" "5.7.0" "@ethersproject/transactions" "5.7.0" "@ethersproject/wallet" "5.7.0" - "@lit-protocol/access-control-conditions" "7.0.1" + "@lit-protocol/access-control-conditions" "7.0.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/auth-browser" "7.0.1" - "@lit-protocol/auth-helpers" "7.0.1" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/auth-browser" "7.0.2" + "@lit-protocol/auth-helpers" "7.0.2" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/contracts-sdk" "7.0.1" - "@lit-protocol/core" "7.0.1" - "@lit-protocol/crypto" "7.0.1" - "@lit-protocol/lit-node-client-nodejs" "7.0.1" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/misc" "7.0.1" - "@lit-protocol/misc-browser" "7.0.1" - "@lit-protocol/nacl" "7.0.1" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" - "@lit-protocol/wasm" "7.0.1" + "@lit-protocol/contracts-sdk" "7.0.2" + "@lit-protocol/core" "7.0.2" + "@lit-protocol/crypto" "7.0.2" + "@lit-protocol/lit-node-client-nodejs" "7.0.2" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/misc" "7.0.2" + "@lit-protocol/misc-browser" "7.0.2" + "@lit-protocol/nacl" "7.0.2" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" + "@lit-protocol/wasm" "7.0.2" "@openagenda/verror" "^3.1.4" "@walletconnect/ethereum-provider" "2.9.2" ajv "^8.12.0" @@ -3664,52 +3664,52 @@ tweetnacl-util "^0.15.1" util "0.12.5" -"@lit-protocol/logger@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/logger/-/logger-7.0.1.tgz#24dd097f202de78d518705ca091d574d722e4ab1" - integrity sha512-cm0bqSr+0WTTL823yJ38/l7KWv5c3BYegXjifBMLt4+0g/7aLOYmeH7q9rbBlmzt/njT/3jMPd9EQvY3vDCbQA== +"@lit-protocol/logger@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/logger/-/logger-7.0.2.tgz#2d28eb73ed3a0771655e03efe75bc27ccf3b7c1a" + integrity sha512-44VsSlLWVxIVG9m5GIkvdXSfd4gyCNToNN0uor41cQTYLbyvasgTfyi12XPNwfFZU7FNMrYpt+Jgig2SqrzXVg== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/types" "7.0.1" + "@lit-protocol/types" "7.0.2" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/misc-browser@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/misc-browser/-/misc-browser-7.0.1.tgz#653ee5d396db2072b3f109ae3e7cb943aefd16e1" - integrity sha512-esO8V3wyo0fD7WTtCEg4H5Y3Wzp0B4kmQMvq1DFSRIaFjsrLoED6rGZr92aMNyyZOCA1PXbH5buKpXEwGbmTYg== +"@lit-protocol/misc-browser@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/misc-browser/-/misc-browser-7.0.2.tgz#2bff97961a17b3fc990974cf296088f6dd7e9e68" + integrity sha512-T9L4j3U6P+/0uI30NB2lCZM2PVPDI6G9JkrBn7PBIgzwynK9jtUHxwmxMk16qrUV9MvVCYSEt+tqEvOI5S/gMg== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/types" "7.0.1" - "@lit-protocol/uint8arrays" "7.0.1" + "@lit-protocol/types" "7.0.2" + "@lit-protocol/uint8arrays" "7.0.2" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/misc@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/misc/-/misc-7.0.1.tgz#e90f5c8b97ae60a056a95b7ec5dcd5b12963f023" - integrity sha512-MJSq3xMz+5Rbjaj7te/yiQKBo7eKrD3KvkGT1Ka8zGGKO7P+jZ2GQZ4qatyXqpQ9xFd2DD+JL4EERvIk1OfUZg== +"@lit-protocol/misc@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/misc/-/misc-7.0.2.tgz#b8da1cb4107d84c8d37391d8c2992960a438f1c9" + integrity sha512-ZUU4j3E+VnCY11oPLGop95UkAUzTiBmPfiCXwFYGmh6PDvHXZlRC1Qc+3aC5lFpocoBTTJ/uE2MQZpHyN0kRlQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@ethersproject/contracts" "5.7.0" "@ethersproject/providers" "5.7.2" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/logger" "7.0.1" - "@lit-protocol/types" "7.0.1" + "@lit-protocol/logger" "7.0.2" + "@lit-protocol/types" "7.0.2" "@openagenda/verror" "^3.1.4" ajv "^8.12.0" bech32 "^2.0.0" @@ -3719,17 +3719,17 @@ tslib "1.14.1" util "0.12.5" -"@lit-protocol/nacl@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/nacl/-/nacl-7.0.1.tgz#a1d493a1db310779d8886519d70ad2c04a7e21eb" - integrity sha512-HrfncvJSdK4stAxZDkfZ0/p7U2e26NUTEEdqy+hMF63+2ZQelq0TaZjZpYxPdZpoJJyaY1LYJbUIiD0mj7ET0g== +"@lit-protocol/nacl@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/nacl/-/nacl-7.0.2.tgz#31d004c9672078354d258d35e39ccb2d01c944ad" + integrity sha512-jdtquJ1iZCgIdKlVP0zAJlVfttLWLG2T6EsKFDp3o1lxEKtiUkKqbM1VGXihQVJQ6kFtmb3PJdMDRYDkOq1bhw== dependencies: tslib "1.14.1" -"@lit-protocol/types@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/types/-/types-7.0.1.tgz#a8675442992eb104390870f610bd65e6d9ddfa59" - integrity sha512-CpAYgn797PgB6DjhPU2+PUTFud+mnm3UfqBpZqgvUC1WureqZ4tW1SdQvSmYrMQzHsJIdUOkMnoyO4dBrVOq0A== +"@lit-protocol/types@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/types/-/types-7.0.2.tgz#2c4c0032a4210ab31f47d25e4266b8731234c8de" + integrity sha512-rEBZoeSByaMxXiP7w3g6/d180d8AbL4xpLqIlZchfJfAcSFkTseByV1d4h/J3LHl+3Q10wQsJT0N+qIi9kZbqA== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" @@ -3738,26 +3738,26 @@ siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/uint8arrays@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/uint8arrays/-/uint8arrays-7.0.1.tgz#aa9fbf89b067752816a54f4facedf8b54682fbe9" - integrity sha512-IYTtWiYXY3X5RwcH5z0vfL/K2N6Co/tyAIn1w4aTHBddhL54zeLqtJNHwCP/Uf33rh0v0HfzBXn+4On6/efD5w== +"@lit-protocol/uint8arrays@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/uint8arrays/-/uint8arrays-7.0.2.tgz#2d6f65edca8d82d2c8bc1b654b7b0659c880b331" + integrity sha512-lwytcoJOQGtwrAU5qdRc3nkNWy4uND17HZux447eljgwJUGYeLFxNDfx8qtveues1MKAbvSOHtUmxmhpN1aHyQ== dependencies: "@ethersproject/abstract-provider" "5.7.0" "@lit-protocol/accs-schemas" "^0.0.20" - "@lit-protocol/constants" "7.0.1" + "@lit-protocol/constants" "7.0.2" "@lit-protocol/contracts" "^0.0.74" - "@lit-protocol/types" "7.0.1" + "@lit-protocol/types" "7.0.2" "@openagenda/verror" "^3.1.4" depd "^2.0.0" ethers "^5.7.1" siwe "^2.3.2" tslib "1.14.1" -"@lit-protocol/wasm@7.0.1": - version "7.0.1" - resolved "https://registry.yarnpkg.com/@lit-protocol/wasm/-/wasm-7.0.1.tgz#8531c1420a46141c43e2a4c1106e38c7cbb0f81c" - integrity sha512-at3QwXMsEc8lTJhhU+UBbhRbNVH61buPpK4G2KbKX9KWug+WgOJv8rC+1/MC9Va5CAbgdHcbL+0z4Y0NjVXyaw== +"@lit-protocol/wasm@7.0.2": + version "7.0.2" + resolved "https://registry.yarnpkg.com/@lit-protocol/wasm/-/wasm-7.0.2.tgz#9b27aa18e810911832e02cc2898fadbb9e5a21ed" + integrity sha512-e5sRe6Oi0ZSCjZZjL96jkbPE6UbxM1OYIrL3CFUo6IeoNZ/ZyYudHrM92v3ZEhiTfJDRnJDv0t3b2hpUz88cIQ== dependencies: ethers "^5.7.1" pako "^2.1.0" From c19db7558c13e12d36af914a9f4b558e16be54a0 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Thu, 12 Dec 2024 23:54:10 -0300 Subject: [PATCH 22/27] fix: add crypto module for Node.js compatibility in jest config - Added the crypto module to the jest configuration to resolve the ReferenceError: crypto is not defined. - Ensured compatibility with Node.js versions prior to 19 by explicitly setting the global.crypto to webcrypto. --- packages/integration-test/jest.config.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/integration-test/jest.config.js b/packages/integration-test/jest.config.js index be20f1cb6c..e55a286829 100644 --- a/packages/integration-test/jest.config.js +++ b/packages/integration-test/jest.config.js @@ -1,3 +1,8 @@ +// The error ReferenceError: crypto is not defined occurs because the Node.js environment needs the crypto module to be explicitly available. +// For Node.js versions before 19, you need to add the crypto global explicitly. +const { webcrypto } = require('crypto'); +global.crypto = webcrypto; + const jestCommonConfig = require('../../jest.config'); /** @type {import('jest').Config} */ From f7c48255df19bdcf9a93e05aca37c7ccc6310026 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 13 Dec 2024 05:55:11 -0300 Subject: [PATCH 23/27] chore: reorder test script execution in integration-test package.json - Updated the test script in package.json to run 'test:lit' before 'test:node' and 'test:layers' for improved test execution flow. - This change aims to enhance the efficiency of the testing process by prioritizing the lit tests. - Fix an old nouce error --- packages/integration-test/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-test/package.json b/packages/integration-test/package.json index 05eef3fd2a..76359b4571 100644 --- a/packages/integration-test/package.json +++ b/packages/integration-test/package.json @@ -29,7 +29,7 @@ "build": "tsc -b tsconfig.build.json", "clean": "rm -rf dist tsconfig.tsbuildinfo tsconfig.build.tsbuildinfo", "lint": "eslint \"test/**/*.ts\"", - "test": "run-s test:node test:layers test:lit", + "test": "run-s test:lit test:node test:layers", "test:scheduled": "run-s test:erc20 test:any test:erc777 test:eth test:btc ", "test:layers": "jest test/layers.test.ts --forceExit", "test:node": "jest test/node-client.test.ts --forceExit", From c3c771a765bc9ec1f901deaf1aefedf079637a87 Mon Sep 17 00:00:00 2001 From: Rodrigo Serviuc Pavezi Date: Fri, 13 Dec 2024 06:54:33 -0300 Subject: [PATCH 24/27] Update packages/integration-test/test/lit-protocol.test.ts Co-authored-by: MantisClone --- packages/integration-test/test/lit-protocol.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index 0329f7ce8a..d1f550e21d 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -12,8 +12,7 @@ async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 100 try { const data = await request.getData(); if ( - data.state === Types.RequestLogic.STATE.CREATED || - data.state === Types.RequestLogic.STATE.PENDING + data.state === Types.RequestLogic.STATE.CREATED ) { console.log(`Request confirmed with state: ${data.state}`); return; From 4975d2484cd8ad5591d0e136b291d10fb0d88a23 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 13 Dec 2024 07:05:04 -0300 Subject: [PATCH 25/27] fix: format --- packages/integration-test/test/lit-protocol.test.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index d1f550e21d..de308e6b2c 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -11,9 +11,7 @@ async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 100 while (attempts < maxAttempts) { try { const data = await request.getData(); - if ( - data.state === Types.RequestLogic.STATE.CREATED - ) { + if (data.state === Types.RequestLogic.STATE.CREATED) { console.log(`Request confirmed with state: ${data.state}`); return; } From 4100d89c653d7a460ef7053330bebaa4ce3b82b4 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 13 Dec 2024 07:22:47 -0300 Subject: [PATCH 26/27] fix: test timeouts --- packages/ethereum-storage/test/ipfs-manager.test.ts | 1 + packages/integration-test/test/lit-protocol.test.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/ethereum-storage/test/ipfs-manager.test.ts b/packages/ethereum-storage/test/ipfs-manager.test.ts index 65ce06544c..2de522fa2b 100644 --- a/packages/ethereum-storage/test/ipfs-manager.test.ts +++ b/packages/ethereum-storage/test/ipfs-manager.test.ts @@ -3,6 +3,7 @@ import IpfsManager from '../src/ipfs-manager'; import { setupServer } from 'msw/node'; import { HttpResponse, delay, http } from 'msw'; +jest.setTimeout(30000); const testErrorHandling: StorageTypes.IIpfsErrorHandlingConfiguration = { delayBetweenRetries: 0, maxRetries: 0, diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index de308e6b2c..387e6a8859 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -4,6 +4,7 @@ import { RequestNetwork, Types, Utils } from '@requestnetwork/request-client.js' import { ethers } from 'ethers'; import { LitNodeClient } from '@lit-protocol/lit-node-client'; +jest.setTimeout(30000); const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); async function waitForConfirmation(request: any, maxAttempts = 10, delayMs = 1000): Promise { From a847618ef1fbfef1ba3c031041e7d01222d51d59 Mon Sep 17 00:00:00 2001 From: rodrigopavezi Date: Fri, 13 Dec 2024 09:07:07 -0300 Subject: [PATCH 27/27] fix: per review --- packages/integration-test/test/lit-protocol.test.ts | 10 +--------- .../src/lit-protocol-cipher-provider.ts | 12 ++++++------ packages/lit-protocol-cipher/test/index.test.ts | 12 +++++------- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/packages/integration-test/test/lit-protocol.test.ts b/packages/integration-test/test/lit-protocol.test.ts index 387e6a8859..ac90efaee3 100644 --- a/packages/integration-test/test/lit-protocol.test.ts +++ b/packages/integration-test/test/lit-protocol.test.ts @@ -184,12 +184,7 @@ describe('Lit Protocol Integration Tests', () => { const requestData = await encryptedRequest.getData(); expect(requestData).toBeDefined(); - expect([Types.RequestLogic.STATE.CREATED, Types.RequestLogic.STATE.PENDING]).toContain( - requestData.state, - ); - - // Wait for any pending operations to complete - await new Promise((resolve) => setTimeout(resolve, 1000)); + expect([Types.RequestLogic.STATE.CREATED]).toContain(requestData.state); }); it('should handle encryption errors gracefully', async () => { @@ -221,8 +216,5 @@ describe('Lit Protocol Integration Tests', () => { ], }), ).rejects.toThrow(); - - // Wait for any pending operations to complete - await new Promise((resolve) => setTimeout(resolve, 1000)); }); }); diff --git a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts index 0d4777e126..2637cd8688 100644 --- a/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts +++ b/packages/lit-protocol-cipher/src/lit-protocol-cipher-provider.ts @@ -214,10 +214,10 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC }); // Build conditions array with 'or' operators between each condition - return encryptionParams.reduce((acc, param, index) => { - if (index > 0) acc.push({ operator: 'or' }); - acc.push(createCondition(param.key)); - return acc; + return encryptionParams.reduce((accessControlConditions, encryptionParam, index) => { + if (index > 0) accessControlConditions.push({ operator: 'or' }); + accessControlConditions.push(createCondition(encryptionParam.key)); + return accessControlConditions; }, [] as AccessControlConditions); } @@ -244,7 +244,7 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC * @returns {boolean} A boolean indicating if encryption is available. */ public isEncryptionAvailable(): boolean { - return this.litClient !== null; + return this.litClient !== undefined; } /** @@ -285,7 +285,7 @@ export default class LitProtocolCipherProvider implements CipherProviderTypes.IC * @returns {boolean} A boolean indicating if decryption is available. */ public isDecryptionAvailable(): boolean { - return this.litClient !== null && this.sessionSigs !== null && this.decryptionEnabled; + return this.litClient && this.sessionSigs !== null && this.decryptionEnabled; } /** diff --git a/packages/lit-protocol-cipher/test/index.test.ts b/packages/lit-protocol-cipher/test/index.test.ts index 9e4b6aa44b..f3cfbb919a 100644 --- a/packages/lit-protocol-cipher/test/index.test.ts +++ b/packages/lit-protocol-cipher/test/index.test.ts @@ -111,17 +111,15 @@ describe('LitProvider', () => { }); it('should check encryption availability', () => { - // First verify it's true with a valid client + // Test with valid client expect(litProvider.isEncryptionAvailable()).toBe(true); - // Mock the implementation to simulate no client - jest.spyOn(litProvider, 'isEncryptionAvailable').mockImplementation(() => false); - - // Now it should return false + // Test with no client + litProvider['litClient'] = undefined as unknown as LitNodeClientNodeJs; expect(litProvider.isEncryptionAvailable()).toBe(false); - // Restore the original implementation - jest.restoreAllMocks(); + // Restore client for other tests + litProvider['litClient'] = mockLitClient; }); it('should check decryption availability', () => {