@solana/codecs-data-structures 2.0.0-experimental.fbd3974 → 2.0.0-experimental.fcff844
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/index.browser.cjs +385 -476
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +387 -472
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +501 -566
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +387 -474
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +385 -476
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +387 -472
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +37 -41
- package/dist/types/array.d.ts +54 -10
- package/dist/types/array.d.ts.map +1 -0
- package/dist/types/assertions.d.ts.map +1 -0
- package/dist/types/bit-array.d.ts +9 -9
- package/dist/types/bit-array.d.ts.map +1 -0
- package/dist/types/boolean.d.ts +22 -10
- package/dist/types/boolean.d.ts.map +1 -0
- package/dist/types/bytes.d.ts +18 -9
- package/dist/types/bytes.d.ts.map +1 -0
- package/dist/types/data-enum.d.ts +20 -20
- package/dist/types/data-enum.d.ts.map +1 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/map.d.ts +43 -10
- package/dist/types/map.d.ts.map +1 -0
- package/dist/types/nullable.d.ts +28 -10
- package/dist/types/nullable.d.ts.map +1 -0
- package/dist/types/scalar-enum.d.ts +22 -10
- package/dist/types/scalar-enum.d.ts.map +1 -0
- package/dist/types/set.d.ts +43 -10
- package/dist/types/set.d.ts.map +1 -0
- package/dist/types/struct.d.ts +28 -18
- package/dist/types/struct.d.ts.map +1 -0
- package/dist/types/tuple.d.ts +22 -15
- package/dist/types/tuple.d.ts.map +1 -0
- package/dist/types/unit.d.ts +4 -12
- package/dist/types/unit.d.ts.map +1 -0
- package/dist/types/utils.d.ts +10 -2
- package/dist/types/utils.d.ts.map +1 -0
- package/package.json +6 -6
- package/dist/types/array-like-codec-size.d.ts +0 -20
package/dist/types/struct.d.ts
CHANGED
|
@@ -1,37 +1,47 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
/** Get the name and encoder of each field in a struct. */
|
|
3
|
-
export type StructToEncoderTuple<
|
|
4
|
-
[K in keyof
|
|
5
|
-
}[keyof
|
|
3
|
+
export type StructToEncoderTuple<TFrom extends object> = Array<{
|
|
4
|
+
[K in keyof TFrom]: [K, Encoder<TFrom[K]>];
|
|
5
|
+
}[keyof TFrom]>;
|
|
6
|
+
/** Get the name and fixed-size encoder of each field in a struct. */
|
|
7
|
+
export type StructToFixedSizeEncoderTuple<TFrom extends object> = Array<{
|
|
8
|
+
[K in keyof TFrom]: [K, FixedSizeEncoder<TFrom[K]>];
|
|
9
|
+
}[keyof TFrom]>;
|
|
6
10
|
/** Get the name and decoder of each field in a struct. */
|
|
7
|
-
export type StructToDecoderTuple<
|
|
8
|
-
[K in keyof
|
|
9
|
-
}[keyof
|
|
11
|
+
export type StructToDecoderTuple<TTo extends object> = Array<{
|
|
12
|
+
[K in keyof TTo]: [K, Decoder<TTo[K]>];
|
|
13
|
+
}[keyof TTo]>;
|
|
14
|
+
/** Get the name and fixed-size decoder of each field in a struct. */
|
|
15
|
+
export type StructToFixedSizeDecoderTuple<TTo extends object> = Array<{
|
|
16
|
+
[K in keyof TTo]: [K, FixedSizeDecoder<TTo[K]>];
|
|
17
|
+
}[keyof TTo]>;
|
|
10
18
|
/** Get the name and codec of each field in a struct. */
|
|
11
|
-
export type StructToCodecTuple<
|
|
12
|
-
[K in keyof
|
|
13
|
-
}[keyof
|
|
14
|
-
/**
|
|
15
|
-
export type
|
|
19
|
+
export type StructToCodecTuple<TFrom extends object, TTo extends TFrom> = Array<{
|
|
20
|
+
[K in keyof TFrom]: [K, Codec<TFrom[K], TTo[K]>];
|
|
21
|
+
}[keyof TFrom]>;
|
|
22
|
+
/** Get the name and fixed-size codec of each field in a struct. */
|
|
23
|
+
export type StructToFixedSizeCodecTuple<TFrom extends object, TTo extends TFrom> = Array<{
|
|
24
|
+
[K in keyof TFrom]: [K, FixedSizeCodec<TFrom[K], TTo[K]>];
|
|
25
|
+
}[keyof TFrom]>;
|
|
16
26
|
/**
|
|
17
27
|
* Creates a encoder for a custom object.
|
|
18
28
|
*
|
|
19
29
|
* @param fields - The name and encoder of each field.
|
|
20
|
-
* @param options - A set of options for the encoder.
|
|
21
30
|
*/
|
|
22
|
-
export declare function getStructEncoder<
|
|
31
|
+
export declare function getStructEncoder<TFrom extends object>(fields: StructToFixedSizeEncoderTuple<TFrom>): FixedSizeEncoder<TFrom>;
|
|
32
|
+
export declare function getStructEncoder<TFrom extends object>(fields: StructToEncoderTuple<TFrom>): VariableSizeEncoder<TFrom>;
|
|
23
33
|
/**
|
|
24
34
|
* Creates a decoder for a custom object.
|
|
25
35
|
*
|
|
26
36
|
* @param fields - The name and decoder of each field.
|
|
27
|
-
* @param options - A set of options for the decoder.
|
|
28
37
|
*/
|
|
29
|
-
export declare function getStructDecoder<
|
|
38
|
+
export declare function getStructDecoder<TTo extends object>(fields: StructToFixedSizeDecoderTuple<TTo>): FixedSizeDecoder<TTo>;
|
|
39
|
+
export declare function getStructDecoder<TTo extends object>(fields: StructToDecoderTuple<TTo>): VariableSizeDecoder<TTo>;
|
|
30
40
|
/**
|
|
31
41
|
* Creates a codec for a custom object.
|
|
32
42
|
*
|
|
33
43
|
* @param fields - The name and codec of each field.
|
|
34
|
-
* @param options - A set of options for the codec.
|
|
35
44
|
*/
|
|
36
|
-
export declare function getStructCodec<
|
|
45
|
+
export declare function getStructCodec<TFrom extends object, TTo extends TFrom = TFrom>(fields: StructToFixedSizeCodecTuple<TFrom, TTo>): FixedSizeCodec<TFrom, TTo>;
|
|
46
|
+
export declare function getStructCodec<TFrom extends object, TTo extends TFrom = TFrom>(fields: StructToCodecTuple<TFrom, TTo>): VariableSizeCodec<TFrom, TTo>;
|
|
37
47
|
//# sourceMappingURL=struct.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"struct.d.ts","sourceRoot":"","sources":["../../src/struct.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAIL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAEhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAI7B,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,CAC1D;KACK,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CAC7C,CAAC,MAAM,KAAK,CAAC,CACjB,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,6BAA6B,CAAC,KAAK,SAAS,MAAM,IAAI,KAAK,CACnE;KACK,CAAC,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;CACtD,CAAC,MAAM,KAAK,CAAC,CACjB,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,CAAC,GAAG,SAAS,MAAM,IAAI,KAAK,CACxD;KACK,CAAC,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;CACzC,CAAC,MAAM,GAAG,CAAC,CACf,CAAC;AAEF,qEAAqE;AACrE,MAAM,MAAM,6BAA6B,CAAC,GAAG,SAAS,MAAM,IAAI,KAAK,CACjE;KACK,CAAC,IAAI,MAAM,GAAG,GAAG,CAAC,CAAC,EAAE,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,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AAE,GAAG,SAAS,KAAK,GAAG,KAAK,EAC1E,MAAM,EAAE,2BAA2B,CAAC,KAAK,EAAE,GAAG,CAAC,GAChD,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9B,wBAAgB,cAAc,CAAC,KAAK,SAAS,MAAM,EAAE,GAAG,SAAS,KAAK,GAAG,KAAK,EAC1E,MAAM,EAAE,kBAAkB,CAAC,KAAK,EAAE,GAAG,CAAC,GACvC,iBAAiB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC"}
|
package/dist/types/tuple.d.ts
CHANGED
|
@@ -1,36 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
type WrapInEncoder<T> = {
|
|
5
|
-
[P in keyof T]: Encoder<T[P]>;
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
|
+
type WrapInFixedSizeEncoder<TFrom> = {
|
|
3
|
+
[P in keyof TFrom]: FixedSizeEncoder<TFrom[P]>;
|
|
6
4
|
};
|
|
7
|
-
type
|
|
8
|
-
[P in keyof
|
|
5
|
+
type WrapInEncoder<TFrom> = {
|
|
6
|
+
[P in keyof TFrom]: Encoder<TFrom[P]>;
|
|
9
7
|
};
|
|
10
|
-
type
|
|
11
|
-
[P in keyof
|
|
8
|
+
type WrapInFixedSizeDecoder<TTo> = {
|
|
9
|
+
[P in keyof TTo]: FixedSizeDecoder<TTo[P]>;
|
|
10
|
+
};
|
|
11
|
+
type WrapInDecoder<TTo> = {
|
|
12
|
+
[P in keyof TTo]: Decoder<TTo[P]>;
|
|
13
|
+
};
|
|
14
|
+
type WrapInCodec<TFrom, TTo extends TFrom> = {
|
|
15
|
+
[P in keyof TFrom]: Codec<TFrom[P], TTo[P]>;
|
|
16
|
+
};
|
|
17
|
+
type WrapInFixedSizeCodec<TFrom, TTo extends TFrom> = {
|
|
18
|
+
[P in keyof TFrom]: FixedSizeCodec<TFrom[P], TTo[P]>;
|
|
12
19
|
};
|
|
13
20
|
type AnyArray = any[];
|
|
14
21
|
/**
|
|
15
22
|
* Creates a encoder for a tuple-like array.
|
|
16
23
|
*
|
|
17
24
|
* @param items - The encoders to use for each item in the tuple.
|
|
18
|
-
* @param options - A set of options for the encoder.
|
|
19
25
|
*/
|
|
20
|
-
export declare function getTupleEncoder<
|
|
26
|
+
export declare function getTupleEncoder<TFrom extends AnyArray>(items: WrapInFixedSizeEncoder<[...TFrom]>): FixedSizeEncoder<TFrom>;
|
|
27
|
+
export declare function getTupleEncoder<TFrom extends AnyArray>(items: WrapInEncoder<[...TFrom]>): VariableSizeEncoder<TFrom>;
|
|
21
28
|
/**
|
|
22
29
|
* Creates a decoder for a tuple-like array.
|
|
23
30
|
*
|
|
24
31
|
* @param items - The decoders to use for each item in the tuple.
|
|
25
|
-
* @param options - A set of options for the decoder.
|
|
26
32
|
*/
|
|
27
|
-
export declare function getTupleDecoder<
|
|
33
|
+
export declare function getTupleDecoder<TTo extends AnyArray>(items: WrapInFixedSizeDecoder<[...TTo]>): FixedSizeDecoder<TTo>;
|
|
34
|
+
export declare function getTupleDecoder<TTo extends AnyArray>(items: WrapInDecoder<[...TTo]>): VariableSizeDecoder<TTo>;
|
|
28
35
|
/**
|
|
29
36
|
* Creates a codec for a tuple-like array.
|
|
30
37
|
*
|
|
31
38
|
* @param items - The codecs to use for each item in the tuple.
|
|
32
|
-
* @param options - A set of options for the codec.
|
|
33
39
|
*/
|
|
34
|
-
export declare function getTupleCodec<
|
|
40
|
+
export declare function getTupleCodec<TFrom extends AnyArray, TTo extends TFrom = TFrom>(items: WrapInFixedSizeCodec<[...TFrom], [...TTo]>): FixedSizeCodec<TFrom, TTo>;
|
|
41
|
+
export declare function getTupleCodec<TFrom extends AnyArray, TTo extends TFrom = TFrom>(items: WrapInCodec<[...TFrom], [...TTo]>): VariableSizeCodec<TFrom, TTo>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
1
|
+
import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';
|
|
4
2
|
/**
|
|
5
3
|
* Creates a void encoder.
|
|
6
|
-
*
|
|
7
|
-
* @param options - A set of options for the encoder.
|
|
8
4
|
*/
|
|
9
|
-
export declare function getUnitEncoder(
|
|
5
|
+
export declare function getUnitEncoder(): FixedSizeEncoder<void, 0>;
|
|
10
6
|
/**
|
|
11
7
|
* Creates a void decoder.
|
|
12
|
-
*
|
|
13
|
-
* @param options - A set of options for the decoder.
|
|
14
8
|
*/
|
|
15
|
-
export declare function getUnitDecoder(
|
|
9
|
+
export declare function getUnitDecoder(): FixedSizeDecoder<void, 0>;
|
|
16
10
|
/**
|
|
17
11
|
* Creates a void codec.
|
|
18
|
-
*
|
|
19
|
-
* @param options - A set of options for the codec.
|
|
20
12
|
*/
|
|
21
|
-
export declare function getUnitCodec(
|
|
13
|
+
export declare function getUnitCodec(): FixedSizeCodec<void, void, 0>;
|
|
22
14
|
//# sourceMappingURL=unit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../src/unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAK1D;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAC,CAK1D;AAED;;GAEG;AACH,wBAAgB,YAAY,IAAI,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAE5D"}
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
|
-
/** Returns the max size or null if at least one size is null. */
|
|
2
1
|
export declare function maxCodecSizes(sizes: (number | null)[]): number | null;
|
|
3
|
-
/** Returns the sum of all sizes or null if at least one size is null. */
|
|
4
2
|
export declare function sumCodecSizes(sizes: (number | null)[]): number | null;
|
|
3
|
+
export declare function getFixedSize(codec: {
|
|
4
|
+
fixedSize: number;
|
|
5
|
+
} | {
|
|
6
|
+
maxSize?: number;
|
|
7
|
+
}): number | null;
|
|
8
|
+
export declare function getMaxSize(codec: {
|
|
9
|
+
fixedSize: number;
|
|
10
|
+
} | {
|
|
11
|
+
maxSize?: number;
|
|
12
|
+
}): number | null;
|
|
5
13
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,CAKrE;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC,EAAE,GAAG,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAE/F;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,GAAG,IAAI,CAE7F"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/codecs-data-structures",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.fcff844",
|
|
4
4
|
"description": "Codecs for various data structures",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/codecs-core": "2.0.0-experimental.
|
|
53
|
-
"@solana/codecs-numbers": "2.0.0-experimental.
|
|
52
|
+
"@solana/codecs-core": "2.0.0-experimental.fcff844",
|
|
53
|
+
"@solana/codecs-numbers": "2.0.0-experimental.fcff844"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@solana/eslint-config-solana": "^1.0.2",
|
|
@@ -66,11 +66,11 @@
|
|
|
66
66
|
"jest-environment-jsdom": "^29.7.0",
|
|
67
67
|
"jest-runner-eslint": "^2.1.2",
|
|
68
68
|
"jest-runner-prettier": "^1.0.0",
|
|
69
|
-
"prettier": "^
|
|
70
|
-
"tsup": "
|
|
69
|
+
"prettier": "^3.1",
|
|
70
|
+
"tsup": "^8.0.1",
|
|
71
71
|
"typescript": "^5.2.2",
|
|
72
72
|
"version-from-git": "^1.1.1",
|
|
73
|
-
"@solana/codecs-strings": "2.0.0-experimental.
|
|
73
|
+
"@solana/codecs-strings": "2.0.0-experimental.fcff844",
|
|
74
74
|
"build-scripts": "0.0.0",
|
|
75
75
|
"test-config": "0.0.0",
|
|
76
76
|
"tsconfig": "0.0.0"
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { CodecData, Offset } from '@solana/codecs-core';
|
|
2
|
-
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
|
-
/**
|
|
4
|
-
* Represents all the size options for array-like codecs
|
|
5
|
-
* — i.e. `array`, `map` and `set`.
|
|
6
|
-
*
|
|
7
|
-
* It can be one of the following:
|
|
8
|
-
* - a {@link NumberCodec} that prefixes its content with its size.
|
|
9
|
-
* - a fixed number of items.
|
|
10
|
-
* - or `'remainder'` to infer the number of items by dividing
|
|
11
|
-
* the rest of the byte array by the fixed size of its item.
|
|
12
|
-
* Note that this option is only available for fixed-size items.
|
|
13
|
-
*/
|
|
14
|
-
export type ArrayLikeCodecSize<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder | CodecData> = TPrefix | number | 'remainder';
|
|
15
|
-
/** Resolves the size of an array-like codec. */
|
|
16
|
-
export declare function decodeArrayLikeCodecSize(size: ArrayLikeCodecSize<NumberDecoder>, childrenSizes: (number | null)[], bytes: Uint8Array, offset: Offset): [number | bigint, Offset];
|
|
17
|
-
export declare function getArrayLikeCodecSizeDescription(size: ArrayLikeCodecSize<CodecData>): string;
|
|
18
|
-
export declare function getArrayLikeCodecSizeFromChildren(size: ArrayLikeCodecSize<CodecData>, childrenSizes: (number | null)[]): number | null;
|
|
19
|
-
export declare function getArrayLikeCodecSizePrefix(size: ArrayLikeCodecSize<NumberEncoder>, realSize: number): Uint8Array;
|
|
20
|
-
//# sourceMappingURL=array-like-codec-size.d.ts.map
|