@ethersphere/bee-js 2.1.0 → 3.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/src/bee-debug.d.ts +5 -1
- package/dist/src/bee.d.ts +23 -46
- package/dist/src/modules/chunk.d.ts +2 -10
- package/dist/src/modules/debug/status.d.ts +10 -4
- package/dist/src/types/debug.d.ts +19 -0
- package/dist/src/types/index.d.ts +31 -2
- package/dist/src/utils/bytes.d.ts +1 -1
- package/dist/src/utils/error.d.ts +21 -2
- package/dist/src/utils/expose.d.ts +1 -0
- package/dist/src/utils/http.d.ts +7 -9
- package/dist/src/utils/stamps.d.ts +12 -0
- package/dist/src/utils/type.d.ts +6 -0
- package/package.json +28 -27
- package/.babelrc.js +0 -33
- package/.depcheckrc.json +0 -27
- package/.editorconfig +0 -6
- package/.eslintignore +0 -1
- package/.eslintrc.js +0 -109
- 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/CHANGELOG.md +0 -520
- 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/jest-puppeteer.config.js +0 -5
- package/jest.config.ts +0 -85
- package/src/bee-debug.ts +0 -601
- package/src/bee.ts +0 -1087
- 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 -217
- package/src/feed/json.ts +0 -33
- 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 -70
- package/src/modules/bzz.ts +0 -179
- package/src/modules/chunk.ts +0 -69
- package/src/modules/debug/balance.ts +0 -63
- package/src/modules/debug/chequebook.ts +0 -175
- 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 -96
- 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 -105
- package/src/modules/pinning.ts +0 -74
- package/src/modules/pss.ts +0 -49
- package/src/modules/soc.ts +0 -40
- package/src/modules/stamps.ts +0 -59
- package/src/modules/status.ts +0 -13
- package/src/modules/stewardship.ts +0 -32
- package/src/modules/tag.ts +0 -83
- package/src/types/debug.ts +0 -204
- package/src/types/index.ts +0 -561
- package/src/types/ky-universal/common.d.ts +0 -17
- package/src/types/ky-universal/hooks.d.ts +0 -103
- package/src/types/ky-universal/index.d.ts +0 -125
- package/src/types/ky-universal/options.d.ts +0 -235
- package/src/types/ky-universal/response.d.ts +0 -38
- package/src/types/ky-universal/retry.d.ts +0 -39
- 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 -68
- package/src/utils/data.ts +0 -48
- package/src/utils/error.ts +0 -23
- package/src/utils/eth.ts +0 -229
- package/src/utils/expose.ts +0 -48
- 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/http.ts +0 -141
- package/src/utils/merge.ts +0 -34
- package/src/utils/pss.ts +0 -16
- package/src/utils/stream.ts +0 -146
- package/src/utils/tar.ts +0 -30
- package/src/utils/type.ts +0 -394
- 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 -272
- package/test/integration/bee-class.spec.ts +0 -648
- package/test/integration/bee-debug-class.spec.ts +0 -114
- 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 -265
- 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/debug/transactions.spec.ts +0 -10
- 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 -105
- 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/tests-setup.ts +0 -94
- package/test/unit/assertions.ts +0 -460
- package/test/unit/bee-class.spec.ts +0 -976
- package/test/unit/bee-debug-class.spec.ts +0 -435
- 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 -151
- 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/stream.spec.ts +0 -30
- package/test/unit/utils/type.spec.ts +0 -32
- package/test/unit/utils/uint64.spec.ts +0 -102
- package/test/utils.ts +0 -426
- 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, Ky, Pin, Reference } from '../types'
|
|
2
|
-
import { http } from '../utils/http'
|
|
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 ky Ky instance for given Bee class instance
|
|
14
|
-
* @param reference Bee data reference
|
|
15
|
-
*/
|
|
16
|
-
export async function pin(ky: Ky, reference: Reference): Promise<void> {
|
|
17
|
-
await http<BeeGenericResponse>(ky, {
|
|
18
|
-
method: 'post',
|
|
19
|
-
responseType: 'json',
|
|
20
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
21
|
-
})
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Unpin data with given reference
|
|
26
|
-
*
|
|
27
|
-
* @param ky Ky instance for given Bee class instance
|
|
28
|
-
* @param reference Bee data reference
|
|
29
|
-
*/
|
|
30
|
-
export async function unpin(ky: Ky, reference: Reference): Promise<void> {
|
|
31
|
-
await http<BeeGenericResponse>(ky, {
|
|
32
|
-
method: 'delete',
|
|
33
|
-
responseType: 'json',
|
|
34
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
35
|
-
})
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Get pin status for specific address.
|
|
40
|
-
*
|
|
41
|
-
* @param ky Ky instance
|
|
42
|
-
* @param reference
|
|
43
|
-
* @throws Error if given address is not pinned
|
|
44
|
-
*/
|
|
45
|
-
export async function getPin(ky: Ky, reference: Reference): Promise<Pin> {
|
|
46
|
-
const response = await http<Pin>(ky, {
|
|
47
|
-
method: 'get',
|
|
48
|
-
responseType: 'json',
|
|
49
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
return response.data
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* Get list of all pins
|
|
57
|
-
*
|
|
58
|
-
* @param ky Ky instance
|
|
59
|
-
*/
|
|
60
|
-
export async function getAllPins(ky: Ky): Promise<Reference[]> {
|
|
61
|
-
const response = await http<GetAllPinResponse>(ky, {
|
|
62
|
-
method: 'get',
|
|
63
|
-
responseType: 'json',
|
|
64
|
-
path: `${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,49 +0,0 @@
|
|
|
1
|
-
import WebSocket from 'isomorphic-ws'
|
|
2
|
-
|
|
3
|
-
import type { BatchId, BeeGenericResponse, Ky, PublicKey } from '../types'
|
|
4
|
-
import { prepareData } from '../utils/data'
|
|
5
|
-
import { http } from '../utils/http'
|
|
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 ky Ky instance for given Bee class instance
|
|
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
|
-
ky: Ky,
|
|
23
|
-
topic: string,
|
|
24
|
-
target: string,
|
|
25
|
-
data: string | Uint8Array,
|
|
26
|
-
postageBatchId: BatchId,
|
|
27
|
-
recipient?: PublicKey,
|
|
28
|
-
): Promise<void> {
|
|
29
|
-
await http<BeeGenericResponse>(ky, {
|
|
30
|
-
method: 'post',
|
|
31
|
-
path: `${endpoint}/send/${topic}/${target}`,
|
|
32
|
-
body: await prepareData(data),
|
|
33
|
-
responseType: 'json',
|
|
34
|
-
searchParams: { recipient },
|
|
35
|
-
headers: extractUploadHeaders(postageBatchId),
|
|
36
|
-
})
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Subscribe for messages on the given topic
|
|
41
|
-
*
|
|
42
|
-
* @param url Bee node URL
|
|
43
|
-
* @param topic Topic name
|
|
44
|
-
*/
|
|
45
|
-
export function subscribe(url: string, topic: string): WebSocket {
|
|
46
|
-
const wsUrl = url.replace(/^http/i, 'ws')
|
|
47
|
-
|
|
48
|
-
return new WebSocket(`${wsUrl}/${endpoint}/subscribe/${topic}`)
|
|
49
|
-
}
|
package/src/modules/soc.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { BatchId, Ky, Reference, ReferenceResponse, UploadOptions } from '../types'
|
|
2
|
-
import { extractUploadHeaders } from '../utils/headers'
|
|
3
|
-
import { http } from '../utils/http'
|
|
4
|
-
|
|
5
|
-
const socEndpoint = 'soc'
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Upload single owner chunk (SOC) to a Bee node
|
|
9
|
-
*
|
|
10
|
-
* @param ky Ky instance
|
|
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
|
-
ky: Ky,
|
|
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 http<ReferenceResponse>(ky, {
|
|
28
|
-
method: 'post',
|
|
29
|
-
path: `${socEndpoint}/${owner}/${identifier}`,
|
|
30
|
-
body: data,
|
|
31
|
-
headers: {
|
|
32
|
-
'content-type': 'application/octet-stream',
|
|
33
|
-
...extractUploadHeaders(postageBatchId, options),
|
|
34
|
-
},
|
|
35
|
-
responseType: 'json',
|
|
36
|
-
searchParams: { sig: signature },
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
return response.data.reference
|
|
40
|
-
}
|
package/src/modules/stamps.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { BatchId, Ky, NumberString, PostageBatch, PostageBatchOptions } from '../types'
|
|
2
|
-
import { http } from '../utils/http'
|
|
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(ky: Ky): Promise<PostageBatch[]> {
|
|
15
|
-
const response = await http<GetAllStampsResponse>(ky, {
|
|
16
|
-
method: 'get',
|
|
17
|
-
path: `${STAMPS_ENDPOINT}`,
|
|
18
|
-
responseType: 'json',
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
return response.data.stamps || []
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function getPostageBatch(ky: Ky, postageBatchId: BatchId): Promise<PostageBatch> {
|
|
25
|
-
const response = await http<PostageBatch>(ky, {
|
|
26
|
-
method: 'get',
|
|
27
|
-
path: `${STAMPS_ENDPOINT}/${postageBatchId}`,
|
|
28
|
-
responseType: 'json',
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
return response.data
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export async function createPostageBatch(
|
|
35
|
-
ky: Ky,
|
|
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 http<CreateStampResponse>(ky, {
|
|
51
|
-
method: 'post',
|
|
52
|
-
path: `${STAMPS_ENDPOINT}/${amount}/${depth}`,
|
|
53
|
-
responseType: 'json',
|
|
54
|
-
searchParams: { 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 { http } from '../utils/http'
|
|
2
|
-
import { Ky } from '../types'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Ping the base bee URL. If connection was not successful throw error
|
|
6
|
-
*
|
|
7
|
-
* @param ky Ky instance for given Bee class instance
|
|
8
|
-
*/
|
|
9
|
-
export async function checkConnection(ky: Ky): Promise<void> | never {
|
|
10
|
-
await http<string>(ky, {
|
|
11
|
-
path: '',
|
|
12
|
-
})
|
|
13
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { Ky, Reference } from '../types'
|
|
2
|
-
import { http } from '../utils/http'
|
|
3
|
-
|
|
4
|
-
const stewardshipEndpoint = 'stewardship'
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Reupload locally pinned data
|
|
8
|
-
* @param ky Ky instance
|
|
9
|
-
* @param reference
|
|
10
|
-
* @param options
|
|
11
|
-
* @throws BeeResponseError if not locally pinned or invalid data
|
|
12
|
-
*/
|
|
13
|
-
export async function reupload(ky: Ky, reference: Reference): Promise<void> {
|
|
14
|
-
await http(ky, {
|
|
15
|
-
method: 'put',
|
|
16
|
-
path: `${stewardshipEndpoint}/${reference}`,
|
|
17
|
-
})
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
interface IsRetrievableResponse {
|
|
21
|
-
isRetrievable: boolean
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export async function isRetrievable(ky: Ky, reference: Reference): Promise<boolean> {
|
|
25
|
-
const response = await http<IsRetrievableResponse>(ky, {
|
|
26
|
-
method: 'get',
|
|
27
|
-
responseType: 'json',
|
|
28
|
-
path: `${stewardshipEndpoint}/${reference}`,
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
return response.data.isRetrievable
|
|
32
|
-
}
|
package/src/modules/tag.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import { Ky, Reference, Tag } from '../types'
|
|
2
|
-
import { http } from '../utils/http'
|
|
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(ky: Ky): Promise<Tag> {
|
|
16
|
-
const response = await http<Tag>(ky, {
|
|
17
|
-
method: 'post',
|
|
18
|
-
path: 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(ky: Ky, uid: number): Promise<Tag> {
|
|
32
|
-
const response = await http<Tag>(ky, {
|
|
33
|
-
path: `${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(ky: Ky, offset?: number, limit?: number): Promise<Tag[]> {
|
|
48
|
-
const response = await http<GetAllTagsResponse>(ky, {
|
|
49
|
-
path: `${endpoint}`,
|
|
50
|
-
searchParams: { 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(ky: Ky, uid: number): Promise<void> {
|
|
63
|
-
await http<void>(ky, {
|
|
64
|
-
method: 'delete',
|
|
65
|
-
path: `${endpoint}/${uid}`,
|
|
66
|
-
})
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Updates tag
|
|
71
|
-
* @param url
|
|
72
|
-
* @param uid
|
|
73
|
-
* @param reference
|
|
74
|
-
*/
|
|
75
|
-
export async function updateTag(ky: Ky, uid: number, reference: Reference): Promise<void> {
|
|
76
|
-
await http<void>(ky, {
|
|
77
|
-
method: 'patch',
|
|
78
|
-
path: `${endpoint}/${uid}`,
|
|
79
|
-
json: {
|
|
80
|
-
reference,
|
|
81
|
-
},
|
|
82
|
-
})
|
|
83
|
-
}
|
package/src/types/debug.ts
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
import { PublicKey, NumberString, Reference, TransactionHash, RequestOptions } 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 extends RequestOptions {
|
|
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
|
-
}
|