@ethersphere/bee-js 13.0.0-upcoming.gcfb9756 → 13.0.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 +104 -103
- package/dist/cjs/api/bytes.js +3 -4
- package/dist/cjs/api/bzz.js +5 -6
- package/dist/cjs/api/chunk.js +3 -3
- package/dist/cjs/api/envelope.js +3 -2
- package/dist/cjs/api/feed.js +4 -5
- package/dist/cjs/api/pin.js +2 -2
- package/dist/cjs/api/soc.js +2 -2
- package/dist/cjs/bee.js +18 -19
- package/dist/cjs/chunk/soc.js +21 -63
- package/dist/cjs/feed/identifier.js +3 -4
- package/dist/cjs/feed/index.js +17 -19
- package/dist/cjs/feed/retrievable.js +2 -2
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/manifest/manifest.js +97 -333
- package/dist/cjs/modules/balance.js +3 -3
- package/dist/cjs/modules/cheque.js +4 -4
- package/dist/cjs/modules/chunk.js +8 -8
- package/dist/cjs/modules/collection.js +6 -6
- package/dist/cjs/modules/connectivity.js +3 -3
- package/dist/cjs/modules/data.js +6 -6
- package/dist/cjs/modules/feed.js +10 -10
- package/dist/cjs/modules/file.js +3 -3
- package/dist/cjs/modules/grantee.js +9 -9
- package/dist/cjs/modules/messaging.js +15 -17
- package/dist/cjs/modules/pin.js +6 -6
- package/dist/cjs/modules/settlement.js +2 -2
- package/dist/cjs/modules/soc.js +3 -3
- package/dist/cjs/modules/stamp.js +7 -7
- package/dist/cjs/modules/tag.js +2 -2
- package/dist/cjs/modules/transaction.js +4 -4
- package/dist/cjs/modules/wallet.js +3 -3
- package/dist/cjs/types/schema/chequebook.js +5 -5
- package/dist/cjs/types/schema/connectivity.js +5 -5
- package/dist/cjs/types/schema/envelope.js +5 -5
- package/dist/cjs/types/schema/grantee.js +4 -4
- package/dist/cjs/types/schema/stake.js +2 -2
- package/dist/cjs/types/schema/stamps.js +4 -4
- package/dist/cjs/types/schema/states.js +2 -2
- package/dist/cjs/types/schema/transactions.js +3 -3
- package/dist/cjs/types/schema/upload.js +2 -2
- package/dist/cjs/utils/chunk-stream.browser.js +24 -16
- package/dist/cjs/utils/chunk-stream.js +17 -9
- package/dist/cjs/utils/constants.js +3 -3
- package/dist/cjs/utils/expose.js +4 -4
- package/dist/cjs/utils/headers.js +4 -4
- package/dist/cjs/utils/http.js +3 -1
- package/dist/cjs/utils/pss.js +2 -2
- package/dist/cjs/utils/resource-locator.js +2 -2
- package/dist/cjs/utils/schema.js +4 -4
- package/dist/cjs/utils/stamps.js +15 -130
- package/dist/cjs/utils/type.js +2 -2
- package/dist/codemod/index.js +141 -0
- package/dist/codemod/transforms/v13.js +524 -0
- package/dist/index.browser.min.js +2 -1
- package/dist/index.browser.min.js.LICENSE.txt +3 -0
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/api/bytes.js +1 -2
- package/dist/mjs/api/bzz.js +1 -2
- package/dist/mjs/api/chunk.js +1 -1
- package/dist/mjs/api/envelope.js +3 -2
- package/dist/mjs/api/feed.js +1 -2
- package/dist/mjs/api/pin.js +1 -1
- package/dist/mjs/api/soc.js +1 -1
- package/dist/mjs/bee.js +13 -14
- package/dist/mjs/chunk/soc.js +11 -49
- package/dist/mjs/feed/identifier.js +2 -3
- package/dist/mjs/feed/index.js +6 -8
- package/dist/mjs/feed/retrievable.js +1 -1
- package/dist/mjs/index.js +2 -5
- package/dist/mjs/manifest/manifest.js +95 -339
- package/dist/mjs/modules/balance.js +1 -1
- package/dist/mjs/modules/cheque.js +1 -1
- package/dist/mjs/modules/chunk.js +1 -1
- package/dist/mjs/modules/collection.js +1 -1
- package/dist/mjs/modules/connectivity.js +1 -1
- package/dist/mjs/modules/data.js +3 -3
- package/dist/mjs/modules/feed.js +1 -1
- package/dist/mjs/modules/file.js +1 -1
- package/dist/mjs/modules/grantee.js +1 -1
- package/dist/mjs/modules/messaging.js +3 -5
- package/dist/mjs/modules/pin.js +1 -1
- package/dist/mjs/modules/settlement.js +1 -1
- package/dist/mjs/modules/soc.js +1 -1
- package/dist/mjs/modules/stamp.js +1 -1
- package/dist/mjs/modules/tag.js +1 -1
- package/dist/mjs/modules/transaction.js +1 -1
- package/dist/mjs/modules/wallet.js +1 -1
- package/dist/mjs/types/schema/chequebook.js +1 -1
- package/dist/mjs/types/schema/connectivity.js +1 -1
- package/dist/mjs/types/schema/envelope.js +5 -5
- package/dist/mjs/types/schema/grantee.js +1 -1
- package/dist/mjs/types/schema/stake.js +1 -1
- package/dist/mjs/types/schema/stamps.js +1 -1
- package/dist/mjs/types/schema/states.js +1 -1
- package/dist/mjs/types/schema/transactions.js +1 -1
- package/dist/mjs/types/schema/upload.js +1 -1
- package/dist/mjs/utils/chunk-stream.browser.js +28 -18
- package/dist/mjs/utils/chunk-stream.js +21 -11
- package/dist/mjs/utils/constants.js +1 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/mjs/utils/headers.js +1 -1
- package/dist/mjs/utils/http.js +6 -1
- package/dist/mjs/utils/pss.js +1 -1
- package/dist/mjs/utils/resource-locator.js +1 -1
- package/dist/mjs/utils/schema.js +1 -1
- package/dist/mjs/utils/stamps.js +5 -99
- package/dist/mjs/utils/type.js +2 -2
- package/dist/types/api/balance.d.ts +1 -1
- package/dist/types/api/batches.d.ts +1 -1
- package/dist/types/api/bytes.d.ts +3 -3
- package/dist/types/api/bzz.d.ts +1 -2
- package/dist/types/api/chequebook.d.ts +1 -1
- package/dist/types/api/chunk.d.ts +1 -1
- package/dist/types/api/connectivity.d.ts +1 -1
- package/dist/types/api/consumed.d.ts +1 -1
- package/dist/types/api/envelope.d.ts +1 -1
- package/dist/types/api/feed.d.ts +1 -2
- package/dist/types/api/grantee.d.ts +1 -1
- package/dist/types/api/pin.d.ts +1 -1
- package/dist/types/api/pss.d.ts +1 -1
- package/dist/types/api/settlement.d.ts +1 -1
- package/dist/types/api/soc.d.ts +1 -1
- package/dist/types/api/stake.d.ts +1 -1
- package/dist/types/api/stamp.d.ts +1 -1
- package/dist/types/api/stewardship.d.ts +1 -1
- package/dist/types/api/tag.d.ts +1 -1
- package/dist/types/api/transaction.d.ts +1 -1
- package/dist/types/api/wallet.d.ts +1 -1
- package/dist/types/bee.d.ts +11 -13
- package/dist/types/chunk/soc.d.ts +3 -48
- package/dist/types/feed/identifier.d.ts +1 -1
- package/dist/types/feed/index.d.ts +1 -3
- package/dist/types/feed/retrievable.d.ts +1 -1
- package/dist/types/index.d.ts +17 -20
- package/dist/types/manifest/manifest.d.ts +24 -33
- package/dist/types/modules/balance.d.ts +1 -1
- package/dist/types/modules/cheque.d.ts +1 -1
- package/dist/types/modules/chequebook.d.ts +1 -1
- package/dist/types/modules/chunk.d.ts +1 -2
- package/dist/types/modules/collection.d.ts +2 -2
- package/dist/types/modules/connectivity.d.ts +1 -1
- package/dist/types/modules/context.d.ts +1 -1
- package/dist/types/modules/data.d.ts +3 -3
- package/dist/types/modules/feed.d.ts +1 -1
- package/dist/types/modules/file.d.ts +1 -2
- package/dist/types/modules/grantee.d.ts +1 -1
- package/dist/types/modules/messaging.d.ts +1 -2
- package/dist/types/modules/pin.d.ts +1 -1
- package/dist/types/modules/settlement.d.ts +1 -1
- package/dist/types/modules/soc.d.ts +1 -1
- package/dist/types/modules/stake.d.ts +1 -1
- package/dist/types/modules/stamp.d.ts +1 -1
- package/dist/types/modules/storage.d.ts +1 -1
- package/dist/types/modules/tag.d.ts +1 -1
- package/dist/types/modules/transaction.d.ts +1 -1
- package/dist/types/modules/wallet.d.ts +1 -1
- package/dist/types/types/debug.d.ts +1 -1
- package/dist/types/types/index.d.ts +2 -11
- package/dist/types/types/schema/chequebook.d.ts +1 -1
- package/dist/types/types/schema/connectivity.d.ts +1 -1
- package/dist/types/types/schema/grantee.d.ts +1 -1
- package/dist/types/types/schema/stake.d.ts +1 -1
- package/dist/types/types/schema/stamps.d.ts +1 -1
- package/dist/types/types/schema/states.d.ts +1 -1
- package/dist/types/types/schema/transactions.d.ts +1 -1
- package/dist/types/types/schema/upload.d.ts +1 -1
- package/dist/types/utils/chunk-stream.browser.d.ts +1 -1
- package/dist/types/utils/chunk-stream.d.ts +2 -2
- package/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/headers.d.ts +1 -1
- package/dist/types/utils/pss.d.ts +1 -1
- package/dist/types/utils/resource-locator.d.ts +1 -1
- package/dist/types/utils/schema.d.ts +1 -1
- package/dist/types/utils/stamps.d.ts +2 -27
- package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
- package/dist/types/utils/tar-uploader.d.ts +1 -1
- package/dist/types/utils/type.d.ts +1 -1
- package/package.json +7 -2
- package/dist/cjs/chunk/bmt.js +0 -37
- package/dist/cjs/chunk/cac.js +0 -43
- package/dist/cjs/stamper/stamper.js +0 -44
- package/dist/cjs/utils/bytes.js +0 -116
- package/dist/cjs/utils/cid.js +0 -37
- package/dist/cjs/utils/redundancy.js +0 -133
- package/dist/cjs/utils/typed-bytes.js +0 -186
- package/dist/mjs/chunk/bmt.js +0 -34
- package/dist/mjs/chunk/cac.js +0 -34
- package/dist/mjs/stamper/stamper.js +0 -40
- package/dist/mjs/utils/bytes.js +0 -102
- package/dist/mjs/utils/cid.js +0 -32
- package/dist/mjs/utils/redundancy.js +0 -98
- package/dist/mjs/utils/typed-bytes.js +0 -167
- package/dist/types/chunk/bmt.d.ts +0 -16
- package/dist/types/chunk/cac.d.ts +0 -40
- package/dist/types/stamper/stamper.d.ts +0 -15
- package/dist/types/utils/bytes.d.ts +0 -19
- package/dist/types/utils/cid.d.ts +0 -10
- package/dist/types/utils/redundancy.d.ts +0 -21
- package/dist/types/utils/typed-bytes.d.ts +0 -69
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Reference } from '../utils/typed-bytes';
|
|
2
|
-
/**
|
|
3
|
-
* Calculate a Binary Merkle Tree hash for a chunk
|
|
4
|
-
*
|
|
5
|
-
* The BMT chunk address is the hash of the 8 byte span and the root
|
|
6
|
-
* hash of a binary Merkle tree (BMT) built on the 32-byte segments
|
|
7
|
-
* of the underlying data.
|
|
8
|
-
*
|
|
9
|
-
* If the chunk content is less than 4k, the hash is calculated as
|
|
10
|
-
* if the chunk was padded with all zeros up to 4096 bytes.
|
|
11
|
-
*
|
|
12
|
-
* @param chunkContent Chunk data including span and payload as well
|
|
13
|
-
*
|
|
14
|
-
* @returns the keccak256 hash in a byte array
|
|
15
|
-
*/
|
|
16
|
-
export declare function calculateChunkAddress(chunkContent: Uint8Array): Reference;
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Bytes } from '../utils/bytes';
|
|
2
|
-
import { Identifier, PrivateKey, Reference, Span } from '../utils/typed-bytes';
|
|
3
|
-
import { SingleOwnerChunk } from './soc';
|
|
4
|
-
export declare const MIN_PAYLOAD_SIZE = 1;
|
|
5
|
-
export declare const MAX_PAYLOAD_SIZE = 4096;
|
|
6
|
-
/**
|
|
7
|
-
* Content Addressed Chunk (CAC) is the immutable building block of Swarm,
|
|
8
|
-
* holding at most 4096 bytes of payload.
|
|
9
|
-
*
|
|
10
|
-
* - `span` indicates the size of the `payload` in bytes.
|
|
11
|
-
* - `payload` contains the actual data or the body of the chunk.
|
|
12
|
-
* - `data` contains the full chunk data - `span` and `payload`.
|
|
13
|
-
* - `address` is the Swarm hash (or reference) of the chunk.
|
|
14
|
-
*
|
|
15
|
-
* The `toSingleOwnerChunk` method allows converting the CAC into a Single Owner Chunk (SOC).
|
|
16
|
-
*/
|
|
17
|
-
export interface Chunk {
|
|
18
|
-
/**
|
|
19
|
-
* Contains the full chunk data - `span` + `payload`.
|
|
20
|
-
*/
|
|
21
|
-
readonly data: Uint8Array;
|
|
22
|
-
/**
|
|
23
|
-
* Indicates the size of the `payload` in bytes.
|
|
24
|
-
*/
|
|
25
|
-
span: Span;
|
|
26
|
-
/**
|
|
27
|
-
* Contains the actual data or the body of the chunk.
|
|
28
|
-
*/
|
|
29
|
-
payload: Bytes;
|
|
30
|
-
/**
|
|
31
|
-
* The Swarm hash (or reference) of the chunk.
|
|
32
|
-
*/
|
|
33
|
-
address: Reference;
|
|
34
|
-
/**
|
|
35
|
-
* Converts the CAC into a Single Owner Chunk (SOC).
|
|
36
|
-
*/
|
|
37
|
-
toSingleOwnerChunk: (identifier: Identifier | Uint8Array | string, signer: PrivateKey | Uint8Array | string) => SingleOwnerChunk;
|
|
38
|
-
}
|
|
39
|
-
export declare function unmarshalContentAddressedChunk(data: Bytes | Uint8Array): Chunk;
|
|
40
|
-
export declare function makeContentAddressedChunk(rawPayload: Bytes | Uint8Array | string, span?: Span | bigint): Chunk;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Chunk } from 'cafe-utility';
|
|
2
|
-
import { EnvelopeWithBatchId } from '../types';
|
|
3
|
-
import { BatchId, PrivateKey } from '../utils/typed-bytes';
|
|
4
|
-
export declare class Stamper {
|
|
5
|
-
signer: PrivateKey;
|
|
6
|
-
batchId: BatchId;
|
|
7
|
-
buckets: Uint32Array;
|
|
8
|
-
depth: number;
|
|
9
|
-
maxSlot: number;
|
|
10
|
-
private constructor();
|
|
11
|
-
static fromBlank(signer: PrivateKey | Uint8Array | string, batchId: BatchId | Uint8Array | string, depth: number): Stamper;
|
|
12
|
-
static fromState(signer: PrivateKey | Uint8Array | string, batchId: BatchId | Uint8Array | string, buckets: Uint32Array, depth: number): Stamper;
|
|
13
|
-
stamp(chunk: Chunk): EnvelopeWithBatchId;
|
|
14
|
-
getState(): Uint32Array;
|
|
15
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export declare class Bytes {
|
|
2
|
-
protected readonly bytes: Uint8Array;
|
|
3
|
-
readonly length: number;
|
|
4
|
-
constructor(bytes: Uint8Array | ArrayBuffer | string | Bytes, byteLength?: number | number[]);
|
|
5
|
-
static keccak256(bytes: Uint8Array | ArrayBuffer | string | Bytes): Bytes;
|
|
6
|
-
static fromUtf8(utf8: string): Bytes;
|
|
7
|
-
static fromSlice(bytes: Uint8Array, start: number, length?: number): Bytes;
|
|
8
|
-
offset(index: number): Uint8Array;
|
|
9
|
-
toUint8Array(): Uint8Array;
|
|
10
|
-
toHex(): string;
|
|
11
|
-
toBase64(): string;
|
|
12
|
-
toBase32(): string;
|
|
13
|
-
toString(): string;
|
|
14
|
-
toUtf8(): string;
|
|
15
|
-
toJSON(): unknown;
|
|
16
|
-
equals(other: Bytes | Uint8Array | string): boolean;
|
|
17
|
-
represent(): string;
|
|
18
|
-
}
|
|
19
|
-
export declare function parseSizeToBytes(sizeStr: string): number;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Bytes } from './bytes';
|
|
2
|
-
import { Reference } from './typed-bytes';
|
|
3
|
-
export declare const SWARM_MANIFEST_CODEC = 250;
|
|
4
|
-
export declare const SWARM_FEED_CODEC = 251;
|
|
5
|
-
export type DecodedCID = {
|
|
6
|
-
type: 'feed' | 'manifest';
|
|
7
|
-
reference: Reference;
|
|
8
|
-
};
|
|
9
|
-
export declare function convertReferenceToCid(reference: string | Uint8Array | Bytes, type: 'feed' | 'manifest'): string;
|
|
10
|
-
export declare function convertCidToReference(cid: string): DecodedCID;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RedundancyLevel } from '..';
|
|
2
|
-
/**
|
|
3
|
-
* Returns an approximate multiplier for the overhead of a given redundancy level.
|
|
4
|
-
* Redundancy level is a tradeoff between storage overhead and fault tolerance.
|
|
5
|
-
* Use this number to estimate the amount of chunks that will be stored for a given
|
|
6
|
-
* redundancy level.
|
|
7
|
-
*/
|
|
8
|
-
export declare function approximateOverheadForRedundancyLevel(chunks: number, level: RedundancyLevel, encrypted: boolean): number;
|
|
9
|
-
interface RedundancyStats {
|
|
10
|
-
label: string;
|
|
11
|
-
value: RedundancyLevel;
|
|
12
|
-
errorTolerance: number;
|
|
13
|
-
}
|
|
14
|
-
export declare function getRedundancyStats(): {
|
|
15
|
-
medium: RedundancyStats;
|
|
16
|
-
strong: RedundancyStats;
|
|
17
|
-
insane: RedundancyStats;
|
|
18
|
-
paranoid: RedundancyStats;
|
|
19
|
-
};
|
|
20
|
-
export declare function getRedundancyStat(level?: string | RedundancyLevel): RedundancyStats;
|
|
21
|
-
export {};
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { Bytes } from './bytes';
|
|
2
|
-
export declare class PrivateKey extends Bytes {
|
|
3
|
-
static readonly LENGTH = 32;
|
|
4
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
5
|
-
publicKey(): PublicKey;
|
|
6
|
-
sign(data: Uint8Array | string): Signature;
|
|
7
|
-
}
|
|
8
|
-
export declare class PublicKey extends Bytes {
|
|
9
|
-
static readonly LENGTH = 64;
|
|
10
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
11
|
-
address(): EthAddress;
|
|
12
|
-
toCompressedUint8Array(): Uint8Array;
|
|
13
|
-
toCompressedHex(): string;
|
|
14
|
-
}
|
|
15
|
-
export declare class EthAddress extends Bytes {
|
|
16
|
-
static readonly LENGTH = 20;
|
|
17
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
18
|
-
toChecksum(): string;
|
|
19
|
-
}
|
|
20
|
-
export declare class Identifier extends Bytes {
|
|
21
|
-
static readonly LENGTH = 32;
|
|
22
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
23
|
-
static fromString(value: string): Identifier;
|
|
24
|
-
}
|
|
25
|
-
export declare class Reference extends Bytes {
|
|
26
|
-
static readonly LENGTH = 32;
|
|
27
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
28
|
-
toCid(type: 'feed' | 'manifest'): string;
|
|
29
|
-
static isValid(value: string): boolean;
|
|
30
|
-
}
|
|
31
|
-
export declare class TransactionId extends Bytes {
|
|
32
|
-
static readonly LENGTH = 32;
|
|
33
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
34
|
-
}
|
|
35
|
-
export declare class Span extends Bytes {
|
|
36
|
-
static readonly LENGTH = 8;
|
|
37
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
38
|
-
static fromBigInt(number: bigint): Span;
|
|
39
|
-
toBigInt(): bigint;
|
|
40
|
-
static fromSlice(bytes: Uint8Array, start: number): Span;
|
|
41
|
-
}
|
|
42
|
-
export declare class PeerAddress extends Bytes {
|
|
43
|
-
static readonly LENGTH = 32;
|
|
44
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
45
|
-
}
|
|
46
|
-
export declare class BatchId extends Bytes {
|
|
47
|
-
static readonly LENGTH = 32;
|
|
48
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
49
|
-
}
|
|
50
|
-
export declare class Signature extends Bytes {
|
|
51
|
-
static readonly LENGTH = 65;
|
|
52
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
53
|
-
static fromSlice(bytes: Uint8Array, start: number): Signature;
|
|
54
|
-
recoverPublicKey(digest: Uint8Array | string): PublicKey;
|
|
55
|
-
isValid(digest: Uint8Array | string, expectedAddress: EthAddress | Uint8Array | string): boolean;
|
|
56
|
-
}
|
|
57
|
-
export declare class Topic extends Bytes {
|
|
58
|
-
static readonly LENGTH = 32;
|
|
59
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
60
|
-
static fromString(value: string): Topic;
|
|
61
|
-
}
|
|
62
|
-
export declare class FeedIndex extends Bytes {
|
|
63
|
-
static readonly LENGTH = 8;
|
|
64
|
-
static readonly MINUS_ONE: FeedIndex;
|
|
65
|
-
constructor(bytes: Uint8Array | string | Bytes);
|
|
66
|
-
static fromBigInt(number: bigint): FeedIndex;
|
|
67
|
-
toBigInt(): bigint;
|
|
68
|
-
next(): FeedIndex;
|
|
69
|
-
}
|