@@ -181,6 +181,17 @@ export const init = async (
181181 } ) ;
182182 console . log ( '✅ Master Payment Balance:' , masterPaymentBalance ) ;
183183
184+ async function masterDepositForUser ( userAddress : string ) {
185+ await masterPaymentManager . depositForUser ( {
186+ userAddress : userAddress ,
187+ amountInEth : LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT ,
188+ } ) ;
189+ console . log (
190+ `✅ New ${ userAddress } Ledger Balance:` ,
191+ await masterPaymentManager . getBalance ( { userAddress : userAddress } )
192+ ) ;
193+ }
194+
184195 /**
185196 * ====================================
186197 * Initialise the AuthManager
@@ -237,6 +248,14 @@ export const init = async (
237248
238249 const eveViemAccountPkp = pkpData . data ;
239250
251+ // Making sure all signers have sufficient ledger balance before calling the signSessionKey endpoint
252+ await masterDepositForUser ( aliceViemAccount . address ) ;
253+ await masterDepositForUser ( bobViemAccount . address ) ;
254+ await masterDepositForUser ( aliceViemAccountPkp . ethAddress ) ;
255+ await masterDepositForUser ( bobViemAccountPkp . ethAddress ) ;
256+ await masterDepositForUser ( eveViemAccount . address ) ;
257+ await masterDepositForUser ( eveViemAccountPkp . ethAddress ) ;
258+
240259 /**
241260 * ====================================
242261 * Create the auth context
@@ -299,35 +318,9 @@ export const init = async (
299318 * ====================================
300319 */
301320
302- async function masterDepositForUser ( userAddress : string ) {
303- await masterPaymentManager . depositForUser ( {
304- userAddress : userAddress ,
305- amountInEth : LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT ,
306- } ) ;
307- console . log (
308- `✅ New ${ userAddress } Ledger Balance:` ,
309- await masterPaymentManager . getBalance ( { userAddress : userAddress } )
310- ) ;
311- }
312-
313- // Deposit to the Alice EOA Ledger
314- await masterDepositForUser ( aliceViemAccount . address ) ;
315-
316- // Deposit to the PKP Ledger
321+ // Deposit to the PKP Viem account Ledger
317322 await masterDepositForUser ( alicePkpViemAccount . address ) ;
318323
319- // Deposit to the Bob EOA Ledger
320- await masterDepositForUser ( bobViemAccount . address ) ;
321-
322- // Deposit to the Bob PKP Ledger
323- await masterDepositForUser ( bobViemAccountPkp . ethAddress ) ;
324-
325- // Deposit to the Eve EOA Ledger
326- await masterDepositForUser ( eveViemAccount . address ) ;
327-
328- // Deposit to the Eve PKP Ledger
329- await masterDepositForUser ( eveViemAccountPkp . ethAddress ) ;
330-
331324 // const alicePkpViemAccountPermissionsManager = await litClient.getPKPPermissionsManager({
332325 // pkpIdentifier: {
333326 // tokenId: aliceViemAccountPkp.tokenId,
0 commit comments