@ethersphere/bee-js 5.2.0 → 6.0.0-pre.1

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.
Files changed (111) hide show
  1. package/dist/cjs/bee-debug.js +58 -72
  2. package/dist/cjs/bee.js +71 -86
  3. package/dist/cjs/chunk/soc.js +14 -14
  4. package/dist/cjs/feed/index.js +20 -21
  5. package/dist/cjs/feed/json.js +2 -2
  6. package/dist/cjs/feed/retrievable.js +7 -8
  7. package/dist/cjs/index.js +7 -7
  8. package/dist/cjs/modules/bytes.js +15 -15
  9. package/dist/cjs/modules/bzz.js +24 -25
  10. package/dist/cjs/modules/chunk.js +10 -10
  11. package/dist/cjs/modules/debug/balance.js +16 -16
  12. package/dist/cjs/modules/debug/chequebook.js +34 -34
  13. package/dist/cjs/modules/debug/chunk.js +8 -8
  14. package/dist/cjs/modules/debug/connectivity.js +24 -24
  15. package/dist/cjs/modules/debug/settlements.js +8 -8
  16. package/dist/cjs/modules/debug/stake.js +11 -11
  17. package/dist/cjs/modules/debug/stamps.js +25 -25
  18. package/dist/cjs/modules/debug/states.js +12 -12
  19. package/dist/cjs/modules/debug/status.js +24 -24
  20. package/dist/cjs/modules/debug/tag.js +4 -4
  21. package/dist/cjs/modules/debug/transactions.js +16 -16
  22. package/dist/cjs/modules/feed.js +14 -14
  23. package/dist/cjs/modules/pinning.js +14 -14
  24. package/dist/cjs/modules/pss.js +6 -6
  25. package/dist/cjs/modules/soc.js +6 -6
  26. package/dist/cjs/modules/status.js +3 -3
  27. package/dist/cjs/modules/stewardship.js +7 -7
  28. package/dist/cjs/modules/tag.js +20 -20
  29. package/dist/cjs/utils/error.js +1 -35
  30. package/dist/cjs/utils/headers.js +3 -3
  31. package/dist/cjs/utils/http.js +14 -141
  32. package/dist/cjs/utils/type.js +1 -4
  33. package/dist/index.browser.min.js +1 -1
  34. package/dist/index.browser.min.js.LICENSE.txt +0 -8
  35. package/dist/index.browser.min.js.map +1 -1
  36. package/dist/mjs/bee-debug.js +59 -73
  37. package/dist/mjs/bee.js +72 -87
  38. package/dist/mjs/chunk/soc.js +14 -14
  39. package/dist/mjs/feed/index.js +20 -21
  40. package/dist/mjs/feed/json.js +2 -2
  41. package/dist/mjs/feed/retrievable.js +7 -8
  42. package/dist/mjs/index.js +2 -2
  43. package/dist/mjs/modules/bytes.js +15 -15
  44. package/dist/mjs/modules/bzz.js +24 -25
  45. package/dist/mjs/modules/chunk.js +10 -10
  46. package/dist/mjs/modules/debug/balance.js +16 -16
  47. package/dist/mjs/modules/debug/chequebook.js +34 -34
  48. package/dist/mjs/modules/debug/chunk.js +8 -8
  49. package/dist/mjs/modules/debug/connectivity.js +24 -24
  50. package/dist/mjs/modules/debug/settlements.js +8 -8
  51. package/dist/mjs/modules/debug/stake.js +11 -11
  52. package/dist/mjs/modules/debug/stamps.js +25 -25
  53. package/dist/mjs/modules/debug/states.js +12 -12
  54. package/dist/mjs/modules/debug/status.js +24 -25
  55. package/dist/mjs/modules/debug/tag.js +4 -4
  56. package/dist/mjs/modules/debug/transactions.js +16 -16
  57. package/dist/mjs/modules/feed.js +14 -14
  58. package/dist/mjs/modules/pinning.js +14 -14
  59. package/dist/mjs/modules/pss.js +6 -6
  60. package/dist/mjs/modules/soc.js +6 -6
  61. package/dist/mjs/modules/status.js +3 -3
  62. package/dist/mjs/modules/stewardship.js +7 -7
  63. package/dist/mjs/modules/tag.js +20 -20
  64. package/dist/mjs/utils/error.js +0 -31
  65. package/dist/mjs/utils/headers.js +3 -3
  66. package/dist/mjs/utils/http.js +10 -138
  67. package/dist/mjs/utils/type.js +2 -5
  68. package/dist/types/bee-debug.d.ts +50 -50
  69. package/dist/types/bee.d.ts +34 -34
  70. package/dist/types/chunk/soc.d.ts +5 -6
  71. package/dist/types/feed/index.d.ts +7 -8
  72. package/dist/types/feed/json.d.ts +2 -2
  73. package/dist/types/feed/retrievable.d.ts +2 -2
  74. package/dist/types/index.d.ts +2 -4
  75. package/dist/types/modules/bytes.d.ts +4 -5
  76. package/dist/types/modules/bzz.d.ts +5 -6
  77. package/dist/types/modules/chunk.d.ts +3 -4
  78. package/dist/types/modules/debug/balance.d.ts +5 -6
  79. package/dist/types/modules/debug/chequebook.d.ts +9 -10
  80. package/dist/types/modules/debug/chunk.d.ts +3 -4
  81. package/dist/types/modules/debug/connectivity.d.ts +7 -8
  82. package/dist/types/modules/debug/settlements.d.ts +3 -4
  83. package/dist/types/modules/debug/stake.d.ts +4 -5
  84. package/dist/types/modules/debug/stamps.d.ts +7 -8
  85. package/dist/types/modules/debug/states.d.ts +4 -5
  86. package/dist/types/modules/debug/status.d.ts +10 -10
  87. package/dist/types/modules/debug/tag.d.ts +2 -3
  88. package/dist/types/modules/debug/transactions.d.ts +5 -6
  89. package/dist/types/modules/feed.d.ts +3 -4
  90. package/dist/types/modules/pinning.d.ts +5 -6
  91. package/dist/types/modules/pss.d.ts +2 -3
  92. package/dist/types/modules/soc.d.ts +2 -3
  93. package/dist/types/modules/status.d.ts +2 -2
  94. package/dist/types/modules/stewardship.d.ts +3 -4
  95. package/dist/types/modules/tag.d.ts +6 -7
  96. package/dist/types/types/debug.d.ts +2 -2
  97. package/dist/types/types/index.d.ts +12 -51
  98. package/dist/types/utils/error.d.ts +0 -26
  99. package/dist/types/utils/headers.d.ts +1 -1
  100. package/dist/types/utils/http.d.ts +12 -21
  101. package/dist/types/utils/type.d.ts +2 -2
  102. package/package.json +4 -4
  103. package/dist/223.index.browser.min.js +0 -3
  104. package/dist/223.index.browser.min.js.LICENSE.txt +0 -1
  105. package/dist/223.index.browser.min.js.map +0 -1
  106. package/dist/cjs/utils/merge.js +0 -34
  107. package/dist/cjs/utils/sleep.js +0 -12
  108. package/dist/mjs/utils/merge.js +0 -32
  109. package/dist/mjs/utils/sleep.js +0 -8
  110. package/dist/types/utils/merge.d.ts +0 -8
  111. package/dist/types/utils/sleep.d.ts +0 -6
