@ethersphere/bee-js 1.2.1 → 3.0.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.
- package/CHANGELOG.md +135 -2
- package/README.md +3 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +51 -0
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.LICENSE.txt +42 -0
- package/dist/index.min.js.map +1 -1
- package/dist/src/bee-debug.d.ts +75 -38
- package/dist/src/bee.d.ts +88 -82
- package/dist/src/chunk/soc.d.ts +6 -6
- package/dist/src/feed/index.d.ts +7 -7
- package/dist/src/feed/json.d.ts +2 -2
- package/dist/src/modules/bytes.d.ts +8 -11
- package/dist/src/modules/bzz.d.ts +9 -14
- package/dist/src/modules/chunk.d.ts +7 -11
- package/dist/src/modules/debug/balance.d.ts +9 -9
- package/dist/src/modules/debug/chequebook.d.ts +17 -18
- package/dist/src/modules/debug/chunk.d.ts +5 -5
- package/dist/src/modules/debug/connectivity.d.ts +7 -7
- package/dist/src/modules/debug/settlements.d.ts +5 -5
- package/dist/src/modules/debug/stamps.d.ts +7 -5
- package/dist/src/modules/debug/states.d.ts +5 -5
- package/dist/src/modules/debug/status.d.ts +5 -4
- package/dist/src/modules/debug/tag.d.ts +3 -3
- package/dist/src/modules/debug/transactions.d.ts +9 -9
- package/dist/src/modules/feed.d.ts +5 -5
- package/dist/src/modules/pinning.d.ts +9 -9
- package/dist/src/modules/pss.d.ts +4 -3
- package/dist/src/modules/soc.d.ts +3 -3
- package/dist/src/modules/status.d.ts +3 -2
- package/dist/src/modules/stewardship.d.ts +4 -4
- package/dist/src/modules/tag.d.ts +6 -6
- package/dist/src/types/debug.d.ts +4 -2
- package/dist/src/types/index.d.ts +71 -19
- package/dist/src/utils/bytes.d.ts +1 -1
- package/dist/src/utils/data.browser.d.ts +3 -1
- package/dist/src/utils/data.d.ts +7 -4
- package/dist/src/utils/expose.d.ts +6 -9
- package/dist/src/utils/headers.d.ts +3 -3
- package/dist/src/utils/http.d.ts +25 -0
- package/dist/src/utils/merge.d.ts +8 -0
- package/dist/src/utils/pss.d.ts +9 -0
- package/dist/src/utils/stream.d.ts +37 -0
- package/dist/src/utils/type.d.ts +19 -9
- package/package.json +15 -8
- package/.babelrc.js +0 -33
- package/.depcheckrc.json +0 -27
- package/.editorconfig +0 -6
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -108
- package/.gitattributes +0 -1
- package/.github/config.yaml +0 -23
- package/.github/workflows/check.yaml +0 -57
- package/.github/workflows/publish_npmjs.yaml +0 -20
- package/.github/workflows/release_github.yaml +0 -20
- package/.github/workflows/tests.yaml +0 -128
- package/.huskyrc +0 -5
- package/.prettierrc +0 -13
- package/.vscode/launch.json +0 -49
- package/.vscode/settings.json +0 -39
- package/CODEOWNERS +0 -1
- package/CODE_OF_CONDUCT.md +0 -76
- package/commitlint.config.js +0 -3
- package/dist/src/modules/stamps.d.ts +0 -4
- package/dist/src/utils/hooks.d.ts +0 -31
- package/dist/src/utils/safe-axios.d.ts +0 -8
- package/jest-puppeteer.config.js +0 -5
- package/jest.config.ts +0 -170
- package/src/bee-debug.ts +0 -440
- package/src/bee.ts +0 -941
- package/src/chunk/bmt.ts +0 -55
- package/src/chunk/cac.ts +0 -79
- package/src/chunk/serialize.ts +0 -16
- package/src/chunk/signer.ts +0 -141
- package/src/chunk/soc.ts +0 -190
- package/src/chunk/span.ts +0 -33
- package/src/feed/index.ts +0 -221
- package/src/feed/json.ts +0 -32
- package/src/feed/topic.ts +0 -23
- package/src/feed/type.ts +0 -12
- package/src/index.ts +0 -24
- package/src/modules/bytes.ts +0 -75
- package/src/modules/bzz.ts +0 -184
- package/src/modules/chunk.ts +0 -75
- package/src/modules/debug/balance.ts +0 -63
- package/src/modules/debug/chequebook.ts +0 -174
- package/src/modules/debug/chunk.ts +0 -39
- package/src/modules/debug/connectivity.ts +0 -61
- package/src/modules/debug/settlements.ts +0 -33
- package/src/modules/debug/stamps.ts +0 -69
- package/src/modules/debug/states.ts +0 -35
- package/src/modules/debug/status.ts +0 -34
- package/src/modules/debug/tag.ts +0 -19
- package/src/modules/debug/transactions.ts +0 -79
- package/src/modules/feed.ts +0 -92
- package/src/modules/pinning.ts +0 -74
- package/src/modules/pss.ts +0 -48
- package/src/modules/soc.ts +0 -41
- package/src/modules/stamps.ts +0 -59
- package/src/modules/status.ts +0 -13
- package/src/modules/stewardship.ts +0 -21
- package/src/modules/tag.ts +0 -83
- package/src/types/axios/index.d.ts +0 -18
- package/src/types/debug.ts +0 -204
- package/src/types/index.ts +0 -497
- package/src/types/tar-js.d.ts +0 -1
- package/src/types/webpack-bundle-analyzer/index.d.ts +0 -13
- package/src/utils/bytes.ts +0 -144
- package/src/utils/collection.ts +0 -151
- package/src/utils/data.browser.ts +0 -24
- package/src/utils/data.ts +0 -35
- package/src/utils/error.ts +0 -23
- package/src/utils/eth.ts +0 -229
- package/src/utils/expose.ts +0 -10
- package/src/utils/file.ts +0 -40
- package/src/utils/hash.ts +0 -16
- package/src/utils/headers.ts +0 -63
- package/src/utils/hex.ts +0 -186
- package/src/utils/hooks.ts +0 -89
- package/src/utils/safe-axios.ts +0 -98
- package/src/utils/tar.ts +0 -30
- package/src/utils/type.ts +0 -302
- package/src/utils/uint64.ts +0 -31
- package/src/utils/url.ts +0 -52
- package/test/bee.sh +0 -187
- package/test/data/1.txt +0 -1
- package/test/data/2.txt +0 -0
- package/test/data/empty +0 -0
- package/test/data/sub/3.txt +0 -1
- package/test/data/sub//303/251 +0 -0
- package/test/data/sub//360/237/230/216 +0 -0
- package/test/integration/bee-class.browser.spec.ts +0 -215
- package/test/integration/bee-class.spec.ts +0 -595
- package/test/integration/bee-debug-class.spec.ts +0 -85
- package/test/integration/chunk/bmt.spec.ts +0 -33
- package/test/integration/chunk/cac.spec.ts +0 -27
- package/test/integration/chunk/soc.spec.ts +0 -38
- package/test/integration/feed/index.spec.ts +0 -84
- package/test/integration/modules/bytes.spec.ts +0 -23
- package/test/integration/modules/bzz.spec.ts +0 -270
- package/test/integration/modules/chunk.spec.ts +0 -29
- package/test/integration/modules/debug/balance.spec.ts +0 -70
- package/test/integration/modules/debug/chequebook.spec.ts +0 -64
- package/test/integration/modules/debug/connectivity.spec.ts +0 -69
- package/test/integration/modules/debug/settlements.spec.ts +0 -34
- package/test/integration/modules/debug/states.spec.ts +0 -34
- package/test/integration/modules/debug/status.spec.ts +0 -65
- package/test/integration/modules/debug/tag.spec.ts +0 -27
- package/test/integration/modules/feed.spec.ts +0 -61
- package/test/integration/modules/pinning.spec.ts +0 -155
- package/test/integration/modules/pss.spec.ts +0 -92
- package/test/integration/modules/status.spec.ts +0 -10
- package/test/integration/modules/stewardship.spec.ts +0 -32
- package/test/integration/modules/tag.spec.ts +0 -51
- package/test/test-type-sequencer.js +0 -36
- package/test/testpage/testpage.html +0 -20
- package/test/unit/assertions.ts +0 -376
- package/test/unit/bee-class.spec.ts +0 -685
- package/test/unit/bee-debug-class.spec.ts +0 -365
- package/test/unit/chunk/bmt.spec.ts +0 -16
- package/test/unit/chunk/cac.spec.ts +0 -29
- package/test/unit/chunk/serialize.spec.ts +0 -24
- package/test/unit/chunk/signer.spec.ts +0 -140
- package/test/unit/chunk/soc.spec.ts +0 -25
- package/test/unit/chunk/span.spec.ts +0 -38
- package/test/unit/feed/json.spec.ts +0 -73
- package/test/unit/nock.ts +0 -134
- package/test/unit/utils/bytes.spec.ts +0 -32
- package/test/unit/utils/collection.spec.ts +0 -22
- package/test/unit/utils/eth.spec.ts +0 -224
- package/test/unit/utils/hex.spec.ts +0 -115
- package/test/unit/utils/hooks.spec.ts +0 -179
- package/test/unit/utils/safe-axios.spec.ts +0 -20
- package/test/unit/utils/type.spec.ts +0 -32
- package/test/unit/utils/uint64.spec.ts +0 -102
- package/test/utils.ts +0 -292
- package/tsconfig.json +0 -18
- package/tsconfig.test.json +0 -11
- package/typedoc.json +0 -7
- package/webpack.config.ts +0 -141
package/src/modules/pinning.ts
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import type { BeeGenericResponse, Pin, Reference } from '../types'
|
|
2
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
3
|
-
|
|
4
|
-
const PINNING_ENDPOINT = '/pins'
|
|
5
|
-
|
|
6
|
-
export interface GetAllPinResponse {
|
|
7
|
-
references: Reference[] | null
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Pin data with given reference
|
|
12
|
-
*
|
|
13
|
-
* @param url Bee URL
|
|
14
|
-
* @param reference Bee data reference
|
|
15
|
-
*/
|
|
16
|
-
export async function pin(url: string, reference: Reference): Promise<void> {
|
|
17
|
-
await safeAxios<BeeGenericResponse>({
|
|
18
|
-
method: 'post',
|
|
19
|
-
responseType: 'json',
|
|
20
|
-
url: `${url}${PINNING_ENDPOINT}/${reference}`,
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Unpin data with given reference
|
|
26
|
-
*
|
|
27
|
-
* @param url Bee URL
|
|
28
|
-
* @param reference Bee data reference
|
|
29
|
-
*/
|
|
30
|
-
export async function unpin(url: string, reference: Reference): Promise<void> {
|
|
31
|
-
await safeAxios<BeeGenericResponse>({
|
|
32
|
-
method: 'delete',
|
|
33
|
-
responseType: 'json',
|
|
34
|
-
url: `${url}${PINNING_ENDPOINT}/${reference}`,
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get pin status for specific address.
|
|
40
|
-
*
|
|
41
|
-
* @param url Bee URL
|
|
42
|
-
* @param reference
|
|
43
|
-
* @throws Error if given address is not pinned
|
|
44
|
-
*/
|
|
45
|
-
export async function getPin(url: string, reference: Reference): Promise<Pin> {
|
|
46
|
-
const response = await safeAxios<Pin>({
|
|
47
|
-
method: 'get',
|
|
48
|
-
responseType: 'json',
|
|
49
|
-
url: `${url}${PINNING_ENDPOINT}/${reference}`,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return response.data
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get list of all pins
|
|
57
|
-
*
|
|
58
|
-
* @param url Bee URL
|
|
59
|
-
*/
|
|
60
|
-
export async function getAllPins(url: string): Promise<Reference[]> {
|
|
61
|
-
const response = await safeAxios<GetAllPinResponse>({
|
|
62
|
-
method: 'get',
|
|
63
|
-
responseType: 'json',
|
|
64
|
-
url: `${url}${PINNING_ENDPOINT}`,
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
const result = response.data.references
|
|
68
|
-
|
|
69
|
-
if (result === null) {
|
|
70
|
-
return []
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
return result
|
|
74
|
-
}
|
package/src/modules/pss.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import WebSocket from 'isomorphic-ws'
|
|
2
|
-
|
|
3
|
-
import type { BatchId, BeeGenericResponse, PublicKey } from '../types'
|
|
4
|
-
import { prepareData } from '../utils/data'
|
|
5
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
6
|
-
import { extractUploadHeaders } from '../utils/headers'
|
|
7
|
-
|
|
8
|
-
const endpoint = '/pss'
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Send to recipient or target with Postal Service for Swarm
|
|
12
|
-
*
|
|
13
|
-
* @param url Bee url
|
|
14
|
-
* @param topic Topic name
|
|
15
|
-
* @param target Target message address prefix
|
|
16
|
-
* @param data
|
|
17
|
-
* @param postageBatchId Postage BatchId that will be assigned to sent message
|
|
18
|
-
* @param recipient Recipient public key
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
export async function send(
|
|
22
|
-
url: string,
|
|
23
|
-
topic: string,
|
|
24
|
-
target: string,
|
|
25
|
-
data: string | Uint8Array,
|
|
26
|
-
postageBatchId: BatchId,
|
|
27
|
-
recipient?: PublicKey,
|
|
28
|
-
): Promise<void> {
|
|
29
|
-
await safeAxios<BeeGenericResponse>({
|
|
30
|
-
method: 'post',
|
|
31
|
-
url: `${url}${endpoint}/send/${topic}/${target.slice(0, 4)}`,
|
|
32
|
-
data: await prepareData(data),
|
|
33
|
-
responseType: 'json',
|
|
34
|
-
params: { recipient },
|
|
35
|
-
headers: extractUploadHeaders(postageBatchId),
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Subscribe for messages on the given topic
|
|
41
|
-
*
|
|
42
|
-
* @param topic Topic name
|
|
43
|
-
*/
|
|
44
|
-
export function subscribe(url: string, topic: string): WebSocket {
|
|
45
|
-
const wsUrl = url.replace(/^http/i, 'ws')
|
|
46
|
-
|
|
47
|
-
return new WebSocket(`${wsUrl}${endpoint}/subscribe/${topic}`)
|
|
48
|
-
}
|
package/src/modules/soc.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { BatchId, Reference, ReferenceResponse, UploadOptions } from '../types'
|
|
2
|
-
import { extractUploadHeaders } from '../utils/headers'
|
|
3
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
4
|
-
|
|
5
|
-
const socEndpoint = '/soc'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Upload single owner chunk (SOC) to a Bee node
|
|
9
|
-
*
|
|
10
|
-
* @param url Bee URL
|
|
11
|
-
* @param owner Owner's ethereum address in hex
|
|
12
|
-
* @param identifier Arbitrary identifier in hex
|
|
13
|
-
* @param signature Signature in hex
|
|
14
|
-
* @param data Content addressed chunk data to be uploaded
|
|
15
|
-
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
|
|
16
|
-
* @param options Additional options like tag, encryption, pinning
|
|
17
|
-
*/
|
|
18
|
-
export async function upload(
|
|
19
|
-
url: string,
|
|
20
|
-
owner: string,
|
|
21
|
-
identifier: string,
|
|
22
|
-
signature: string,
|
|
23
|
-
data: Uint8Array,
|
|
24
|
-
postageBatchId: BatchId,
|
|
25
|
-
options?: UploadOptions,
|
|
26
|
-
): Promise<Reference> {
|
|
27
|
-
const response = await safeAxios<ReferenceResponse>({
|
|
28
|
-
...options?.axiosOptions,
|
|
29
|
-
method: 'post',
|
|
30
|
-
url: `${url}${socEndpoint}/${owner}/${identifier}`,
|
|
31
|
-
data,
|
|
32
|
-
headers: {
|
|
33
|
-
'content-type': 'application/octet-stream',
|
|
34
|
-
...extractUploadHeaders(postageBatchId, options),
|
|
35
|
-
},
|
|
36
|
-
responseType: 'json',
|
|
37
|
-
params: { sig: signature },
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
return response.data.reference
|
|
41
|
-
}
|
package/src/modules/stamps.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { BatchId, NumberString, PostageBatch, PostageBatchOptions } from '../types'
|
|
2
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
3
|
-
|
|
4
|
-
const STAMPS_ENDPOINT = '/stamps'
|
|
5
|
-
|
|
6
|
-
interface GetAllStampsResponse {
|
|
7
|
-
stamps: PostageBatch[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface CreateStampResponse {
|
|
11
|
-
batchID: BatchId
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function getAllPostageBatches(url: string): Promise<PostageBatch[]> {
|
|
15
|
-
const response = await safeAxios<GetAllStampsResponse>({
|
|
16
|
-
method: 'get',
|
|
17
|
-
url: `${url}${STAMPS_ENDPOINT}`,
|
|
18
|
-
responseType: 'json',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
return response.data.stamps || []
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function getPostageBatch(url: string, postageBatchId: BatchId): Promise<PostageBatch> {
|
|
25
|
-
const response = await safeAxios<PostageBatch>({
|
|
26
|
-
method: 'get',
|
|
27
|
-
url: `${url}${STAMPS_ENDPOINT}/${postageBatchId}`,
|
|
28
|
-
responseType: 'json',
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
return response.data
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function createPostageBatch(
|
|
35
|
-
url: string,
|
|
36
|
-
amount: NumberString,
|
|
37
|
-
depth: number,
|
|
38
|
-
options?: PostageBatchOptions,
|
|
39
|
-
): Promise<BatchId> {
|
|
40
|
-
const headers: Record<string, string> = {}
|
|
41
|
-
|
|
42
|
-
if (options?.gasPrice) {
|
|
43
|
-
headers['gas-price'] = options.gasPrice.toString()
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (options?.immutableFlag !== undefined) {
|
|
47
|
-
headers.immutable = String(options.immutableFlag)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const response = await safeAxios<CreateStampResponse>({
|
|
51
|
-
method: 'post',
|
|
52
|
-
url: `${url}${STAMPS_ENDPOINT}/${amount}/${depth}`,
|
|
53
|
-
responseType: 'json',
|
|
54
|
-
params: { label: options?.label },
|
|
55
|
-
headers,
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
return response.data.batchID
|
|
59
|
-
}
|
package/src/modules/status.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Ping the base bee URL. If connection was not successful throw error
|
|
5
|
-
*
|
|
6
|
-
* @param url Bee URL
|
|
7
|
-
*/
|
|
8
|
-
export async function checkConnection(url: string): Promise<void> | never {
|
|
9
|
-
await safeAxios<string>({
|
|
10
|
-
url: url,
|
|
11
|
-
responseType: 'json',
|
|
12
|
-
})
|
|
13
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Reference } from '../types'
|
|
2
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
3
|
-
import { AxiosRequestConfig } from 'axios'
|
|
4
|
-
|
|
5
|
-
const stewardshipEndpoint = '/stewardship'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Reupload locally pinned data
|
|
9
|
-
* @param url
|
|
10
|
-
* @param reference
|
|
11
|
-
* @param options
|
|
12
|
-
* @throws BeeResponseError if not locally pinned or invalid data
|
|
13
|
-
*/
|
|
14
|
-
export async function reupload(url: string, reference: Reference, options?: AxiosRequestConfig): Promise<void> {
|
|
15
|
-
await safeAxios({
|
|
16
|
-
...options,
|
|
17
|
-
method: 'put',
|
|
18
|
-
url: `${url}${stewardshipEndpoint}/${reference}`,
|
|
19
|
-
responseType: 'json',
|
|
20
|
-
})
|
|
21
|
-
}
|
package/src/modules/tag.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Reference, Tag } from '../types'
|
|
2
|
-
import { safeAxios } from '../utils/safe-axios'
|
|
3
|
-
|
|
4
|
-
const endpoint = '/tags'
|
|
5
|
-
|
|
6
|
-
interface GetAllTagsResponse {
|
|
7
|
-
tags: Tag[]
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Create new tag on the Bee node
|
|
12
|
-
*
|
|
13
|
-
* @param url Bee tag URL
|
|
14
|
-
*/
|
|
15
|
-
export async function createTag(url: string): Promise<Tag> {
|
|
16
|
-
const response = await safeAxios<Tag>({
|
|
17
|
-
method: 'post',
|
|
18
|
-
url: url + endpoint,
|
|
19
|
-
responseType: 'json',
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
return response.data
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Retrieve tag information from Bee node
|
|
27
|
-
*
|
|
28
|
-
* @param url Bee tag URL
|
|
29
|
-
* @param uid UID of tag to be retrieved
|
|
30
|
-
*/
|
|
31
|
-
export async function retrieveTag(url: string, uid: number): Promise<Tag> {
|
|
32
|
-
const response = await safeAxios<Tag>({
|
|
33
|
-
url: `${url}${endpoint}/${uid}`,
|
|
34
|
-
responseType: 'json',
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
return response.data
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Get limited listing of all tags.
|
|
42
|
-
*
|
|
43
|
-
* @param url
|
|
44
|
-
* @param offset
|
|
45
|
-
* @param limit
|
|
46
|
-
*/
|
|
47
|
-
export async function getAllTags(url: string, offset?: number, limit?: number): Promise<Tag[]> {
|
|
48
|
-
const response = await safeAxios<GetAllTagsResponse>({
|
|
49
|
-
url: `${url}${endpoint}`,
|
|
50
|
-
params: { offset, limit },
|
|
51
|
-
responseType: 'json',
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
return response.data.tags
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Removes tag from the Bee node.
|
|
59
|
-
* @param url
|
|
60
|
-
* @param uid
|
|
61
|
-
*/
|
|
62
|
-
export async function deleteTag(url: string, uid: number): Promise<void> {
|
|
63
|
-
await safeAxios<void>({
|
|
64
|
-
method: 'delete',
|
|
65
|
-
url: `${url}${endpoint}/${uid}`,
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Updates tag
|
|
71
|
-
* @param url
|
|
72
|
-
* @param uid
|
|
73
|
-
* @param reference
|
|
74
|
-
*/
|
|
75
|
-
export async function updateTag(url: string, uid: number, reference: Reference): Promise<void> {
|
|
76
|
-
await safeAxios<void>({
|
|
77
|
-
method: 'patch',
|
|
78
|
-
url: `${url}${endpoint}/${uid}`,
|
|
79
|
-
data: {
|
|
80
|
-
reference,
|
|
81
|
-
},
|
|
82
|
-
})
|
|
83
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare module 'axios/lib/helpers/normalizeHeaderName' {
|
|
2
|
-
export default function (headers: Record<string, unknown>, header: string): void
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
declare module 'axios/lib/utils' {
|
|
6
|
-
import ArrayBufferView = NodeJS.ArrayBufferView
|
|
7
|
-
|
|
8
|
-
export function isFormData(data: unknown): boolean
|
|
9
|
-
export function isArrayBuffer(data: unknown): boolean
|
|
10
|
-
export function isBuffer(data: unknown): boolean
|
|
11
|
-
export function isStream(data: unknown): boolean
|
|
12
|
-
export function isFile(data: unknown): boolean
|
|
13
|
-
export function isBlob(data: unknown): boolean
|
|
14
|
-
export function isArrayBufferView(data: unknown): data is ArrayBufferView
|
|
15
|
-
export function isURLSearchParams(data: unknown): data is URLSearchParams
|
|
16
|
-
export function isObject(data: unknown): boolean
|
|
17
|
-
export function isUndefined(data: unknown): boolean
|
|
18
|
-
}
|
package/src/types/debug.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { PublicKey, NumberString, Reference, TransactionHash } from './index'
|
|
2
|
-
import { HexEthAddress } from '../utils/eth'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Object that contains information about progress of upload of data to network.
|
|
6
|
-
*
|
|
7
|
-
* @see [Bee docs - Syncing / Tags](https://docs.ethswarm.org/docs/access-the-swarm/syncing)
|
|
8
|
-
*/
|
|
9
|
-
export interface ExtendedTag {
|
|
10
|
-
/**
|
|
11
|
-
* Number of all chunks that the data will be split into.
|
|
12
|
-
*/
|
|
13
|
-
total: number
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Number of chunks already processed by splitter for hashing
|
|
17
|
-
*/
|
|
18
|
-
split: number
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Number of chunks already seen
|
|
22
|
-
*/
|
|
23
|
-
seen: number
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Number of chunks already stored locally
|
|
27
|
-
*/
|
|
28
|
-
stored: number
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Number of chunks sent for push syncing
|
|
32
|
-
*/
|
|
33
|
-
sent: number
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Number of chunks synced with proof
|
|
37
|
-
*/
|
|
38
|
-
synced: number
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Unique identifier
|
|
42
|
-
*/
|
|
43
|
-
uid: number
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* The associated swarm hash for this tag
|
|
47
|
-
*/
|
|
48
|
-
address: Reference
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* When the upload process started
|
|
52
|
-
*/
|
|
53
|
-
startedAt: string
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export interface Settlements {
|
|
57
|
-
peer: string
|
|
58
|
-
received: NumberString
|
|
59
|
-
sent: NumberString
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export interface AllSettlements {
|
|
63
|
-
totalReceived: NumberString
|
|
64
|
-
totalSent: NumberString
|
|
65
|
-
settlements: Settlements[]
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface NodeAddresses {
|
|
69
|
-
overlay: string
|
|
70
|
-
underlay: string[]
|
|
71
|
-
ethereum: HexEthAddress
|
|
72
|
-
publicKey: PublicKey
|
|
73
|
-
pssPublicKey: PublicKey
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface Peer {
|
|
77
|
-
address: string
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
export interface ChequebookAddressResponse {
|
|
81
|
-
chequebookAddress: string
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
export interface ChequebookBalanceResponse {
|
|
85
|
-
totalBalance: NumberString
|
|
86
|
-
availableBalance: NumberString
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export interface CashoutOptions {
|
|
90
|
-
/**
|
|
91
|
-
* Gas price for the cashout transaction in WEI
|
|
92
|
-
*/
|
|
93
|
-
gasPrice?: NumberString
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Gas limit for the cashout transaction in WEI
|
|
97
|
-
*/
|
|
98
|
-
gasLimit?: NumberString
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
export interface CashoutResult {
|
|
102
|
-
recipient: string
|
|
103
|
-
lastPayout: NumberString
|
|
104
|
-
bounced: boolean
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export interface LastCashoutActionResponse {
|
|
108
|
-
peer: string
|
|
109
|
-
uncashedAmount: NumberString
|
|
110
|
-
transactionHash: string | null
|
|
111
|
-
lastCashedCheque: Cheque | null
|
|
112
|
-
result: CashoutResult | null
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
export interface TransactionResponse {
|
|
116
|
-
transactionHash: TransactionHash
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
export interface Cheque {
|
|
120
|
-
beneficiary: string
|
|
121
|
-
chequebook: string
|
|
122
|
-
payout: NumberString
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface LastChequesForPeerResponse {
|
|
126
|
-
peer: string
|
|
127
|
-
lastreceived: Cheque
|
|
128
|
-
lastsent: Cheque
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface LastChequesResponse {
|
|
132
|
-
lastcheques: LastChequesForPeerResponse[]
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
export interface PeerBalance {
|
|
136
|
-
peer: string
|
|
137
|
-
balance: NumberString
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export interface BalanceResponse {
|
|
141
|
-
balances: PeerBalance[]
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export interface Health {
|
|
145
|
-
status: 'ok'
|
|
146
|
-
version: string
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface RemovePeerResponse {
|
|
150
|
-
message: string
|
|
151
|
-
code: 0
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface Bin {
|
|
155
|
-
population: number
|
|
156
|
-
connected: number
|
|
157
|
-
disconnectedPeers: Peer[] | null
|
|
158
|
-
connectedPeers: Peer[] | null
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export interface Topology {
|
|
162
|
-
baseAddr: string
|
|
163
|
-
population: number
|
|
164
|
-
connected: number
|
|
165
|
-
timestamp: string
|
|
166
|
-
nnLowWatermark: number
|
|
167
|
-
depth: number
|
|
168
|
-
bins: {
|
|
169
|
-
bin_0: Bin
|
|
170
|
-
bin_1: Bin
|
|
171
|
-
bin_2: Bin
|
|
172
|
-
bin_3: Bin
|
|
173
|
-
bin_4: Bin
|
|
174
|
-
bin_5: Bin
|
|
175
|
-
bin_6: Bin
|
|
176
|
-
bin_7: Bin
|
|
177
|
-
bin_8: Bin
|
|
178
|
-
bin_9: Bin
|
|
179
|
-
bin_10: Bin
|
|
180
|
-
bin_11: Bin
|
|
181
|
-
bin_12: Bin
|
|
182
|
-
bin_13: Bin
|
|
183
|
-
bin_14: Bin
|
|
184
|
-
bin_15: Bin
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
export interface PingResponse {
|
|
189
|
-
rtt: string
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export interface ReserveState {
|
|
193
|
-
radius: number
|
|
194
|
-
storageRadius: number
|
|
195
|
-
available: number
|
|
196
|
-
outer: NumberString
|
|
197
|
-
inner: NumberString
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
export interface ChainState {
|
|
201
|
-
block: number
|
|
202
|
-
totalAmount: NumberString
|
|
203
|
-
currentPrice: NumberString
|
|
204
|
-
}
|