Skip to content

Commit cac2eef

Browse files
committed
fix: increase deposit amount to 2 and update encrypt/decrypt to use ctx.bobViemAccount instead
1 parent 152422a commit cac2eef

File tree

4 files changed

+26
-21
lines changed

4 files changed

+26
-21
lines changed

e2e/src/helper/tests/encrypt-decrypt-flow.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,9 @@ export const createEncryptDecryptFlowTest = (
99
const { createAccBuilder } = await import(
1010
'@lit-protocol/access-control-conditions'
1111
);
12-
const { generatePrivateKey, privateKeyToAccount } = await import(
13-
'viem/accounts'
14-
);
1512

1613
const authContext = getAuthContext();
1714

18-
// Create a test account for Bob (recipient)
19-
const bobAccount = privateKeyToAccount(generatePrivateKey());
20-
2115
// Determine which address to use for Alice based on auth context type
2216
let aliceAddress: string;
2317
if (authContext === ctx.aliceEoaAuthContext) {
@@ -29,7 +23,7 @@ export const createEncryptDecryptFlowTest = (
2923
// Set up access control conditions requiring Bob's wallet ownership
3024
const builder = createAccBuilder();
3125
const accs = builder
32-
.requireWalletOwnership(bobAccount.address)
26+
.requireWalletOwnership(ctx.bobViemAccount.address)
3327
.on('ethereum')
3428
.build();
3529

@@ -50,7 +44,7 @@ export const createEncryptDecryptFlowTest = (
5044
const jsonData = {
5145
message: 'Test JSON data',
5246
sender: aliceAddress,
53-
recipient: bobAccount.address,
47+
recipient: ctx.bobViemAccount.address,
5448
timestamp: Date.now(),
5549
};
5650

@@ -105,7 +99,7 @@ export const createEncryptDecryptFlowTest = (
10599
// Create Bob's auth context for decryption
106100
const bobAuthContext = await ctx.authManager.createEoaAuthContext({
107101
config: {
108-
account: bobAccount,
102+
account: ctx.bobViemAccount,
109103
},
110104
authConfig: {
111105
domain: 'localhost',

e2e/src/init.ts

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type LogLevel = z.infer<typeof LogLevelSchema>;
2525
// Configurations
2626
const LIVE_NETWORK_FUNDING_AMOUNT = '0.01';
2727
const LOCAL_NETWORK_FUNDING_AMOUNT = '1';
28-
const LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT = '0.1';
28+
const LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT = '2';
2929

3030
export const init = async (
3131
network?: SupportedNetwork,
@@ -42,6 +42,7 @@ export const init = async (
4242
bobViemAccountPkp: any;
4343
aliceEoaAuthContext: any;
4444
alicePkpAuthContext: any;
45+
masterDepositForUser: (userAddress: string) => Promise<void>;
4546
// alicePkpViemAccountPermissionsManager: any,
4647
}> => {
4748
/**
@@ -241,13 +242,22 @@ export const init = async (
241242
* ====================================
242243
*/
243244

245+
async function masterDepositForUser(userAddress: string) {
246+
await masterPaymentManager.depositForUser({ userAddress: userAddress, amountInEth: LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT });
247+
console.log(`✅ New ${userAddress} Ledger Balance:`, await masterPaymentManager.getBalance({ userAddress: userAddress }));
248+
}
249+
244250
// Deposit to the Alice EOA Ledger
245-
await masterPaymentManager.depositForUser({ userAddress: aliceViemAccount.address, amountInEth: LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT });
246-
console.log('✅ New Alice EOA Ledger Balance:', await masterPaymentManager.getBalance({ userAddress: aliceViemAccount.address }));
251+
await masterDepositForUser(aliceViemAccount.address);
247252

248253
// Deposit to the PKP Ledger
249-
await masterPaymentManager.depositForUser({ userAddress: alicePkpViemAccount.address, amountInEth: LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT });
250-
console.log('✅ New PKP Ledger Balance:', await masterPaymentManager.getBalance({ userAddress: alicePkpViemAccount.address }));
254+
await masterDepositForUser(alicePkpViemAccount.address);
255+
256+
// Deposit to the Bob EOA Ledger
257+
await masterDepositForUser(bobViemAccount.address);
258+
259+
// Deposit to the Bob PKP Ledger
260+
await masterDepositForUser(bobViemAccountPkp.ethAddress);
251261

252262
// const alicePkpViemAccountPermissionsManager = await litClient.getPKPPermissionsManager({
253263
// pkpIdentifier: {
@@ -274,6 +284,7 @@ export const init = async (
274284
bobViemAccountPkp,
275285
aliceEoaAuthContext,
276286
alicePkpAuthContext,
287+
masterDepositForUser
277288
// alicePkpViemAccountPermissionsManager
278289
};
279290
};

packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodByIdentifier.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ export async function removePermittedAuthMethodByIdentifier(
4343
networkCtx
4444
);
4545

46-
console.log('❌ AUTH METHOD TYPE:', authMethodType);
47-
console.log('❌ AUTH METHOD ID:', authMethodId);
48-
console.log('❌ PKP TOKEN ID:', pkpTokenId);
46+
// console.log('❌ AUTH METHOD TYPE:', authMethodType);
47+
// console.log('❌ AUTH METHOD ID:', authMethodId);
48+
// console.log('❌ PKP TOKEN ID:', pkpTokenId);
4949

5050
return removePermittedAuthMethod(
5151
{

packages/networks/src/networks/vNaga/LitChainClient/apis/highLevelApis/PKPPermissionsManager/handlers/removePermittedAuthMethodScopeByIdentifier.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ export async function removePermittedAuthMethodScopeByIdentifier(
4444
networkCtx
4545
);
4646

47-
console.log('🔥 AUTH METHOD TYPE:', authMethodType);
48-
console.log('🔥 AUTH METHOD ID:', authMethodId);
49-
console.log('🔥 SCOPE ID:', scopeId);
50-
console.log('🔥 PKP TOKEN ID:', pkpTokenId);
47+
// console.log('🔥 AUTH METHOD TYPE:', authMethodType);
48+
// console.log('🔥 AUTH METHOD ID:', authMethodId);
49+
// console.log('🔥 SCOPE ID:', scopeId);
50+
// console.log('🔥 PKP TOKEN ID:', pkpTokenId);
5151

5252
return removePermittedAuthMethodScope(
5353
{

0 commit comments

Comments
 (0)