@@ -9,12 +9,12 @@ const settlementsEndpoint = 'settlements';
9
9
  * @param kyOptions Ky Options for making requests
10
10
  * @param peer Swarm address of peer
11
11
  */
12
- async function getSettlements(kyOptions, peer) {
13
- const response = await (0, http_1.http)(kyOptions, {
14
- path: `${settlementsEndpoint}/${peer}`,
12
+ async function getSettlements(requestOptions, peer) {
13
+ const response = await (0, http_1.http)(requestOptions, {
14
+ url: `${settlementsEndpoint}/${peer}`,
15
15
  responseType: 'json',
16
16
  });
17
- return response.parsedData;
17
+ return response.data;
18
18
  }
19
19
  exports.getSettlements = getSettlements;
20
20
  /**
@@ -22,11 +22,11 @@ exports.getSettlements = getSettlements;
22
22
  *
23
23
  * @param kyOptions Ky Options for making requests
24
24
  */
25
- async function getAllSettlements(kyOptions) {
26
- const response = await (0, http_1.http)(kyOptions, {
27
- path: settlementsEndpoint,
25
+ async function getAllSettlements(requestOptions) {
26
+ const response = await (0, http_1.http)(requestOptions, {
27
+ url: settlementsEndpoint,
28
28
  responseType: 'json',
29
29
  });
30
- return response.parsedData;
30
+ return response.data;
31
31
  }
32
32
  exports.getAllSettlements = getAllSettlements;
@@ -9,13 +9,13 @@ const REDISTRIBUTION_ENDPOINT = 'redistributionstate';
9
9
  *
10
10
  * @param kyOptions Ky Options for making requests
11
11
  */
12
- async function getStake(kyOptions) {
13
- const response = await (0, http_1.http)(kyOptions, {
12
+ async function getStake(requestOptions) {
13
+ const response = await (0, http_1.http)(requestOptions, {
14
14
  method: 'get',
15
15
  responseType: 'json',
16
- path: `${STAKE_ENDPOINT}`,
16
+ url: `${STAKE_ENDPOINT}`,
17
17
  });
18
- return response.parsedData.stakedAmount.toString();
18
+ return response.data.stakedAmount.toString();
19
19
  }
20
20
  exports.getStake = getStake;
21
21
  /**
@@ -25,7 +25,7 @@ exports.getStake = getStake;
25
25
  * @param amount
26
26
  * @param options
27
27
  */
28
- async function stake(kyOptions, amount, options) {
28
+ async function stake(requestOptions, amount, options) {
29
29
  const headers = {};
30
30
  if (options?.gasPrice) {
31
31
  headers['gas-price'] = options.gasPrice.toString();
@@ -33,10 +33,10 @@ async function stake(kyOptions, amount, options) {
33
33
  if (options?.gasLimit) {
34
34
  headers['gas-limit'] = options.gasLimit.toString();
35
35
  }
36
- await (0, http_1.http)(kyOptions, {
36
+ await (0, http_1.http)(requestOptions, {
37
37
  method: 'post',
38
38
  responseType: 'json',
39
- path: `${STAKE_ENDPOINT}/${amount}`,
39
+ url: `${STAKE_ENDPOINT}/${amount}`,
40
40
  headers,
41
41
  });
42
42
  }
@@ -46,12 +46,12 @@ exports.stake = stake;
46
46
  *
47
47
  * @param kyOptions Ky Options for making requests
48
48
  */
49
- async function getRedistributionState(kyOptions) {
50
- const response = await (0, http_1.http)(kyOptions, {
49
+ async function getRedistributionState(requestOptions) {
50
+ const response = await (0, http_1.http)(requestOptions, {
51
51
  method: 'get',
52
52
  responseType: 'json',
53
- path: REDISTRIBUTION_ENDPOINT,
53
+ url: REDISTRIBUTION_ENDPOINT,
54
54
  });
55
- return response.parsedData;
55
+ return response.data;
56
56
  }
57
57
  exports.getRedistributionState = getRedistributionState;
@@ -3,34 +3,34 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.diluteBatch = exports.topUpBatch = exports.createPostageBatch = exports.getPostageBatchBuckets = exports.getPostageBatch = exports.getAllPostageBatches = void 0;
4
4
  const http_1 = require("../../utils/http");
5
5
  const STAMPS_ENDPOINT = 'stamps';
6
- async function getAllPostageBatches(kyOptions) {
7
- const response = await (0, http_1.http)(kyOptions, {
6
+ async function getAllPostageBatches(requestOptions) {
7
+ const response = await (0, http_1.http)(requestOptions, {
8
8
  method: 'get',
9
- path: `${STAMPS_ENDPOINT}`,
9
+ url: `${STAMPS_ENDPOINT}`,
10
10
  responseType: 'json',
11
11
  });
12
- return response.parsedData.stamps;
12
+ return response.data.stamps;
13
13
  }
14
14
  exports.getAllPostageBatches = getAllPostageBatches;
15
- async function getPostageBatch(kyOptions, postageBatchId) {
16
- const response = await (0, http_1.http)(kyOptions, {
15
+ async function getPostageBatch(requestOptions, postageBatchId) {
16
+ const response = await (0, http_1.http)(requestOptions, {
17
17
  method: 'get',
18
- path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
18
+ url: `${STAMPS_ENDPOINT}/${postageBatchId}`,
19
19
  responseType: 'json',
20
20
  });
21
- return response.parsedData;
21
+ return response.data;
22
22
  }
23
23
  exports.getPostageBatch = getPostageBatch;
24
- async function getPostageBatchBuckets(kyOptions, postageBatchId) {
25
- const response = await (0, http_1.http)(kyOptions, {
24
+ async function getPostageBatchBuckets(requestOptions, postageBatchId) {
25
+ const response = await (0, http_1.http)(requestOptions, {
26
26
  method: 'get',
27
- path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
27
+ url: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
28
28
  responseType: 'json',
29
29
  });
30
- return response.parsedData;
30
+ return response.data;
31
31
  }
32
32
  exports.getPostageBatchBuckets = getPostageBatchBuckets;
33
- async function createPostageBatch(kyOptions, amount, depth, options) {
33
+ async function createPostageBatch(requestOptions, amount, depth, options) {
34
34
  const headers = {};
35
35
  if (options?.gasPrice) {
36
36
  headers['gas-price'] = options.gasPrice.toString();
@@ -38,31 +38,31 @@ async function createPostageBatch(kyOptions, amount, depth, options) {
38
38
  if (options?.immutableFlag !== undefined) {
39
39
  headers.immutable = String(options.immutableFlag);
40
40
  }
41
- const response = await (0, http_1.http)(kyOptions, {
41
+ const response = await (0, http_1.http)(requestOptions, {
42
42
  method: 'post',
43
- path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
43
+ url: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
44
44
  responseType: 'json',
45
- searchParams: { label: options?.label },
45
+ params: { label: options?.label },
46
46
  headers,
47
47
  });
48
- return response.parsedData.batchID;
48
+ return response.data.batchID;
49
49
  }
50
50
  exports.createPostageBatch = createPostageBatch;
51
- async function topUpBatch(kyOptions, id, amount) {
52
- const response = await (0, http_1.http)(kyOptions, {
51
+ async function topUpBatch(requestOptions, id, amount) {
52
+ const response = await (0, http_1.http)(requestOptions, {
53
53
  method: 'patch',
54
- path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
54
+ url: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
55
55
  responseType: 'json',
56
56
  });
57
- return response.parsedData.batchID;
57
+ return response.data.batchID;
58
58
  }
59
59
  exports.topUpBatch = topUpBatch;
60
- async function diluteBatch(kyOptions, id, depth) {
61
- const response = await (0, http_1.http)(kyOptions, {
60
+ async function diluteBatch(requestOptions, id, depth) {
61
+ const response = await (0, http_1.http)(requestOptions, {
62
62
  method: 'patch',
63
- path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
63
+ url: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
64
64
  responseType: 'json',
65
65
  });
66
- return response.parsedData.batchID;
66
+ return response.data.batchID;
67
67
  }
68
68
  exports.diluteBatch = diluteBatch;
@@ -10,13 +10,13 @@ const CHAIN_STATE_ENDPOINT = 'chainstate';
10
10
  *
11
11
  * @param kyOptions Ky Options for making requests
12
12
  */
13
- async function getReserveState(kyOptions) {
14
- const response = await (0, http_1.http)(kyOptions, {
13
+ async function getReserveState(requestOptions) {
14
+ const response = await (0, http_1.http)(requestOptions, {
15
15
  method: 'get',
16
- path: `${RESERVE_STATE_ENDPOINT}`,
16
+ url: `${RESERVE_STATE_ENDPOINT}`,
17
17
  responseType: 'json',
18
18
  });
19
- return response.parsedData;
19
+ return response.data;
20
20
  }
21
21
  exports.getReserveState = getReserveState;
22
22
  /**
@@ -24,13 +24,13 @@ exports.getReserveState = getReserveState;
24
24
  *
25
25
  * @param kyOptions Ky Options for making requests
26
26
  */
27
- async function getChainState(kyOptions) {
28
- const response = await (0, http_1.http)(kyOptions, {
27
+ async function getChainState(requestOptions) {
28
+ const response = await (0, http_1.http)(requestOptions, {
29
29
  method: 'get',
30
- path: `${CHAIN_STATE_ENDPOINT}`,
30
+ url: `${CHAIN_STATE_ENDPOINT}`,
31
31
  responseType: 'json',
32
32
  });
33
- return response.parsedData;
33
+ return response.data;
34
34
  }
35
35
  exports.getChainState = getChainState;
36
36
  /**
@@ -38,13 +38,13 @@ exports.getChainState = getChainState;
38
38
  *
39
39
  * @param kyOptions Ky Options for making requests
40
40
  */
41
- async function getWalletBalance(kyOptions) {
42
- const response = await (0, http_1.http)(kyOptions, {
41
+ async function getWalletBalance(requestOptions) {
42
+ const response = await (0, http_1.http)(requestOptions, {
43
43
  method: 'get',
44
- path: `${WALLET_ENDPOINT}`,
44
+ url: `${WALLET_ENDPOINT}`,
45
45
  responseType: 'json',
46
46
  });
47
- return mapWalletProperties(response.parsedData);
47
+ return mapWalletProperties(response.data);
48
48
  }
49
49
  exports.getWalletBalance = getWalletBalance;
50
50
  /**
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getVersions = exports.isSupportedApiVersion = exports.isSupportedDebugApiVersion = exports.isSupportedMainApiVersion = exports.isSupportedExactVersion = exports.isSupportedVersion = exports.getNodeInfo = exports.getReadiness = exports.getHealth = exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_DEBUG_API_VERSION = exports.SUPPORTED_API_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT = void 0;
7
- const http_1 = require("../../utils/http");
8
7
  const major_js_1 = __importDefault(require("semver/functions/major.js"));
8
+ const http_1 = require("../../utils/http");
9
9
  // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
10
10
  // so if you are changing anything about them change the `update_bee` action accordingly!
11
11
  exports.SUPPORTED_BEE_VERSION_EXACT = '1.12.0-88c1d236';
@@ -20,13 +20,13 @@ const READINESS_URL = 'readiness';
20
20
  *
21
21
  * @param kyOptions Ky Options for making requests
22
22
  */
23
- async function getHealth(kyOptions) {
24
- const response = await (0, http_1.http)(kyOptions, {
23
+ async function getHealth(requestOptions) {
24
+ const response = await (0, http_1.http)(requestOptions, {
25
25
  method: 'get',
26
- path: HEALTH_URL,
26
+ url: HEALTH_URL,
27
27
  responseType: 'json',
28
28
  });
29
- return response.parsedData;
29
+ return response.data;
30
30
  }
31
31
  exports.getHealth = getHealth;
32
32
  /**
@@ -34,11 +34,11 @@ exports.getHealth = getHealth;
34
34
  *
35
35
  * @param kyOptions Ky Options for making requests
36
36
  */
37
- async function getReadiness(kyOptions) {
37
+ async function getReadiness(requestOptions) {
38
38
  try {
39
- const response = await (0, http_1.http)(kyOptions, {
39
+ const response = await (0, http_1.http)(requestOptions, {
40
40
  method: 'get',
41
- path: READINESS_URL,
41
+ url: READINESS_URL,
42
42
  });
43
43
  return response.status === 200;
44
44
  }
@@ -52,13 +52,13 @@ exports.getReadiness = getReadiness;
52
52
  *
53
53
  * @param kyOptions Ky Options for making requests
54
54
  */
55
- async function getNodeInfo(kyOptions) {
56
- const response = await (0, http_1.http)(kyOptions, {
55
+ async function getNodeInfo(requestOptions) {
56
+ const response = await (0, http_1.http)(requestOptions, {
57
57
  method: 'get',
58
- path: NODE_INFO_URL,
58
+ url: NODE_INFO_URL,
59
59
  responseType: 'json',
60
60
  });
61
- return response.parsedData;
61
+ return response.data;
62
62
  }
63
63
  exports.getNodeInfo = getNodeInfo;
64
64
  /**
@@ -70,8 +70,8 @@ exports.getNodeInfo = getNodeInfo;
70
70
  * @deprecated Use `isSupportedExactVersion` instead
71
71
  */
72
72
  // TODO: Remove on break
73
- async function isSupportedVersion(kyOptions) {
74
- return isSupportedExactVersion(kyOptions);
73
+ async function isSupportedVersion(requestOptions) {
74
+ return isSupportedExactVersion(requestOptions);
75
75
  }
76
76
  exports.isSupportedVersion = isSupportedVersion;
77
77
  /**
@@ -84,8 +84,8 @@ exports.isSupportedVersion = isSupportedVersion;
84
84
  *
85
85
  * @param ky
86
86
  */
87
- async function isSupportedExactVersion(kyOptions) {
88
- const { version } = await getHealth(kyOptions);
87
+ async function isSupportedExactVersion(requestOptions) {
88
+ const { version } = await getHealth(requestOptions);
89
89
  return version === exports.SUPPORTED_BEE_VERSION_EXACT;
90
90
  }
91
91
  exports.isSupportedExactVersion = isSupportedExactVersion;
@@ -97,8 +97,8 @@ exports.isSupportedExactVersion = isSupportedExactVersion;
97
97
  *
98
98
  * @param ky
99
99
  */
100
- async function isSupportedMainApiVersion(kyOptions) {
101
- const { apiVersion } = await getHealth(kyOptions);
100
+ async function isSupportedMainApiVersion(requestOptions) {
101
+ const { apiVersion } = await getHealth(requestOptions);
102
102
  return (0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION);
103
103
  }
104
104
  exports.isSupportedMainApiVersion = isSupportedMainApiVersion;
@@ -110,8 +110,8 @@ exports.isSupportedMainApiVersion = isSupportedMainApiVersion;
110
110
  *
111
111
  * @param ky
112
112
  */
113
- async function isSupportedDebugApiVersion(kyOptions) {
114
- const { debugApiVersion } = await getHealth(kyOptions);
113
+ async function isSupportedDebugApiVersion(requestOptions) {
114
+ const { debugApiVersion } = await getHealth(requestOptions);
115
115
  return (0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION);
116
116
  }
117
117
  exports.isSupportedDebugApiVersion = isSupportedDebugApiVersion;
@@ -122,8 +122,8 @@ exports.isSupportedDebugApiVersion = isSupportedDebugApiVersion;
122
122
  *
123
123
  * @param ky
124
124
  */
125
- async function isSupportedApiVersion(kyOptions) {
126
- const { apiVersion, debugApiVersion } = await getHealth(kyOptions);
125
+ async function isSupportedApiVersion(requestOptions) {
126
+ const { apiVersion, debugApiVersion } = await getHealth(requestOptions);
127
127
  return ((0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION) &&
128
128
  (0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION));
129
129
  }
@@ -134,8 +134,8 @@ exports.isSupportedApiVersion = isSupportedApiVersion;
134
134
  *
135
135
  * @param ky
136
136
  */
137
- async function getVersions(kyOptions) {
138
- const { version, apiVersion, debugApiVersion } = await getHealth(kyOptions);
137
+ async function getVersions(requestOptions) {
138
+ const { version, apiVersion, debugApiVersion } = await getHealth(requestOptions);
139
139
  return {
140
140
  supportedBeeVersion: exports.SUPPORTED_BEE_VERSION_EXACT,
141
141
  supportedBeeApiVersion: exports.SUPPORTED_API_VERSION,
@@ -9,11 +9,11 @@ const endpoint = 'tags';
9
9
  * @param kyOptions Ky Options for making requests
10
10
  * @param uid UID of tag to be retrieved
11
11
  */
12
- async function retrieveExtendedTag(kyOptions, uid) {
13
- const response = await (0, http_1.http)(kyOptions, {
14
- path: `${endpoint}/${uid}`,
12
+ async function retrieveExtendedTag(requestOptions, uid) {
13
+ const response = await (0, http_1.http)(requestOptions, {
14
+ url: `${endpoint}/${uid}`,
15
15
  responseType: 'json',
16
16
  });
17
- return response.parsedData;
17
+ return response.data;
18
18
  }
19
19
  exports.retrieveExtendedTag = retrieveExtendedTag;
@@ -8,12 +8,12 @@ const transactionsEndpoint = 'transactions';
8
8
  *
9
9
  * @param ky Debug Ky instance
10
10
  */
11
- async function getAllTransactions(kyOptions) {
12
- const response = await (0, http_1.http)(kyOptions, {
13
- path: transactionsEndpoint,
11
+ async function getAllTransactions(requestOptions) {
12
+ const response = await (0, http_1.http)(requestOptions, {
13
+ url: transactionsEndpoint,
14
14
  responseType: 'json',
15
15
  });
16
- return response.parsedData.pendingTransactions;
16
+ return response.data.pendingTransactions;
17
17
  }
18
18
  exports.getAllTransactions = getAllTransactions;
19
19
  /**
@@ -22,12 +22,12 @@ exports.getAllTransactions = getAllTransactions;
22
22
  * @param ky Debug Ky instance
23
23
  * @param transactionHash Hash of the transaction
24
24
  */
25
- async function getTransaction(kyOptions, transactionHash) {
26
- const response = await (0, http_1.http)(kyOptions, {
27
- path: `${transactionsEndpoint}/${transactionHash}`,
25
+ async function getTransaction(requestOptions, transactionHash) {
26
+ const response = await (0, http_1.http)(requestOptions, {
27
+ url: `${transactionsEndpoint}/${transactionHash}`,
28
28
  responseType: 'json',
29
29
  });
30
- return response.parsedData;
30
+ return response.data;
31
31
  }
32
32
  exports.getTransaction = getTransaction;
33
33
  /**
@@ -36,13 +36,13 @@ exports.getTransaction = getTransaction;
36
36
  * @param ky Debug Ky instance
37
37
  * @param transactionHash Hash of the transaction
38
38
  */
39
- async function rebroadcastTransaction(kyOptions, transactionHash) {
40
- const response = await (0, http_1.http)(kyOptions, {
39
+ async function rebroadcastTransaction(requestOptions, transactionHash) {
40
+ const response = await (0, http_1.http)(requestOptions, {
41
41
  method: 'post',
42
- path: `${transactionsEndpoint}/${transactionHash}`,
42
+ url: `${transactionsEndpoint}/${transactionHash}`,
43
43
  responseType: 'json',
44
44
  });
45
- return response.parsedData.transactionHash;
45
+ return response.data.transactionHash;
46
46
  }
47
47
  exports.rebroadcastTransaction = rebroadcastTransaction;
48
48
  /**
@@ -52,13 +52,13 @@ exports.rebroadcastTransaction = rebroadcastTransaction;
52
52
  * @param transactionHash Hash of the transaction
53
53
  * @param gasPrice Optional gas price
54
54
  */
55
- async function cancelTransaction(kyOptions, transactionHash, gasPrice) {
56
- const response = await (0, http_1.http)(kyOptions, {
55
+ async function cancelTransaction(requestOptions, transactionHash, gasPrice) {
56
+ const response = await (0, http_1.http)(requestOptions, {
57
57
  method: 'delete',
58
58
  headers: { 'gas-price': gasPrice },
59
- path: `${transactionsEndpoint}/${transactionHash}`,
59
+ url: `${transactionsEndpoint}/${transactionHash}`,
60
60
  responseType: 'json',
61
61
  });
62
- return response.parsedData.transactionHash;
62
+ return response.data.transactionHash;
63
63
  }
64
64
  exports.cancelTransaction = cancelTransaction;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchLatestFeedUpdate = exports.createFeedManifest = void 0;
4
- const http_1 = require("../utils/http");
5
- const headers_1 = require("../utils/headers");
6
4
  const error_1 = require("../utils/error");
5
+ const headers_1 = require("../utils/headers");
6
+ const http_1 = require("../utils/http");
7
7
  const feedEndpoint = 'feeds';
8
8
  /**
9
9
  * Create an initial feed root manifest
@@ -14,20 +14,20 @@ const feedEndpoint = 'feeds';
14
14
  * @param postageBatchId Postage BatchId to be used to create the Feed Manifest
15
15
  * @param options Additional options, like type (default: 'sequence')
16
16
  */
17
- async function createFeedManifest(kyOptions, owner, topic, postageBatchId, options) {
18
- const response = await (0, http_1.http)(kyOptions, {
17
+ async function createFeedManifest(requestOptions, owner, topic, postageBatchId, options) {
18
+ const response = await (0, http_1.http)(requestOptions, {
19
19
  method: 'post',
20
20
  responseType: 'json',
21
- path: `${feedEndpoint}/${owner}/${topic}`,
22
- searchParams: (0, http_1.filterHeaders)(options),
21
+ url: `${feedEndpoint}/${owner}/${topic}`,
22
+ params: options,
23
23
  headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
24
24
  });
25
- return response.parsedData.reference;
25
+ return response.data.reference;
26
26
  }
27
27
  exports.createFeedManifest = createFeedManifest;
28
28
  function readFeedUpdateHeaders(headers) {
29
- const feedIndex = headers.get('swarm-feed-index');
30
- const feedIndexNext = headers.get('swarm-feed-index-next');
29
+ const feedIndex = headers['swarm-feed-index'];
30
+ const feedIndexNext = headers['swarm-feed-index-next'];
31
31
  if (!feedIndex) {
32
32
  throw new error_1.BeeError('Response did not contain expected swarm-feed-index!');
33
33
  }
@@ -52,14 +52,14 @@ function readFeedUpdateHeaders(headers) {
52
52
  * @param topic Topic in hex
53
53
  * @param options Additional options, like index, at, type
54
54
  */
55
- async function fetchLatestFeedUpdate(kyOptions, owner, topic, options) {
56
- const response = await (0, http_1.http)(kyOptions, {
55
+ async function fetchLatestFeedUpdate(requestOptions, owner, topic, options) {
56
+ const response = await (0, http_1.http)(requestOptions, {
57
57
  responseType: 'json',
58
- path: `${feedEndpoint}/${owner}/${topic}`,
59
- searchParams: (0, http_1.filterHeaders)(options),
58
+ url: `${feedEndpoint}/${owner}/${topic}`,
59
+ params: options,
60
60
  });
61
61
  return {
62
- ...response.parsedData,
62
+ ...response.data,
63
63
  ...readFeedUpdateHeaders(response.headers),
64
64
  };
65
65
  }
@@ -9,11 +9,11 @@ const PINNING_ENDPOINT = 'pins';
9
9
  * @param kyOptions Ky Options for making requests
10
10
  * @param reference Bee data reference
11
11
  */
12
- async function pin(kyOptions, reference) {
13
- await (0, http_1.http)(kyOptions, {
12
+ async function pin(requestOptions, reference) {
13
+ await (0, http_1.http)(requestOptions, {
14
14
  method: 'post',
15
15
  responseType: 'json',
16
- path: `${PINNING_ENDPOINT}/${reference}`,
16
+ url: `${PINNING_ENDPOINT}/${reference}`,
17
17
  });
18
18
  }
19
19
  exports.pin = pin;
@@ -23,11 +23,11 @@ exports.pin = pin;
23
23
  * @param kyOptions Ky Options for making requests
24
24
  * @param reference Bee data reference
25
25
  */
26
- async function unpin(kyOptions, reference) {
27
- await (0, http_1.http)(kyOptions, {
26
+ async function unpin(requestOptions, reference) {
27
+ await (0, http_1.http)(requestOptions, {
28
28
  method: 'delete',
29
29
  responseType: 'json',
30
- path: `${PINNING_ENDPOINT}/${reference}`,
30
+ url: `${PINNING_ENDPOINT}/${reference}`,
31
31
  });
32
32
  }
33
33
  exports.unpin = unpin;
@@ -38,13 +38,13 @@ exports.unpin = unpin;
38
38
  * @param reference
39
39
  * @throws Error if given address is not pinned
40
40
  */
41
- async function getPin(kyOptions, reference) {
42
- const response = await (0, http_1.http)(kyOptions, {
41
+ async function getPin(requestOptions, reference) {
42
+ const response = await (0, http_1.http)(requestOptions, {
43
43
  method: 'get',
44
44
  responseType: 'json',
45
- path: `${PINNING_ENDPOINT}/${reference}`,
45
+ url: `${PINNING_ENDPOINT}/${reference}`,
46
46
  });
47
- return response.parsedData;
47
+ return response.data;
48
48
  }
49
49
  exports.getPin = getPin;
50
50
  /**
@@ -52,12 +52,12 @@ exports.getPin = getPin;
52
52
  *
53
53
  * @param ky Ky instance
54
54
  */
55
- async function getAllPins(kyOptions) {
56
- const response = await (0, http_1.http)(kyOptions, {
55
+ async function getAllPins(requestOptions) {
56
+ const response = await (0, http_1.http)(requestOptions, {
57
57
  method: 'get',
58
58
  responseType: 'json',
59
- path: `${PINNING_ENDPOINT}`,
59
+ url: `${PINNING_ENDPOINT}`,
60
60
  });
61
- return response.parsedData.references;
61
+ return response.data.references;
62
62
  }
63
63
  exports.getAllPins = getAllPins;
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.subscribe = exports.send = void 0;
7
7
  const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
8
8
  const data_1 = require("../utils/data");
9
- const http_1 = require("../utils/http");
10
9
  const headers_1 = require("../utils/headers");
10
+ const http_1 = require("../utils/http");
11
11
  const endpoint = 'pss';
12
12
  /**
13
13
  * Send to recipient or target with Postal Service for Swarm
@@ -20,13 +20,13 @@ const endpoint = 'pss';
20
20
  * @param recipient Recipient public key
21
21
  *
22
22
  */
23
- async function send(kyOptions, topic, target, data, postageBatchId, recipient) {
24
- await (0, http_1.http)(kyOptions, {
23
+ async function send(requestOptions, topic, target, data, postageBatchId, recipient) {
24
+ await (0, http_1.http)(requestOptions, {
25
25
  method: 'post',
26
- path: `${endpoint}/send/${topic}/${target}`,
27
- body: await (0, data_1.prepareData)(data),
26
+ url: `${endpoint}/send/${topic}/${target}`,
27
+ data: await (0, data_1.prepareData)(data),
28
28
  responseType: 'json',
29
- searchParams: { recipient },
29
+ params: { recipient },
30
30
  headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
31
31
  });
32
32
  }
@@ -15,18 +15,18 @@ const socEndpoint = 'soc';
15
15
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
16
16
  * @param options Additional options like tag, encryption, pinning
17
17
  */
18
- async function upload(kyOptions, owner, identifier, signature, data, postageBatchId, options) {
19
- const response = await (0, http_1.http)(kyOptions, {
18
+ async function upload(requestOptions, owner, identifier, signature, data, postageBatchId, options) {
19
+ const response = await (0, http_1.http)(requestOptions, {
20
20
  method: 'post',
21
- path: `${socEndpoint}/${owner}/${identifier}`,
22
- body: data,
21
+ url: `${socEndpoint}/${owner}/${identifier}`,
22
+ data,
23
23
  headers: {
24
24
  'content-type': 'application/octet-stream',
25
25
  ...(0, headers_1.extractUploadHeaders)(postageBatchId, options),
26
26
  },
27
27
  responseType: 'json',
28
- searchParams: { sig: signature },
28
+ params: { sig: signature },
29
29
  });
30
- return response.parsedData.reference;
30
+ return response.data.reference;
31
31
  }
32
32
  exports.upload = upload;
@@ -7,9 +7,9 @@ const http_1 = require("../utils/http");
7
7
  *
8
8
  * @param kyOptions Ky instance for given Bee class instance
9
9
  */
10
- async function checkConnection(kyOptions) {
11
- await (0, http_1.http)(kyOptions, {
12
- path: '',
10
+ async function checkConnection(requestOptions) {
11
+ await (0, http_1.http)(requestOptions, {
12
+ url: '',
13
13
  });
14
14
  }
15
15
  exports.checkConnection = checkConnection;