@ethersphere/bee-js 3.3.4 → 4.1.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 -22
- package/dist/cjs/{bee-debug.js → src/bee-debug.js} +31 -8
- package/dist/cjs/{bee.js → src/bee.js} +79 -24
- package/dist/cjs/{chunk → src/chunk}/bmt.js +0 -0
- package/dist/cjs/{chunk → src/chunk}/cac.js +0 -0
- package/dist/cjs/{chunk → src/chunk}/serialize.js +0 -0
- package/dist/cjs/{chunk → src/chunk}/signer.js +0 -0
- package/dist/cjs/{chunk → src/chunk}/soc.js +0 -0
- package/dist/cjs/{chunk → src/chunk}/span.js +0 -0
- package/dist/cjs/src/feed/identifier.js +35 -0
- package/dist/cjs/{feed → src/feed}/index.js +34 -90
- package/dist/cjs/{feed → src/feed}/json.js +0 -0
- package/dist/cjs/src/feed/retrievable.js +72 -0
- package/dist/cjs/{feed → src/feed}/topic.js +0 -0
- package/dist/cjs/{feed → src/feed}/type.js +0 -0
- package/dist/cjs/{index.js → src/index.js} +0 -0
- package/dist/cjs/{modules → src/modules}/bytes.js +0 -0
- package/dist/cjs/{modules → src/modules}/bzz.js +0 -0
- package/dist/cjs/{modules → src/modules}/chunk.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/balance.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/chequebook.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/chunk.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/connectivity.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/settlements.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/stamps.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/states.js +18 -1
- package/dist/cjs/{modules → src/modules}/debug/status.js +3 -3
- package/dist/cjs/{modules → src/modules}/debug/tag.js +0 -0
- package/dist/cjs/{modules → src/modules}/debug/transactions.js +0 -0
- package/dist/cjs/{modules → src/modules}/feed.js +3 -3
- package/dist/cjs/{modules → src/modules}/pinning.js +0 -0
- package/dist/cjs/{modules → src/modules}/pss.js +0 -0
- package/dist/cjs/{modules → src/modules}/soc.js +0 -0
- package/dist/cjs/{modules → src/modules}/status.js +0 -0
- package/dist/cjs/{modules → src/modules}/stewardship.js +0 -0
- package/dist/cjs/{modules → src/modules}/tag.js +0 -0
- package/dist/cjs/{types → src/types}/debug.js +0 -0
- package/dist/cjs/{types → src/types}/index.js +2 -1
- package/dist/cjs/{types → src/types}/ky-options.js +0 -0
- package/dist/cjs/{types → src/types}/ky-universal/common.js +0 -0
- package/dist/cjs/{types → src/types}/ky-universal/hooks.js +0 -0
- package/dist/cjs/{types → src/types}/ky-universal/retry.js +0 -0
- package/dist/cjs/{utils → src/utils}/bytes.js +15 -1
- package/dist/cjs/{utils → src/utils}/collection.browser.js +0 -0
- package/dist/cjs/{utils → src/utils}/collection.js +0 -0
- package/dist/cjs/{utils → src/utils}/collection.node.js +0 -0
- package/dist/cjs/{utils → src/utils}/data.browser.js +0 -0
- package/dist/cjs/{utils → src/utils}/data.js +0 -0
- package/dist/cjs/{utils → src/utils}/error.js +0 -0
- package/dist/cjs/{utils → src/utils}/eth.js +0 -0
- package/dist/cjs/{utils → src/utils}/expose.js +0 -0
- package/dist/cjs/{utils → src/utils}/file.js +0 -0
- package/dist/cjs/{utils → src/utils}/hash.js +0 -0
- package/dist/cjs/{utils → src/utils}/headers.js +0 -0
- package/dist/cjs/{utils → src/utils}/hex.js +0 -0
- package/dist/cjs/{utils → src/utils}/http.js +6 -0
- package/dist/cjs/{utils → src/utils}/merge.js +0 -0
- package/dist/cjs/{utils → src/utils}/pss.js +0 -0
- package/dist/cjs/src/utils/reference.js +36 -0
- package/dist/cjs/{utils → src/utils}/stamps.js +0 -0
- package/dist/cjs/{utils → src/utils}/stream.js +0 -0
- package/dist/cjs/{utils → src/utils}/tar.js +0 -0
- package/dist/cjs/{utils → src/utils}/type.js +100 -1
- package/dist/cjs/{utils → src/utils}/uint64.js +0 -0
- package/dist/cjs/{utils → src/utils}/url.js +0 -0
- package/dist/cjs/test/utils.js +419 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/{bee-debug.js → src/bee-debug.js} +40 -10
- package/dist/mjs/{bee.js → src/bee.js} +87 -27
- package/dist/mjs/{chunk → src/chunk}/bmt.js +0 -0
- package/dist/mjs/{chunk → src/chunk}/cac.js +1 -1
- package/dist/mjs/{chunk → src/chunk}/serialize.js +0 -0
- package/dist/mjs/{chunk → src/chunk}/signer.js +0 -0
- package/dist/mjs/{chunk → src/chunk}/soc.js +0 -0
- package/dist/mjs/{chunk → src/chunk}/span.js +0 -0
- package/dist/mjs/src/feed/identifier.js +35 -0
- package/dist/mjs/{feed → src/feed}/index.js +39 -94
- package/dist/mjs/{feed → src/feed}/json.js +0 -0
- package/dist/mjs/src/feed/retrievable.js +105 -0
- package/dist/mjs/{feed → src/feed}/topic.js +0 -0
- package/dist/mjs/{feed → src/feed}/type.js +0 -0
- package/dist/mjs/{index.js → src/index.js} +0 -0
- package/dist/mjs/{modules → src/modules}/bytes.js +0 -0
- package/dist/mjs/{modules → src/modules}/bzz.js +0 -0
- package/dist/mjs/{modules → src/modules}/chunk.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/balance.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/chequebook.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/chunk.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/connectivity.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/settlements.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/stamps.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/states.js +17 -0
- package/dist/mjs/{modules → src/modules}/debug/status.js +3 -3
- package/dist/mjs/{modules → src/modules}/debug/tag.js +0 -0
- package/dist/mjs/{modules → src/modules}/debug/transactions.js +0 -0
- package/dist/mjs/{modules → src/modules}/feed.js +1 -1
- package/dist/mjs/{modules → src/modules}/pinning.js +0 -0
- package/dist/mjs/{modules → src/modules}/pss.js +0 -0
- package/dist/mjs/{modules → src/modules}/soc.js +0 -0
- package/dist/mjs/{modules → src/modules}/status.js +0 -0
- package/dist/mjs/{modules → src/modules}/stewardship.js +0 -0
- package/dist/mjs/{modules → src/modules}/tag.js +0 -0
- package/dist/mjs/{types → src/types}/debug.js +0 -0
- package/dist/mjs/{types → src/types}/index.js +1 -0
- package/dist/mjs/{types → src/types}/ky-options.js +0 -0
- package/dist/mjs/{types → src/types}/ky-universal/common.js +0 -0
- package/dist/mjs/{types → src/types}/ky-universal/hooks.js +0 -0
- package/dist/mjs/{types → src/types}/ky-universal/retry.js +0 -0
- package/dist/mjs/{utils → src/utils}/bytes.js +15 -0
- package/dist/mjs/{utils → src/utils}/collection.browser.js +0 -0
- package/dist/mjs/{utils → src/utils}/collection.js +0 -0
- package/dist/mjs/{utils → src/utils}/collection.node.js +0 -0
- package/dist/mjs/{utils → src/utils}/data.browser.js +0 -0
- package/dist/mjs/{utils → src/utils}/data.js +0 -0
- package/dist/mjs/{utils → src/utils}/error.js +0 -0
- package/dist/mjs/{utils → src/utils}/eth.js +0 -0
- package/dist/mjs/{utils → src/utils}/expose.js +0 -0
- package/dist/mjs/{utils → src/utils}/file.js +0 -0
- package/dist/mjs/{utils → src/utils}/hash.js +0 -0
- package/dist/mjs/{utils → src/utils}/headers.js +0 -0
- package/dist/mjs/{utils → src/utils}/hex.js +0 -0
- package/dist/mjs/{utils → src/utils}/http.js +7 -0
- package/dist/mjs/{utils → src/utils}/merge.js +0 -0
- package/dist/mjs/{utils → src/utils}/pss.js +0 -0
- package/dist/mjs/src/utils/reference.js +32 -0
- package/dist/mjs/{utils → src/utils}/stamps.js +0 -0
- package/dist/mjs/{utils → src/utils}/stream.js +0 -0
- package/dist/mjs/{utils → src/utils}/tar.js +0 -0
- package/dist/mjs/{utils → src/utils}/type.js +109 -2
- package/dist/mjs/{utils → src/utils}/uint64.js +0 -0
- package/dist/mjs/{utils → src/utils}/url.js +0 -0
- package/dist/mjs/test/utils.js +458 -0
- package/dist/types/{bee-debug.d.ts → src/bee-debug.d.ts} +8 -1
- package/dist/types/{bee.d.ts → src/bee.d.ts} +55 -24
- package/dist/types/{chunk → src/chunk}/bmt.d.ts +0 -0
- package/dist/types/{chunk → src/chunk}/cac.d.ts +4 -5
- package/dist/types/{chunk → src/chunk}/serialize.d.ts +0 -0
- package/dist/types/{chunk → src/chunk}/signer.d.ts +0 -0
- package/dist/types/{chunk → src/chunk}/soc.d.ts +4 -4
- package/dist/types/{chunk → src/chunk}/span.d.ts +0 -0
- package/dist/types/src/feed/identifier.d.ts +4 -0
- package/dist/types/src/feed/index.d.ts +28 -0
- package/dist/types/{feed → src/feed}/json.d.ts +0 -0
- package/dist/types/src/feed/retrievable.d.ts +5 -0
- package/dist/types/{feed → src/feed}/topic.d.ts +0 -0
- package/dist/types/{feed → src/feed}/type.d.ts +0 -0
- package/dist/types/{index.d.ts → src/index.d.ts} +0 -0
- package/dist/types/{modules → src/modules}/bytes.d.ts +3 -3
- package/dist/types/{modules → src/modules}/bzz.d.ts +3 -3
- package/dist/types/{modules → src/modules}/chunk.d.ts +2 -2
- package/dist/types/{modules → src/modules}/debug/balance.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/chequebook.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/chunk.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/connectivity.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/settlements.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/stamps.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/states.d.ts +7 -1
- package/dist/types/{modules → src/modules}/debug/status.d.ts +3 -3
- package/dist/types/{modules → src/modules}/debug/tag.d.ts +0 -0
- package/dist/types/{modules → src/modules}/debug/transactions.d.ts +0 -0
- package/dist/types/{modules → src/modules}/feed.d.ts +12 -1
- package/dist/types/{modules → src/modules}/pinning.d.ts +0 -0
- package/dist/types/{modules → src/modules}/pss.d.ts +0 -0
- package/dist/types/{modules → src/modules}/soc.d.ts +0 -0
- package/dist/types/{modules → src/modules}/status.d.ts +0 -0
- package/dist/types/{modules → src/modules}/stewardship.d.ts +3 -3
- package/dist/types/{modules → src/modules}/tag.d.ts +0 -0
- package/dist/types/{types → src/types}/debug.d.ts +19 -3
- package/dist/types/{types → src/types}/index.d.ts +33 -2
- package/dist/types/{types → src/types}/ky-options.d.ts +0 -0
- package/dist/types/{types → src/types}/ky-universal/common.d.ts +0 -0
- package/dist/types/{types → src/types}/ky-universal/hooks.d.ts +0 -0
- package/dist/types/{types → src/types}/ky-universal/retry.d.ts +0 -0
- package/dist/types/{utils → src/utils}/bytes.d.ts +7 -0
- package/dist/types/{utils → src/utils}/collection.browser.d.ts +0 -0
- package/dist/types/{utils → src/utils}/collection.d.ts +0 -0
- package/dist/types/{utils → src/utils}/collection.node.d.ts +0 -0
- package/dist/types/{utils → src/utils}/data.browser.d.ts +0 -0
- package/dist/types/{utils → src/utils}/data.d.ts +0 -0
- package/dist/types/{utils → src/utils}/error.d.ts +0 -0
- package/dist/types/{utils → src/utils}/eth.d.ts +0 -0
- package/dist/types/{utils → src/utils}/expose.d.ts +0 -0
- package/dist/types/{utils → src/utils}/file.d.ts +0 -0
- package/dist/types/{utils → src/utils}/hash.d.ts +0 -0
- package/dist/types/{utils → src/utils}/headers.d.ts +0 -0
- package/dist/types/{utils → src/utils}/hex.d.ts +0 -0
- package/dist/types/{utils → src/utils}/http.d.ts +0 -0
- package/dist/types/{utils → src/utils}/merge.d.ts +0 -0
- package/dist/types/{utils → src/utils}/pss.d.ts +0 -0
- package/dist/types/src/utils/reference.d.ts +2 -0
- package/dist/types/{utils → src/utils}/stamps.d.ts +0 -0
- package/dist/types/{utils → src/utils}/stream.d.ts +0 -0
- package/dist/types/{utils → src/utils}/tar.d.ts +0 -0
- package/dist/types/{utils → src/utils}/type.d.ts +17 -1
- package/dist/types/{utils → src/utils}/uint64.d.ts +0 -0
- package/dist/types/{utils → src/utils}/url.d.ts +0 -0
- package/dist/types/test/utils.d.ts +119 -0
- package/package.json +24 -24
- package/dist/types/feed/index.d.ts +0 -35
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { BrandedType } from '../types';
|
|
1
|
+
import { BrandedType, PlainBytesReference } from '../types';
|
|
2
2
|
import { Bytes, FlexBytes } from '../utils/bytes';
|
|
3
3
|
export declare const MIN_PAYLOAD_SIZE = 1;
|
|
4
4
|
export declare const MAX_PAYLOAD_SIZE = 4096;
|
|
5
|
-
export declare type ChunkAddress = Bytes<32>;
|
|
6
5
|
/**
|
|
7
6
|
* General chunk interface for Swarm
|
|
8
7
|
*
|
|
@@ -16,7 +15,7 @@ export interface Chunk {
|
|
|
16
15
|
readonly data: Uint8Array;
|
|
17
16
|
span(): Bytes<8>;
|
|
18
17
|
payload(): FlexBytes<1, 4096>;
|
|
19
|
-
address():
|
|
18
|
+
address(): PlainBytesReference;
|
|
20
19
|
}
|
|
21
20
|
declare type ValidChunkData = BrandedType<Uint8Array, 'ValidChunkData'>;
|
|
22
21
|
/**
|
|
@@ -31,7 +30,7 @@ export declare function makeContentAddressedChunk(payloadBytes: Uint8Array): Chu
|
|
|
31
30
|
* @param data The chunk data
|
|
32
31
|
* @param chunkAddress The address of the chunk
|
|
33
32
|
*/
|
|
34
|
-
export declare function isValidChunkData(data: unknown, chunkAddress:
|
|
33
|
+
export declare function isValidChunkData(data: unknown, chunkAddress: PlainBytesReference): data is ValidChunkData;
|
|
35
34
|
/**
|
|
36
35
|
* Asserts if data are representing given address of its chunk.
|
|
37
36
|
*
|
|
@@ -40,5 +39,5 @@ export declare function isValidChunkData(data: unknown, chunkAddress: ChunkAddre
|
|
|
40
39
|
*
|
|
41
40
|
* @returns a valid content addressed chunk or throws error
|
|
42
41
|
*/
|
|
43
|
-
export declare function assertValidChunkData(data: unknown, chunkAddress:
|
|
42
|
+
export declare function assertValidChunkData(data: unknown, chunkAddress: PlainBytesReference): asserts data is ValidChunkData;
|
|
44
43
|
export {};
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Bytes } from '../utils/bytes';
|
|
2
|
-
import { Chunk
|
|
3
|
-
import { UploadOptions, Signature, Signer, BatchId, Reference, Ky } from '../types';
|
|
2
|
+
import { Chunk } from './cac';
|
|
3
|
+
import { UploadOptions, Signature, Signer, BatchId, Reference, Ky, PlainBytesReference } from '../types';
|
|
4
4
|
import { EthAddress } from '../utils/eth';
|
|
5
5
|
export declare type Identifier = Bytes<32>;
|
|
6
6
|
/**
|
|
@@ -24,8 +24,8 @@ export interface SingleOwnerChunk extends Chunk {
|
|
|
24
24
|
*
|
|
25
25
|
* @returns a single owner chunk or throws error
|
|
26
26
|
*/
|
|
27
|
-
export declare function makeSingleOwnerChunkFromData(data: Uint8Array, address:
|
|
28
|
-
export declare function makeSOCAddress(identifier: Identifier, address: EthAddress):
|
|
27
|
+
export declare function makeSingleOwnerChunkFromData(data: Uint8Array, address: PlainBytesReference): SingleOwnerChunk;
|
|
28
|
+
export declare function makeSOCAddress(identifier: Identifier, address: EthAddress): PlainBytesReference;
|
|
29
29
|
/**
|
|
30
30
|
* Creates a single owner chunk object
|
|
31
31
|
*
|
|
File without changes
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FeedUpdateOptions } from '../modules/feed';
|
|
2
|
+
import { BatchId, BytesReference, FEED_INDEX_HEX_LENGTH, FeedReader, FeedWriter, Ky, PlainBytesReference, Reference, Signer, Topic, UploadOptions } from '../types';
|
|
3
|
+
import { Bytes } from '../utils/bytes';
|
|
4
|
+
import { HexString } from '../utils/hex';
|
|
5
|
+
import { EthAddress, HexEthAddress } from '../utils/eth';
|
|
6
|
+
import type { FeedType } from './type';
|
|
7
|
+
export interface Epoch {
|
|
8
|
+
time: number;
|
|
9
|
+
level: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Bytes of Feed's Index.
|
|
13
|
+
* For Sequential Feeds this is numeric value in big-endian.
|
|
14
|
+
*/
|
|
15
|
+
export declare type IndexBytes = Bytes<8>;
|
|
16
|
+
export declare type Index = number | Epoch | IndexBytes | string;
|
|
17
|
+
export interface FeedUploadOptions extends UploadOptions, FeedUpdateOptions {
|
|
18
|
+
}
|
|
19
|
+
export interface FeedUpdate {
|
|
20
|
+
timestamp: number;
|
|
21
|
+
reference: BytesReference;
|
|
22
|
+
}
|
|
23
|
+
export declare function findNextIndex(ky: Ky, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<HexString<typeof FEED_INDEX_HEX_LENGTH>>;
|
|
24
|
+
export declare function updateFeed(ky: Ky, signer: Signer, topic: Topic, reference: BytesReference, postageBatchId: BatchId, options?: FeedUploadOptions, index?: Index): Promise<Reference>;
|
|
25
|
+
export declare function getFeedUpdateChunkReference(owner: EthAddress, topic: Topic, index: Index): PlainBytesReference;
|
|
26
|
+
export declare function downloadFeedUpdate(ky: Ky, owner: EthAddress, topic: Topic, index: Index): Promise<FeedUpdate>;
|
|
27
|
+
export declare function makeFeedReader(ky: Ky, type: FeedType, topic: Topic, owner: HexEthAddress): FeedReader;
|
|
28
|
+
export declare function makeFeedWriter(ky: Ky, type: FeedType, topic: Topic, signer: Signer): FeedWriter;
|
|
File without changes
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Bee } from '../bee';
|
|
2
|
+
import { EthAddress } from '../utils/eth';
|
|
3
|
+
import { RequestOptions, Topic } from '../types';
|
|
4
|
+
import { Index } from './index';
|
|
5
|
+
export declare function areAllSequentialFeedsUpdateRetrievable(bee: Bee, owner: EthAddress, topic: Topic, index: Index, options?: RequestOptions): Promise<boolean>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BatchId, Data, Ky,
|
|
1
|
+
import type { BatchId, Data, Ky, ReferenceOrEns, UploadOptions } from '../types';
|
|
2
2
|
import { UploadResult } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Upload data to a Bee node
|
|
@@ -15,11 +15,11 @@ export declare function upload(ky: Ky, data: string | Uint8Array, postageBatchId
|
|
|
15
15
|
* @param ky
|
|
16
16
|
* @param hash Bee content reference
|
|
17
17
|
*/
|
|
18
|
-
export declare function download(ky: Ky, hash:
|
|
18
|
+
export declare function download(ky: Ky, hash: ReferenceOrEns): Promise<Data>;
|
|
19
19
|
/**
|
|
20
20
|
* Download data as a readable stream
|
|
21
21
|
*
|
|
22
22
|
* @param ky
|
|
23
23
|
* @param hash Bee content reference
|
|
24
24
|
*/
|
|
25
|
-
export declare function downloadReadable(ky: Ky, hash:
|
|
25
|
+
export declare function downloadReadable(ky: Ky, hash: ReferenceOrEns): Promise<ReadableStream<Uint8Array>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchId, Collection, CollectionUploadOptions, Data, FileData, FileUploadOptions, Ky, Readable, UploadResult } from '../types';
|
|
1
|
+
import { BatchId, Collection, CollectionUploadOptions, Data, FileData, FileUploadOptions, Ky, Readable, ReferenceOrEns, UploadResult } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Upload single file
|
|
4
4
|
*
|
|
@@ -16,7 +16,7 @@ export declare function uploadFile(ky: Ky, data: string | Uint8Array | Readable
|
|
|
16
16
|
* @param hash Bee file or collection hash
|
|
17
17
|
* @param path If hash is collection then this defines path to a single file in the collection
|
|
18
18
|
*/
|
|
19
|
-
export declare function downloadFile(ky: Ky, hash:
|
|
19
|
+
export declare function downloadFile(ky: Ky, hash: ReferenceOrEns, path?: string): Promise<FileData<Data>>;
|
|
20
20
|
/**
|
|
21
21
|
* Download single file as a readable stream
|
|
22
22
|
*
|
|
@@ -24,7 +24,7 @@ export declare function downloadFile(ky: Ky, hash: string, path?: string): Promi
|
|
|
24
24
|
* @param hash Bee file or collection hash
|
|
25
25
|
* @param path If hash is collection then this defines path to a single file in the collection
|
|
26
26
|
*/
|
|
27
|
-
export declare function downloadFileReadable(ky: Ky, hash:
|
|
27
|
+
export declare function downloadFileReadable(ky: Ky, hash: ReferenceOrEns, path?: string): Promise<FileData<ReadableStream<Uint8Array>>>;
|
|
28
28
|
/**
|
|
29
29
|
* Upload collection
|
|
30
30
|
* @param ky Ky instance for given Bee class instance
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BatchId, Data, Ky, Reference, UploadOptions } from '../types';
|
|
1
|
+
import type { BatchId, Data, Ky, Reference, ReferenceOrEns, UploadOptions } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Upload chunk to a Bee node
|
|
4
4
|
*
|
|
@@ -19,4 +19,4 @@ export declare function upload(ky: Ky, data: Uint8Array, postageBatchId: BatchId
|
|
|
19
19
|
* @param hash Bee content reference
|
|
20
20
|
*
|
|
21
21
|
*/
|
|
22
|
-
export declare function download(ky: Ky, hash:
|
|
22
|
+
export declare function download(ky: Ky, hash: ReferenceOrEns): Promise<Data>;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ChainState, Ky, ReserveState } from '../../types';
|
|
1
|
+
import { ChainState, Ky, ReserveState, WalletBalance } from '../../types';
|
|
2
2
|
/**
|
|
3
3
|
* Get state of reserve
|
|
4
4
|
*
|
|
@@ -11,3 +11,9 @@ export declare function getReserveState(ky: Ky): Promise<ReserveState>;
|
|
|
11
11
|
* @param ky Ky debug instance
|
|
12
12
|
*/
|
|
13
13
|
export declare function getChainState(ky: Ky): Promise<ChainState>;
|
|
14
|
+
/**
|
|
15
|
+
* Get wallet balances for xDai and BZZ of the node
|
|
16
|
+
*
|
|
17
|
+
* @param ky Ky debug instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function getWalletBalance(ky: Ky): Promise<WalletBalance>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
2
|
import { Ky } from '../../types';
|
|
3
3
|
import { BeeVersions } from '../../types/debug';
|
|
4
|
-
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.
|
|
5
|
-
export declare const SUPPORTED_API_VERSION = "3.0.
|
|
6
|
-
export declare const SUPPORTED_DEBUG_API_VERSION = "2.0.
|
|
4
|
+
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.6.0-6ceadd35";
|
|
5
|
+
export declare const SUPPORTED_API_VERSION = "3.0.1";
|
|
6
|
+
export declare const SUPPORTED_DEBUG_API_VERSION = "2.0.1";
|
|
7
7
|
export declare const SUPPORTED_BEE_VERSION: string;
|
|
8
8
|
/**
|
|
9
9
|
* Get health of node
|
|
File without changes
|
|
File without changes
|
|
@@ -13,9 +13,20 @@ export interface FeedUpdateOptions {
|
|
|
13
13
|
* Can be 'epoch' or 'sequence' (default: 'sequence')
|
|
14
14
|
*/
|
|
15
15
|
type?: FeedType;
|
|
16
|
+
/**
|
|
17
|
+
* Fetch specific previous Feed's update (default fetches latest update)
|
|
18
|
+
*/
|
|
19
|
+
index?: string;
|
|
16
20
|
}
|
|
17
21
|
interface FeedUpdateHeaders {
|
|
22
|
+
/**
|
|
23
|
+
* The current feed's index
|
|
24
|
+
*/
|
|
18
25
|
feedIndex: string;
|
|
26
|
+
/**
|
|
27
|
+
* The feed's index for next update.
|
|
28
|
+
* Only set for the latest update. If update is fetched using previous index, then this is an empty string.
|
|
29
|
+
*/
|
|
19
30
|
feedIndexNext: string;
|
|
20
31
|
}
|
|
21
32
|
export interface FetchFeedUpdateResponse extends ReferenceResponse, FeedUpdateHeaders {
|
|
@@ -43,5 +54,5 @@ export declare function createFeedManifest(ky: Ky, owner: HexEthAddress, topic:
|
|
|
43
54
|
* @param topic Topic in hex
|
|
44
55
|
* @param options Additional options, like index, at, type
|
|
45
56
|
*/
|
|
46
|
-
export declare function
|
|
57
|
+
export declare function fetchLatestFeedUpdate(ky: Ky, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse>;
|
|
47
58
|
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Ky,
|
|
1
|
+
import type { Ky, ReferenceOrEns } from '../types';
|
|
2
2
|
/**
|
|
3
3
|
* Reupload locally pinned data
|
|
4
4
|
* @param ky Ky instance
|
|
@@ -6,5 +6,5 @@ import type { Ky, Reference } from '../types';
|
|
|
6
6
|
* @param options
|
|
7
7
|
* @throws BeeResponseError if not locally pinned or invalid data
|
|
8
8
|
*/
|
|
9
|
-
export declare function reupload(ky: Ky, reference:
|
|
10
|
-
export declare function isRetrievable(ky: Ky, reference:
|
|
9
|
+
export declare function reupload(ky: Ky, reference: ReferenceOrEns): Promise<void>;
|
|
10
|
+
export declare function isRetrievable(ky: Ky, reference: ReferenceOrEns): Promise<boolean>;
|
|
File without changes
|
|
@@ -207,13 +207,29 @@ export interface PingResponse {
|
|
|
207
207
|
}
|
|
208
208
|
export interface ReserveState {
|
|
209
209
|
radius: number;
|
|
210
|
+
commitment: number;
|
|
210
211
|
storageRadius: number;
|
|
211
|
-
available: number;
|
|
212
|
-
outer: NumberString;
|
|
213
|
-
inner: NumberString;
|
|
214
212
|
}
|
|
215
213
|
export interface ChainState {
|
|
216
214
|
block: number;
|
|
217
215
|
totalAmount: NumberString;
|
|
218
216
|
currentPrice: NumberString;
|
|
219
217
|
}
|
|
218
|
+
export interface WalletBalance {
|
|
219
|
+
/**
|
|
220
|
+
* Balance of BZZ tokens
|
|
221
|
+
*/
|
|
222
|
+
bzz: NumberString;
|
|
223
|
+
/**
|
|
224
|
+
* Balance of xDai
|
|
225
|
+
*/
|
|
226
|
+
xDai: NumberString;
|
|
227
|
+
/**
|
|
228
|
+
* Chain network ID to which the Bee node is connected
|
|
229
|
+
*/
|
|
230
|
+
chainID: number;
|
|
231
|
+
/**
|
|
232
|
+
* Chequebook contract address
|
|
233
|
+
*/
|
|
234
|
+
contractAddress: string;
|
|
235
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { Identifier, SingleOwnerChunk } from '../chunk/soc';
|
|
3
|
-
import type {
|
|
3
|
+
import type { FeedUploadOptions } from '../feed';
|
|
4
4
|
import type { FeedType } from '../feed/type';
|
|
5
5
|
import type { FeedUpdateOptions, FetchFeedUpdateResponse } from '../modules/feed';
|
|
6
6
|
import type { Bytes } from '../utils/bytes';
|
|
@@ -39,6 +39,7 @@ export declare const STAMPS_DEPTH_MIN = 17;
|
|
|
39
39
|
export declare const STAMPS_DEPTH_MAX = 255;
|
|
40
40
|
export declare const TAGS_LIMIT_MIN = 1;
|
|
41
41
|
export declare const TAGS_LIMIT_MAX = 1000;
|
|
42
|
+
export declare const FEED_INDEX_HEX_LENGTH = 16;
|
|
42
43
|
/**
|
|
43
44
|
* Generic reference that can be either non-encrypted reference which is a hex string of length 64 or encrypted
|
|
44
45
|
* reference which is a hex string of length 128.
|
|
@@ -48,6 +49,17 @@ export declare const TAGS_LIMIT_MAX = 1000;
|
|
|
48
49
|
* @see [Bee docs - Store with Encryption](https://docs.ethswarm.org/docs/access-the-swarm/store-with-encryption)
|
|
49
50
|
*/
|
|
50
51
|
export declare type Reference = HexString<typeof REFERENCE_HEX_LENGTH> | HexString<typeof ENCRYPTED_REFERENCE_HEX_LENGTH>;
|
|
52
|
+
/**
|
|
53
|
+
* Type that represents either Swarm's reference in hex string or ESN domain (something.eth).
|
|
54
|
+
*/
|
|
55
|
+
export declare type ReferenceOrEns = Reference | string;
|
|
56
|
+
/**
|
|
57
|
+
* Type that represents either Swarm's reference in hex string, ESN domain (something.eth) or CID using one of the Swarm's codecs.
|
|
58
|
+
*/
|
|
59
|
+
export declare type ReferenceCidOrEns = ReferenceOrEns | string;
|
|
60
|
+
export declare type PlainBytesReference = Bytes<typeof REFERENCE_BYTES_LENGTH>;
|
|
61
|
+
export declare type EncryptedBytesReference = Bytes<typeof ENCRYPTED_REFERENCE_BYTES_LENGTH>;
|
|
62
|
+
export declare type BytesReference = PlainBytesReference | EncryptedBytesReference;
|
|
51
63
|
export declare type PublicKey = HexString<typeof PUBKEY_HEX_LENGTH>;
|
|
52
64
|
export declare type Address = HexString<typeof ADDRESS_HEX_LENGTH>;
|
|
53
65
|
/**
|
|
@@ -111,6 +123,9 @@ export interface BeeOptions extends RequestOptions {
|
|
|
111
123
|
*/
|
|
112
124
|
onResponse?: HookCallback<BeeResponse>;
|
|
113
125
|
}
|
|
126
|
+
export interface UploadResultWithCid extends UploadResult {
|
|
127
|
+
cid: string;
|
|
128
|
+
}
|
|
114
129
|
/**
|
|
115
130
|
* Result of upload calls.
|
|
116
131
|
*/
|
|
@@ -356,7 +371,7 @@ export interface FeedWriter extends FeedReader {
|
|
|
356
371
|
*
|
|
357
372
|
* @returns Reference that points at Single Owner Chunk that contains the new update and pointer to the updated chunk reference.
|
|
358
373
|
*/
|
|
359
|
-
upload(postageBatchId: string | BatchId, reference:
|
|
374
|
+
upload(postageBatchId: string | BatchId, reference: BytesReference | Reference, options?: FeedUploadOptions): Promise<Reference>;
|
|
360
375
|
}
|
|
361
376
|
/**
|
|
362
377
|
* Interface for downloading single owner chunks
|
|
@@ -441,6 +456,22 @@ export interface PostageBatchOptions extends RequestOptions {
|
|
|
441
456
|
*/
|
|
442
457
|
gasPrice?: NumberString;
|
|
443
458
|
immutableFlag?: boolean;
|
|
459
|
+
/**
|
|
460
|
+
* The returned Promise will await until the purchased Postage Batch is usable.
|
|
461
|
+
* In other word, it has to have enough block confirmations that Bee pronounce it usable.
|
|
462
|
+
* If turned on, this significantly prolong the creation of postage batch!
|
|
463
|
+
* If you plan to use the stamp right away for some action with Bee (like uploading using this stamp) it is
|
|
464
|
+
* highly recommended to use this option, otherwise you might get errors "stamp not usable" from Bee.
|
|
465
|
+
*
|
|
466
|
+
* In next breaking release this option will be turned on by default.
|
|
467
|
+
* @default false
|
|
468
|
+
*/
|
|
469
|
+
waitForUsable?: boolean;
|
|
470
|
+
/**
|
|
471
|
+
* When waiting for the postage stamp to become usable, this specify the timeout for the waiting.
|
|
472
|
+
* Default: 120s
|
|
473
|
+
*/
|
|
474
|
+
waitForUsableTimeout?: number;
|
|
444
475
|
}
|
|
445
476
|
/**
|
|
446
477
|
* With this type a number should be represented in a string
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -28,6 +28,13 @@ export interface FlexBytes<Min extends number, Max extends number> extends Uint8
|
|
|
28
28
|
* @param length The length of the byte array
|
|
29
29
|
*/
|
|
30
30
|
export declare function isBytes<Length extends number>(b: unknown, length: Length): b is Bytes<Length>;
|
|
31
|
+
/**
|
|
32
|
+
* Function that verifies if passed data are Bytes and if the array has "length" number of bytes under given offset.
|
|
33
|
+
* @param data
|
|
34
|
+
* @param offset
|
|
35
|
+
* @param length
|
|
36
|
+
*/
|
|
37
|
+
export declare function hasBytesAtOffset(data: unknown, offset: number, length: number): boolean;
|
|
31
38
|
/**
|
|
32
39
|
* Verifies if a byte array has a certain length
|
|
33
40
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions } from '../types';
|
|
1
|
+
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns, UploadResult, UploadResultWithCid } from '../types';
|
|
2
|
+
import { ReferenceType } from '@ethersphere/swarm-cid';
|
|
2
3
|
export declare function isUint8Array(obj: unknown): obj is Uint8Array;
|
|
3
4
|
export declare function isInteger(value: unknown): value is number | NumberString;
|
|
4
5
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -22,7 +23,22 @@ export declare function assertStrictlyObject(value: unknown, name?: string): ass
|
|
|
22
23
|
export declare function assertBoolean(value: unknown, name?: string): asserts value is boolean;
|
|
23
24
|
export declare function assertInteger(value: unknown, name?: string): asserts value is number | NumberString;
|
|
24
25
|
export declare function assertNonNegativeInteger(value: unknown, name?: string): asserts value is number | NumberString;
|
|
26
|
+
export declare function assertPositiveInteger(value: unknown, name?: string): asserts value is number | NumberString;
|
|
25
27
|
export declare function assertReference(value: unknown): asserts value is Reference;
|
|
28
|
+
export declare function assertReferenceOrEns(value: unknown): asserts value is ReferenceOrEns;
|
|
29
|
+
/**
|
|
30
|
+
* Function that mainly converts Swarm CID into hex encoded Swarm Reference
|
|
31
|
+
*
|
|
32
|
+
* @param value
|
|
33
|
+
* @param expectedCidType
|
|
34
|
+
*/
|
|
35
|
+
export declare function makeReferenceOrEns(value: unknown, expectedCidType: ReferenceType): ReferenceOrEns;
|
|
36
|
+
/**
|
|
37
|
+
* Function that adds getter which converts the reference into CID base32 encoded string.
|
|
38
|
+
* @param result
|
|
39
|
+
* @param cidType Type as described in the @ethersphere/swarm-cids-js -> ReferenceType
|
|
40
|
+
*/
|
|
41
|
+
export declare function addCidConversionFunction(result: UploadResult, cidType: ReferenceType): UploadResultWithCid;
|
|
26
42
|
export declare function assertAddress(value: unknown): asserts value is Address;
|
|
27
43
|
export declare function assertBatchId(value: unknown): asserts value is BatchId;
|
|
28
44
|
export declare function assertRequestOptions(value: unknown, name?: string): asserts value is RequestOptions;
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { Readable } from 'stream';
|
|
3
|
+
import type { Ky, BeeGenericResponse, Reference, Address, BatchId, PostageBatch, PlainBytesReference } from '../src/types';
|
|
4
|
+
import { HexString } from '../src/utils/hex';
|
|
5
|
+
declare global {
|
|
6
|
+
namespace jest {
|
|
7
|
+
interface Matchers<R> {
|
|
8
|
+
toBeHashReference(): R;
|
|
9
|
+
toBeBeeResponse(expectedStatusCode: number): R;
|
|
10
|
+
toBeOneOf(el: unknown[]): R;
|
|
11
|
+
toBeType(type: string): R;
|
|
12
|
+
toBeNumberString(): R;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Load common own Jest Matchers which can be used to check particular return values.
|
|
18
|
+
*/
|
|
19
|
+
export declare function commonMatchers(): void;
|
|
20
|
+
/**
|
|
21
|
+
* Sleep for N miliseconds
|
|
22
|
+
*
|
|
23
|
+
* @param ms Number of miliseconds to sleep
|
|
24
|
+
*/
|
|
25
|
+
export declare function sleep(ms: number): Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Helper function that reads whole content of ReadableStream
|
|
28
|
+
* @param stream
|
|
29
|
+
*/
|
|
30
|
+
export declare function readWholeUint8ArrayReadableStream(stream: ReadableStream<Uint8Array>): Promise<Uint8Array>;
|
|
31
|
+
export declare function createRandomNodeReadable(totalSize: number, chunkSize?: number): Readable;
|
|
32
|
+
export declare function createReadableStream(iterable: Iterable<Uint8Array>): ReadableStream;
|
|
33
|
+
/**
|
|
34
|
+
* Utility function for generating random Buffer
|
|
35
|
+
* !!! IT IS NOT CRYPTO SAFE !!!
|
|
36
|
+
* For that use `crypto.randomBytes()`
|
|
37
|
+
*
|
|
38
|
+
* @param length Number of bytes to generate
|
|
39
|
+
* @param seed Seed for the pseudo-random generator
|
|
40
|
+
*/
|
|
41
|
+
export declare function randomByteArray(length: number, seed?: number): Uint8Array;
|
|
42
|
+
/**
|
|
43
|
+
* Returns a url for testing the Bee public API
|
|
44
|
+
*/
|
|
45
|
+
export declare function beeUrl(): string;
|
|
46
|
+
export declare function beeKy(): Ky;
|
|
47
|
+
/**
|
|
48
|
+
* Returns a url of another peer for testing the Bee public API
|
|
49
|
+
*/
|
|
50
|
+
export declare function beePeerUrl(): string;
|
|
51
|
+
export declare function beePeerKy(): Ky;
|
|
52
|
+
/**
|
|
53
|
+
* Helper function that create monster batch for all the tests.
|
|
54
|
+
* There is semaphore mechanism that allows only creation of one batch across all the
|
|
55
|
+
* parallel running tests that have to wait until it is created.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getPostageBatch(url?: string): BatchId;
|
|
58
|
+
/**
|
|
59
|
+
* Returns a url for testing the Bee Debug API
|
|
60
|
+
*/
|
|
61
|
+
export declare function beeDebugUrl(): string;
|
|
62
|
+
export declare function beeDebugKy(): Ky;
|
|
63
|
+
/**
|
|
64
|
+
* Returns a url for testing the Bee Debug API
|
|
65
|
+
*/
|
|
66
|
+
export declare function beePeerDebugUrl(): string;
|
|
67
|
+
export declare function beePeerDebugKy(): Ky;
|
|
68
|
+
/**
|
|
69
|
+
* Try to delete a chunk from local storage, ignoring all errors
|
|
70
|
+
*
|
|
71
|
+
* @param address Swarm address of chunk
|
|
72
|
+
*/
|
|
73
|
+
export declare function tryDeleteChunkFromLocalStorage(address: string | PlainBytesReference): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Formatting utility for displaying long strings like hexstrings.
|
|
76
|
+
*
|
|
77
|
+
* @param inputStr
|
|
78
|
+
* @param len
|
|
79
|
+
*/
|
|
80
|
+
export declare function shorten(inputStr: unknown, len?: number): string;
|
|
81
|
+
export declare function waitForBatchToBeUsable(batchId: string, pollingInterval?: number): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Returns already existing batch or will create one.
|
|
84
|
+
*
|
|
85
|
+
* If some specification is passed then it is guaranteed that the batch will have this property(ies)
|
|
86
|
+
*
|
|
87
|
+
* @param amount
|
|
88
|
+
* @param depth
|
|
89
|
+
* @param immutable
|
|
90
|
+
*/
|
|
91
|
+
export declare function getOrCreatePostageBatch(amount?: string, depth?: number, immutable?: boolean): Promise<PostageBatch>;
|
|
92
|
+
export declare function makeTestTarget(target: string): string;
|
|
93
|
+
export declare const invalidReference: Reference;
|
|
94
|
+
export declare const okResponse: BeeGenericResponse;
|
|
95
|
+
export declare const createdResponse: BeeGenericResponse;
|
|
96
|
+
export declare const ERR_TIMEOUT = 40000;
|
|
97
|
+
export declare const BIG_FILE_TIMEOUT = 100000;
|
|
98
|
+
export declare const PSS_TIMEOUT = 120000;
|
|
99
|
+
export declare const FEED_TIMEOUT = 120000;
|
|
100
|
+
export declare const BLOCKCHAIN_TRANSACTION_TIMEOUT = 40000;
|
|
101
|
+
export declare const WAITING_USABLE_STAMP_TIMEOUT = 130000;
|
|
102
|
+
export declare const testChunkPayload: Uint8Array;
|
|
103
|
+
export declare const testChunkSpan: Uint8Array;
|
|
104
|
+
export declare const testChunkData: Uint8Array;
|
|
105
|
+
export declare const testChunkHash: Reference;
|
|
106
|
+
export declare const testAddress: Address;
|
|
107
|
+
export declare const testBatchId: BatchId;
|
|
108
|
+
export declare const testJsonPayload: {
|
|
109
|
+
some: string;
|
|
110
|
+
}[];
|
|
111
|
+
export declare const testJsonStringPayload: string;
|
|
112
|
+
export declare const testJsonHash = "872a858115b8bee4408b1427b49e472883fdc2512d5a8f2d428b97ecc8f7ccfa";
|
|
113
|
+
export declare const testJsonCid = "bah5acgzaq4vilaivxc7oiqelcqt3jhshfcb73qsrfvni6lkcrol6zshxzt5a";
|
|
114
|
+
export declare const testJsonEns = "testing.eth";
|
|
115
|
+
export declare const testIdentity: {
|
|
116
|
+
privateKey: HexString<number>;
|
|
117
|
+
publicKey: HexString<number>;
|
|
118
|
+
address: HexString<number>;
|
|
119
|
+
};
|