@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 +9 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +9 -0
- package/dist/types/bee.d.ts +1 -0
- package/package.json +1 -1
package/dist/mjs/bee.js
CHANGED
|
@@ -1176,6 +1176,15 @@ export class Bee {
|
|
|
1176
1176
|
const amount = getAmountForDuration(duration, chainState.currentPrice);
|
|
1177
1177
|
return this.topUpBatch(batch.batchID, amount, options);
|
|
1178
1178
|
}
|
|
1179
|
+
async getExtensionCost(postageBatchId, gigabytes, duration, options) {
|
|
1180
|
+
const batch = await this.getPostageBatch(postageBatchId, options);
|
|
1181
|
+
const chainState = await this.getChainState(options);
|
|
1182
|
+
const amount = getAmountForDuration(duration, chainState.currentPrice);
|
|
1183
|
+
const depth = getDepthForSize(gigabytes);
|
|
1184
|
+
const currentValue = getStampCost(batch.depth, batch.amount);
|
|
1185
|
+
const newValue = getStampCost(depth, amount);
|
|
1186
|
+
return newValue.minus(currentValue);
|
|
1187
|
+
}
|
|
1179
1188
|
async getSizeExtensionCost(postageBatchId, gigabytes, options) {
|
|
1180
1189
|
const batch = await this.getPostageBatch(postageBatchId, options);
|
|
1181
1190
|
const depth = getDepthForSize(gigabytes);
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -653,6 +653,7 @@ export declare class Bee {
|
|
|
653
653
|
getStorageCost(gigabytes: number, duration: Duration, options?: BeeRequestOptions): Promise<BZZ>;
|
|
654
654
|
extendStorageSize(postageBatchId: BatchId | Uint8Array | string, gigabytes: number, options?: BeeRequestOptions): Promise<BatchId>;
|
|
655
655
|
extendStorageDuration(postageBatchId: BatchId | Uint8Array | string, duration: Duration, options?: BeeRequestOptions): Promise<BatchId>;
|
|
656
|
+
getExtensionCost(postageBatchId: BatchId | Uint8Array | string, gigabytes: number, duration: Duration, options?: BeeRequestOptions): Promise<BZZ>;
|
|
656
657
|
getSizeExtensionCost(postageBatchId: BatchId | Uint8Array | string, gigabytes: number, options?: BeeRequestOptions): Promise<BZZ>;
|
|
657
658
|
getDurationExtensionCost(postageBatchId: BatchId | Uint8Array | string, duration: Duration, options?: BeeRequestOptions): Promise<BZZ>;
|
|
658
659
|
/**
|