Skip to content

Commit 334d925

Browse files
committed
feat(init): add aliceViemAccountPkp to BaseInitResult and FullInitResult
1 parent 1d3e9cc commit 334d925

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

packages/e2e/src/init.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ type BaseInitResult = {
5353
localMasterAccount: ViemAccount;
5454
aliceViemAccount: ViemAccount;
5555
aliceViemAccountAuthData: AuthData;
56+
aliceViemAccountPkp: PKPData;
5657
aliceEoaAuthContext: AuthContext;
5758
masterDepositForUser: (userAddress: string) => Promise<void>;
5859
};
5960

6061
type FullInitResult = BaseInitResult & {
61-
aliceViemAccountPkp: PKPData;
6262
bobViemAccount: ViemAccount;
6363
bobViemAccountAuthData: AuthData;
6464
bobViemAccountPkp: PKPData;
@@ -252,8 +252,15 @@ async function initInternal(
252252
litClient: litClient,
253253
});
254254

255+
const aliceViemAccountPkp = await getOrCreatePkp(
256+
litClient,
257+
aliceViemAccountAuthData,
258+
aliceViemAccount
259+
);
260+
255261
if (mode === 'fast') {
256262
await masterDepositForUser(aliceViemAccount.address);
263+
await masterDepositForUser(aliceViemAccountPkp.ethAddress);
257264

258265
const aliceEoaAuthContext = await createAliceEoaAuthContext();
259266

@@ -265,6 +272,7 @@ async function initInternal(
265272
localMasterAccount,
266273
aliceViemAccount,
267274
aliceViemAccountAuthData,
275+
aliceViemAccountPkp,
268276
aliceEoaAuthContext,
269277
masterDepositForUser,
270278
};
@@ -281,10 +289,11 @@ async function initInternal(
281289
* Get or create PKPs for Alice and Bob
282290
* ====================================
283291
*/
284-
const [aliceViemAccountPkp, bobViemAccountPkp] = await Promise.all([
285-
getOrCreatePkp(litClient, aliceViemAccountAuthData, aliceViemAccount),
286-
getOrCreatePkp(litClient, bobViemAccountAuthData, bobViemAccount),
287-
]);
292+
const bobViemAccountPkp = await getOrCreatePkp(
293+
litClient,
294+
bobViemAccountAuthData,
295+
bobViemAccount
296+
);
288297

289298
// Use custom auth to create a PKP for Eve
290299
const uniqueDappName = 'e2e-test-dapp';
@@ -372,13 +381,13 @@ async function initInternal(
372381
localMasterAccount,
373382
aliceViemAccount,
374383
aliceViemAccountAuthData,
384+
aliceViemAccountPkp,
375385
aliceEoaAuthContext,
376386
masterDepositForUser,
377387
};
378388

379389
const fullResult: FullInitResult = {
380390
...baseResult,
381-
aliceViemAccountPkp,
382391
bobViemAccount,
383392
bobViemAccountAuthData,
384393
bobViemAccountPkp,

0 commit comments

Comments
 (0)