@ethersphere/bee-js 8.3.1 → 9.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +192 -50
- package/dist/cjs/bee-dev.js +78 -0
- package/dist/cjs/bee.js +341 -417
- package/dist/cjs/chunk/bmt.js +15 -32
- package/dist/cjs/chunk/cac.js +26 -36
- package/dist/cjs/chunk/soc.js +56 -51
- package/dist/cjs/feed/identifier.js +3 -28
- package/dist/cjs/feed/index.js +95 -44
- package/dist/cjs/feed/retrievable.js +11 -22
- package/dist/cjs/index.js +17 -1
- package/dist/cjs/manifest/manifest.js +369 -0
- package/dist/cjs/modules/bytes.js +24 -12
- package/dist/cjs/modules/bzz.js +24 -34
- package/dist/cjs/modules/chunk.js +13 -7
- package/dist/cjs/modules/debug/balance.js +29 -4
- package/dist/cjs/modules/debug/chequebook.js +60 -16
- package/dist/cjs/modules/debug/connectivity.js +82 -4
- package/dist/cjs/modules/debug/settlements.js +22 -2
- package/dist/cjs/modules/debug/stake.js +29 -11
- package/dist/cjs/modules/debug/stamps.js +88 -7
- package/dist/cjs/modules/debug/states.js +25 -3
- package/dist/cjs/modules/debug/status.js +45 -47
- package/dist/cjs/modules/debug/transactions.js +27 -5
- package/dist/cjs/modules/envelope.js +8 -6
- package/dist/cjs/modules/feed.js +25 -10
- package/dist/cjs/modules/grantee.js +18 -12
- package/dist/cjs/modules/gsoc.js +24 -0
- package/dist/cjs/modules/pinning.js +13 -2
- package/dist/cjs/modules/pss.js +9 -3
- package/dist/cjs/modules/soc.js +9 -4
- package/dist/cjs/modules/stewardship.js +7 -3
- package/dist/cjs/modules/tag.js +35 -3
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/stamper/stamper.js +43 -0
- package/dist/cjs/types/debug.js +16 -1
- package/dist/cjs/types/index.js +2 -24
- package/dist/cjs/utils/bytes.js +67 -115
- package/dist/cjs/utils/chunk-size.js +17 -0
- package/dist/cjs/utils/chunk-stream.browser.js +85 -0
- package/dist/cjs/utils/chunk-stream.js +84 -0
- package/dist/cjs/utils/cid.js +5 -6
- package/dist/cjs/utils/collection.browser.js +2 -2
- package/dist/cjs/utils/collection.js +3 -2
- package/dist/cjs/utils/collection.node.js +0 -2
- package/dist/cjs/utils/constants.js +7 -3
- package/dist/cjs/utils/data.browser.js +6 -3
- package/dist/cjs/utils/data.js +8 -4
- package/dist/cjs/utils/duration.js +51 -0
- package/dist/cjs/utils/expose.js +11 -40
- package/dist/cjs/utils/headers.js +79 -52
- package/dist/cjs/utils/http.js +34 -10
- package/dist/cjs/utils/mime.js +78 -0
- package/dist/cjs/utils/pss.js +3 -4
- package/dist/cjs/utils/redundancy.js +18 -14
- package/dist/cjs/utils/resource-locator.js +17 -0
- package/dist/cjs/utils/size.js +35 -0
- package/dist/cjs/utils/stamps.js +67 -51
- package/dist/cjs/utils/tar-uploader.browser.js +2 -2
- package/dist/cjs/utils/tar-uploader.js +2 -2
- package/dist/cjs/utils/tokens.js +144 -0
- package/dist/cjs/utils/type.js +142 -350
- package/dist/cjs/utils/typed-bytes.js +179 -0
- package/dist/cjs/utils/upload-progress.js +2 -0
- package/dist/cjs/utils/url.js +0 -4
- package/dist/cjs/utils/workaround.js +27 -0
- package/dist/index.browser.min.js +1 -2
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-dev.js +98 -0
- package/dist/mjs/bee.js +367 -411
- package/dist/mjs/chunk/bmt.js +13 -29
- package/dist/mjs/chunk/cac.js +26 -34
- package/dist/mjs/chunk/soc.js +57 -53
- package/dist/mjs/feed/identifier.js +3 -26
- package/dist/mjs/feed/index.js +98 -51
- package/dist/mjs/feed/retrievable.js +12 -23
- package/dist/mjs/index.js +10 -1
- package/dist/mjs/manifest/manifest.js +371 -0
- package/dist/mjs/modules/bytes.js +27 -15
- package/dist/mjs/modules/bzz.js +25 -32
- package/dist/mjs/modules/chunk.js +16 -8
- package/dist/mjs/modules/debug/balance.js +61 -4
- package/dist/mjs/modules/debug/chequebook.js +116 -16
- package/dist/mjs/modules/debug/connectivity.js +144 -3
- package/dist/mjs/modules/debug/settlements.js +46 -2
- package/dist/mjs/modules/debug/stake.js +69 -11
- package/dist/mjs/modules/debug/stamps.js +184 -7
- package/dist/mjs/modules/debug/states.js +55 -3
- package/dist/mjs/modules/debug/status.js +97 -45
- package/dist/mjs/modules/debug/transactions.js +61 -5
- package/dist/mjs/modules/envelope.js +11 -9
- package/dist/mjs/modules/feed.js +26 -10
- package/dist/mjs/modules/grantee.js +35 -13
- package/dist/mjs/modules/gsoc.js +16 -0
- package/dist/mjs/modules/pinning.js +23 -2
- package/dist/mjs/modules/pss.js +10 -4
- package/dist/mjs/modules/soc.js +10 -5
- package/dist/mjs/modules/stewardship.js +14 -4
- package/dist/mjs/modules/tag.js +93 -3
- package/dist/mjs/package.json +2 -1
- package/dist/mjs/stamper/stamper.js +39 -0
- package/dist/mjs/types/debug.js +15 -1
- package/dist/mjs/types/index.js +2 -24
- package/dist/mjs/utils/bytes.js +63 -104
- package/dist/mjs/utils/chunk-size.js +13 -0
- package/dist/mjs/utils/chunk-stream.browser.js +85 -0
- package/dist/mjs/utils/chunk-stream.js +87 -0
- package/dist/mjs/utils/cid.js +5 -6
- package/dist/mjs/utils/collection.browser.js +2 -2
- package/dist/mjs/utils/collection.js +2 -2
- package/dist/mjs/utils/collection.node.js +0 -2
- package/dist/mjs/utils/constants.js +6 -2
- package/dist/mjs/utils/data.browser.js +9 -3
- package/dist/mjs/utils/data.js +12 -4
- package/dist/mjs/utils/duration.js +47 -0
- package/dist/mjs/utils/expose.js +2 -7
- package/dist/mjs/utils/headers.js +73 -48
- package/dist/mjs/utils/http.js +33 -11
- package/dist/mjs/utils/mime.js +75 -0
- package/dist/mjs/utils/pss.js +3 -4
- package/dist/mjs/utils/redundancy.js +18 -8
- package/dist/mjs/utils/resource-locator.js +13 -0
- package/dist/mjs/utils/size.js +31 -0
- package/dist/mjs/utils/stamps.js +47 -44
- package/dist/mjs/utils/tar-uploader.browser.js +2 -2
- package/dist/mjs/utils/tar-uploader.js +2 -2
- package/dist/mjs/utils/tokens.js +139 -0
- package/dist/mjs/utils/type.js +216 -310
- package/dist/mjs/utils/typed-bytes.js +160 -0
- package/dist/mjs/utils/upload-progress.js +1 -0
- package/dist/mjs/utils/url.js +0 -4
- package/dist/mjs/utils/workaround.js +22 -0
- package/dist/types/bee-dev.d.ts +5 -0
- package/dist/types/bee.d.ts +88 -165
- package/dist/types/chunk/bmt.d.ts +2 -2
- package/dist/types/chunk/cac.d.ts +7 -24
- package/dist/types/chunk/soc.d.ts +15 -15
- package/dist/types/feed/identifier.d.ts +2 -4
- package/dist/types/feed/index.d.ts +14 -18
- package/dist/types/feed/retrievable.d.ts +3 -4
- package/dist/types/index.d.ts +28 -1
- package/dist/types/manifest/manifest.d.ts +106 -0
- package/dist/types/modules/bytes.d.ts +8 -5
- package/dist/types/modules/bzz.d.ts +8 -10
- package/dist/types/modules/chunk.d.ts +4 -3
- package/dist/types/modules/debug/balance.d.ts +3 -2
- package/dist/types/modules/debug/chequebook.d.ts +7 -6
- package/dist/types/modules/debug/connectivity.d.ts +5 -3
- package/dist/types/modules/debug/settlements.d.ts +2 -1
- package/dist/types/modules/debug/stake.d.ts +4 -2
- package/dist/types/modules/debug/stamps.d.ts +5 -4
- package/dist/types/modules/debug/status.d.ts +6 -25
- package/dist/types/modules/debug/transactions.d.ts +5 -4
- package/dist/types/modules/envelope.d.ts +3 -2
- package/dist/types/modules/feed.d.ts +20 -16
- package/dist/types/modules/grantee.d.ts +7 -6
- package/dist/types/modules/gsoc.d.ts +7 -0
- package/dist/types/modules/pinning.d.ts +2 -4
- package/dist/types/modules/pss.d.ts +4 -3
- package/dist/types/modules/soc.d.ts +3 -2
- package/dist/types/modules/stewardship.d.ts +4 -4
- package/dist/types/modules/tag.d.ts +2 -1
- package/dist/types/stamper/stamper.d.ts +15 -0
- package/dist/types/types/debug.d.ts +63 -115
- package/dist/types/types/index.d.ts +103 -204
- package/dist/types/utils/bytes.d.ts +16 -90
- package/dist/types/utils/chunk-size.d.ts +1 -0
- package/dist/types/utils/chunk-stream.browser.d.ts +6 -0
- package/dist/types/utils/chunk-stream.d.ts +6 -0
- package/dist/types/utils/cid.d.ts +3 -2
- package/dist/types/utils/collection.browser.d.ts +2 -2
- package/dist/types/utils/collection.d.ts +2 -1
- package/dist/types/utils/collection.node.d.ts +0 -1
- package/dist/types/utils/constants.d.ts +4 -1
- package/dist/types/utils/duration.d.ts +17 -0
- package/dist/types/utils/error.d.ts +2 -2
- package/dist/types/utils/expose.d.ts +2 -7
- package/dist/types/utils/headers.d.ts +3 -4
- package/dist/types/utils/mime.d.ts +1 -0
- package/dist/types/utils/pss.d.ts +2 -2
- package/dist/types/utils/resource-locator.d.ts +6 -0
- package/dist/types/utils/size.d.ts +16 -0
- package/dist/types/utils/stamps.d.ts +27 -33
- package/dist/types/utils/tar-uploader.browser.d.ts +3 -4
- package/dist/types/utils/tar-uploader.d.ts +3 -4
- package/dist/types/utils/tokens.d.ts +77 -0
- package/dist/types/utils/type.d.ts +20 -52
- package/dist/types/utils/typed-bytes.d.ts +68 -0
- package/dist/types/utils/upload-progress.d.ts +4 -0
- package/dist/types/utils/workaround.d.ts +2 -0
- package/package.json +11 -17
- package/dist/cjs/chunk/signer.js +0 -126
- package/dist/cjs/chunk/span.js +0 -25
- package/dist/cjs/feed/json.js +0 -28
- package/dist/cjs/feed/topic.js +0 -25
- package/dist/cjs/feed/type.js +0 -15
- package/dist/cjs/modules/debug/chunk.js +0 -21
- package/dist/cjs/modules/debug/tag.js +0 -19
- package/dist/cjs/utils/eth.js +0 -216
- package/dist/cjs/utils/hash.js +0 -21
- package/dist/cjs/utils/hex.js +0 -150
- package/dist/cjs/utils/reference.js +0 -36
- package/dist/index.browser.min.js.LICENSE.txt +0 -8
- package/dist/mjs/chunk/signer.js +0 -114
- package/dist/mjs/chunk/span.js +0 -21
- package/dist/mjs/feed/json.js +0 -26
- package/dist/mjs/feed/topic.js +0 -19
- package/dist/mjs/feed/type.js +0 -10
- package/dist/mjs/modules/debug/chunk.js +0 -17
- package/dist/mjs/modules/debug/tag.js +0 -15
- package/dist/mjs/utils/eth.js +0 -192
- package/dist/mjs/utils/hash.js +0 -16
- package/dist/mjs/utils/hex.js +0 -135
- package/dist/mjs/utils/reference.js +0 -29
- package/dist/types/chunk/signer.d.ts +0 -31
- package/dist/types/chunk/span.d.ts +0 -10
- package/dist/types/feed/json.d.ts +0 -4
- package/dist/types/feed/topic.d.ts +0 -3
- package/dist/types/feed/type.d.ts +0 -6
- package/dist/types/modules/debug/chunk.d.ts +0 -10
- package/dist/types/modules/debug/tag.d.ts +0 -8
- package/dist/types/utils/eth.d.ts +0 -67
- package/dist/types/utils/hash.d.ts +0 -9
- package/dist/types/utils/hex.d.ts +0 -86
- package/dist/types/utils/reference.d.ts +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Reference } from '../utils/typed-bytes';
|
|
2
2
|
/**
|
|
3
3
|
* Calculate a Binary Merkle Tree hash for a chunk
|
|
4
4
|
*
|
|
@@ -13,4 +13,4 @@ import { Bytes } from '../utils/bytes';
|
|
|
13
13
|
*
|
|
14
14
|
* @returns the keccak256 hash in a byte array
|
|
15
15
|
*/
|
|
16
|
-
export declare function
|
|
16
|
+
export declare function calculateChunkAddress(chunkContent: Uint8Array): Reference;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Bytes } from '../utils/bytes';
|
|
2
|
+
import { Reference, Span } from '../utils/typed-bytes';
|
|
3
3
|
export declare const MIN_PAYLOAD_SIZE = 1;
|
|
4
4
|
export declare const MAX_PAYLOAD_SIZE = 4096;
|
|
5
5
|
/**
|
|
@@ -13,31 +13,14 @@ export declare const MAX_PAYLOAD_SIZE = 4096;
|
|
|
13
13
|
*/
|
|
14
14
|
export interface Chunk {
|
|
15
15
|
readonly data: Uint8Array;
|
|
16
|
-
span
|
|
17
|
-
payload
|
|
18
|
-
address
|
|
16
|
+
span: Span;
|
|
17
|
+
payload: Bytes;
|
|
18
|
+
address: Reference;
|
|
19
19
|
}
|
|
20
|
-
type ValidChunkData = BrandedType<Uint8Array, 'ValidChunkData'>;
|
|
21
20
|
/**
|
|
22
21
|
* Creates a content addressed chunk and verifies the payload size.
|
|
23
22
|
*
|
|
24
23
|
* @param payloadBytes the data to be stored in the chunk
|
|
25
24
|
*/
|
|
26
|
-
export declare function makeContentAddressedChunk(payloadBytes: Uint8Array): Chunk;
|
|
27
|
-
|
|
28
|
-
* Type guard for valid content addressed chunk data
|
|
29
|
-
*
|
|
30
|
-
* @param data The chunk data
|
|
31
|
-
* @param chunkAddress The address of the chunk
|
|
32
|
-
*/
|
|
33
|
-
export declare function isValidChunkData(data: unknown, chunkAddress: PlainBytesReference): data is ValidChunkData;
|
|
34
|
-
/**
|
|
35
|
-
* Asserts if data are representing given address of its chunk.
|
|
36
|
-
*
|
|
37
|
-
* @param data The chunk data
|
|
38
|
-
* @param chunkAddress The address of the chunk
|
|
39
|
-
*
|
|
40
|
-
* @returns a valid content addressed chunk or throws error
|
|
41
|
-
*/
|
|
42
|
-
export declare function assertValidChunkData(data: unknown, chunkAddress: PlainBytesReference): asserts data is ValidChunkData;
|
|
43
|
-
export {};
|
|
25
|
+
export declare function makeContentAddressedChunk(payloadBytes: Uint8Array | string): Chunk;
|
|
26
|
+
export declare function asContentAddressedChunk(chunkBytes: Uint8Array): Chunk;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BeeRequestOptions, UploadOptions, UploadResult } from '../types';
|
|
2
2
|
import { Bytes } from '../utils/bytes';
|
|
3
|
-
import { EthAddress } from '../utils/
|
|
3
|
+
import { BatchId, EthAddress, Identifier, PrivateKey, Reference, Signature } from '../utils/typed-bytes';
|
|
4
4
|
import { Chunk } from './cac';
|
|
5
|
-
export type Identifier = Bytes<32>;
|
|
6
5
|
/**
|
|
7
6
|
* With single owner chunks, a user can assign arbitrary data to an
|
|
8
7
|
* address and attest chunk integrity with their digital signature.
|
|
@@ -12,9 +11,9 @@ export type Identifier = Bytes<32>;
|
|
|
12
11
|
* and the owner of the chunk.
|
|
13
12
|
*/
|
|
14
13
|
export interface SingleOwnerChunk extends Chunk {
|
|
15
|
-
identifier:
|
|
16
|
-
signature:
|
|
17
|
-
owner:
|
|
14
|
+
identifier: Identifier;
|
|
15
|
+
signature: Signature;
|
|
16
|
+
owner: EthAddress;
|
|
18
17
|
}
|
|
19
18
|
/**
|
|
20
19
|
* Verifies if the data is a valid single owner chunk
|
|
@@ -24,16 +23,16 @@ export interface SingleOwnerChunk extends Chunk {
|
|
|
24
23
|
*
|
|
25
24
|
* @returns a single owner chunk or throws error
|
|
26
25
|
*/
|
|
27
|
-
export declare function makeSingleOwnerChunkFromData(data: Uint8Array, address:
|
|
28
|
-
export declare function makeSOCAddress(identifier: Identifier, address: EthAddress):
|
|
26
|
+
export declare function makeSingleOwnerChunkFromData(data: Bytes | Uint8Array, address: Reference | Uint8Array | string): SingleOwnerChunk;
|
|
27
|
+
export declare function makeSOCAddress(identifier: Identifier, address: EthAddress): Reference;
|
|
29
28
|
/**
|
|
30
29
|
* Creates a single owner chunk object
|
|
31
30
|
*
|
|
32
31
|
* @param chunk A chunk object used for the span and payload
|
|
33
32
|
* @param identifier The identifier of the chunk
|
|
34
|
-
* @param signer The
|
|
33
|
+
* @param signer The signer interface for signing the chunk
|
|
35
34
|
*/
|
|
36
|
-
export declare function makeSingleOwnerChunk(chunk: Chunk, identifier: Identifier, signer:
|
|
35
|
+
export declare function makeSingleOwnerChunk(chunk: Chunk, identifier: Identifier | Uint8Array | string, signer: PrivateKey | Uint8Array | string): SingleOwnerChunk;
|
|
37
36
|
/**
|
|
38
37
|
* Helper function to upload a chunk.
|
|
39
38
|
*
|
|
@@ -41,7 +40,7 @@ export declare function makeSingleOwnerChunk(chunk: Chunk, identifier: Identifie
|
|
|
41
40
|
*
|
|
42
41
|
* @param requestOptions Options for making requests
|
|
43
42
|
* @param chunk A chunk object
|
|
44
|
-
* @param
|
|
43
|
+
* @param stamp Postage BatchId that will be assigned to uploaded data
|
|
45
44
|
* @param options Upload options
|
|
46
45
|
*/
|
|
47
46
|
export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions, chunk: SingleOwnerChunk, stamp: BatchId | Uint8Array | string, options?: UploadOptions): Promise<UploadResult>;
|
|
@@ -49,18 +48,19 @@ export declare function uploadSingleOwnerChunk(requestOptions: BeeRequestOptions
|
|
|
49
48
|
* Helper function to create and upload SOC.
|
|
50
49
|
*
|
|
51
50
|
* @param requestOptions Options for making requests
|
|
52
|
-
* @param signer The
|
|
51
|
+
* @param signer The signer interface for signing the chunk
|
|
53
52
|
* @param postageBatchId
|
|
54
53
|
* @param identifier The identifier of the chunk
|
|
55
54
|
* @param data The chunk data
|
|
56
55
|
* @param options
|
|
57
56
|
*/
|
|
58
|
-
export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer:
|
|
57
|
+
export declare function uploadSingleOwnerChunkData(requestOptions: BeeRequestOptions, signer: PrivateKey | Uint8Array | string, stamp: BatchId | Uint8Array | string, identifier: Identifier | Uint8Array | string, data: Uint8Array, options?: UploadOptions): Promise<UploadResult>;
|
|
58
|
+
export declare function uploadSingleOwnerChunkWithWrappedChunk(requestOptions: BeeRequestOptions, signer: PrivateKey | Uint8Array | string, stamp: BatchId | Uint8Array | string, identifier: Identifier | Uint8Array | string, rootChunk: Uint8Array, options?: UploadOptions): Promise<UploadResult>;
|
|
59
59
|
/**
|
|
60
60
|
* Helper function to download SOC.
|
|
61
61
|
*
|
|
62
62
|
* @param url The url of the Bee service
|
|
63
|
-
* @param ownerAddress The
|
|
63
|
+
* @param ownerAddress The signer interface for signing the chunk
|
|
64
64
|
* @param identifier The identifier of the chunk
|
|
65
65
|
*/
|
|
66
|
-
export declare function downloadSingleOwnerChunk(requestOptions: BeeRequestOptions, ownerAddress: EthAddress, identifier: Identifier): Promise<SingleOwnerChunk>;
|
|
66
|
+
export declare function downloadSingleOwnerChunk(requestOptions: BeeRequestOptions, ownerAddress: EthAddress | Uint8Array | string, identifier: Identifier | Uint8Array | string): Promise<SingleOwnerChunk>;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import { Identifier } from '../
|
|
2
|
-
|
|
3
|
-
import { Index } from './index';
|
|
4
|
-
export declare function makeFeedIdentifier(topic: Topic, index: Index): Identifier;
|
|
1
|
+
import { FeedIndex, Identifier, Topic } from '../utils/typed-bytes';
|
|
2
|
+
export declare function makeFeedIdentifier(topic: Topic, index: FeedIndex | number): Identifier;
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
+
import { Optional } from 'cafe-utility';
|
|
2
|
+
import { Chunk } from '../chunk/cac';
|
|
1
3
|
import { FeedUpdateOptions } from '../modules/feed';
|
|
2
|
-
import {
|
|
4
|
+
import { BeeRequestOptions, FeedReader, FeedWriter, UploadOptions, UploadResult } from '../types';
|
|
3
5
|
import { Bytes } from '../utils/bytes';
|
|
4
|
-
import { EthAddress,
|
|
5
|
-
import { HexString } from '../utils/hex';
|
|
6
|
-
import type { FeedType } from './type';
|
|
6
|
+
import { BatchId, EthAddress, FeedIndex, PrivateKey, Reference, Topic } from '../utils/typed-bytes';
|
|
7
7
|
export interface Epoch {
|
|
8
8
|
time: number;
|
|
9
9
|
level: number;
|
|
10
10
|
}
|
|
11
|
-
/**
|
|
12
|
-
* Bytes of Feed's Index.
|
|
13
|
-
* For Sequential Feeds this is numeric value in big-endian.
|
|
14
|
-
*/
|
|
15
|
-
export type IndexBytes = Bytes<8>;
|
|
16
|
-
export type Index = number | Epoch | IndexBytes | string;
|
|
17
11
|
export interface FeedUploadOptions extends UploadOptions, FeedUpdateOptions {
|
|
18
12
|
}
|
|
19
13
|
export interface FeedUpdate {
|
|
20
|
-
timestamp: number
|
|
21
|
-
|
|
14
|
+
timestamp: Optional<number>;
|
|
15
|
+
payload: Bytes;
|
|
22
16
|
}
|
|
23
|
-
export declare function findNextIndex(requestOptions: BeeRequestOptions, owner:
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
26
|
-
export declare function
|
|
27
|
-
export declare function
|
|
28
|
-
export declare function
|
|
17
|
+
export declare function findNextIndex(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic): Promise<FeedIndex>;
|
|
18
|
+
export declare function updateFeedWithReference(requestOptions: BeeRequestOptions, signer: PrivateKey, topic: Topic, reference: Reference | string | Uint8Array, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<UploadResult>;
|
|
19
|
+
export declare function updateFeedWithPayload(requestOptions: BeeRequestOptions, signer: PrivateKey, topic: Topic, data: Uint8Array | string, postageBatchId: BatchId, options?: FeedUploadOptions): Promise<UploadResult>;
|
|
20
|
+
export declare function getFeedUpdateChunkReference(owner: EthAddress, topic: Topic, index: FeedIndex): Reference;
|
|
21
|
+
export declare function downloadFeedUpdate(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, index: FeedIndex | number, hasTimestamp?: boolean): Promise<FeedUpdate>;
|
|
22
|
+
export declare function downloadFeedUpdateAsCAC(requestOptions: BeeRequestOptions, owner: EthAddress, topic: Topic, index: FeedIndex | number): Promise<Chunk>;
|
|
23
|
+
export declare function makeFeedReader(requestOptions: BeeRequestOptions, topic: Topic, owner: EthAddress): FeedReader;
|
|
24
|
+
export declare function makeFeedWriter(requestOptions: BeeRequestOptions, topic: Topic, signer: PrivateKey): FeedWriter;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Bee } from '../bee';
|
|
2
|
-
import { BeeRequestOptions,
|
|
3
|
-
import { EthAddress } from '../utils/
|
|
4
|
-
|
|
5
|
-
export declare function areAllSequentialFeedsUpdateRetrievable(bee: Bee, owner: EthAddress, topic: Topic, index: Index, requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
2
|
+
import { BeeRequestOptions, DownloadOptions } from '../types';
|
|
3
|
+
import { EthAddress, FeedIndex, Topic } from '../utils/typed-bytes';
|
|
4
|
+
export declare function areAllSequentialFeedsUpdateRetrievable(bee: Bee, owner: EthAddress, topic: Topic, index: FeedIndex, options: DownloadOptions | undefined, requestOptions: BeeRequestOptions): Promise<boolean>;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,18 +1,45 @@
|
|
|
1
1
|
import { Bee } from './bee';
|
|
2
|
+
import { BeeDev } from './bee-dev';
|
|
3
|
+
import { Stamper } from './stamper/stamper';
|
|
4
|
+
export { MerkleTree } from 'cafe-utility';
|
|
5
|
+
export { MantarayNode } from './manifest/manifest';
|
|
2
6
|
export { SUPPORTED_BEE_VERSION, SUPPORTED_BEE_VERSION_EXACT } from './modules/debug/status';
|
|
3
7
|
export * from './types';
|
|
8
|
+
export { Bytes } from './utils/bytes';
|
|
4
9
|
export * from './utils/constants';
|
|
10
|
+
export { Duration } from './utils/duration';
|
|
5
11
|
export * from './utils/error';
|
|
6
12
|
export * as Utils from './utils/expose';
|
|
7
|
-
export {
|
|
13
|
+
export { Size } from './utils/size';
|
|
14
|
+
export * from './utils/tokens';
|
|
15
|
+
export * from './utils/typed-bytes';
|
|
16
|
+
export { Bee, BeeDev, Stamper };
|
|
8
17
|
declare global {
|
|
9
18
|
interface Window {
|
|
10
19
|
BeeJs: {
|
|
11
20
|
Bee: typeof import('./bee').Bee;
|
|
21
|
+
BeeDev: typeof import('./bee-dev').BeeDev;
|
|
22
|
+
Stamper: typeof import('./stamper/stamper').Stamper;
|
|
12
23
|
Utils: typeof import('./utils/expose');
|
|
24
|
+
Duration: typeof import('./utils/duration').Duration;
|
|
25
|
+
Size: typeof import('./utils/size').Size;
|
|
13
26
|
BeeError: typeof import('./utils/error').BeeError;
|
|
14
27
|
BeeArgumentError: typeof import('./utils/error').BeeArgumentError;
|
|
15
28
|
BeeResponseError: typeof import('./utils/error').BeeResponseError;
|
|
29
|
+
MantarayNode: typeof import('./manifest/manifest').MantarayNode;
|
|
30
|
+
MerkleTree: typeof import('cafe-utility').MerkleTree;
|
|
31
|
+
PrivateKey: typeof import('./utils/typed-bytes').PrivateKey;
|
|
32
|
+
PublicKey: typeof import('./utils/typed-bytes').PublicKey;
|
|
33
|
+
EthAddress: typeof import('./utils/typed-bytes').EthAddress;
|
|
34
|
+
Identifier: typeof import('./utils/typed-bytes').Identifier;
|
|
35
|
+
Reference: typeof import('./utils/typed-bytes').Reference;
|
|
36
|
+
TransactionId: typeof import('./utils/typed-bytes').TransactionId;
|
|
37
|
+
Span: typeof import('./utils/typed-bytes').Span;
|
|
38
|
+
PeerAddress: typeof import('./utils/typed-bytes').PeerAddress;
|
|
39
|
+
BatchId: typeof import('./utils/typed-bytes').BatchId;
|
|
40
|
+
Signature: typeof import('./utils/typed-bytes').Signature;
|
|
41
|
+
Topic: typeof import('./utils/typed-bytes').Topic;
|
|
42
|
+
FeedIndex: typeof import('./utils/typed-bytes').FeedIndex;
|
|
16
43
|
};
|
|
17
44
|
}
|
|
18
45
|
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { Optional, Uint8ArrayReader } from 'cafe-utility';
|
|
2
|
+
import { Bee, BeeRequestOptions, DownloadOptions, UploadOptions, UploadResult } from '..';
|
|
3
|
+
import { FeedPayloadResult } from '../modules/feed';
|
|
4
|
+
import { Bytes } from '../utils/bytes';
|
|
5
|
+
import { BatchId, Reference } from '../utils/typed-bytes';
|
|
6
|
+
export declare class Fork {
|
|
7
|
+
prefix: Uint8Array;
|
|
8
|
+
node: MantarayNode;
|
|
9
|
+
constructor(prefix: Uint8Array, node: MantarayNode);
|
|
10
|
+
static split(a: Fork, b: Fork): Fork;
|
|
11
|
+
marshal(): Uint8Array;
|
|
12
|
+
static unmarshal(reader: Uint8ArrayReader): Fork;
|
|
13
|
+
}
|
|
14
|
+
interface MantarayNodeOptions {
|
|
15
|
+
selfAddress?: Uint8Array;
|
|
16
|
+
targetAddress?: Uint8Array;
|
|
17
|
+
obfuscationKey?: Uint8Array;
|
|
18
|
+
metadata?: Record<string, string> | null;
|
|
19
|
+
path?: Uint8Array | null;
|
|
20
|
+
parent?: MantarayNode | null;
|
|
21
|
+
}
|
|
22
|
+
export declare class MantarayNode {
|
|
23
|
+
obfuscationKey: Uint8Array;
|
|
24
|
+
selfAddress: Uint8Array | null;
|
|
25
|
+
targetAddress: Uint8Array;
|
|
26
|
+
metadata: Record<string, string> | undefined | null;
|
|
27
|
+
path: Uint8Array;
|
|
28
|
+
forks: Map<number, Fork>;
|
|
29
|
+
parent: MantarayNode | null;
|
|
30
|
+
constructor(options?: MantarayNodeOptions);
|
|
31
|
+
get fullPath(): Uint8Array;
|
|
32
|
+
get fullPathString(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Returns the metadata at the `/` path to access idiomatic properties.
|
|
35
|
+
*/
|
|
36
|
+
getRootMetadata(): Optional<Record<string, string>>;
|
|
37
|
+
/**
|
|
38
|
+
* Returns the `swarm-index-document` and `swarm-error-document` metadata values.
|
|
39
|
+
*/
|
|
40
|
+
getDocsMetadata(): {
|
|
41
|
+
indexDocument: string | null;
|
|
42
|
+
errorDocument: string | null;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Attempts to resolve the manifest as a feed, returning the latest update.
|
|
46
|
+
*/
|
|
47
|
+
resolveFeed(bee: Bee, requestOptions?: BeeRequestOptions): Promise<Optional<FeedPayloadResult>>;
|
|
48
|
+
/**
|
|
49
|
+
* Gets the binary representation of the node.
|
|
50
|
+
*/
|
|
51
|
+
marshal(): Promise<Uint8Array>;
|
|
52
|
+
/**
|
|
53
|
+
* Downloads and unmarshals a MantarayNode from the given reference.
|
|
54
|
+
*
|
|
55
|
+
* Do not forget calling `loadRecursively` on the returned node to load the entire tree.
|
|
56
|
+
*/
|
|
57
|
+
static unmarshal(bee: Bee, reference: Reference | Uint8Array | string, options?: DownloadOptions, requestOptions?: BeeRequestOptions): Promise<MantarayNode>;
|
|
58
|
+
/**
|
|
59
|
+
* Unmarshals a MantarayNode from the given data.
|
|
60
|
+
*
|
|
61
|
+
* Do not forget calling `loadRecursively` on the returned node to load the entire tree.
|
|
62
|
+
*/
|
|
63
|
+
static unmarshalFromData(data: Uint8Array): MantarayNode;
|
|
64
|
+
/**
|
|
65
|
+
* Adds a fork to the node.
|
|
66
|
+
*/
|
|
67
|
+
addFork(path: string | Uint8Array, reference: string | Uint8Array | Bytes | Reference, metadata?: Record<string, string> | null): void;
|
|
68
|
+
/**
|
|
69
|
+
* Removes a fork from the node.
|
|
70
|
+
*/
|
|
71
|
+
removeFork(path: string | Uint8Array): void;
|
|
72
|
+
/**
|
|
73
|
+
* Calculates the self address of the node.
|
|
74
|
+
*/
|
|
75
|
+
calculateSelfAddress(): Promise<Reference>;
|
|
76
|
+
/**
|
|
77
|
+
* Saves the node and its children recursively.
|
|
78
|
+
*/
|
|
79
|
+
saveRecursively(bee: Bee, postageBatchId: string | BatchId, options?: UploadOptions, requestOptions?: BeeRequestOptions): Promise<UploadResult>;
|
|
80
|
+
/**
|
|
81
|
+
* Loads the node and its children recursively.
|
|
82
|
+
*/
|
|
83
|
+
loadRecursively(bee: Bee, options?: DownloadOptions, requestOptions?: BeeRequestOptions): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Finds a node in the tree by its path.
|
|
86
|
+
*/
|
|
87
|
+
find(path: string | Uint8Array): MantarayNode | null;
|
|
88
|
+
/**
|
|
89
|
+
* Finds the closest node in the tree to the given path.
|
|
90
|
+
*/
|
|
91
|
+
findClosest(path: string | Uint8Array, current?: Uint8Array): [MantarayNode, Uint8Array];
|
|
92
|
+
/**
|
|
93
|
+
* Returns an array of all nodes in the tree which have a target address set.
|
|
94
|
+
*
|
|
95
|
+
* Must be called after `loadRecursively`.
|
|
96
|
+
*/
|
|
97
|
+
collect(nodes?: MantarayNode[]): MantarayNode[];
|
|
98
|
+
/**
|
|
99
|
+
* Returns a path:reference map of all nodes in the tree which have a target address set.
|
|
100
|
+
*
|
|
101
|
+
* Must be called after `loadRecursively`.
|
|
102
|
+
*/
|
|
103
|
+
collectAndMap(): Record<string, string>;
|
|
104
|
+
determineType(): number;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BeeRequestOptions, DownloadOptions, RedundantUploadOptions, ReferenceInformation } from '../types';
|
|
2
2
|
import { UploadResult } from '../types';
|
|
3
|
+
import { Bytes } from '../utils/bytes';
|
|
4
|
+
import { ResourceLocator } from '../utils/resource-locator';
|
|
5
|
+
import { BatchId, Reference } from '../utils/typed-bytes';
|
|
3
6
|
/**
|
|
4
7
|
* Upload data to a Bee node
|
|
5
8
|
*
|
|
@@ -8,25 +11,25 @@ import { UploadResult } from '../types';
|
|
|
8
11
|
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
|
|
9
12
|
* @param options Additional options like tag, encryption, pinning
|
|
10
13
|
*/
|
|
11
|
-
export declare function upload(requestOptions: BeeRequestOptions, data: string | Uint8Array, postageBatchId: BatchId, options?:
|
|
14
|
+
export declare function upload(requestOptions: BeeRequestOptions, data: string | Uint8Array, postageBatchId: BatchId, options?: RedundantUploadOptions): Promise<UploadResult>;
|
|
12
15
|
/**
|
|
13
16
|
* Requests content length for a reference
|
|
14
17
|
*
|
|
15
18
|
* @param requestOptions Options for making requests
|
|
16
19
|
* @param hash Bee content reference
|
|
17
20
|
*/
|
|
18
|
-
export declare function head(requestOptions: BeeRequestOptions,
|
|
21
|
+
export declare function head(requestOptions: BeeRequestOptions, reference: Reference | Uint8Array | string): Promise<ReferenceInformation>;
|
|
19
22
|
/**
|
|
20
23
|
* Download data as a byte array
|
|
21
24
|
*
|
|
22
25
|
* @param requestOptions Options for making requests
|
|
23
26
|
* @param hash Bee content reference
|
|
24
27
|
*/
|
|
25
|
-
export declare function download(requestOptions: BeeRequestOptions,
|
|
28
|
+
export declare function download(requestOptions: BeeRequestOptions, resource: ResourceLocator, options?: DownloadOptions): Promise<Bytes>;
|
|
26
29
|
/**
|
|
27
30
|
* Download data as a readable stream
|
|
28
31
|
*
|
|
29
32
|
* @param requestOptions Options for making requests
|
|
30
33
|
* @param hash Bee content reference
|
|
31
34
|
*/
|
|
32
|
-
export declare function downloadReadable(requestOptions: BeeRequestOptions,
|
|
35
|
+
export declare function downloadReadable(requestOptions: BeeRequestOptions, resource: ResourceLocator, options?: DownloadOptions): Promise<ReadableStream<Uint8Array>>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import { Readable } from 'stream';
|
|
3
|
-
import {
|
|
3
|
+
import { BeeRequestOptions, Collection, CollectionUploadOptions, DownloadOptions, FileData, FileUploadOptions, UploadResult } from '../types';
|
|
4
|
+
import { Bytes } from '../utils/bytes';
|
|
5
|
+
import { ResourceLocator } from '../utils/resource-locator';
|
|
6
|
+
import { BatchId, Reference } from '../utils/typed-bytes';
|
|
4
7
|
/**
|
|
5
8
|
* Upload single file
|
|
6
9
|
*
|
|
@@ -10,7 +13,7 @@ import { BatchId, BeeRequestOptions, Collection, CollectionUploadOptions, Data,
|
|
|
10
13
|
* @param name Name that will be attached to the uploaded file. Wraps the data into manifest with set index document.
|
|
11
14
|
* @param options
|
|
12
15
|
*/
|
|
13
|
-
export declare function uploadFile(requestOptions: BeeRequestOptions, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions
|
|
16
|
+
export declare function uploadFile(requestOptions: BeeRequestOptions, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions): Promise<UploadResult>;
|
|
14
17
|
/**
|
|
15
18
|
* Download single file as a buffer
|
|
16
19
|
*
|
|
@@ -18,7 +21,7 @@ export declare function uploadFile(requestOptions: BeeRequestOptions, data: stri
|
|
|
18
21
|
* @param hash Bee file or collection hash
|
|
19
22
|
* @param path If hash is collection then this defines path to a single file in the collection
|
|
20
23
|
*/
|
|
21
|
-
export declare function downloadFile(requestOptions: BeeRequestOptions,
|
|
24
|
+
export declare function downloadFile(requestOptions: BeeRequestOptions, resource: ResourceLocator, path?: string, options?: DownloadOptions): Promise<FileData<Bytes>>;
|
|
22
25
|
/**
|
|
23
26
|
* Download single file as a readable stream
|
|
24
27
|
*
|
|
@@ -26,13 +29,8 @@ export declare function downloadFile(requestOptions: BeeRequestOptions, hash: Re
|
|
|
26
29
|
* @param hash Bee file or collection hash
|
|
27
30
|
* @param path If hash is collection then this defines path to a single file in the collection
|
|
28
31
|
*/
|
|
29
|
-
export declare function downloadFileReadable(requestOptions: BeeRequestOptions,
|
|
32
|
+
export declare function downloadFileReadable(requestOptions: BeeRequestOptions, reference: Reference, path?: string, options?: DownloadOptions): Promise<FileData<ReadableStream<Uint8Array>>>;
|
|
30
33
|
/*******************************************************************************************************************/
|
|
31
|
-
export interface CollectionUploadHeaders extends UploadHeaders {
|
|
32
|
-
'swarm-index-document'?: string;
|
|
33
|
-
'swarm-error-document'?: string;
|
|
34
|
-
}
|
|
35
|
-
export declare function extractCollectionUploadHeaders(postageBatchId: BatchId, options?: CollectionUploadOptions & UploadRedundancyOptions): CollectionUploadHeaders & UploadRedundancyOptions;
|
|
36
34
|
/**
|
|
37
35
|
* Upload collection
|
|
38
36
|
* @param requestOptions Options for making requests
|
|
@@ -40,4 +38,4 @@ export declare function extractCollectionUploadHeaders(postageBatchId: BatchId,
|
|
|
40
38
|
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
|
|
41
39
|
* @param options
|
|
42
40
|
*/
|
|
43
|
-
export declare function uploadCollection(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions
|
|
41
|
+
export declare function uploadCollection(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions): Promise<UploadResult>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BeeRequestOptions, DownloadOptions, EnvelopeWithBatchId, UploadOptions, UploadResult } from '../types';
|
|
2
|
+
import { BatchId, Reference } from '../utils/typed-bytes';
|
|
2
3
|
/**
|
|
3
4
|
* Upload chunk to a Bee node
|
|
4
5
|
*
|
|
@@ -11,7 +12,7 @@ import type { BatchId, BeeRequestOptions, Data, ReferenceOrEns, UploadOptions, U
|
|
|
11
12
|
* @param stamp BatchId or marshaled stamp to be used for the upload
|
|
12
13
|
* @param options Additional options like tag, encryption, pinning
|
|
13
14
|
*/
|
|
14
|
-
export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, stamp: BatchId | Uint8Array | string, options?: UploadOptions): Promise<UploadResult>;
|
|
15
|
+
export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Array, stamp: EnvelopeWithBatchId | BatchId | Uint8Array | string, options?: UploadOptions): Promise<UploadResult>;
|
|
15
16
|
/**
|
|
16
17
|
* Download chunk data as a byte array
|
|
17
18
|
*
|
|
@@ -19,4 +20,4 @@ export declare function upload(requestOptions: BeeRequestOptions, data: Uint8Arr
|
|
|
19
20
|
* @param hash Bee content reference
|
|
20
21
|
*
|
|
21
22
|
*/
|
|
22
|
-
export declare function download(requestOptions: BeeRequestOptions,
|
|
23
|
+
export declare function download(requestOptions: BeeRequestOptions, reference: Reference | string | Uint8Array, options?: DownloadOptions): Promise<Uint8Array>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BalanceResponse, BeeRequestOptions, PeerBalance } from '../../types';
|
|
2
|
+
import { PeerAddress } from '../../utils/typed-bytes';
|
|
2
3
|
/**
|
|
3
4
|
* Get the balances with all known peers including prepaid services
|
|
4
5
|
*
|
|
@@ -11,7 +12,7 @@ export declare function getAllBalances(requestOptions: BeeRequestOptions): Promi
|
|
|
11
12
|
* @param requestOptions Options for making requests
|
|
12
13
|
* @param address Swarm address of peer
|
|
13
14
|
*/
|
|
14
|
-
export declare function getPeerBalance(requestOptions: BeeRequestOptions, address:
|
|
15
|
+
export declare function getPeerBalance(requestOptions: BeeRequestOptions, address: PeerAddress): Promise<PeerBalance>;
|
|
15
16
|
/**
|
|
16
17
|
* Get the past due consumption balances with all known peers
|
|
17
18
|
*
|
|
@@ -24,4 +25,4 @@ export declare function getPastDueConsumptionBalances(requestOptions: BeeRequest
|
|
|
24
25
|
* @param requestOptions Options for making requests
|
|
25
26
|
* @param address Swarm address of peer
|
|
26
27
|
*/
|
|
27
|
-
export declare function getPastDueConsumptionPeerBalance(requestOptions: BeeRequestOptions, address:
|
|
28
|
+
export declare function getPastDueConsumptionPeerBalance(requestOptions: BeeRequestOptions, address: PeerAddress): Promise<PeerBalance>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BeeRequestOptions,
|
|
1
|
+
import type { BeeRequestOptions, ChequebookAddressResponse, ChequebookBalanceResponse, LastCashoutActionResponse, LastChequesForPeerResponse, LastChequesResponse, NumberString, TransactionOptions } from '../../types';
|
|
2
|
+
import { PeerAddress, TransactionId } from '../../utils/typed-bytes';
|
|
2
3
|
/**
|
|
3
4
|
* Get the address of the chequebook contract used
|
|
4
5
|
*
|
|
@@ -17,7 +18,7 @@ export declare function getChequebookBalance(requestOptions: BeeRequestOptions):
|
|
|
17
18
|
* @param requestOptions Options for making requests
|
|
18
19
|
* @param peer Swarm address of peer
|
|
19
20
|
*/
|
|
20
|
-
export declare function getLastCashoutAction(requestOptions: BeeRequestOptions, peer:
|
|
21
|
+
export declare function getLastCashoutAction(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<LastCashoutActionResponse>;
|
|
21
22
|
/**
|
|
22
23
|
* Cashout the last cheque for the peer
|
|
23
24
|
*
|
|
@@ -25,14 +26,14 @@ export declare function getLastCashoutAction(requestOptions: BeeRequestOptions,
|
|
|
25
26
|
* @param peer Swarm address of peer
|
|
26
27
|
* @param options
|
|
27
28
|
*/
|
|
28
|
-
export declare function cashoutLastCheque(requestOptions: BeeRequestOptions, peer:
|
|
29
|
+
export declare function cashoutLastCheque(requestOptions: BeeRequestOptions, peer: PeerAddress, options?: TransactionOptions): Promise<TransactionId>;
|
|
29
30
|
/**
|
|
30
31
|
* Get last cheques for the peer
|
|
31
32
|
*
|
|
32
33
|
* @param requestOptions Options for making requests
|
|
33
34
|
* @param peer Swarm address of peer
|
|
34
35
|
*/
|
|
35
|
-
export declare function getLastChequesForPeer(requestOptions: BeeRequestOptions, peer:
|
|
36
|
+
export declare function getLastChequesForPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<LastChequesForPeerResponse>;
|
|
36
37
|
/**
|
|
37
38
|
* Get last cheques for all peers
|
|
38
39
|
*
|
|
@@ -47,7 +48,7 @@ export declare function getLastCheques(requestOptions: BeeRequestOptions): Promi
|
|
|
47
48
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
48
49
|
* @return string Hash of the transaction
|
|
49
50
|
*/
|
|
50
|
-
export declare function depositTokens(requestOptions: BeeRequestOptions, amount:
|
|
51
|
+
export declare function depositTokens(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, gasPrice?: NumberString | string | bigint): Promise<TransactionId>;
|
|
51
52
|
/**
|
|
52
53
|
* Withdraw tokens from the chequebook to the overlay address
|
|
53
54
|
*
|
|
@@ -56,4 +57,4 @@ export declare function depositTokens(requestOptions: BeeRequestOptions, amount:
|
|
|
56
57
|
* @param gasPrice Gas Price in WEI for the transaction call
|
|
57
58
|
* @return string Hash of the transaction
|
|
58
59
|
*/
|
|
59
|
-
export declare function withdrawTokens(requestOptions: BeeRequestOptions, amount:
|
|
60
|
+
export declare function withdrawTokens(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, gasPrice?: NumberString | string | bigint): Promise<TransactionId>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { BeeRequestOptions, NodeAddresses, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
|
|
1
|
+
import type { BeeRequestOptions, Bin, NodeAddresses, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
|
|
2
|
+
import { PeerAddress } from '../../utils/typed-bytes';
|
|
2
3
|
export declare function getNodeAddresses(requestOptions: BeeRequestOptions): Promise<NodeAddresses>;
|
|
3
4
|
export declare function getPeers(requestOptions: BeeRequestOptions): Promise<Peer[]>;
|
|
4
5
|
export declare function getBlocklist(requestOptions: BeeRequestOptions): Promise<Peer[]>;
|
|
5
|
-
export declare function removePeer(requestOptions: BeeRequestOptions, peer:
|
|
6
|
+
export declare function removePeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<RemovePeerResponse>;
|
|
6
7
|
export declare function getTopology(requestOptions: BeeRequestOptions): Promise<Topology>;
|
|
7
|
-
export declare function pingPeer(requestOptions: BeeRequestOptions, peer:
|
|
8
|
+
export declare function pingPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<PingResponse>;
|
|
9
|
+
export declare function asBin(value: unknown, name: string): Bin;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { AllSettlements, BeeRequestOptions, Settlements } from '../../types';
|
|
2
|
+
import { PeerAddress } from '../../utils/typed-bytes';
|
|
2
3
|
/**
|
|
3
4
|
* Get amount of sent and received from settlements with a peer
|
|
4
5
|
*
|
|
5
6
|
* @param requestOptions Options for making requests
|
|
6
7
|
* @param peer Swarm address of peer
|
|
7
8
|
*/
|
|
8
|
-
export declare function getSettlements(requestOptions: BeeRequestOptions, peer:
|
|
9
|
+
export declare function getSettlements(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<Settlements>;
|
|
9
10
|
/**
|
|
10
11
|
* Get settlements with all known peers and total amount sent or received
|
|
11
12
|
*
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { BeeRequestOptions, NumberString, RedistributionState, TransactionOptions } from '../../types';
|
|
2
|
+
import { BZZ } from '../../utils/tokens';
|
|
3
|
+
import { TransactionId } from '../../utils/typed-bytes';
|
|
2
4
|
/**
|
|
3
5
|
* Gets the staked amount
|
|
4
6
|
*
|
|
5
7
|
* @param requestOptions Options for making requests
|
|
6
8
|
*/
|
|
7
|
-
export declare function getStake(requestOptions: BeeRequestOptions): Promise<
|
|
9
|
+
export declare function getStake(requestOptions: BeeRequestOptions): Promise<BZZ>;
|
|
8
10
|
/**
|
|
9
11
|
* Stake given amount of tokens.
|
|
10
12
|
*
|
|
@@ -12,7 +14,7 @@ export declare function getStake(requestOptions: BeeRequestOptions): Promise<Num
|
|
|
12
14
|
* @param amount
|
|
13
15
|
* @param options
|
|
14
16
|
*/
|
|
15
|
-
export declare function stake(requestOptions: BeeRequestOptions, amount: NumberString, options?: TransactionOptions): Promise<
|
|
17
|
+
export declare function stake(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, options?: TransactionOptions): Promise<TransactionId>;
|
|
16
18
|
/**
|
|
17
19
|
* Get current status of node in redistribution game
|
|
18
20
|
*
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { BeeRequestOptions, GlobalPostageBatch, NumberString, PostageBatch, PostageBatchBuckets, PostageBatchOptions } from '../../types';
|
|
2
|
+
import { BatchId } from '../../utils/typed-bytes';
|
|
3
|
+
export declare function getGlobalPostageBatches(requestOptions: BeeRequestOptions): Promise<GlobalPostageBatch[]>;
|
|
3
4
|
export declare function getAllPostageBatches(requestOptions: BeeRequestOptions): Promise<PostageBatch[]>;
|
|
4
5
|
export declare function getPostageBatch(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<PostageBatch>;
|
|
5
6
|
export declare function getPostageBatchBuckets(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<PostageBatchBuckets>;
|
|
6
7
|
export declare function createPostageBatch(requestOptions: BeeRequestOptions, amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
|
|
7
|
-
export declare function topUpBatch(requestOptions: BeeRequestOptions, id:
|
|
8
|
-
export declare function diluteBatch(requestOptions: BeeRequestOptions, id:
|
|
8
|
+
export declare function topUpBatch(requestOptions: BeeRequestOptions, id: BatchId, amount: NumberString): Promise<BatchId>;
|
|
9
|
+
export declare function diluteBatch(requestOptions: BeeRequestOptions, id: BatchId, depth: number): Promise<BatchId>;
|