@@ -149,6 +149,11 @@ export class Bee {
149149 */
150150 public readonly signer ?: PrivateKey
151151
152+ /**
153+ * Network on which the Bee node is running
154+ */
155+ public readonly network : 'gnosis' | 'sepolia'
156+
152157 /**
153158 * Options for making requests
154159 * @private
@@ -171,6 +176,8 @@ export class Bee {
171176 this . signer = new PrivateKey ( options . signer )
172177 }
173178
179+ this . network = options ?. network ?? 'gnosis'
180+
174181 this . requestOptions = {
175182 baseURL : this . url ,
176183 timeout : options ?. timeout ?? 0 ,
@@ -1035,6 +1042,7 @@ export class Bee {
10351042 const signer = new PrivateKey ( Binary . numberToUint256 ( start + i , 'BE' ) )
10361043 const socAddress = makeSOCAddress ( identifier , signer . publicKey ( ) . address ( ) )
10371044 const actualProximity = 256 - Binary . proximity ( socAddress . toUint8Array ( ) , targetOverlay . toUint8Array ( ) , 256 )
1045+
10381046 if ( actualProximity <= 256 - proximity ) {
10391047 return signer
10401048 }
@@ -1637,7 +1645,7 @@ export class Bee {
16371645 requestOptions ?: BeeRequestOptions ,
16381646 ) : Promise < BatchId > {
16391647 const chainState = await this . getChainState ( requestOptions )
1640- const amount = getAmountForDuration ( duration , chainState . currentPrice )
1648+ const amount = getAmountForDuration ( duration , chainState . currentPrice , this . network === 'gnosis' ? 5 : 15 )
16411649 const depth = getDepthForSize ( size )
16421650
16431651 if ( options ) {
@@ -1649,7 +1657,7 @@ export class Bee {
16491657
16501658 async getStorageCost ( size : Size , duration : Duration , options ?: BeeRequestOptions ) : Promise < BZZ > {
16511659 const chainState = await this . getChainState ( options )
1652- const amount = getAmountForDuration ( duration , chainState . currentPrice )
1660+ const amount = getAmountForDuration ( duration , chainState . currentPrice , this . network === 'gnosis' ? 5 : 15 )
16531661 const depth = getDepthForSize ( size )
16541662
16551663 return getStampCost ( depth , amount )
@@ -1676,7 +1684,7 @@ export class Bee {
16761684 ) {
16771685 const batch = await this . getPostageBatch ( postageBatchId , options )
16781686 const chainState = await this . getChainState ( options )
1679- const amount = getAmountForDuration ( duration , chainState . currentPrice )
1687+ const amount = getAmountForDuration ( duration , chainState . currentPrice , this . network === 'gnosis' ? 5 : 15 )
16801688
16811689 return this . topUpBatch ( batch . batchID , amount , options )
16821690 }
@@ -1689,7 +1697,7 @@ export class Bee {
16891697 ) : Promise < BZZ > {
16901698 const batch = await this . getPostageBatch ( postageBatchId , options )
16911699 const chainState = await this . getChainState ( options )
1692- const amount = getAmountForDuration ( duration , chainState . currentPrice )
1700+ const amount = getAmountForDuration ( duration , chainState . currentPrice , this . network === 'gnosis' ? 5 : 15 )
16931701 const depth = getDepthForSize ( size )
16941702
16951703 const currentValue = getStampCost ( batch . depth , batch . amount )
@@ -1713,6 +1721,7 @@ export class Bee {
17131721
17141722 const currentPaid = getStampCost ( batch . depth , batch . amount )
17151723 const newPaid = getStampCost ( depth , batch . amount )
1724+
17161725 return newPaid . minus ( currentPaid )
17171726 }
17181727
@@ -1723,7 +1732,7 @@ export class Bee {
17231732 ) : Promise < BZZ > {
17241733 const batch = await this . getPostageBatch ( postageBatchId , options )
17251734 const chainState = await this . getChainState ( options )
1726- const amount = getAmountForDuration ( duration , chainState . currentPrice )
1735+ const amount = getAmountForDuration ( duration , chainState . currentPrice , this . network === 'gnosis' ? 5 : 15 )
17271736
17281737 return getStampCost ( batch . depth , amount )
17291738 }
0 commit comments