@@ -25,6 +25,7 @@ type LogLevel = z.infer<typeof LogLevelSchema>;
2525// Configurations
2626const LIVE_NETWORK_FUNDING_AMOUNT = '0.01' ;
2727const LOCAL_NETWORK_FUNDING_AMOUNT = '1' ;
28+ const LIVE_NETWORK_LEDGER_DEPOSIT_AMOUNT = '0.1' ;
2829
2930export const init = async (
3031 network ?: SupportedNetwork ,
@@ -132,6 +133,18 @@ export const init = async (
132133 */
133134 const litClient = await createLitClient ( { network : _networkModule } ) ;
134135
136+ /**
137+ * ====================================
138+ * (Master) Initialise Payment Manager
139+ * ====================================
140+ */
141+ const masterPaymentManager = await litClient . getPaymentManager ( {
142+ account : masterAccount ,
143+ } ) ;
144+
145+ const masterPaymentBalance = await masterPaymentManager . getBalance ( { userAddress : masterAccount . address } )
146+ console . log ( '✅ Master Payment Balance:' , masterPaymentBalance ) ;
147+
135148 /**
136149 * ====================================
137150 * Initialise the AuthManager
@@ -211,16 +224,30 @@ export const init = async (
211224 litClient : litClient ,
212225 } ) ;
213226
214- // const alicePkpViemAccount = await litClient.getPkpViemAccount({
215- // pkpPublicKey: aliceViemAccountPkp.publicKey,
216- // authContext: alicePkpAuthContext,
217- // chainConfig: _networkModule.getChainConfig(),
218- // });
227+ const alicePkpViemAccount = await litClient . getPkpViemAccount ( {
228+ pkpPublicKey : aliceViemAccountPkp . publicKey ,
229+ authContext : alicePkpAuthContext ,
230+ chainConfig : _networkModule . getChainConfig ( ) ,
231+ } ) ;
219232
220- // await fundAccount(alicePkpViemAccount, localMasterAccount, _networkModule, {
221- // ifLessThan: LOCAL_NETWORK_FUNDING_AMOUNT,
222- // thenFundWith: LOCAL_NETWORK_FUNDING_AMOUNT,
223- // });
233+ await fundAccount ( alicePkpViemAccount , masterAccount , _networkModule , {
234+ ifLessThan : LOCAL_NETWORK_FUNDING_AMOUNT ,
235+ thenFundWith : LOCAL_NETWORK_FUNDING_AMOUNT ,
236+ } ) ;
237+
238+ /**
239+ * ====================================
240+ * Depositing to Lit Ledger for differen
241+ * ====================================
242+ */
243+
244+ // 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 } ) ) ;
247+
248+ // 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 } ) ) ;
224251
225252 // const alicePkpViemAccountPermissionsManager = await litClient.getPKPPermissionsManager({
226253 // pkpIdentifier: {
0 commit comments