@ethersphere/bee-js 12.2.0 → 12.2.2
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 +7 -1
- package/dist/cjs/index.js +1 -3
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +7 -1
- package/dist/mjs/index.js +1 -2
- package/dist/types/bee.d.ts +1 -1
- package/dist/types/index.d.ts +1 -3
- package/package.json +5 -5
- package/dist/cjs/bee-dev.js +0 -78
- package/dist/mjs/bee-dev.js +0 -98
- package/dist/types/bee-dev.d.ts +0 -5
package/dist/mjs/bee.js
CHANGED
|
@@ -1602,10 +1602,16 @@ export class Bee {
|
|
|
1602
1602
|
const currentAmount = getAmountForDuration(batch.duration, chainState.currentPrice, blockTime);
|
|
1603
1603
|
const targetAmount = duration.isZero() ? currentAmount * multiplier : (currentAmount + additionalAmount) * multiplier;
|
|
1604
1604
|
const amountDelta = targetAmount - currentAmount;
|
|
1605
|
-
|
|
1605
|
+
let transactionId;
|
|
1606
|
+
if (amountDelta > 0n) {
|
|
1607
|
+
transactionId = await this.topUpBatch(batch.batchID, amountDelta, requestOptions);
|
|
1608
|
+
}
|
|
1606
1609
|
if (depthDelta > 0) {
|
|
1607
1610
|
return this.diluteBatch(batch.batchID, depth, requestOptions);
|
|
1608
1611
|
}
|
|
1612
|
+
if (!transactionId) {
|
|
1613
|
+
throw new Error('Nothing to extend, both size and duration are already sufficient');
|
|
1614
|
+
}
|
|
1609
1615
|
return transactionId;
|
|
1610
1616
|
}
|
|
1611
1617
|
/**
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Bee } from "./bee.js";
|
|
2
|
-
import { BeeDev } from "./bee-dev.js";
|
|
3
2
|
import { Stamper } from "./stamper/stamper.js";
|
|
4
3
|
export { MerkleTree } from 'cafe-utility';
|
|
5
4
|
export { MantarayNode } from "./manifest/manifest.js";
|
|
@@ -13,4 +12,4 @@ export * as Utils from "./utils/expose.js";
|
|
|
13
12
|
export { Size } from "./utils/size.js";
|
|
14
13
|
export * from "./utils/tokens.js";
|
|
15
14
|
export * from "./utils/typed-bytes.js";
|
|
16
|
-
export { Bee,
|
|
15
|
+
export { Bee, Stamper };
|
package/dist/types/bee.d.ts
CHANGED
|
@@ -1074,7 +1074,7 @@ export declare class Bee {
|
|
|
1074
1074
|
* @param erasureCodeLevel Assume the future uploaded data is erasure coded, which skews the capacity of the postage batch.
|
|
1075
1075
|
* @returns
|
|
1076
1076
|
*/
|
|
1077
|
-
extendStorage(postageBatchId: BatchId | Uint8Array | string, size: Size, duration: Duration, requestOptions?: BeeRequestOptions, encryption?: boolean, erasureCodeLevel?: RedundancyLevel): Promise<BatchId>;
|
|
1077
|
+
extendStorage(postageBatchId: BatchId | Uint8Array | string, size: Size, duration: Duration, requestOptions?: BeeRequestOptions, encryption?: boolean, erasureCodeLevel?: RedundancyLevel): Promise<TransactionId | BatchId>;
|
|
1078
1078
|
/**
|
|
1079
1079
|
* Extends the storage size of a postage batch by increasing its depth.
|
|
1080
1080
|
*
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Bee } from './bee';
|
|
2
|
-
import { BeeDev } from './bee-dev';
|
|
3
2
|
import { Stamper } from './stamper/stamper';
|
|
4
3
|
export { MerkleTree } from 'cafe-utility';
|
|
5
4
|
export type { Chunk } from './chunk/cac';
|
|
@@ -16,12 +15,11 @@ export { Size } from './utils/size';
|
|
|
16
15
|
export * from './utils/tokens';
|
|
17
16
|
export * from './utils/typed-bytes';
|
|
18
17
|
export type { UploadProgress } from './utils/upload-progress';
|
|
19
|
-
export { Bee,
|
|
18
|
+
export { Bee, Stamper };
|
|
20
19
|
declare global {
|
|
21
20
|
interface Window {
|
|
22
21
|
BeeJs: {
|
|
23
22
|
Bee: typeof import('./bee').Bee;
|
|
24
|
-
BeeDev: typeof import('./bee-dev').BeeDev;
|
|
25
23
|
Stamper: typeof import('./stamper/stamper').Stamper;
|
|
26
24
|
Utils: typeof import('./utils/expose');
|
|
27
25
|
Duration: typeof import('./utils/duration').Duration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "12.2.
|
|
3
|
+
"version": "12.2.2",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -64,16 +64,16 @@
|
|
|
64
64
|
"depcheck": "depcheck ."
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"axios": "^1.15.
|
|
67
|
+
"axios": "^1.15.2",
|
|
68
68
|
"cafe-utility": "^33.9.0",
|
|
69
69
|
"debug": "^4.4.1",
|
|
70
70
|
"isomorphic-ws": "^4.0.1",
|
|
71
71
|
"semver": "^7.3.5",
|
|
72
|
-
"ws": "^8.
|
|
72
|
+
"ws": "^8.20.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@babel/cli": "^7.19.3",
|
|
76
|
-
"@babel/core": "^7.
|
|
76
|
+
"@babel/core": "^7.29.0",
|
|
77
77
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
78
78
|
"@babel/plugin-transform-runtime": "^7.17.0",
|
|
79
79
|
"@babel/preset-env": "^7.20.2",
|
|
@@ -93,7 +93,7 @@
|
|
|
93
93
|
"eslint": "^8.13.0",
|
|
94
94
|
"eslint-config-prettier": "^8.5.0",
|
|
95
95
|
"eslint-plugin-prettier": "^4.0.0",
|
|
96
|
-
"eslint-plugin-unused-imports": "^
|
|
96
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
97
97
|
"husky": "^8.0.1",
|
|
98
98
|
"jest": "^30.2.0",
|
|
99
99
|
"jest-environment-jsdom": "^30.4.1",
|
package/dist/cjs/bee-dev.js
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BeeDev = void 0;
|
|
4
|
-
const cafe_utility_1 = require("cafe-utility");
|
|
5
|
-
const _1 = require(".");
|
|
6
|
-
const connectivity_1 = require("./modules/debug/connectivity");
|
|
7
|
-
const http_1 = require("./utils/http");
|
|
8
|
-
class BeeDev extends _1.Bee {
|
|
9
|
-
async getNodeAddresses(options) {
|
|
10
|
-
const requestOptions = super.getRequestOptionsForCall(options);
|
|
11
|
-
const response = await (0, http_1.http)(requestOptions, {
|
|
12
|
-
url: 'addresses',
|
|
13
|
-
responseType: 'json',
|
|
14
|
-
});
|
|
15
|
-
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
16
|
-
return {
|
|
17
|
-
overlay: new _1.PeerAddress(cafe_utility_1.Types.asString(body.overlay, { name: 'overlay' })),
|
|
18
|
-
underlay: [],
|
|
19
|
-
ethereum: new _1.EthAddress(cafe_utility_1.Types.asString(body.ethereum, { name: 'ethereum' })),
|
|
20
|
-
publicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.publicKey, { name: 'publicKey' })),
|
|
21
|
-
pssPublicKey: new _1.PublicKey(cafe_utility_1.Types.asString(body.pssPublicKey, { name: 'pssPublicKey' })),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
async getTopology(options) {
|
|
25
|
-
const requestOptions = super.getRequestOptionsForCall(options);
|
|
26
|
-
const response = await (0, http_1.http)(requestOptions, {
|
|
27
|
-
url: `topology`,
|
|
28
|
-
responseType: 'json',
|
|
29
|
-
});
|
|
30
|
-
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
31
|
-
const bins = cafe_utility_1.Types.asObject(body.bins, { name: 'bins' });
|
|
32
|
-
return {
|
|
33
|
-
baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
|
|
34
|
-
population: cafe_utility_1.Types.asNumber(body.population, { name: 'population' }),
|
|
35
|
-
connected: cafe_utility_1.Types.asNumber(body.connected, { name: 'connected' }),
|
|
36
|
-
timestamp: cafe_utility_1.Types.asString(body.timestamp, { name: 'timestamp' }),
|
|
37
|
-
nnLowWatermark: cafe_utility_1.Types.asNumber(body.nnLowWatermark, { name: 'nnLowWatermark' }),
|
|
38
|
-
depth: cafe_utility_1.Types.asNumber(body.depth, { name: 'depth' }),
|
|
39
|
-
reachability: 'Public',
|
|
40
|
-
networkAvailability: 'Available',
|
|
41
|
-
bins: {
|
|
42
|
-
bin_0: (0, connectivity_1.asBin)(bins.bin_0, 'bin_0'),
|
|
43
|
-
bin_1: (0, connectivity_1.asBin)(bins.bin_1, 'bin_1'),
|
|
44
|
-
bin_2: (0, connectivity_1.asBin)(bins.bin_2, 'bin_2'),
|
|
45
|
-
bin_3: (0, connectivity_1.asBin)(bins.bin_3, 'bin_3'),
|
|
46
|
-
bin_4: (0, connectivity_1.asBin)(bins.bin_4, 'bin_4'),
|
|
47
|
-
bin_5: (0, connectivity_1.asBin)(bins.bin_5, 'bin_5'),
|
|
48
|
-
bin_6: (0, connectivity_1.asBin)(bins.bin_6, 'bin_6'),
|
|
49
|
-
bin_7: (0, connectivity_1.asBin)(bins.bin_7, 'bin_7'),
|
|
50
|
-
bin_8: (0, connectivity_1.asBin)(bins.bin_8, 'bin_8'),
|
|
51
|
-
bin_9: (0, connectivity_1.asBin)(bins.bin_9, 'bin_9'),
|
|
52
|
-
bin_10: (0, connectivity_1.asBin)(bins.bin_10, 'bin_10'),
|
|
53
|
-
bin_11: (0, connectivity_1.asBin)(bins.bin_11, 'bin_11'),
|
|
54
|
-
bin_12: (0, connectivity_1.asBin)(bins.bin_12, 'bin_12'),
|
|
55
|
-
bin_13: (0, connectivity_1.asBin)(bins.bin_13, 'bin_13'),
|
|
56
|
-
bin_14: (0, connectivity_1.asBin)(bins.bin_14, 'bin_14'),
|
|
57
|
-
bin_15: (0, connectivity_1.asBin)(bins.bin_15, 'bin_15'),
|
|
58
|
-
bin_16: (0, connectivity_1.asBin)(bins.bin_16, 'bin_16'),
|
|
59
|
-
bin_17: (0, connectivity_1.asBin)(bins.bin_17, 'bin_17'),
|
|
60
|
-
bin_18: (0, connectivity_1.asBin)(bins.bin_18, 'bin_18'),
|
|
61
|
-
bin_19: (0, connectivity_1.asBin)(bins.bin_19, 'bin_19'),
|
|
62
|
-
bin_20: (0, connectivity_1.asBin)(bins.bin_20, 'bin_20'),
|
|
63
|
-
bin_21: (0, connectivity_1.asBin)(bins.bin_21, 'bin_21'),
|
|
64
|
-
bin_22: (0, connectivity_1.asBin)(bins.bin_22, 'bin_22'),
|
|
65
|
-
bin_23: (0, connectivity_1.asBin)(bins.bin_23, 'bin_23'),
|
|
66
|
-
bin_24: (0, connectivity_1.asBin)(bins.bin_24, 'bin_24'),
|
|
67
|
-
bin_25: (0, connectivity_1.asBin)(bins.bin_25, 'bin_25'),
|
|
68
|
-
bin_26: (0, connectivity_1.asBin)(bins.bin_26, 'bin_26'),
|
|
69
|
-
bin_27: (0, connectivity_1.asBin)(bins.bin_27, 'bin_27'),
|
|
70
|
-
bin_28: (0, connectivity_1.asBin)(bins.bin_28, 'bin_28'),
|
|
71
|
-
bin_29: (0, connectivity_1.asBin)(bins.bin_29, 'bin_29'),
|
|
72
|
-
bin_30: (0, connectivity_1.asBin)(bins.bin_30, 'bin_30'),
|
|
73
|
-
bin_31: (0, connectivity_1.asBin)(bins.bin_31, 'bin_31'),
|
|
74
|
-
},
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
exports.BeeDev = BeeDev;
|
package/dist/mjs/bee-dev.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { Types } from 'cafe-utility';
|
|
2
|
-
import { Bee, EthAddress, PeerAddress, PublicKey } from "./index.js";
|
|
3
|
-
import { asBin } from "./modules/debug/connectivity.js";
|
|
4
|
-
import { http } from "./utils/http.js";
|
|
5
|
-
export class BeeDev extends Bee {
|
|
6
|
-
async getNodeAddresses(options) {
|
|
7
|
-
const requestOptions = super.getRequestOptionsForCall(options);
|
|
8
|
-
const response = await http(requestOptions, {
|
|
9
|
-
url: 'addresses',
|
|
10
|
-
responseType: 'json'
|
|
11
|
-
});
|
|
12
|
-
const body = Types.asObject(response.data, {
|
|
13
|
-
name: 'response.data'
|
|
14
|
-
});
|
|
15
|
-
return {
|
|
16
|
-
overlay: new PeerAddress(Types.asString(body.overlay, {
|
|
17
|
-
name: 'overlay'
|
|
18
|
-
})),
|
|
19
|
-
underlay: [],
|
|
20
|
-
ethereum: new EthAddress(Types.asString(body.ethereum, {
|
|
21
|
-
name: 'ethereum'
|
|
22
|
-
})),
|
|
23
|
-
publicKey: new PublicKey(Types.asString(body.publicKey, {
|
|
24
|
-
name: 'publicKey'
|
|
25
|
-
})),
|
|
26
|
-
pssPublicKey: new PublicKey(Types.asString(body.pssPublicKey, {
|
|
27
|
-
name: 'pssPublicKey'
|
|
28
|
-
}))
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
async getTopology(options) {
|
|
32
|
-
const requestOptions = super.getRequestOptionsForCall(options);
|
|
33
|
-
const response = await http(requestOptions, {
|
|
34
|
-
url: `topology`,
|
|
35
|
-
responseType: 'json'
|
|
36
|
-
});
|
|
37
|
-
const body = Types.asObject(response.data, {
|
|
38
|
-
name: 'response.data'
|
|
39
|
-
});
|
|
40
|
-
const bins = Types.asObject(body.bins, {
|
|
41
|
-
name: 'bins'
|
|
42
|
-
});
|
|
43
|
-
return {
|
|
44
|
-
baseAddr: '0bab5ca208a980950604f900f2791613fc980676c2dee7dd92a4fdda5a54bf26',
|
|
45
|
-
population: Types.asNumber(body.population, {
|
|
46
|
-
name: 'population'
|
|
47
|
-
}),
|
|
48
|
-
connected: Types.asNumber(body.connected, {
|
|
49
|
-
name: 'connected'
|
|
50
|
-
}),
|
|
51
|
-
timestamp: Types.asString(body.timestamp, {
|
|
52
|
-
name: 'timestamp'
|
|
53
|
-
}),
|
|
54
|
-
nnLowWatermark: Types.asNumber(body.nnLowWatermark, {
|
|
55
|
-
name: 'nnLowWatermark'
|
|
56
|
-
}),
|
|
57
|
-
depth: Types.asNumber(body.depth, {
|
|
58
|
-
name: 'depth'
|
|
59
|
-
}),
|
|
60
|
-
reachability: 'Public',
|
|
61
|
-
networkAvailability: 'Available',
|
|
62
|
-
bins: {
|
|
63
|
-
bin_0: asBin(bins.bin_0, 'bin_0'),
|
|
64
|
-
bin_1: asBin(bins.bin_1, 'bin_1'),
|
|
65
|
-
bin_2: asBin(bins.bin_2, 'bin_2'),
|
|
66
|
-
bin_3: asBin(bins.bin_3, 'bin_3'),
|
|
67
|
-
bin_4: asBin(bins.bin_4, 'bin_4'),
|
|
68
|
-
bin_5: asBin(bins.bin_5, 'bin_5'),
|
|
69
|
-
bin_6: asBin(bins.bin_6, 'bin_6'),
|
|
70
|
-
bin_7: asBin(bins.bin_7, 'bin_7'),
|
|
71
|
-
bin_8: asBin(bins.bin_8, 'bin_8'),
|
|
72
|
-
bin_9: asBin(bins.bin_9, 'bin_9'),
|
|
73
|
-
bin_10: asBin(bins.bin_10, 'bin_10'),
|
|
74
|
-
bin_11: asBin(bins.bin_11, 'bin_11'),
|
|
75
|
-
bin_12: asBin(bins.bin_12, 'bin_12'),
|
|
76
|
-
bin_13: asBin(bins.bin_13, 'bin_13'),
|
|
77
|
-
bin_14: asBin(bins.bin_14, 'bin_14'),
|
|
78
|
-
bin_15: asBin(bins.bin_15, 'bin_15'),
|
|
79
|
-
bin_16: asBin(bins.bin_16, 'bin_16'),
|
|
80
|
-
bin_17: asBin(bins.bin_17, 'bin_17'),
|
|
81
|
-
bin_18: asBin(bins.bin_18, 'bin_18'),
|
|
82
|
-
bin_19: asBin(bins.bin_19, 'bin_19'),
|
|
83
|
-
bin_20: asBin(bins.bin_20, 'bin_20'),
|
|
84
|
-
bin_21: asBin(bins.bin_21, 'bin_21'),
|
|
85
|
-
bin_22: asBin(bins.bin_22, 'bin_22'),
|
|
86
|
-
bin_23: asBin(bins.bin_23, 'bin_23'),
|
|
87
|
-
bin_24: asBin(bins.bin_24, 'bin_24'),
|
|
88
|
-
bin_25: asBin(bins.bin_25, 'bin_25'),
|
|
89
|
-
bin_26: asBin(bins.bin_26, 'bin_26'),
|
|
90
|
-
bin_27: asBin(bins.bin_27, 'bin_27'),
|
|
91
|
-
bin_28: asBin(bins.bin_28, 'bin_28'),
|
|
92
|
-
bin_29: asBin(bins.bin_29, 'bin_29'),
|
|
93
|
-
bin_30: asBin(bins.bin_30, 'bin_30'),
|
|
94
|
-
bin_31: asBin(bins.bin_31, 'bin_31')
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
package/dist/types/bee-dev.d.ts
DELETED