@ethersphere/bee-js 4.0.0 → 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 -14
- package/dist/cjs/{bee-debug.js → src/bee-debug.js} +31 -8
- package/dist/cjs/{bee.js → src/bee.js} +12 -10
- 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/{feed → src/feed}/identifier.js +0 -0
- package/dist/cjs/{feed → src/feed}/index.js +0 -0
- package/dist/cjs/{feed → src/feed}/json.js +0 -0
- package/dist/cjs/{feed → src/feed}/retrievable.js +0 -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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- 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/{utils → src/utils}/reference.js +0 -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 +66 -2
- 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} +15 -13
- package/dist/mjs/{chunk → src/chunk}/bmt.js +0 -0
- package/dist/mjs/{chunk → src/chunk}/cac.js +0 -0
- 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/{feed → src/feed}/identifier.js +0 -0
- package/dist/mjs/{feed → src/feed}/index.js +0 -0
- package/dist/mjs/{feed → src/feed}/json.js +0 -0
- package/dist/mjs/{feed → src/feed}/retrievable.js +0 -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 +0 -0
- 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 +0 -0
- 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 +0 -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 +0 -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/{utils → src/utils}/reference.js +0 -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 +72 -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} +11 -10
- package/dist/types/{chunk → src/chunk}/bmt.d.ts +0 -0
- package/dist/types/{chunk → src/chunk}/cac.d.ts +0 -0
- 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 +0 -0
- package/dist/types/{chunk → src/chunk}/span.d.ts +0 -0
- package/dist/types/{feed → src/feed}/identifier.d.ts +0 -0
- package/dist/types/{feed → src/feed}/index.d.ts +0 -0
- package/dist/types/{feed → src/feed}/json.d.ts +0 -0
- package/dist/types/{feed → src/feed}/retrievable.d.ts +0 -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 +0 -0
- package/dist/types/{modules → src/modules}/bzz.d.ts +0 -0
- package/dist/types/{modules → src/modules}/chunk.d.ts +0 -0
- 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 +0 -0
- 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 +0 -0
- 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 +0 -0
- package/dist/types/{modules → src/modules}/tag.d.ts +0 -0
- package/dist/types/{types → src/types}/debug.d.ts +18 -0
- package/dist/types/{types → src/types}/index.d.ts +23 -1
- 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 +0 -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/{utils → src/utils}/reference.d.ts +0 -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 +16 -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 +5 -4
|
@@ -215,3 +215,21 @@ export interface ChainState {
|
|
|
215
215
|
totalAmount: NumberString;
|
|
216
216
|
currentPrice: NumberString;
|
|
217
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
|
+
}
|
|
@@ -51,9 +51,12 @@ export declare const FEED_INDEX_HEX_LENGTH = 16;
|
|
|
51
51
|
export declare type Reference = HexString<typeof REFERENCE_HEX_LENGTH> | HexString<typeof ENCRYPTED_REFERENCE_HEX_LENGTH>;
|
|
52
52
|
/**
|
|
53
53
|
* Type that represents either Swarm's reference in hex string or ESN domain (something.eth).
|
|
54
|
-
* This is the type used on all the download functions.
|
|
55
54
|
*/
|
|
56
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;
|
|
57
60
|
export declare type PlainBytesReference = Bytes<typeof REFERENCE_BYTES_LENGTH>;
|
|
58
61
|
export declare type EncryptedBytesReference = Bytes<typeof ENCRYPTED_REFERENCE_BYTES_LENGTH>;
|
|
59
62
|
export declare type BytesReference = PlainBytesReference | EncryptedBytesReference;
|
|
@@ -120,6 +123,9 @@ export interface BeeOptions extends RequestOptions {
|
|
|
120
123
|
*/
|
|
121
124
|
onResponse?: HookCallback<BeeResponse>;
|
|
122
125
|
}
|
|
126
|
+
export interface UploadResultWithCid extends UploadResult {
|
|
127
|
+
cid: string;
|
|
128
|
+
}
|
|
123
129
|
/**
|
|
124
130
|
* Result of upload calls.
|
|
125
131
|
*/
|
|
@@ -450,6 +456,22 @@ export interface PostageBatchOptions extends RequestOptions {
|
|
|
450
456
|
*/
|
|
451
457
|
gasPrice?: NumberString;
|
|
452
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;
|
|
453
475
|
}
|
|
454
476
|
/**
|
|
455
477
|
* With this type a number should be represented in a string
|
|
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
|
|
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, ReferenceOrEns } 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,8 +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;
|
|
26
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;
|
|
27
42
|
export declare function assertAddress(value: unknown): asserts value is Address;
|
|
28
43
|
export declare function assertBatchId(value: unknown): asserts value is BatchId;
|
|
29
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"bee": "bee-factory start"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
+
"@ethersphere/swarm-cid": "^0.1.0",
|
|
67
68
|
"@types/readable-stream": "^2.3.13",
|
|
68
69
|
"bufferutil": "^4.0.6",
|
|
69
70
|
"elliptic": "^6.5.4",
|
|
@@ -87,7 +88,7 @@
|
|
|
87
88
|
"@babel/preset-typescript": "^7.14.5",
|
|
88
89
|
"@commitlint/cli": "^16.2.3",
|
|
89
90
|
"@commitlint/config-conventional": "^16.2.1",
|
|
90
|
-
"@ethersphere/bee-factory": "^0.4.
|
|
91
|
+
"@ethersphere/bee-factory": "^0.4.1",
|
|
91
92
|
"@fluffy-spoon/substitute": "^1.208.0",
|
|
92
93
|
"@jest/test-sequencer": "^27.5.0",
|
|
93
94
|
"@jest/types": "^27.5.1",
|
|
@@ -103,8 +104,8 @@
|
|
|
103
104
|
"@types/semver": "^7.3.9",
|
|
104
105
|
"@types/ws": "^8.5.3",
|
|
105
106
|
"@typescript-eslint/eslint-plugin": "^5.10.0",
|
|
106
|
-
"@typescript-eslint/parser": "^5.
|
|
107
|
-
"babel-jest": "^
|
|
107
|
+
"@typescript-eslint/parser": "^5.26.0",
|
|
108
|
+
"babel-jest": "^28.1.0",
|
|
108
109
|
"babel-loader": "^8.2.5",
|
|
109
110
|
"babel-plugin-add-import-extension": "^1.6.0",
|
|
110
111
|
"cross-blob": "^2.0.1",
|