@ethersphere/bee-js 10.1.2 → 10.2.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.
|
@@ -320,7 +320,17 @@ export class MantarayNode {
|
|
|
320
320
|
*/
|
|
321
321
|
async saveRecursively(bee, postageBatchId, options, requestOptions) {
|
|
322
322
|
for (const fork of this.forks.values()) {
|
|
323
|
-
await fork.node.saveRecursively(bee, postageBatchId, options, requestOptions);
|
|
323
|
+
const uploadResult = await fork.node.saveRecursively(bee, postageBatchId, options, requestOptions);
|
|
324
|
+
if (options?.act) {
|
|
325
|
+
let historyAddress;
|
|
326
|
+
uploadResult.historyAddress.ifPresent(ref => historyAddress = ref);
|
|
327
|
+
if (historyAddress) {
|
|
328
|
+
if (!fork.node.metadata) {
|
|
329
|
+
fork.node.metadata = {};
|
|
330
|
+
}
|
|
331
|
+
fork.node.metadata['swarm-act-history-address'] = historyAddress.toHex();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
324
334
|
}
|
|
325
335
|
const result = await bee.uploadData(postageBatchId, await this.marshal(), options, requestOptions);
|
|
326
336
|
this.selfAddress = result.reference.toUint8Array();
|
|
@@ -334,7 +344,14 @@ export class MantarayNode {
|
|
|
334
344
|
if (!fork.node.selfAddress) {
|
|
335
345
|
throw Error('MantarayNode#loadRecursively fork.node.selfAddress is not set');
|
|
336
346
|
}
|
|
337
|
-
|
|
347
|
+
let downloadOptions = options;
|
|
348
|
+
if (fork.node.metadata && fork.node.metadata['swarm-act-history-address']) {
|
|
349
|
+
downloadOptions = {
|
|
350
|
+
...options,
|
|
351
|
+
actHistoryAddress: fork.node.metadata['swarm-act-history-address']
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const node = await MantarayNode.unmarshal(bee, fork.node.selfAddress, downloadOptions, requestOptions);
|
|
338
355
|
fork.node.targetAddress = node.targetAddress;
|
|
339
356
|
fork.node.forks = node.forks;
|
|
340
357
|
fork.node.path = fork.prefix;
|