Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ jobs:
run: NETWORK=naga-dev bun run test:e2e all
timeout-minutes: 10

- name: Run health check for naga-test
run: NETWORK=naga-test bun run test:e2e all
timeout-minutes: 10
# - name: Run health check for naga-test
# run: NETWORK=naga-test bun run test:e2e all
# timeout-minutes: 10

- name: Run health check for naga-staging
run: NETWORK=naga-staging bun run test:e2e all
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ bunx changeset publish

# Contact

You can reach the Lit Protocol team through [Telegram](https://t.me/+aa73FAF9Vp82ZjJh), [Discord](https://litgateway.com/discord), or [X](https://x.com/litprotocol).
You can reach the Lit Protocol team through [Telegram](https://t.me/+aa73FAF9Vp82ZjJh), [Discord](https://litgateway.com/discord), or [X](https://x.com/litprotocol).
1,646 changes: 702 additions & 944 deletions bun.lock

Large diffs are not rendered by default.

15 changes: 10 additions & 5 deletions e2e/src/e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ describe('all', () => {
createPkpSignTest(ctx, () => ctx.aliceEoaAuthContext)());
it('executeJs', () =>
createExecuteJsTest(ctx, () => ctx.aliceEoaAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => ctx.aliceEoaAuthContext)());
it('viewPKPsByAddress', () => createViewPKPsByAddressTest(ctx)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => ctx.aliceEoaAuthContext)());
createViewPKPsByAuthDataTest(
ctx,
ctx.aliceViemAccountAuthData
)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => ctx.aliceEoaAuthContext)());
it('encryptDecryptFlow', () =>
Expand Down Expand Up @@ -98,9 +100,12 @@ describe('all', () => {
it('executeJs', () =>
createExecuteJsTest(ctx, () => ctx.alicePkpAuthContext)());
it('viewPKPsByAddress', () =>
createViewPKPsByAddressTest(ctx, () => ctx.alicePkpAuthContext)());
createViewPKPsByAddressTest(ctx)());
it('viewPKPsByAuthData', () =>
createViewPKPsByAuthDataTest(ctx, () => ctx.alicePkpAuthContext)());
createViewPKPsByAuthDataTest(
ctx,
ctx.aliceViemAccountAuthData
)());
it('pkpEncryptDecrypt', () =>
createPkpEncryptDecryptTest(ctx, () => ctx.alicePkpAuthContext)());
it('encryptDecryptFlow', () =>
Expand Down
4 changes: 3 additions & 1 deletion e2e/src/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export const init = async (
alicePkpAuthContext: any;
eveViemAccount: any;
eveCustomAuthData: Awaited<ReturnType<typeof litUtils.generateAuthData>>;
eveViemAccountPkp: Awaited<ReturnType<typeof litClient.mintWithCustomAuth>>['pkpData']['data'];
eveViemAccountPkp: Awaited<
ReturnType<typeof litClient.mintWithCustomAuth>
>['pkpData']['data'];
eveValidationIpfsCid: string;
masterDepositForUser: (userAddress: string) => Promise<void>;
// alicePkpViemAccountPermissionsManager: any,
Expand Down
78 changes: 37 additions & 41 deletions e2e/src/v7-compatability.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { createAuthManager, storagePlugins, ViemAccountAuthenticator } from "@lit-protocol/auth";
import { createLitClient } from "@lit-protocol/lit-client";
import { nagaDev } from "@lit-protocol/networks";
import { privateKeyToAccount } from "viem/accounts";

import {
createAuthManager,
storagePlugins,
ViemAccountAuthenticator,
} from '@lit-protocol/auth';
import { createLitClient } from '@lit-protocol/lit-client';
import { nagaDev } from '@lit-protocol/networks';
import { privateKeyToAccount } from 'viem/accounts';

describe('v7 compatability', () => {
it('should be able to use the v7 api', async () => {


const liveMasterAccount = privateKeyToAccount(
process.env['LIVE_MASTER_ACCOUNT'] as `0x${string}`
);


const litClient = await createLitClient({ network: nagaDev });

const authManager = createAuthManager({
Expand Down Expand Up @@ -46,40 +46,38 @@ describe('v7 compatability', () => {
litClient: litClient,
});




const { createAccBuilder } = await import(
'@lit-protocol/access-control-conditions'
);


const unifiedAccs = createAccBuilder().unifiedAccs({
conditionType: 'evmBasic',
contractAddress: '',
standardContractType: '',
chain: 'ethereum',
method: '',
parameters: [':userAddress'],
returnValueTest: {
comparator: '=',
value: liveMasterAccount.address,
},
}).build();


const accs = createAccBuilder().evmBasic({
contractAddress: '',
standardContractType: '',
chain: 'ethereum',
method: '',
parameters: [':userAddress'],
returnValueTest: {
comparator: '=',
value: liveMasterAccount.address,
},
}).build();

const unifiedAccs = createAccBuilder()
.unifiedAccs({
conditionType: 'evmBasic',
contractAddress: '',
standardContractType: '',
chain: 'ethereum',
method: '',
parameters: [':userAddress'],
returnValueTest: {
comparator: '=',
value: liveMasterAccount.address,
},
})
.build();

const accs = createAccBuilder()
.evmBasic({
contractAddress: '',
standardContractType: '',
chain: 'ethereum',
method: '',
parameters: [':userAddress'],
returnValueTest: {
comparator: '=',
value: liveMasterAccount.address,
},
})
.build();

const stringData = 'Hello from encrypt-decrypt flow test!';
const encryptedStringData = await litClient.encrypt({
Expand All @@ -88,10 +86,8 @@ describe('v7 compatability', () => {
chain: 'ethereum',
});


console.log(encryptedStringData);


const decryptedStringResponse = await litClient.decrypt({
data: encryptedStringData,
unifiedAccessControlConditions: accs,
Expand All @@ -100,4 +96,4 @@ describe('v7 compatability', () => {
});
console.log(decryptedStringResponse);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -852,4 +852,4 @@ describe('Access Control Conditions Builder', () => {
expect(condition.parameters).toEqual(['param1', 'param2', 'param3']);
});
});
});
});
30 changes: 12 additions & 18 deletions packages/access-control-conditions/src/lib/createAccBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -549,11 +549,9 @@ class AccessControlConditionBuilder implements AccBuilder {
return this;
}

evmBasic(
params: Omit<EvmBasicAcc, 'conditionType'>
): AccBuilder {
evmBasic(params: Omit<EvmBasicAcc, 'conditionType'>): AccBuilder {
const p = params as Partial<EvmBasicAcc>;

// For raw evmBasic, chain must be provided in params
if (!p.chain) {
throw new Error('Chain must be specified in params for evmBasic method');
Expand All @@ -568,14 +566,14 @@ class AccessControlConditionBuilder implements AccBuilder {
return this;
}

evmContract(
params: Omit<EvmContractAcc, 'conditionType'>
): AccBuilder {
evmContract(params: Omit<EvmContractAcc, 'conditionType'>): AccBuilder {
const p = params as Partial<EvmContractAcc>;

// For raw evmContract, chain must be provided in params
if (!p.chain) {
throw new Error('Chain must be specified in params for evmContract method');
throw new Error(
'Chain must be specified in params for evmContract method'
);
}

this.pendingCondition = {
Expand All @@ -587,11 +585,9 @@ class AccessControlConditionBuilder implements AccBuilder {
return this;
}

solRpc(
params: Omit<SolAcc, 'conditionType'>
): AccBuilder {
solRpc(params: Omit<SolAcc, 'conditionType'>): AccBuilder {
const p = params as Partial<SolAcc>;

// For raw solRpc, chain must be provided in params
if (!p.chain) {
throw new Error('Chain must be specified in params for solRpc method');
Expand All @@ -606,11 +602,9 @@ class AccessControlConditionBuilder implements AccBuilder {
return this;
}

cosmos(
params: Omit<AtomAcc, 'conditionType'>
): AccBuilder {
cosmos(params: Omit<AtomAcc, 'conditionType'>): AccBuilder {
const p = params as Partial<AtomAcc>;

// For raw cosmos, chain must be provided in params
if (!p.chain) {
throw new Error('Chain must be specified in params for cosmos method');
Expand Down Expand Up @@ -938,4 +932,4 @@ export const createLitActionCondition = (
comparator: comparator as any,
value: expectedValue,
},
});
});
17 changes: 14 additions & 3 deletions packages/auth-services/src/_setup/initSystemContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,20 @@ export async function initSystemContext({
: networkModule;

try {
const baseRpc = typeof networkModule.getRpcUrl === 'function' ? networkModule.getRpcUrl() : 'n/a';
const effRpc = typeof effectiveModule.getRpcUrl === 'function' ? effectiveModule.getRpcUrl() : 'n/a';
console.log('[initSystemContext] RPC (base → effective):', baseRpc, '→', effRpc);
const baseRpc =
typeof networkModule.getRpcUrl === 'function'
? networkModule.getRpcUrl()
: 'n/a';
const effRpc =
typeof effectiveModule.getRpcUrl === 'function'
? effectiveModule.getRpcUrl()
: 'n/a';
console.log(
'[initSystemContext] RPC (base → effective):',
baseRpc,
'→',
effRpc
);
} catch {}

const litClient = await createLitClient({
Expand Down
5 changes: 4 additions & 1 deletion packages/auth-services/src/queue-manager/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ interface ParsedRedisConnectionOpts {
}

export async function startAuthServiceWorker() {
await initSystemContext({ appName: 'auth-services-worker', rpcUrl: env.LIT_TXSENDER_RPC_URL });
await initSystemContext({
appName: 'auth-services-worker',
rpcUrl: env.LIT_TXSENDER_RPC_URL,
});
console.log('------------------------------------------------------');
console.log(' Attempting to start Generic BullMQ Worker Process... ');
console.log('------------------------------------------------------');
Expand Down
Loading
Loading