@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
@@ -1,30 +1,30 @@
1
1
  import { http } from "../../utils/http.js";
2
2
  const STAMPS_ENDPOINT = 'stamps';
3
- export async function getAllPostageBatches(kyOptions) {
4
- const response = await http(kyOptions, {
3
+ export async function getAllPostageBatches(requestOptions) {
4
+ const response = await http(requestOptions, {
5
5
  method: 'get',
6
- path: `${STAMPS_ENDPOINT}`,
6
+ url: `${STAMPS_ENDPOINT}`,
7
7
  responseType: 'json'
8
8
  });
9
- return response.parsedData.stamps;
9
+ return response.data.stamps;
10
10
  }
11
- export async function getPostageBatch(kyOptions, postageBatchId) {
12
- const response = await http(kyOptions, {
11
+ export async function getPostageBatch(requestOptions, postageBatchId) {
12
+ const response = await http(requestOptions, {
13
13
  method: 'get',
14
- path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
14
+ url: `${STAMPS_ENDPOINT}/${postageBatchId}`,
15
15
  responseType: 'json'
16
16
  });
17
- return response.parsedData;
17
+ return response.data;
18
18
  }
19
- export async function getPostageBatchBuckets(kyOptions, postageBatchId) {
20
- const response = await http(kyOptions, {
19
+ export async function getPostageBatchBuckets(requestOptions, postageBatchId) {
20
+ const response = await http(requestOptions, {
21
21
  method: 'get',
22
- path: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
22
+ url: `${STAMPS_ENDPOINT}/${postageBatchId}/buckets`,
23
23
  responseType: 'json'
24
24
  });
25
- return response.parsedData;
25
+ return response.data;
26
26
  }
27
- export async function createPostageBatch(kyOptions, amount, depth, options) {
27
+ export async function createPostageBatch(requestOptions, amount, depth, options) {
28
28
  const headers = {};
29
29
  if (options?.gasPrice) {
30
30
  headers['gas-price'] = options.gasPrice.toString();
@@ -32,30 +32,30 @@ export async function createPostageBatch(kyOptions, amount, depth, options) {
32
32
  if (options?.immutableFlag !== undefined) {
33
33
  headers.immutable = String(options.immutableFlag);
34
34
  }
35
- const response = await http(kyOptions, {
35
+ const response = await http(requestOptions, {
36
36
  method: 'post',
37
- path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
37
+ url: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
38
38
  responseType: 'json',
39
- searchParams: {
39
+ params: {
40
40
  label: options?.label
41
41
  },
42
42
  headers
43
43
  });
44
- return response.parsedData.batchID;
44
+ return response.data.batchID;
45
45
  }
46
- export async function topUpBatch(kyOptions, id, amount) {
47
- const response = await http(kyOptions, {
46
+ export async function topUpBatch(requestOptions, id, amount) {
47
+ const response = await http(requestOptions, {
48
48
  method: 'patch',
49
- path: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
49
+ url: `${STAMPS_ENDPOINT}/topup/${id}/${amount}`,
50
50
  responseType: 'json'
51
51
  });
52
- return response.parsedData.batchID;
52
+ return response.data.batchID;
53
53
  }
54
- export async function diluteBatch(kyOptions, id, depth) {
55
- const response = await http(kyOptions, {
54
+ export async function diluteBatch(requestOptions, id, depth) {
55
+ const response = await http(requestOptions, {
56
56
  method: 'patch',
57
- path: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
57
+ url: `${STAMPS_ENDPOINT}/dilute/${id}/${depth}`,
58
58
  responseType: 'json'
59
59
  });
60
- return response.parsedData.batchID;
60
+ return response.data.batchID;
61
61
  }
@@ -7,39 +7,39 @@ const CHAIN_STATE_ENDPOINT = 'chainstate';
7
7
  *
8
8
  * @param kyOptions Ky Options for making requests
9
9
  */
10
- export async function getReserveState(kyOptions) {
11
- const response = await http(kyOptions, {
10
+ export async function getReserveState(requestOptions) {
11
+ const response = await http(requestOptions, {
12
12
  method: 'get',
13
- path: `${RESERVE_STATE_ENDPOINT}`,
13
+ url: `${RESERVE_STATE_ENDPOINT}`,
14
14
  responseType: 'json'
15
15
  });
16
- return response.parsedData;
16
+ return response.data;
17
17
  }
18
18
  /**
19
19
  * Get state of reserve
20
20
  *
21
21
  * @param kyOptions Ky Options for making requests
22
22
  */
23
- export async function getChainState(kyOptions) {
24
- const response = await http(kyOptions, {
23
+ export async function getChainState(requestOptions) {
24
+ const response = await http(requestOptions, {
25
25
  method: 'get',
26
- path: `${CHAIN_STATE_ENDPOINT}`,
26
+ url: `${CHAIN_STATE_ENDPOINT}`,
27
27
  responseType: 'json'
28
28
  });
29
- return response.parsedData;
29
+ return response.data;
30
30
  }
31
31
  /**
32
32
  * Get wallet balances for xDai and BZZ of the node
33
33
  *
34
34
  * @param kyOptions Ky Options for making requests
35
35
  */
36
- export async function getWalletBalance(kyOptions) {
37
- const response = await http(kyOptions, {
36
+ export async function getWalletBalance(requestOptions) {
37
+ const response = await http(requestOptions, {
38
38
  method: 'get',
39
- path: `${WALLET_ENDPOINT}`,
39
+ url: `${WALLET_ENDPOINT}`,
40
40
  responseType: 'json'
41
41
  });
42
- return mapWalletProperties(response.parsedData);
42
+ return mapWalletProperties(response.data);
43
43
  }
44
44
  /**
45
45
  * TODO: Remove on next break
@@ -1,6 +1,5 @@
1
- import { http } from "../../utils/http.js";
2
1
  import getMajorSemver from 'semver/functions/major.js';
3
- // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
2
+ import { http } from "../../utils/http.js"; // Following lines bellow are automatically updated with GitHub Action when Bee version is updated
4
3
  // so if you are changing anything about them change the `update_bee` action accordingly!
5
4
  export const SUPPORTED_BEE_VERSION_EXACT = '1.12.0-88c1d236';
6
5
  export const SUPPORTED_API_VERSION = '4.0.0';
@@ -14,24 +13,24 @@ const READINESS_URL = 'readiness';
14
13
  *
15
14
  * @param kyOptions Ky Options for making requests
16
15
  */
17
- export async function getHealth(kyOptions) {
18
- const response = await http(kyOptions, {
16
+ export async function getHealth(requestOptions) {
17
+ const response = await http(requestOptions, {
19
18
  method: 'get',
20
- path: HEALTH_URL,
19
+ url: HEALTH_URL,
21
20
  responseType: 'json'
22
21
  });
23
- return response.parsedData;
22
+ return response.data;
24
23
  }
25
24
  /**
26
25
  * Get readiness of node
27
26
  *
28
27
  * @param kyOptions Ky Options for making requests
29
28
  */
30
- export async function getReadiness(kyOptions) {
29
+ export async function getReadiness(requestOptions) {
31
30
  try {
32
- const response = await http(kyOptions, {
31
+ const response = await http(requestOptions, {
33
32
  method: 'get',
34
- path: READINESS_URL
33
+ url: READINESS_URL
35
34
  });
36
35
  return response.status === 200;
37
36
  } catch {
@@ -43,13 +42,13 @@ export async function getReadiness(kyOptions) {
43
42
  *
44
43
  * @param kyOptions Ky Options for making requests
45
44
  */
46
- export async function getNodeInfo(kyOptions) {
47
- const response = await http(kyOptions, {
45
+ export async function getNodeInfo(requestOptions) {
46
+ const response = await http(requestOptions, {
48
47
  method: 'get',
49
- path: NODE_INFO_URL,
48
+ url: NODE_INFO_URL,
50
49
  responseType: 'json'
51
50
  });
52
- return response.parsedData;
51
+ return response.data;
53
52
  }
54
53
  /**
55
54
  * Connects to a node and checks if it is a supported Bee version by the bee-js
@@ -60,8 +59,8 @@ export async function getNodeInfo(kyOptions) {
60
59
  * @deprecated Use `isSupportedExactVersion` instead
61
60
  */
62
61
  // TODO: Remove on break
63
- export async function isSupportedVersion(kyOptions) {
64
- return isSupportedExactVersion(kyOptions);
62
+ export async function isSupportedVersion(requestOptions) {
63
+ return isSupportedExactVersion(requestOptions);
65
64
  }
66
65
  /**
67
66
  * Connects to a node and checks if its version matches with the one that bee-js supports.
@@ -73,10 +72,10 @@ export async function isSupportedVersion(kyOptions) {
73
72
  *
74
73
  * @param ky
75
74
  */
76
- export async function isSupportedExactVersion(kyOptions) {
75
+ export async function isSupportedExactVersion(requestOptions) {
77
76
  const {
78
77
  version
79
- } = await getHealth(kyOptions);
78
+ } = await getHealth(requestOptions);
80
79
  return version === SUPPORTED_BEE_VERSION_EXACT;
81
80
  }
82
81
  /**
@@ -87,10 +86,10 @@ export async function isSupportedExactVersion(kyOptions) {
87
86
  *
88
87
  * @param ky
89
88
  */
90
- export async function isSupportedMainApiVersion(kyOptions) {
89
+ export async function isSupportedMainApiVersion(requestOptions) {
91
90
  const {
92
91
  apiVersion
93
- } = await getHealth(kyOptions);
92
+ } = await getHealth(requestOptions);
94
93
  return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION);
95
94
  }
96
95
  /**
@@ -101,10 +100,10 @@ export async function isSupportedMainApiVersion(kyOptions) {
101
100
  *
102
101
  * @param ky
103
102
  */
104
- export async function isSupportedDebugApiVersion(kyOptions) {
103
+ export async function isSupportedDebugApiVersion(requestOptions) {
105
104
  const {
106
105
  debugApiVersion
107
- } = await getHealth(kyOptions);
106
+ } = await getHealth(requestOptions);
108
107
  return getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
109
108
  }
110
109
  /**
@@ -114,11 +113,11 @@ export async function isSupportedDebugApiVersion(kyOptions) {
114
113
  *
115
114
  * @param ky
116
115
  */
117
- export async function isSupportedApiVersion(kyOptions) {
116
+ export async function isSupportedApiVersion(requestOptions) {
118
117
  const {
119
118
  apiVersion,
120
119
  debugApiVersion
121
- } = await getHealth(kyOptions);
120
+ } = await getHealth(requestOptions);
122
121
  return getMajorSemver(apiVersion) === getMajorSemver(SUPPORTED_API_VERSION) && getMajorSemver(debugApiVersion) === getMajorSemver(SUPPORTED_DEBUG_API_VERSION);
123
122
  }
124
123
  /**
@@ -127,12 +126,12 @@ export async function isSupportedApiVersion(kyOptions) {
127
126
  *
128
127
  * @param ky
129
128
  */
130
- export async function getVersions(kyOptions) {
129
+ export async function getVersions(requestOptions) {
131
130
  const {
132
131
  version,
133
132
  apiVersion,
134
133
  debugApiVersion
135
- } = await getHealth(kyOptions);
134
+ } = await getHealth(requestOptions);
136
135
  return {
137
136
  supportedBeeVersion: SUPPORTED_BEE_VERSION_EXACT,
138
137
  supportedBeeApiVersion: SUPPORTED_API_VERSION,
@@ -6,10 +6,10 @@ const endpoint = 'tags';
6
6
  * @param kyOptions Ky Options for making requests
7
7
  * @param uid UID of tag to be retrieved
8
8
  */
9
- export async function retrieveExtendedTag(kyOptions, uid) {
10
- const response = await http(kyOptions, {
11
- path: `${endpoint}/${uid}`,
9
+ export async function retrieveExtendedTag(requestOptions, uid) {
10
+ const response = await http(requestOptions, {
11
+ url: `${endpoint}/${uid}`,
12
12
  responseType: 'json'
13
13
  });
14
- return response.parsedData;
14
+ return response.data;
15
15
  }
@@ -5,12 +5,12 @@ const transactionsEndpoint = 'transactions';
5
5
  *
6
6
  * @param ky Debug Ky instance
7
7
  */
8
- export async function getAllTransactions(kyOptions) {
9
- const response = await http(kyOptions, {
10
- path: transactionsEndpoint,
8
+ export async function getAllTransactions(requestOptions) {
9
+ const response = await http(requestOptions, {
10
+ url: transactionsEndpoint,
11
11
  responseType: 'json'
12
12
  });
13
- return response.parsedData.pendingTransactions;
13
+ return response.data.pendingTransactions;
14
14
  }
15
15
  /**
16
16
  * Get information for specific pending transactions
@@ -18,12 +18,12 @@ export async function getAllTransactions(kyOptions) {
18
18
  * @param ky Debug Ky instance
19
19
  * @param transactionHash Hash of the transaction
20
20
  */
21
- export async function getTransaction(kyOptions, transactionHash) {
22
- const response = await http(kyOptions, {
23
- path: `${transactionsEndpoint}/${transactionHash}`,
21
+ export async function getTransaction(requestOptions, transactionHash) {
22
+ const response = await http(requestOptions, {
23
+ url: `${transactionsEndpoint}/${transactionHash}`,
24
24
  responseType: 'json'
25
25
  });
26
- return response.parsedData;
26
+ return response.data;
27
27
  }
28
28
  /**
29
29
  * Rebroadcast existing transaction
@@ -31,13 +31,13 @@ export async function getTransaction(kyOptions, transactionHash) {
31
31
  * @param ky Debug Ky instance
32
32
  * @param transactionHash Hash of the transaction
33
33
  */
34
- export async function rebroadcastTransaction(kyOptions, transactionHash) {
35
- const response = await http(kyOptions, {
34
+ export async function rebroadcastTransaction(requestOptions, transactionHash) {
35
+ const response = await http(requestOptions, {
36
36
  method: 'post',
37
- path: `${transactionsEndpoint}/${transactionHash}`,
37
+ url: `${transactionsEndpoint}/${transactionHash}`,
38
38
  responseType: 'json'
39
39
  });
40
- return response.parsedData.transactionHash;
40
+ return response.data.transactionHash;
41
41
  }
42
42
  /**
43
43
  * Cancel existing transaction
@@ -46,14 +46,14 @@ export async function rebroadcastTransaction(kyOptions, transactionHash) {
46
46
  * @param transactionHash Hash of the transaction
47
47
  * @param gasPrice Optional gas price
48
48
  */
49
- export async function cancelTransaction(kyOptions, transactionHash, gasPrice) {
50
- const response = await http(kyOptions, {
49
+ export async function cancelTransaction(requestOptions, transactionHash, gasPrice) {
50
+ const response = await http(requestOptions, {
51
51
  method: 'delete',
52
52
  headers: {
53
53
  'gas-price': gasPrice
54
54
  },
55
- path: `${transactionsEndpoint}/${transactionHash}`,
55
+ url: `${transactionsEndpoint}/${transactionHash}`,
56
56
  responseType: 'json'
57
57
  });
58
- return response.parsedData.transactionHash;
58
+ return response.data.transactionHash;
59
59
  }
@@ -1,6 +1,6 @@
1
- import { filterHeaders, http } from "../utils/http.js";
2
- import { extractUploadHeaders } from "../utils/headers.js";
3
1
  import { BeeError } from "../utils/error.js";
2
+ import { extractUploadHeaders } from "../utils/headers.js";
3
+ import { http } from "../utils/http.js";
4
4
  const feedEndpoint = 'feeds';
5
5
  /**
6
6
  * Create an initial feed root manifest
@@ -11,19 +11,19 @@ const feedEndpoint = 'feeds';
11
11
  * @param postageBatchId Postage BatchId to be used to create the Feed Manifest
12
12
  * @param options Additional options, like type (default: 'sequence')
13
13
  */
14
- export async function createFeedManifest(kyOptions, owner, topic, postageBatchId, options) {
15
- const response = await http(kyOptions, {
14
+ export async function createFeedManifest(requestOptions, owner, topic, postageBatchId, options) {
15
+ const response = await http(requestOptions, {
16
16
  method: 'post',
17
17
  responseType: 'json',
18
- path: `${feedEndpoint}/${owner}/${topic}`,
19
- searchParams: filterHeaders(options),
18
+ url: `${feedEndpoint}/${owner}/${topic}`,
19
+ params: options,
20
20
  headers: extractUploadHeaders(postageBatchId)
21
21
  });
22
- return response.parsedData.reference;
22
+ return response.data.reference;
23
23
  }
24
24
  function readFeedUpdateHeaders(headers) {
25
- const feedIndex = headers.get('swarm-feed-index');
26
- const feedIndexNext = headers.get('swarm-feed-index-next');
25
+ const feedIndex = headers['swarm-feed-index'];
26
+ const feedIndexNext = headers['swarm-feed-index-next'];
27
27
  if (!feedIndex) {
28
28
  throw new BeeError('Response did not contain expected swarm-feed-index!');
29
29
  }
@@ -48,14 +48,14 @@ function readFeedUpdateHeaders(headers) {
48
48
  * @param topic Topic in hex
49
49
  * @param options Additional options, like index, at, type
50
50
  */
51
- export async function fetchLatestFeedUpdate(kyOptions, owner, topic, options) {
52
- const response = await http(kyOptions, {
51
+ export async function fetchLatestFeedUpdate(requestOptions, owner, topic, options) {
52
+ const response = await http(requestOptions, {
53
53
  responseType: 'json',
54
- path: `${feedEndpoint}/${owner}/${topic}`,
55
- searchParams: filterHeaders(options)
54
+ url: `${feedEndpoint}/${owner}/${topic}`,
55
+ params: options
56
56
  });
57
57
  return {
58
- ...response.parsedData,
58
+ ...response.data,
59
59
  ...readFeedUpdateHeaders(response.headers)
60
60
  };
61
61
  }
@@ -6,11 +6,11 @@ const PINNING_ENDPOINT = 'pins';
6
6
  * @param kyOptions Ky Options for making requests
7
7
  * @param reference Bee data reference
8
8
  */
9
- export async function pin(kyOptions, reference) {
10
- await http(kyOptions, {
9
+ export async function pin(requestOptions, reference) {
10
+ await http(requestOptions, {
11
11
  method: 'post',
12
12
  responseType: 'json',
13
- path: `${PINNING_ENDPOINT}/${reference}`
13
+ url: `${PINNING_ENDPOINT}/${reference}`
14
14
  });
15
15
  }
16
16
  /**
@@ -19,11 +19,11 @@ export async function pin(kyOptions, reference) {
19
19
  * @param kyOptions Ky Options for making requests
20
20
  * @param reference Bee data reference
21
21
  */
22
- export async function unpin(kyOptions, reference) {
23
- await http(kyOptions, {
22
+ export async function unpin(requestOptions, reference) {
23
+ await http(requestOptions, {
24
24
  method: 'delete',
25
25
  responseType: 'json',
26
- path: `${PINNING_ENDPOINT}/${reference}`
26
+ url: `${PINNING_ENDPOINT}/${reference}`
27
27
  });
28
28
  }
29
29
  /**
@@ -33,24 +33,24 @@ export async function unpin(kyOptions, reference) {
33
33
  * @param reference
34
34
  * @throws Error if given address is not pinned
35
35
  */
36
- export async function getPin(kyOptions, reference) {
37
- const response = await http(kyOptions, {
36
+ export async function getPin(requestOptions, reference) {
37
+ const response = await http(requestOptions, {
38
38
  method: 'get',
39
39
  responseType: 'json',
40
- path: `${PINNING_ENDPOINT}/${reference}`
40
+ url: `${PINNING_ENDPOINT}/${reference}`
41
41
  });
42
- return response.parsedData;
42
+ return response.data;
43
43
  }
44
44
  /**
45
45
  * Get list of all pins
46
46
  *
47
47
  * @param ky Ky instance
48
48
  */
49
- export async function getAllPins(kyOptions) {
50
- const response = await http(kyOptions, {
49
+ export async function getAllPins(requestOptions) {
50
+ const response = await http(requestOptions, {
51
51
  method: 'get',
52
52
  responseType: 'json',
53
- path: `${PINNING_ENDPOINT}`
53
+ url: `${PINNING_ENDPOINT}`
54
54
  });
55
- return response.parsedData.references;
55
+ return response.data.references;
56
56
  }
@@ -1,7 +1,7 @@
1
1
  import WebSocket from 'isomorphic-ws';
2
2
  import { prepareData } from "../utils/data.js";
3
- import { http } from "../utils/http.js";
4
3
  import { extractUploadHeaders } from "../utils/headers.js";
4
+ import { http } from "../utils/http.js";
5
5
  const endpoint = 'pss';
6
6
  /**
7
7
  * Send to recipient or target with Postal Service for Swarm
@@ -14,13 +14,13 @@ const endpoint = 'pss';
14
14
  * @param recipient Recipient public key
15
15
  *
16
16
  */
17
- export async function send(kyOptions, topic, target, data, postageBatchId, recipient) {
18
- await http(kyOptions, {
17
+ export async function send(requestOptions, topic, target, data, postageBatchId, recipient) {
18
+ await http(requestOptions, {
19
19
  method: 'post',
20
- path: `${endpoint}/send/${topic}/${target}`,
21
- body: await prepareData(data),
20
+ url: `${endpoint}/send/${topic}/${target}`,
21
+ data: await prepareData(data),
22
22
  responseType: 'json',
23
- searchParams: {
23
+ params: {
24
24
  recipient
25
25
  },
26
26
  headers: extractUploadHeaders(postageBatchId)
@@ -12,19 +12,19 @@ const socEndpoint = 'soc';
12
12
  * @param postageBatchId Postage BatchId that will be assigned to uploaded data
13
13
  * @param options Additional options like tag, encryption, pinning
14
14
  */
15
- export async function upload(kyOptions, owner, identifier, signature, data, postageBatchId, options) {
16
- const response = await http(kyOptions, {
15
+ export async function upload(requestOptions, owner, identifier, signature, data, postageBatchId, options) {
16
+ const response = await http(requestOptions, {
17
17
  method: 'post',
18
- path: `${socEndpoint}/${owner}/${identifier}`,
19
- body: data,
18
+ url: `${socEndpoint}/${owner}/${identifier}`,
19
+ data,
20
20
  headers: {
21
21
  'content-type': 'application/octet-stream',
22
22
  ...extractUploadHeaders(postageBatchId, options)
23
23
  },
24
24
  responseType: 'json',
25
- searchParams: {
25
+ params: {
26
26
  sig: signature
27
27
  }
28
28
  });
29
- return response.parsedData.reference;
29
+ return response.data.reference;
30
30
  }
@@ -4,8 +4,8 @@ import { http } from "../utils/http.js";
4
4
  *
5
5
  * @param kyOptions Ky instance for given Bee class instance
6
6
  */
7
- export async function checkConnection(kyOptions) {
8
- await http(kyOptions, {
9
- path: ''
7
+ export async function checkConnection(requestOptions) {
8
+ await http(requestOptions, {
9
+ url: ''
10
10
  });
11
11
  }
@@ -7,17 +7,17 @@ const stewardshipEndpoint = 'stewardship';
7
7
  * @param options
8
8
  * @throws BeeResponseError if not locally pinned or invalid data
9
9
  */
10
- export async function reupload(kyOptions, reference) {
11
- await http(kyOptions, {
10
+ export async function reupload(requestOptions, reference) {
11
+ await http(requestOptions, {
12
12
  method: 'put',
13
- path: `${stewardshipEndpoint}/${reference}`
13
+ url: `${stewardshipEndpoint}/${reference}`
14
14
  });
15
15
  }
16
- export async function isRetrievable(kyOptions, reference) {
17
- const response = await http(kyOptions, {
16
+ export async function isRetrievable(requestOptions, reference) {
17
+ const response = await http(requestOptions, {
18
18
  method: 'get',
19
19
  responseType: 'json',
20
- path: `${stewardshipEndpoint}/${reference}`
20
+ url: `${stewardshipEndpoint}/${reference}`
21
21
  });
22
- return response.parsedData.isRetrievable;
22
+ return response.data.isRetrievable;
23
23
  }
@@ -5,13 +5,13 @@ const endpoint = 'tags';
5
5
  *
6
6
  * @param url Bee tag URL
7
7
  */
8
- export async function createTag(kyOptions) {
9
- const response = await http(kyOptions, {
8
+ export async function createTag(requestOptions) {
9
+ const response = await http(requestOptions, {
10
10
  method: 'post',
11
- path: endpoint,
11
+ url: endpoint,
12
12
  responseType: 'json'
13
13
  });
14
- return response.parsedData;
14
+ return response.data;
15
15
  }
16
16
  /**
17
17
  * Retrieve tag information from Bee node
@@ -19,12 +19,12 @@ export async function createTag(kyOptions) {
19
19
  * @param url Bee tag URL
20
20
  * @param uid UID of tag to be retrieved
21
21
  */
22
- export async function retrieveTag(kyOptions, uid) {
23
- const response = await http(kyOptions, {
24
- path: `${endpoint}/${uid}`,
22
+ export async function retrieveTag(requestOptions, uid) {
23
+ const response = await http(requestOptions, {
24
+ url: `${endpoint}/${uid}`,
25
25
  responseType: 'json'
26
26
  });
27
- return response.parsedData;
27
+ return response.data;
28
28
  }
29
29
  /**
30
30
  * Get limited listing of all tags.
@@ -33,26 +33,26 @@ export async function retrieveTag(kyOptions, uid) {
33
33
  * @param offset
34
34
  * @param limit
35
35
  */
36
- export async function getAllTags(kyOptions, offset, limit) {
37
- const response = await http(kyOptions, {
38
- path: `${endpoint}`,
39
- searchParams: {
36
+ export async function getAllTags(requestOptions, offset, limit) {
37
+ const response = await http(requestOptions, {
38
+ url: endpoint,
39
+ params: {
40
40
  offset,
41
41
  limit
42
42
  },
43
43
  responseType: 'json'
44
44
  });
45
- return response.parsedData.tags;
45
+ return response.data.tags;
46
46
  }
47
47
  /**
48
48
  * Removes tag from the Bee node.
49
49
  * @param url
50
50
  * @param uid
51
51
  */
52
- export async function deleteTag(kyOptions, uid) {
53
- await http(kyOptions, {
52
+ export async function deleteTag(requestOptions, uid) {
53
+ await http(requestOptions, {
54
54
  method: 'delete',
55
- path: `${endpoint}/${uid}`
55
+ url: `${endpoint}/${uid}`
56
56
  });
57
57
  }
58
58
  /**
@@ -61,11 +61,11 @@ export async function deleteTag(kyOptions, uid) {
61
61
  * @param uid
62
62
  * @param reference
63
63
  */
64
- export async function updateTag(kyOptions, uid, reference) {
65
- await http(kyOptions, {
64
+ export async function updateTag(requestOptions, uid, reference) {
65
+ await http(requestOptions, {
66
66
  method: 'patch',
67
- path: `${endpoint}/${uid}`,
68
- json: {
67
+ url: `${endpoint}/${uid}`,
68
+ data: {
69
69
  reference
70
70
  }
71
71
  });