diff --git a/src/bee-debug.ts b/src/bee-debug.ts index d5dfca4d..d0683710 100644 --- a/src/bee-debug.ts +++ b/src/bee-debug.ts @@ -642,6 +642,15 @@ export class BeeDebug { return stamps.getAllPostageBatches(this.getRequestOptionsForCall(options)) } + /** + * Return all globally available postage batches. + */ + async getAllGlobalPostageBatch(options?: BeeRequestOptions): Promise { + assertRequestOptions(options) + + return stamps.getGlobalPostageBatches(this.getRequestOptionsForCall(options)) + } + /** * Return lists of all current pending transactions that the Bee made */ diff --git a/src/modules/debug/stamps.ts b/src/modules/debug/stamps.ts index 17a1d96a..cedd8c19 100644 --- a/src/modules/debug/stamps.ts +++ b/src/modules/debug/stamps.ts @@ -9,6 +9,7 @@ import type { import { http } from '../../utils/http' const STAMPS_ENDPOINT = 'stamps' +const BATCHES_ENDPOINT = 'batches' interface GetAllStampsResponse { stamps: PostageBatch[] @@ -18,6 +19,16 @@ interface StampResponse { batchID: BatchId } +export async function getGlobalPostageBatches(requestOptions: BeeRequestOptions): Promise { + const response = await http(requestOptions, { + method: 'get', + url: `${BATCHES_ENDPOINT}`, + responseType: 'json', + }) + + return response.data.stamps +} + export async function getAllPostageBatches(requestOptions: BeeRequestOptions): Promise { const response = await http(requestOptions, { method: 'get',