@ethersphere/bee-js 5.2.0 → 6.0.0-pre.1
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/dist/cjs/bee-debug.js +58 -72
- package/dist/cjs/bee.js +71 -86
- package/dist/cjs/chunk/soc.js +14 -14
- package/dist/cjs/feed/index.js +20 -21
- package/dist/cjs/feed/json.js +2 -2
- package/dist/cjs/feed/retrievable.js +7 -8
- package/dist/cjs/index.js +7 -7
- package/dist/cjs/modules/bytes.js +15 -15
- package/dist/cjs/modules/bzz.js +24 -25
- package/dist/cjs/modules/chunk.js +10 -10
- package/dist/cjs/modules/debug/balance.js +16 -16
- package/dist/cjs/modules/debug/chequebook.js +34 -34
- package/dist/cjs/modules/debug/chunk.js +8 -8
- package/dist/cjs/modules/debug/connectivity.js +24 -24
- package/dist/cjs/modules/debug/settlements.js +8 -8
- package/dist/cjs/modules/debug/stake.js +11 -11
- package/dist/cjs/modules/debug/stamps.js +25 -25
- package/dist/cjs/modules/debug/states.js +12 -12
- package/dist/cjs/modules/debug/status.js +24 -24
- package/dist/cjs/modules/debug/tag.js +4 -4
- package/dist/cjs/modules/debug/transactions.js +16 -16
- package/dist/cjs/modules/feed.js +14 -14
- package/dist/cjs/modules/pinning.js +14 -14
- package/dist/cjs/modules/pss.js +6 -6
- package/dist/cjs/modules/soc.js +6 -6
- package/dist/cjs/modules/status.js +3 -3
- package/dist/cjs/modules/stewardship.js +7 -7
- package/dist/cjs/modules/tag.js +20 -20
- package/dist/cjs/utils/error.js +1 -35
- package/dist/cjs/utils/headers.js +3 -3
- package/dist/cjs/utils/http.js +14 -141
- package/dist/cjs/utils/type.js +1 -4
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +0 -8
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +59 -73
- package/dist/mjs/bee.js +72 -87
- package/dist/mjs/chunk/soc.js +14 -14
- package/dist/mjs/feed/index.js +20 -21
- package/dist/mjs/feed/json.js +2 -2
- package/dist/mjs/feed/retrievable.js +7 -8
- package/dist/mjs/index.js +2 -2
- package/dist/mjs/modules/bytes.js +15 -15
- package/dist/mjs/modules/bzz.js +24 -25
- package/dist/mjs/modules/chunk.js +10 -10
- package/dist/mjs/modules/debug/balance.js +16 -16
- package/dist/mjs/modules/debug/chequebook.js +34 -34
- package/dist/mjs/modules/debug/chunk.js +8 -8
- package/dist/mjs/modules/debug/connectivity.js +24 -24
- package/dist/mjs/modules/debug/settlements.js +8 -8
- package/dist/mjs/modules/debug/stake.js +11 -11
- package/dist/mjs/modules/debug/stamps.js +25 -25
- package/dist/mjs/modules/debug/states.js +12 -12
- package/dist/mjs/modules/debug/status.js +24 -25
- package/dist/mjs/modules/debug/tag.js +4 -4
- package/dist/mjs/modules/debug/transactions.js +16 -16
- package/dist/mjs/modules/feed.js +14 -14
- package/dist/mjs/modules/pinning.js +14 -14
- package/dist/mjs/modules/pss.js +6 -6
- package/dist/mjs/modules/soc.js +6 -6
- package/dist/mjs/modules/status.js +3 -3
- package/dist/mjs/modules/stewardship.js +7 -7
- package/dist/mjs/modules/tag.js +20 -20
- package/dist/mjs/utils/error.js +0 -31
- package/dist/mjs/utils/headers.js +3 -3
- package/dist/mjs/utils/http.js +10 -138
- package/dist/mjs/utils/type.js +2 -5
- package/dist/types/bee-debug.d.ts +50 -50
- package/dist/types/bee.d.ts +34 -34
- package/dist/types/chunk/soc.d.ts +5 -6
- package/dist/types/feed/index.d.ts +7 -8
- package/dist/types/feed/json.d.ts +2 -2
- package/dist/types/feed/retrievable.d.ts +2 -2
- package/dist/types/index.d.ts +2 -4
- package/dist/types/modules/bytes.d.ts +4 -5
- package/dist/types/modules/bzz.d.ts +5 -6
- package/dist/types/modules/chunk.d.ts +3 -4
- package/dist/types/modules/debug/balance.d.ts +5 -6
- package/dist/types/modules/debug/chequebook.d.ts +9 -10
- package/dist/types/modules/debug/chunk.d.ts +3 -4
- package/dist/types/modules/debug/connectivity.d.ts +7 -8
- package/dist/types/modules/debug/settlements.d.ts +3 -4
- package/dist/types/modules/debug/stake.d.ts +4 -5
- package/dist/types/modules/debug/stamps.d.ts +7 -8
- package/dist/types/modules/debug/states.d.ts +4 -5
- package/dist/types/modules/debug/status.d.ts +10 -10
- package/dist/types/modules/debug/tag.d.ts +2 -3
- package/dist/types/modules/debug/transactions.d.ts +5 -6
- package/dist/types/modules/feed.d.ts +3 -4
- package/dist/types/modules/pinning.d.ts +5 -6
- package/dist/types/modules/pss.d.ts +2 -3
- package/dist/types/modules/soc.d.ts +2 -3
- package/dist/types/modules/status.d.ts +2 -2
- package/dist/types/modules/stewardship.d.ts +3 -4
- package/dist/types/modules/tag.d.ts +6 -7
- package/dist/types/types/debug.d.ts +2 -2
- package/dist/types/types/index.d.ts +12 -51
- package/dist/types/utils/error.d.ts +0 -26
- package/dist/types/utils/headers.d.ts +1 -1
- package/dist/types/utils/http.d.ts +12 -21
- package/dist/types/utils/type.d.ts +2 -2
- package/package.json +4 -4
- package/dist/223.index.browser.min.js +0 -3
- package/dist/223.index.browser.min.js.LICENSE.txt +0 -1
- package/dist/223.index.browser.min.js.map +0 -1
- package/dist/cjs/utils/merge.js +0 -34
- package/dist/cjs/utils/sleep.js +0 -12
- package/dist/mjs/utils/merge.js +0 -32
- package/dist/mjs/utils/sleep.js +0 -8
- package/dist/types/utils/merge.d.ts +0 -8
- package/dist/types/utils/sleep.d.ts +0 -6
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import type { AllSettlements, BeeRequestOptions, Settlements } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Get amount of sent and received from settlements with a peer
|
|
5
4
|
*
|
|
6
5
|
* @param kyOptions Ky Options for making requests
|
|
7
6
|
* @param peer Swarm address of peer
|
|
8
7
|
*/
|
|
9
|
-
export declare function getSettlements(
|
|
8
|
+
export declare function getSettlements(requestOptions: BeeRequestOptions, peer: string): Promise<Settlements>;
|
|
10
9
|
/**
|
|
11
10
|
* Get settlements with all known peers and total amount sent or received
|
|
12
11
|
*
|
|
13
12
|
* @param kyOptions Ky Options for making requests
|
|
14
13
|
*/
|
|
15
|
-
export declare function getAllSettlements(
|
|
14
|
+
export declare function getAllSettlements(requestOptions: BeeRequestOptions): Promise<AllSettlements>;
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { NumberString, RedistributionState, TransactionOptions } from '../../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BeeRequestOptions, NumberString, RedistributionState, TransactionOptions } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Gets the staked amount
|
|
5
4
|
*
|
|
6
5
|
* @param kyOptions Ky Options for making requests
|
|
7
6
|
*/
|
|
8
|
-
export declare function getStake(
|
|
7
|
+
export declare function getStake(requestOptions: BeeRequestOptions): Promise<NumberString>;
|
|
9
8
|
/**
|
|
10
9
|
* Stake given amount of tokens.
|
|
11
10
|
*
|
|
@@ -13,10 +12,10 @@ export declare function getStake(kyOptions: KyOptions): Promise<NumberString>;
|
|
|
13
12
|
* @param amount
|
|
14
13
|
* @param options
|
|
15
14
|
*/
|
|
16
|
-
export declare function stake(
|
|
15
|
+
export declare function stake(requestOptions: BeeRequestOptions, amount: NumberString, options?: TransactionOptions): Promise<void>;
|
|
17
16
|
/**
|
|
18
17
|
* Get current status of node in redistribution game
|
|
19
18
|
*
|
|
20
19
|
* @param kyOptions Ky Options for making requests
|
|
21
20
|
*/
|
|
22
|
-
export declare function getRedistributionState(
|
|
21
|
+
export declare function getRedistributionState(requestOptions: BeeRequestOptions): Promise<RedistributionState>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import type { BatchId,
|
|
2
|
-
|
|
3
|
-
export declare function
|
|
4
|
-
export declare function
|
|
5
|
-
export declare function
|
|
6
|
-
export declare function
|
|
7
|
-
export declare function
|
|
8
|
-
export declare function diluteBatch(kyOptions: KyOptions, id: string, depth: number): Promise<BatchId>;
|
|
1
|
+
import type { BatchId, BeeRequestOptions, NumberString, PostageBatch, PostageBatchBuckets, PostageBatchOptions } from '../../types';
|
|
2
|
+
export declare function getAllPostageBatches(requestOptions: BeeRequestOptions): Promise<PostageBatch[]>;
|
|
3
|
+
export declare function getPostageBatch(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<PostageBatch>;
|
|
4
|
+
export declare function getPostageBatchBuckets(requestOptions: BeeRequestOptions, postageBatchId: BatchId): Promise<PostageBatchBuckets>;
|
|
5
|
+
export declare function createPostageBatch(requestOptions: BeeRequestOptions, amount: NumberString, depth: number, options?: PostageBatchOptions): Promise<BatchId>;
|
|
6
|
+
export declare function topUpBatch(requestOptions: BeeRequestOptions, id: string, amount: NumberString): Promise<BatchId>;
|
|
7
|
+
export declare function diluteBatch(requestOptions: BeeRequestOptions, id: string, depth: number): Promise<BatchId>;
|
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
import { ChainState, ReserveState, WalletBalance } from '../../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BeeRequestOptions, ChainState, ReserveState, WalletBalance } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Get state of reserve
|
|
5
4
|
*
|
|
6
5
|
* @param kyOptions Ky Options for making requests
|
|
7
6
|
*/
|
|
8
|
-
export declare function getReserveState(
|
|
7
|
+
export declare function getReserveState(requestOptions: BeeRequestOptions): Promise<ReserveState>;
|
|
9
8
|
/**
|
|
10
9
|
* Get state of reserve
|
|
11
10
|
*
|
|
12
11
|
* @param kyOptions Ky Options for making requests
|
|
13
12
|
*/
|
|
14
|
-
export declare function getChainState(
|
|
13
|
+
export declare function getChainState(requestOptions: BeeRequestOptions): Promise<ChainState>;
|
|
15
14
|
/**
|
|
16
15
|
* Get wallet balances for xDai and BZZ of the node
|
|
17
16
|
*
|
|
18
17
|
* @param kyOptions Ky Options for making requests
|
|
19
18
|
*/
|
|
20
|
-
export declare function getWalletBalance(
|
|
19
|
+
export declare function getWalletBalance(requestOptions: BeeRequestOptions): Promise<WalletBalance>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { BeeRequestOptions } from '../../index';
|
|
1
2
|
import type { Health, NodeInfo } from '../../types/debug';
|
|
2
3
|
import { BeeVersions } from '../../types/debug';
|
|
3
|
-
import type { Options as KyOptions } from 'ky';
|
|
4
4
|
export declare const SUPPORTED_BEE_VERSION_EXACT = "1.12.0-88c1d236";
|
|
5
5
|
export declare const SUPPORTED_API_VERSION = "4.0.0";
|
|
6
6
|
export declare const SUPPORTED_DEBUG_API_VERSION = "4.0.0";
|
|
@@ -10,19 +10,19 @@ export declare const SUPPORTED_BEE_VERSION: string;
|
|
|
10
10
|
*
|
|
11
11
|
* @param kyOptions Ky Options for making requests
|
|
12
12
|
*/
|
|
13
|
-
export declare function getHealth(
|
|
13
|
+
export declare function getHealth(requestOptions: BeeRequestOptions): Promise<Health>;
|
|
14
14
|
/**
|
|
15
15
|
* Get readiness of node
|
|
16
16
|
*
|
|
17
17
|
* @param kyOptions Ky Options for making requests
|
|
18
18
|
*/
|
|
19
|
-
export declare function getReadiness(
|
|
19
|
+
export declare function getReadiness(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
20
20
|
/**
|
|
21
21
|
* Get information about Bee node
|
|
22
22
|
*
|
|
23
23
|
* @param kyOptions Ky Options for making requests
|
|
24
24
|
*/
|
|
25
|
-
export declare function getNodeInfo(
|
|
25
|
+
export declare function getNodeInfo(requestOptions: BeeRequestOptions): Promise<NodeInfo>;
|
|
26
26
|
/**
|
|
27
27
|
* Connects to a node and checks if it is a supported Bee version by the bee-js
|
|
28
28
|
*
|
|
@@ -31,7 +31,7 @@ export declare function getNodeInfo(kyOptions: KyOptions): Promise<NodeInfo>;
|
|
|
31
31
|
* @returns true if the Bee node version is supported
|
|
32
32
|
* @deprecated Use `isSupportedExactVersion` instead
|
|
33
33
|
*/
|
|
34
|
-
export declare function isSupportedVersion(
|
|
34
|
+
export declare function isSupportedVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
35
35
|
/**
|
|
36
36
|
* Connects to a node and checks if its version matches with the one that bee-js supports.
|
|
37
37
|
*
|
|
@@ -42,7 +42,7 @@ export declare function isSupportedVersion(kyOptions: KyOptions): Promise<boolea
|
|
|
42
42
|
*
|
|
43
43
|
* @param ky
|
|
44
44
|
*/
|
|
45
|
-
export declare function isSupportedExactVersion(
|
|
45
|
+
export declare function isSupportedExactVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
46
46
|
/**
|
|
47
47
|
* Connects to a node and checks if its main's API version matches with the one that bee-js supports.
|
|
48
48
|
*
|
|
@@ -51,7 +51,7 @@ export declare function isSupportedExactVersion(kyOptions: KyOptions): Promise<b
|
|
|
51
51
|
*
|
|
52
52
|
* @param ky
|
|
53
53
|
*/
|
|
54
|
-
export declare function isSupportedMainApiVersion(
|
|
54
|
+
export declare function isSupportedMainApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
55
55
|
/**
|
|
56
56
|
* Connects to a node and checks if its Debug API version matches with the one that bee-js supports.
|
|
57
57
|
*
|
|
@@ -60,7 +60,7 @@ export declare function isSupportedMainApiVersion(kyOptions: KyOptions): Promise
|
|
|
60
60
|
*
|
|
61
61
|
* @param ky
|
|
62
62
|
*/
|
|
63
|
-
export declare function isSupportedDebugApiVersion(
|
|
63
|
+
export declare function isSupportedDebugApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
64
64
|
/**
|
|
65
65
|
* Connects to a node and checks if its Main and Debug API versions matches with the one that bee-js supports.
|
|
66
66
|
*
|
|
@@ -68,11 +68,11 @@ export declare function isSupportedDebugApiVersion(kyOptions: KyOptions): Promis
|
|
|
68
68
|
*
|
|
69
69
|
* @param ky
|
|
70
70
|
*/
|
|
71
|
-
export declare function isSupportedApiVersion(
|
|
71
|
+
export declare function isSupportedApiVersion(requestOptions: BeeRequestOptions): Promise<boolean>;
|
|
72
72
|
/**
|
|
73
73
|
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
|
|
74
74
|
* and versions that bee-js supports (properties prefixed with `supported*`).
|
|
75
75
|
*
|
|
76
76
|
* @param ky
|
|
77
77
|
*/
|
|
78
|
-
export declare function getVersions(
|
|
78
|
+
export declare function getVersions(requestOptions: BeeRequestOptions): Promise<BeeVersions>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ExtendedTag } from '../../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BeeRequestOptions, ExtendedTag } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Retrieve tag with extended information from Bee node
|
|
5
4
|
*
|
|
6
5
|
* @param kyOptions Ky Options for making requests
|
|
7
6
|
* @param uid UID of tag to be retrieved
|
|
8
7
|
*/
|
|
9
|
-
export declare function retrieveExtendedTag(
|
|
8
|
+
export declare function retrieveExtendedTag(requestOptions: BeeRequestOptions, uid: number): Promise<ExtendedTag>;
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import { NumberString, TransactionHash, TransactionInfo } from '../../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BeeRequestOptions, NumberString, TransactionHash, TransactionInfo } from '../../types';
|
|
3
2
|
/**
|
|
4
3
|
* Get list of all pending transactions
|
|
5
4
|
*
|
|
6
5
|
* @param ky Debug Ky instance
|
|
7
6
|
*/
|
|
8
|
-
export declare function getAllTransactions(
|
|
7
|
+
export declare function getAllTransactions(requestOptions: BeeRequestOptions): Promise<TransactionInfo[]>;
|
|
9
8
|
/**
|
|
10
9
|
* Get information for specific pending transactions
|
|
11
10
|
*
|
|
12
11
|
* @param ky Debug Ky instance
|
|
13
12
|
* @param transactionHash Hash of the transaction
|
|
14
13
|
*/
|
|
15
|
-
export declare function getTransaction(
|
|
14
|
+
export declare function getTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionInfo>;
|
|
16
15
|
/**
|
|
17
16
|
* Rebroadcast existing transaction
|
|
18
17
|
*
|
|
19
18
|
* @param ky Debug Ky instance
|
|
20
19
|
* @param transactionHash Hash of the transaction
|
|
21
20
|
*/
|
|
22
|
-
export declare function rebroadcastTransaction(
|
|
21
|
+
export declare function rebroadcastTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash): Promise<TransactionHash>;
|
|
23
22
|
/**
|
|
24
23
|
* Cancel existing transaction
|
|
25
24
|
*
|
|
@@ -27,4 +26,4 @@ export declare function rebroadcastTransaction(kyOptions: KyOptions, transaction
|
|
|
27
26
|
* @param transactionHash Hash of the transaction
|
|
28
27
|
* @param gasPrice Optional gas price
|
|
29
28
|
*/
|
|
30
|
-
export declare function cancelTransaction(
|
|
29
|
+
export declare function cancelTransaction(requestOptions: BeeRequestOptions, transactionHash: TransactionHash, gasPrice?: NumberString): Promise<TransactionHash>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { BatchId, Reference, ReferenceResponse, Topic } from '../types';
|
|
2
1
|
import { FeedType } from '../feed/type';
|
|
2
|
+
import { BatchId, BeeRequestOptions, Reference, ReferenceResponse, Topic } from '../types';
|
|
3
3
|
import { HexEthAddress } from '../utils/eth';
|
|
4
|
-
import type { Options as KyOptions } from 'ky';
|
|
5
4
|
export interface CreateFeedOptions {
|
|
6
5
|
type?: FeedType;
|
|
7
6
|
}
|
|
@@ -41,7 +40,7 @@ export interface FetchFeedUpdateResponse extends ReferenceResponse, FeedUpdateHe
|
|
|
41
40
|
* @param postageBatchId Postage BatchId to be used to create the Feed Manifest
|
|
42
41
|
* @param options Additional options, like type (default: 'sequence')
|
|
43
42
|
*/
|
|
44
|
-
export declare function createFeedManifest(
|
|
43
|
+
export declare function createFeedManifest(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, postageBatchId: BatchId, options?: CreateFeedOptions): Promise<Reference>;
|
|
45
44
|
/**
|
|
46
45
|
* Find and retrieve feed update
|
|
47
46
|
*
|
|
@@ -55,5 +54,5 @@ export declare function createFeedManifest(kyOptions: KyOptions, owner: HexEthAd
|
|
|
55
54
|
* @param topic Topic in hex
|
|
56
55
|
* @param options Additional options, like index, at, type
|
|
57
56
|
*/
|
|
58
|
-
export declare function fetchLatestFeedUpdate(
|
|
57
|
+
export declare function fetchLatestFeedUpdate(requestOptions: BeeRequestOptions, owner: HexEthAddress, topic: Topic, options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse>;
|
|
59
58
|
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { Pin, Reference } from '../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import type { BeeRequestOptions, Pin, Reference } from '../types';
|
|
3
2
|
export interface GetAllPinResponse {
|
|
4
3
|
references: Reference[];
|
|
5
4
|
}
|
|
@@ -9,14 +8,14 @@ export interface GetAllPinResponse {
|
|
|
9
8
|
* @param kyOptions Ky Options for making requests
|
|
10
9
|
* @param reference Bee data reference
|
|
11
10
|
*/
|
|
12
|
-
export declare function pin(
|
|
11
|
+
export declare function pin(requestOptions: BeeRequestOptions, reference: Reference): Promise<void>;
|
|
13
12
|
/**
|
|
14
13
|
* Unpin data with given reference
|
|
15
14
|
*
|
|
16
15
|
* @param kyOptions Ky Options for making requests
|
|
17
16
|
* @param reference Bee data reference
|
|
18
17
|
*/
|
|
19
|
-
export declare function unpin(
|
|
18
|
+
export declare function unpin(requestOptions: BeeRequestOptions, reference: Reference): Promise<void>;
|
|
20
19
|
/**
|
|
21
20
|
* Get pin status for specific address.
|
|
22
21
|
*
|
|
@@ -24,10 +23,10 @@ export declare function unpin(kyOptions: KyOptions, reference: Reference): Promi
|
|
|
24
23
|
* @param reference
|
|
25
24
|
* @throws Error if given address is not pinned
|
|
26
25
|
*/
|
|
27
|
-
export declare function getPin(
|
|
26
|
+
export declare function getPin(requestOptions: BeeRequestOptions, reference: Reference): Promise<Pin>;
|
|
28
27
|
/**
|
|
29
28
|
* Get list of all pins
|
|
30
29
|
*
|
|
31
30
|
* @param ky Ky instance
|
|
32
31
|
*/
|
|
33
|
-
export declare function getAllPins(
|
|
32
|
+
export declare function getAllPins(requestOptions: BeeRequestOptions): Promise<Reference[]>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="ws" />
|
|
2
2
|
import WebSocket from 'isomorphic-ws';
|
|
3
|
-
import type { BatchId, PublicKey } from '../types';
|
|
4
|
-
import type { Options as KyOptions } from 'ky';
|
|
3
|
+
import type { BatchId, BeeRequestOptions, PublicKey } from '../types';
|
|
5
4
|
/**
|
|
6
5
|
* Send to recipient or target with Postal Service for Swarm
|
|
7
6
|
*
|
|
@@ -13,7 +12,7 @@ import type { Options as KyOptions } from 'ky';
|
|
|
13
12
|
* @param recipient Recipient public key
|
|
14
13
|
*
|
|
15
14
|
*/
|
|
16
|
-
export declare function send(
|
|
15
|
+
export declare function send(requestOptions: BeeRequestOptions, topic: string, target: string, data: string | Uint8Array, postageBatchId: BatchId, recipient?: PublicKey): Promise<void>;
|
|
17
16
|
/**
|
|
18
17
|
* Subscribe for messages on the given topic
|
|
19
18
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { BatchId, Reference, UploadOptions } from '../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BatchId, BeeRequestOptions, Reference, UploadOptions } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Upload single owner chunk (SOC) to a Bee node
|
|
5
4
|
*
|
|
@@ -11,4 +10,4 @@ import type { Options as KyOptions } from 'ky';
|
|
|
11
10
|
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
|
|
12
11
|
* @param options Additional options like tag, encryption, pinning
|
|
13
12
|
*/
|
|
14
|
-
export declare function upload(
|
|
13
|
+
export declare function upload(requestOptions: BeeRequestOptions, owner: string, identifier: string, signature: string, data: Uint8Array, postageBatchId: BatchId, options?: UploadOptions): Promise<Reference>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BeeRequestOptions } from '../index';
|
|
2
2
|
/**
|
|
3
3
|
* Ping the base bee URL. If connection was not successful throw error
|
|
4
4
|
*
|
|
5
5
|
* @param kyOptions Ky instance for given Bee class instance
|
|
6
6
|
*/
|
|
7
|
-
export declare function checkConnection(
|
|
7
|
+
export declare function checkConnection(requestOptions: BeeRequestOptions): Promise<void> | never;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type { ReferenceOrEns } from '../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import type { BeeRequestOptions, ReferenceOrEns } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Reupload locally pinned data
|
|
5
4
|
* @param ky Ky instance
|
|
@@ -7,5 +6,5 @@ import type { Options as KyOptions } from 'ky';
|
|
|
7
6
|
* @param options
|
|
8
7
|
* @throws BeeResponseError if not locally pinned or invalid data
|
|
9
8
|
*/
|
|
10
|
-
export declare function reupload(
|
|
11
|
-
export declare function isRetrievable(
|
|
9
|
+
export declare function reupload(requestOptions: BeeRequestOptions, reference: ReferenceOrEns): Promise<void>;
|
|
10
|
+
export declare function isRetrievable(requestOptions: BeeRequestOptions, reference: ReferenceOrEns): Promise<boolean>;
|
|
@@ -1,18 +1,17 @@
|
|
|
1
|
-
import { Reference, Tag } from '../types';
|
|
2
|
-
import type { Options as KyOptions } from 'ky';
|
|
1
|
+
import { BeeRequestOptions, Reference, Tag } from '../types';
|
|
3
2
|
/**
|
|
4
3
|
* Create new tag on the Bee node
|
|
5
4
|
*
|
|
6
5
|
* @param url Bee tag URL
|
|
7
6
|
*/
|
|
8
|
-
export declare function createTag(
|
|
7
|
+
export declare function createTag(requestOptions: BeeRequestOptions): Promise<Tag>;
|
|
9
8
|
/**
|
|
10
9
|
* Retrieve tag information from Bee node
|
|
11
10
|
*
|
|
12
11
|
* @param url Bee tag URL
|
|
13
12
|
* @param uid UID of tag to be retrieved
|
|
14
13
|
*/
|
|
15
|
-
export declare function retrieveTag(
|
|
14
|
+
export declare function retrieveTag(requestOptions: BeeRequestOptions, uid: number): Promise<Tag>;
|
|
16
15
|
/**
|
|
17
16
|
* Get limited listing of all tags.
|
|
18
17
|
*
|
|
@@ -20,17 +19,17 @@ export declare function retrieveTag(kyOptions: KyOptions, uid: number): Promise<
|
|
|
20
19
|
* @param offset
|
|
21
20
|
* @param limit
|
|
22
21
|
*/
|
|
23
|
-
export declare function getAllTags(
|
|
22
|
+
export declare function getAllTags(requestOptions: BeeRequestOptions, offset?: number, limit?: number): Promise<Tag[]>;
|
|
24
23
|
/**
|
|
25
24
|
* Removes tag from the Bee node.
|
|
26
25
|
* @param url
|
|
27
26
|
* @param uid
|
|
28
27
|
*/
|
|
29
|
-
export declare function deleteTag(
|
|
28
|
+
export declare function deleteTag(requestOptions: BeeRequestOptions, uid: number): Promise<void>;
|
|
30
29
|
/**
|
|
31
30
|
* Updates tag
|
|
32
31
|
* @param url
|
|
33
32
|
* @param uid
|
|
34
33
|
* @param reference
|
|
35
34
|
*/
|
|
36
|
-
export declare function updateTag(
|
|
35
|
+
export declare function updateTag(requestOptions: BeeRequestOptions, uid: number, reference: Reference): Promise<void>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HexEthAddress } from '../utils/eth';
|
|
2
|
-
import { NumberString, PublicKey, Reference,
|
|
2
|
+
import { NumberString, PublicKey, Reference, TransactionHash } from './index';
|
|
3
3
|
/**
|
|
4
4
|
* Object that contains information about progress of upload of data to network.
|
|
5
5
|
*
|
|
@@ -80,7 +80,7 @@ export interface TransactionOptions {
|
|
|
80
80
|
*/
|
|
81
81
|
gasLimit?: NumberString;
|
|
82
82
|
}
|
|
83
|
-
export type CashoutOptions = TransactionOptions
|
|
83
|
+
export type CashoutOptions = TransactionOptions;
|
|
84
84
|
export interface CashoutResult {
|
|
85
85
|
recipient: string;
|
|
86
86
|
lastPayout: NumberString;
|
|
@@ -7,13 +7,10 @@ import type { Bytes } from '../utils/bytes';
|
|
|
7
7
|
import type { BeeError } from '../utils/error';
|
|
8
8
|
import type { EthAddress, HexEthAddress } from '../utils/eth';
|
|
9
9
|
import type { HexString } from '../utils/hex';
|
|
10
|
-
import type ky from 'ky-universal';
|
|
11
|
-
import type { Readable as NativeReadable } from 'stream';
|
|
12
10
|
import type { Readable as CompatibilityReadable } from 'readable-stream';
|
|
11
|
+
import type { Readable as NativeReadable } from 'stream';
|
|
13
12
|
import type { ReadableStream as ReadableStreamPonyfill } from 'web-streams-polyfill';
|
|
14
|
-
import type { Options as KyOptions } from 'ky';
|
|
15
13
|
export * from './debug';
|
|
16
|
-
export type Ky = typeof ky;
|
|
17
14
|
export interface Dictionary<T> {
|
|
18
15
|
[Key: string]: T;
|
|
19
16
|
}
|
|
@@ -76,52 +73,17 @@ export type BatchId = HexString<typeof BATCH_ID_HEX_LENGTH>;
|
|
|
76
73
|
* It represents PSS Address Prefix that is used to define address neighborhood that will receive the PSS message.
|
|
77
74
|
*/
|
|
78
75
|
export type AddressPrefix = HexString;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
* Overridden parameter that allows undefined as a value.
|
|
87
|
-
*/
|
|
88
|
-
searchParams?: Record<string, string | number | boolean | undefined>;
|
|
89
|
-
}
|
|
90
|
-
export interface RequestOptions {
|
|
91
|
-
/**
|
|
92
|
-
* Timeout of requests in milliseconds
|
|
93
|
-
*/
|
|
94
|
-
timeout?: number;
|
|
95
|
-
/**
|
|
96
|
-
* Configure backoff mechanism for requests retries.
|
|
97
|
-
* Specifies how many retries will be performed before failing a request.
|
|
98
|
-
* Retries are performed for GET, PUT, HEAD, DELETE, OPTIONS and TRACE requests.
|
|
99
|
-
* Default is 2.
|
|
100
|
-
*/
|
|
101
|
-
retry?: number;
|
|
102
|
-
/**
|
|
103
|
-
* User defined Fetch compatible function
|
|
104
|
-
*/
|
|
105
|
-
fetch?: Fetch;
|
|
106
|
-
}
|
|
107
|
-
export interface BeeOptions extends RequestOptions {
|
|
76
|
+
export type BeeRequestOptions = {
|
|
77
|
+
baseURL?: string;
|
|
78
|
+
timeout?: number | false;
|
|
79
|
+
retry?: number | false;
|
|
80
|
+
headers?: Record<string, string>;
|
|
81
|
+
};
|
|
82
|
+
export interface BeeOptions extends BeeRequestOptions {
|
|
108
83
|
/**
|
|
109
84
|
* Signer object or private key of the Signer in form of either hex string or Uint8Array that will be default signer for the instance.
|
|
110
85
|
*/
|
|
111
86
|
signer?: Signer | Uint8Array | string;
|
|
112
|
-
/**
|
|
113
|
-
* Object that contains default headers that will be present
|
|
114
|
-
* in all outgoing bee-js requests for instance of Bee class.
|
|
115
|
-
*/
|
|
116
|
-
defaultHeaders?: Record<string, string>;
|
|
117
|
-
/**
|
|
118
|
-
* Function that registers listener callback for all outgoing HTTP requests that Bee instance makes.
|
|
119
|
-
*/
|
|
120
|
-
onRequest?: HookCallback<BeeRequest>;
|
|
121
|
-
/**
|
|
122
|
-
* Function that registers listener callback for all incoming HTTP responses that Bee instance made.
|
|
123
|
-
*/
|
|
124
|
-
onResponse?: HookCallback<BeeResponse>;
|
|
125
87
|
}
|
|
126
88
|
export interface UploadResultWithCid extends UploadResult {
|
|
127
89
|
/**
|
|
@@ -145,7 +107,7 @@ export interface UploadResult {
|
|
|
145
107
|
*/
|
|
146
108
|
tagUid: number;
|
|
147
109
|
}
|
|
148
|
-
export interface UploadOptions
|
|
110
|
+
export interface UploadOptions {
|
|
149
111
|
/**
|
|
150
112
|
* Will pin the data locally in the Bee node as well.
|
|
151
113
|
*
|
|
@@ -246,7 +208,7 @@ export interface Tag {
|
|
|
246
208
|
*/
|
|
247
209
|
startedAt: string;
|
|
248
210
|
}
|
|
249
|
-
export interface AllTagsOptions
|
|
211
|
+
export interface AllTagsOptions {
|
|
250
212
|
limit?: number;
|
|
251
213
|
offset?: number;
|
|
252
214
|
}
|
|
@@ -361,7 +323,7 @@ export interface FeedReader {
|
|
|
361
323
|
*/
|
|
362
324
|
download(options?: FeedUpdateOptions): Promise<FetchFeedUpdateResponse>;
|
|
363
325
|
}
|
|
364
|
-
export interface JsonFeedOptions
|
|
326
|
+
export interface JsonFeedOptions {
|
|
365
327
|
/**
|
|
366
328
|
* Valid only for `get` action, where either this `address` or `signer` has
|
|
367
329
|
* to be specified.
|
|
@@ -459,7 +421,7 @@ export interface TransactionInfo {
|
|
|
459
421
|
/**
|
|
460
422
|
* Options for creation of postage batch
|
|
461
423
|
*/
|
|
462
|
-
export interface PostageBatchOptions
|
|
424
|
+
export interface PostageBatchOptions {
|
|
463
425
|
/**
|
|
464
426
|
* Sets label for the postage batch
|
|
465
427
|
*/
|
|
@@ -544,4 +506,3 @@ interface JsonMap {
|
|
|
544
506
|
[key: string]: AnyJson;
|
|
545
507
|
}
|
|
546
508
|
type JsonArray = Array<AnyJson>;
|
|
547
|
-
type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { KyRequestOptions } from '../types';
|
|
2
1
|
export declare class BeeError extends Error {
|
|
3
2
|
constructor(message: string);
|
|
4
3
|
}
|
|
@@ -6,28 +5,3 @@ export declare class BeeArgumentError extends BeeError {
|
|
|
6
5
|
readonly value: unknown;
|
|
7
6
|
constructor(message: string, value: unknown);
|
|
8
7
|
}
|
|
9
|
-
export declare class BeeRequestError extends BeeError {
|
|
10
|
-
readonly requestOptions: KyRequestOptions;
|
|
11
|
-
/**
|
|
12
|
-
* @param message
|
|
13
|
-
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
14
|
-
*/
|
|
15
|
-
constructor(message: string, requestOptions: KyRequestOptions);
|
|
16
|
-
}
|
|
17
|
-
export declare class BeeResponseError extends BeeError {
|
|
18
|
-
readonly status: number;
|
|
19
|
-
readonly response: Response;
|
|
20
|
-
readonly responseBody: string;
|
|
21
|
-
readonly requestOptions: KyRequestOptions;
|
|
22
|
-
/**
|
|
23
|
-
* @param status HTTP status code number
|
|
24
|
-
* @param response Response returned from the server
|
|
25
|
-
* @param responseBody Response body as string which is returned from response.text() call
|
|
26
|
-
* @param requestOptions KyOptions that were used to assemble the request. THIS MIGHT NOT BE COMPLETE! If custom Ky instance was used that has set defaults then these defaults are not visible in this object!
|
|
27
|
-
* @param message
|
|
28
|
-
*/
|
|
29
|
-
constructor(status: number, response: Response, responseBody: string, requestOptions: KyRequestOptions, message: string);
|
|
30
|
-
}
|
|
31
|
-
export declare class BeeNotAJsonError extends BeeError {
|
|
32
|
-
constructor();
|
|
33
|
-
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { BatchId, FileHeaders, UploadOptions } from '../types';
|
|
2
|
-
export declare function readFileHeaders(headers:
|
|
2
|
+
export declare function readFileHeaders(headers: Record<string, string>): FileHeaders;
|
|
3
3
|
export declare function extractUploadHeaders(postageBatchId: BatchId, options?: UploadOptions): Record<string, string>;
|
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export declare function wrapResponseClosure(cb: HookCallback<BeeResponse>): (request: Request, options: unknown, response: Response) => Promise<void>;
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
|
+
import { BeeRequestOptions } from '../index';
|
|
3
|
+
export declare const DEFAULT_HTTP_CONFIG: {
|
|
4
|
+
headers: {
|
|
5
|
+
accept: string;
|
|
6
|
+
'user-agent': string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param obj
|
|
10
|
+
* Main function to make HTTP requests.
|
|
11
|
+
* @param options User defined settings
|
|
12
|
+
* @param config Internal settings and/or Bee settings
|
|
15
13
|
*/
|
|
16
|
-
export declare function
|
|
17
|
-
/**
|
|
18
|
-
* Main utility function to make HTTP requests.
|
|
19
|
-
* @param kyOptions
|
|
20
|
-
* @param config
|
|
21
|
-
*/
|
|
22
|
-
export declare function http<T>(kyOptions: KyOptions, config: KyRequestOptions): Promise<KyResponse<T>>;
|
|
23
|
-
export {};
|
|
14
|
+
export declare function http<T>(options: BeeRequestOptions, config: AxiosRequestConfig): Promise<AxiosResponse<T>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Address, AddressPrefix, AllTagsOptions, BatchId, CollectionUploadOptions, FileUploadOptions, NumberString, PssMessageHandler, PublicKey, Readable, Reference, Tag, UploadOptions, TransactionHash, RequestOptions, PostageBatchOptions, CashoutOptions, ReferenceOrEns, TransactionOptions } from '../types';
|
|
2
1
|
import { ReferenceType } from '@ethersphere/swarm-cid';
|
|
2
|
+
import { Address, AddressPrefix, AllTagsOptions, BatchId, BeeRequestOptions, CashoutOptions, CollectionUploadOptions, FileUploadOptions, NumberString, PostageBatchOptions, PssMessageHandler, PublicKey, Readable, Reference, ReferenceOrEns, Tag, TransactionHash, TransactionOptions, UploadOptions } from '../types';
|
|
3
3
|
export declare function isUint8Array(obj: unknown): obj is Uint8Array;
|
|
4
4
|
export declare function isInteger(value: unknown): value is number | NumberString;
|
|
5
5
|
export declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
@@ -45,7 +45,7 @@ export declare function addCidConversionFunction<T extends {
|
|
|
45
45
|
};
|
|
46
46
|
export declare function assertAddress(value: unknown): asserts value is Address;
|
|
47
47
|
export declare function assertBatchId(value: unknown): asserts value is BatchId;
|
|
48
|
-
export declare function assertRequestOptions(value: unknown, name?: string): asserts value is
|
|
48
|
+
export declare function assertRequestOptions(value: unknown, name?: string): asserts value is BeeRequestOptions;
|
|
49
49
|
export declare function assertUploadOptions(value: unknown, name?: string): asserts value is UploadOptions;
|
|
50
50
|
export declare function assertFileUploadOptions(value: unknown): asserts value is FileUploadOptions;
|
|
51
51
|
export declare function assertCollectionUploadOptions(value: unknown): asserts value is CollectionUploadOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ethersphere/bee-js",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-pre.1",
|
|
4
4
|
"description": "Javascript client for Bee",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bee",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@ethersphere/swarm-cid": "^0.1.0",
|
|
62
62
|
"@types/readable-stream": "^2.3.13",
|
|
63
|
+
"axios": "^1.3.4",
|
|
63
64
|
"bufferutil": "^4.0.6",
|
|
65
|
+
"cafe-utility": "8.0.0",
|
|
64
66
|
"elliptic": "^6.5.4",
|
|
65
67
|
"fetch-blob": "2.1.2",
|
|
66
68
|
"isomorphic-ws": "^4.0.1",
|
|
67
69
|
"js-sha3": "^0.8.0",
|
|
68
|
-
"ky": "^0.33.2",
|
|
69
|
-
"ky-universal": "^0.11.0",
|
|
70
70
|
"semver": "^7.3.5",
|
|
71
71
|
"tar-js": "^0.3.0",
|
|
72
72
|
"utf-8-validate": "^5.0.9",
|
|
@@ -134,4 +134,4 @@
|
|
|
134
134
|
"beeDebugApiVersion": "4.0.0",
|
|
135
135
|
"bee": "1.12.0-88c1d236"
|
|
136
136
|
}
|
|
137
|
-
}
|
|
137
|
+
}
|