@@ -15,10 +15,13 @@ const _network = process.env['NETWORK'];
1515
1616// CONFIGURATIONS
1717const REJECT_BALANCE_THRESHOLD = 0 ;
18- const LEDGER_MINIMUM_BALANCE = 10000 ;
18+ const MASTER_LEDGER_MINIMUM_BALANCE = 10_000 ;
19+ const PKP_LEDGER_MINIMUM_BALANCE = 10_000 ;
1920
20- if ( Number . isNaN ( LEDGER_MINIMUM_BALANCE ) || LEDGER_MINIMUM_BALANCE < 0 ) {
21- throw new Error ( '❌ LEDGER_MINIMUM_BALANCE must be a non-negative number' ) ;
21+ if ( MASTER_LEDGER_MINIMUM_BALANCE < 0 || PKP_LEDGER_MINIMUM_BALANCE < 0 ) {
22+ throw new Error (
23+ '❌ Ledger minimum balances must be non-negative numbers'
24+ ) ;
2225}
2326
2427const ensureLedgerBalance = async ( {
@@ -91,7 +94,7 @@ const ensureLedgerBalance = async ({
9194 masterAccountDetails . paymentManager . getBalance ( {
9295 userAddress : masterAccount . address ,
9396 } ) ,
94- minimumBalance : LEDGER_MINIMUM_BALANCE ,
97+ minimumBalance : MASTER_LEDGER_MINIMUM_BALANCE ,
9598 topUp : async ( difference ) => {
9699 await masterAccountDetails . paymentManager . deposit ( {
97100 amountInEth : difference . toString ( ) ,
@@ -172,7 +175,7 @@ const ensureLedgerBalance = async ({
172175 masterAccountDetails . paymentManager . getBalance ( {
173176 userAddress : pkpEthAddress ,
174177 } ) ,
175- minimumBalance : LEDGER_MINIMUM_BALANCE ,
178+ minimumBalance : PKP_LEDGER_MINIMUM_BALANCE ,
176179 topUp : async ( difference ) => {
177180 await masterAccountDetails . paymentManager . depositForUser ( {
178181 userAddress : pkpEthAddress ,
0 commit comments