@upcoming/bee-js 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/bee.js CHANGED
@@ -1190,6 +1190,15 @@ class Bee {
1190
1190
  const amount = (0, stamps_1.getAmountForDuration)(duration, chainState.currentPrice);
1191
1191
  return this.topUpBatch(batch.batchID, amount, options);
1192
1192
  }
1193
+ async getExtensionCost(postageBatchId, gigabytes, duration, options) {
1194
+ const batch = await this.getPostageBatch(postageBatchId, options);
1195
+ const chainState = await this.getChainState(options);
1196
+ const amount = (0, stamps_1.getAmountForDuration)(duration, chainState.currentPrice);
1197
+ const depth = (0, stamps_1.getDepthForSize)(gigabytes);
1198
+ const currentValue = (0, stamps_1.getStampCost)(batch.depth, batch.amount);
1199
+ const newValue = (0, stamps_1.getStampCost)(depth, amount);
1200
+ return newValue.minus(currentValue);
1201
+ }
1193
1202
  async getSizeExtensionCost(postageBatchId, gigabytes, options) {
1194
1203
  const batch = await this.getPostageBatch(postageBatchId, options);
1195
1204
  const depth = (0, stamps_1.getDepthForSize)(gigabytes);