@solana/codecs-data-structures 2.0.0-experimental.85b7dfe → 2.0.0-experimental.8618508
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 +341 -430
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +343 -430
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +450 -539
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +345 -428
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +341 -430
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +343 -428
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +36 -40
- package/dist/types/array.d.ts +50 -6
- package/dist/types/array.d.ts.map +1 -1
- package/dist/types/bit-array.d.ts +5 -5
- package/dist/types/bit-array.d.ts.map +1 -1
- package/dist/types/boolean.d.ts +18 -6
- package/dist/types/boolean.d.ts.map +1 -1
- package/dist/types/bytes.d.ts +14 -5
- package/dist/types/bytes.d.ts.map +1 -1
- package/dist/types/data-enum.d.ts +14 -14
- package/dist/types/data-enum.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/map.d.ts +39 -6
- package/dist/types/map.d.ts.map +1 -1
- package/dist/types/nullable.d.ts +24 -6
- package/dist/types/nullable.d.ts.map +1 -1
- package/dist/types/scalar-enum.d.ts +18 -6
- package/dist/types/scalar-enum.d.ts.map +1 -1
- package/dist/types/set.d.ts +39 -6
- package/dist/types/set.d.ts.map +1 -1
- package/dist/types/struct.d.ts +28 -18
- package/dist/types/struct.d.ts.map +1 -1
- package/dist/types/tuple.d.ts +22 -15
- package/dist/types/tuple.d.ts.map +1 -1
- package/dist/types/unit.d.ts +4 -12
- package/dist/types/unit.d.ts.map +1 -1
- package/dist/types/utils.d.ts +10 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/types/array-like-codec-size.d.ts +0 -20
- package/dist/types/array-like-codec-size.d.ts.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
/** Defines the config for bitArray codecs. */
|
|
3
|
-
export type BitArrayCodecConfig =
|
|
3
|
+
export type BitArrayCodecConfig = {
|
|
4
4
|
/**
|
|
5
5
|
* Whether to read the bits in reverse order.
|
|
6
6
|
* @defaultValue `false`
|
|
@@ -13,19 +13,19 @@ export type BitArrayCodecConfig = BaseCodecConfig & {
|
|
|
13
13
|
* @param size - The amount of bytes to use for the bit array.
|
|
14
14
|
* @param config - A set of config for the encoder.
|
|
15
15
|
*/
|
|
16
|
-
export declare
|
|
16
|
+
export declare function getBitArrayEncoder<TSize extends number>(size: TSize, config?: BitArrayCodecConfig | boolean): FixedSizeEncoder<boolean[], TSize>;
|
|
17
17
|
/**
|
|
18
18
|
* Decodes bits into an array of booleans.
|
|
19
19
|
*
|
|
20
20
|
* @param size - The amount of bytes to use for the bit array.
|
|
21
21
|
* @param config - A set of config for the decoder.
|
|
22
22
|
*/
|
|
23
|
-
export declare
|
|
23
|
+
export declare function getBitArrayDecoder<TSize extends number>(size: TSize, config?: BitArrayCodecConfig | boolean): FixedSizeDecoder<boolean[], TSize>;
|
|
24
24
|
/**
|
|
25
25
|
* An array of boolean codec that converts booleans to bits and vice versa.
|
|
26
26
|
*
|
|
27
27
|
* @param size - The amount of bytes to use for the bit array.
|
|
28
28
|
* @param config - A set of config for the codec.
|
|
29
29
|
*/
|
|
30
|
-
export declare
|
|
30
|
+
export declare function getBitArrayCodec<TSize extends number>(size: TSize, config?: BitArrayCodecConfig | boolean): FixedSizeCodec<boolean[], boolean[], TSize>;
|
|
31
31
|
//# sourceMappingURL=bit-array.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bit-array.d.ts","sourceRoot":"","sources":["../../src/bit-array.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"bit-array.d.ts","sourceRoot":"","sources":["../../src/bit-array.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EACnB,MAAM,qBAAqB,CAAC;AAE7B,8CAA8C;AAC9C,MAAM,MAAM,mBAAmB,GAAG;IAC9B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,MAAM,EACnD,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,mBAAmB,GAAG,OAAY,GAC3C,gBAAgB,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CAyBpC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,SAAS,MAAM,EACnD,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,mBAAmB,GAAG,OAAY,GAC3C,gBAAgB,CAAC,OAAO,EAAE,EAAE,KAAK,CAAC,CA0BpC;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,SAAS,MAAM,EACjD,IAAI,EAAE,KAAK,EACX,MAAM,GAAE,mBAAmB,GAAG,OAAY,GAC3C,cAAc,CAAC,OAAO,EAAE,EAAE,OAAO,EAAE,EAAE,KAAK,CAAC,CAE7C"}
|
package/dist/types/boolean.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder } from '@solana/codecs-core';
|
|
2
|
+
import { FixedSizeNumberCodec, FixedSizeNumberDecoder, FixedSizeNumberEncoder, NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/** Defines the config for boolean codecs. */
|
|
4
|
-
export type BooleanCodecConfig<TSize extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
4
|
+
export type BooleanCodecConfig<TSize extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
5
5
|
/**
|
|
6
6
|
* The number codec to delegate to.
|
|
7
7
|
* @defaultValue u8 size.
|
|
@@ -13,17 +13,29 @@ export type BooleanCodecConfig<TSize extends NumberCodec | NumberEncoder | Numbe
|
|
|
13
13
|
*
|
|
14
14
|
* @param config - A set of config for the encoder.
|
|
15
15
|
*/
|
|
16
|
-
export declare function getBooleanEncoder(
|
|
16
|
+
export declare function getBooleanEncoder(): FixedSizeEncoder<boolean, 1>;
|
|
17
|
+
export declare function getBooleanEncoder<TSize extends number>(config: BooleanCodecConfig<NumberEncoder> & {
|
|
18
|
+
size: FixedSizeNumberEncoder<TSize>;
|
|
19
|
+
}): FixedSizeEncoder<boolean, TSize>;
|
|
20
|
+
export declare function getBooleanEncoder(config: BooleanCodecConfig<NumberEncoder>): Encoder<boolean>;
|
|
17
21
|
/**
|
|
18
22
|
* Decodes booleans.
|
|
19
23
|
*
|
|
20
24
|
* @param config - A set of config for the decoder.
|
|
21
25
|
*/
|
|
22
|
-
export declare function getBooleanDecoder(
|
|
26
|
+
export declare function getBooleanDecoder(): FixedSizeDecoder<boolean, 1>;
|
|
27
|
+
export declare function getBooleanDecoder<TSize extends number>(config: BooleanCodecConfig<NumberDecoder> & {
|
|
28
|
+
size: FixedSizeNumberDecoder<TSize>;
|
|
29
|
+
}): FixedSizeDecoder<boolean, TSize>;
|
|
30
|
+
export declare function getBooleanDecoder(config: BooleanCodecConfig<NumberDecoder>): Decoder<boolean>;
|
|
23
31
|
/**
|
|
24
32
|
* Creates a boolean codec.
|
|
25
33
|
*
|
|
26
34
|
* @param config - A set of config for the codec.
|
|
27
35
|
*/
|
|
28
|
-
export declare function getBooleanCodec(
|
|
36
|
+
export declare function getBooleanCodec(): FixedSizeCodec<boolean, boolean, 1>;
|
|
37
|
+
export declare function getBooleanCodec<TSize extends number>(config: BooleanCodecConfig<NumberCodec> & {
|
|
38
|
+
size: FixedSizeNumberCodec<TSize>;
|
|
39
|
+
}): FixedSizeCodec<boolean, boolean, TSize>;
|
|
40
|
+
export declare function getBooleanCodec(config: BooleanCodecConfig<NumberCodec>): Codec<boolean>;
|
|
29
41
|
//# sourceMappingURL=boolean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../src/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,EAEL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAGtB,WAAW,EACX,aAAa,EACb,aAAa,EAChB,MAAM,wBAAwB,CAAC;AAEhC,6CAA6C;AAC7C,MAAM,MAAM,kBAAkB,CAAC,KAAK,SAAS,WAAW,GAAG,aAAa,GAAG,aAAa,IAAI;IACxF;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAClE,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,MAAM,EAClD,MAAM,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GACpF,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACpC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAO/F;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAClE,wBAAgB,iBAAiB,CAAC,KAAK,SAAS,MAAM,EAClD,MAAM,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG;IAAE,IAAI,EAAE,sBAAsB,CAAC,KAAK,CAAC,CAAA;CAAE,GACpF,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AACpC,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAO/F;;;;GAIG;AACH,wBAAgB,eAAe,IAAI,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACvE,wBAAgB,eAAe,CAAC,KAAK,SAAS,MAAM,EAChD,MAAM,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAA;CAAE,GAChF,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAC3C,wBAAgB,eAAe,CAAC,MAAM,EAAE,kBAAkB,CAAC,WAAW,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC"}
|
package/dist/types/bytes.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/** Defines the config for bytes codecs. */
|
|
4
|
-
export type BytesCodecConfig<TSize extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
4
|
+
export type BytesCodecConfig<TSize extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
5
5
|
/**
|
|
6
6
|
* The size of the byte array. It can be one of the following:
|
|
7
7
|
* - a {@link NumberSerializer} that prefixes the byte array with its size.
|
|
@@ -16,17 +16,26 @@ export type BytesCodecConfig<TSize extends NumberCodec | NumberEncoder | NumberD
|
|
|
16
16
|
*
|
|
17
17
|
* @param config - A set of config for the encoder.
|
|
18
18
|
*/
|
|
19
|
-
export declare function getBytesEncoder(config
|
|
19
|
+
export declare function getBytesEncoder<TSize extends number>(config: BytesCodecConfig<NumberEncoder> & {
|
|
20
|
+
size: TSize;
|
|
21
|
+
}): FixedSizeEncoder<Uint8Array, TSize>;
|
|
22
|
+
export declare function getBytesEncoder(config?: BytesCodecConfig<NumberEncoder>): VariableSizeEncoder<Uint8Array>;
|
|
20
23
|
/**
|
|
21
24
|
* Decodes sized bytes.
|
|
22
25
|
*
|
|
23
26
|
* @param config - A set of config for the decoder.
|
|
24
27
|
*/
|
|
25
|
-
export declare function getBytesDecoder(config
|
|
28
|
+
export declare function getBytesDecoder<TSize extends number>(config: BytesCodecConfig<NumberDecoder> & {
|
|
29
|
+
size: TSize;
|
|
30
|
+
}): FixedSizeDecoder<Uint8Array, TSize>;
|
|
31
|
+
export declare function getBytesDecoder(config?: BytesCodecConfig<NumberDecoder>): VariableSizeDecoder<Uint8Array>;
|
|
26
32
|
/**
|
|
27
33
|
* Creates a sized bytes codec.
|
|
28
34
|
*
|
|
29
35
|
* @param config - A set of config for the codec.
|
|
30
36
|
*/
|
|
31
|
-
export declare function getBytesCodec(config
|
|
37
|
+
export declare function getBytesCodec<TSize extends number>(config: BytesCodecConfig<NumberCodec> & {
|
|
38
|
+
size: TSize;
|
|
39
|
+
}): FixedSizeCodec<Uint8Array, Uint8Array, TSize>;
|
|
40
|
+
export declare function getBytesCodec(config?: BytesCodecConfig<NumberCodec>): VariableSizeCodec<Uint8Array>;
|
|
32
41
|
//# sourceMappingURL=bytes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../src/bytes.ts"],"names":[],"mappings":"AAAA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AAE,GACxD,cAAc,CAAC,UAAU,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC;AACjD,wBAAgB,aAAa,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,WAAW,CAAC,GAAG,iBAAiB,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder } from '@solana/codecs-core';
|
|
2
2
|
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a data enum using discriminated union types.
|
|
@@ -43,23 +43,23 @@ export type GetDataEnumKind<T extends DataEnum, K extends T['__kind']> = Extract
|
|
|
43
43
|
export type GetDataEnumKindContent<T extends DataEnum, K extends T['__kind']> = Omit<Extract<T, {
|
|
44
44
|
__kind: K;
|
|
45
45
|
}>, '__kind'>;
|
|
46
|
-
/** Get the name and codec of each variant in a data enum. */
|
|
47
|
-
export type DataEnumToCodecTuple<T extends DataEnum, U extends T = T> = Array<T extends never ? never : [
|
|
48
|
-
T['__kind'],
|
|
49
|
-
keyof Omit<T, '__kind'> extends never ? Codec<Omit<T, '__kind'>, Omit<U, '__kind'>> | Codec<void> : Codec<Omit<T, '__kind'>, Omit<U, '__kind'>>
|
|
50
|
-
]>;
|
|
51
46
|
/** Get the name and encoder of each variant in a data enum. */
|
|
52
|
-
export type DataEnumToEncoderTuple<
|
|
53
|
-
|
|
54
|
-
keyof Omit<
|
|
47
|
+
export type DataEnumToEncoderTuple<TFrom extends DataEnum> = Array<TFrom extends never ? never : [
|
|
48
|
+
TFrom['__kind'],
|
|
49
|
+
keyof Omit<TFrom, '__kind'> extends never ? Encoder<Omit<TFrom, '__kind'>> | Encoder<void> : Encoder<Omit<TFrom, '__kind'>>
|
|
55
50
|
]>;
|
|
56
51
|
/** Get the name and decoder of each variant in a data enum. */
|
|
57
|
-
export type DataEnumToDecoderTuple<
|
|
58
|
-
|
|
59
|
-
keyof Omit<
|
|
52
|
+
export type DataEnumToDecoderTuple<TTo extends DataEnum> = Array<TTo extends never ? never : [
|
|
53
|
+
TTo['__kind'],
|
|
54
|
+
keyof Omit<TTo, '__kind'> extends never ? Decoder<Omit<TTo, '__kind'>> | Decoder<void> : Decoder<Omit<TTo, '__kind'>>
|
|
55
|
+
]>;
|
|
56
|
+
/** Get the name and codec of each variant in a data enum. */
|
|
57
|
+
export type DataEnumToCodecTuple<TFrom extends DataEnum, TTo extends TFrom = TFrom> = Array<TFrom extends never ? never : [
|
|
58
|
+
TFrom['__kind'],
|
|
59
|
+
keyof Omit<TFrom, '__kind'> extends never ? Codec<Omit<TFrom, '__kind'>, Omit<TTo, '__kind'>> | Codec<void> : Codec<Omit<TFrom, '__kind'>, Omit<TTo, '__kind'>>
|
|
60
60
|
]>;
|
|
61
61
|
/** Defines the config for data enum codecs. */
|
|
62
|
-
export type DataEnumCodecConfig<TDiscriminator = NumberCodec | NumberEncoder | NumberDecoder> =
|
|
62
|
+
export type DataEnumCodecConfig<TDiscriminator = NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
63
63
|
/**
|
|
64
64
|
* The codec to use for the enum discriminator prefixing the variant.
|
|
65
65
|
* @defaultValue u8 prefix.
|
|
@@ -72,7 +72,7 @@ export type DataEnumCodecConfig<TDiscriminator = NumberCodec | NumberEncoder | N
|
|
|
72
72
|
* @param variants - The variant encoders of the data enum.
|
|
73
73
|
* @param config - A set of config for the encoder.
|
|
74
74
|
*/
|
|
75
|
-
export declare function getDataEnumEncoder<
|
|
75
|
+
export declare function getDataEnumEncoder<TFrom extends DataEnum>(variants: DataEnumToEncoderTuple<TFrom>, config?: DataEnumCodecConfig<NumberEncoder>): Encoder<TFrom>;
|
|
76
76
|
/**
|
|
77
77
|
* Creates a data enum decoder.
|
|
78
78
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-enum.d.ts","sourceRoot":"","sources":["../../src/data-enum.ts"],"names":[],"mappings":"AAAA,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AsB,CAAC,CAAC,CAAC,EACnC,MAAM,GAAE,mBAAmB,CAAC,aAAa,CAAM,GAChD,OAAO,CAAC,CAAC,CAAC,CAsBZ;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,EAChE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,EAAE,CAAC,CAAC,EACpC,MAAM,GAAE,mBAAmB,CAAC,WAAW,CAAM,GAC9C,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAEb"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC"}
|
package/dist/types/map.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
|
-
import { ArrayLikeCodecSize } from './array
|
|
3
|
+
import { ArrayLikeCodecSize } from './array';
|
|
4
4
|
/** Defines the config for Map codecs. */
|
|
5
|
-
export type MapCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
5
|
+
export type MapCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
6
6
|
/**
|
|
7
7
|
* The size of the array.
|
|
8
8
|
* @defaultValue u32 prefix.
|
|
@@ -16,7 +16,18 @@ export type MapCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberD
|
|
|
16
16
|
* @param value - The encoder to use for the map's values.
|
|
17
17
|
* @param config - A set of config for the encoder.
|
|
18
18
|
*/
|
|
19
|
-
export declare function getMapEncoder<
|
|
19
|
+
export declare function getMapEncoder<TFromKey, TFromValue>(key: Encoder<TFromKey>, value: Encoder<TFromValue>, config: MapCodecConfig<NumberEncoder> & {
|
|
20
|
+
size: 0;
|
|
21
|
+
}): FixedSizeEncoder<Map<TFromKey, TFromValue>, 0>;
|
|
22
|
+
export declare function getMapEncoder<TFromKey, TFromValue>(key: FixedSizeEncoder<TFromKey>, value: FixedSizeEncoder<TFromValue>, config: MapCodecConfig<NumberEncoder> & {
|
|
23
|
+
size: number;
|
|
24
|
+
}): FixedSizeEncoder<Map<TFromKey, TFromValue>>;
|
|
25
|
+
export declare function getMapEncoder<TFromKey, TFromValue>(key: FixedSizeEncoder<TFromKey>, value: FixedSizeEncoder<TFromValue>, config: MapCodecConfig<NumberEncoder> & {
|
|
26
|
+
size: 'remainder';
|
|
27
|
+
}): VariableSizeEncoder<Map<TFromKey, TFromValue>>;
|
|
28
|
+
export declare function getMapEncoder<TFromKey, TFromValue>(key: Encoder<TFromKey>, value: Encoder<TFromValue>, config?: MapCodecConfig<NumberEncoder> & {
|
|
29
|
+
size?: number | NumberEncoder;
|
|
30
|
+
}): VariableSizeEncoder<Map<TFromKey, TFromValue>>;
|
|
20
31
|
/**
|
|
21
32
|
* Creates a decoder for a map.
|
|
22
33
|
*
|
|
@@ -24,7 +35,18 @@ export declare function getMapEncoder<K, V>(key: Encoder<K>, value: Encoder<V>,
|
|
|
24
35
|
* @param value - The decoder to use for the map's values.
|
|
25
36
|
* @param config - A set of config for the decoder.
|
|
26
37
|
*/
|
|
27
|
-
export declare function getMapDecoder<
|
|
38
|
+
export declare function getMapDecoder<TToKey, TToValue>(key: Decoder<TToKey>, value: Decoder<TToValue>, config: MapCodecConfig<NumberDecoder> & {
|
|
39
|
+
size: 0;
|
|
40
|
+
}): FixedSizeDecoder<Map<TToKey, TToValue>, 0>;
|
|
41
|
+
export declare function getMapDecoder<TToKey, TToValue>(key: FixedSizeDecoder<TToKey>, value: FixedSizeDecoder<TToValue>, config: MapCodecConfig<NumberDecoder> & {
|
|
42
|
+
size: number;
|
|
43
|
+
}): FixedSizeDecoder<Map<TToKey, TToValue>>;
|
|
44
|
+
export declare function getMapDecoder<TToKey, TToValue>(key: FixedSizeDecoder<TToKey>, value: FixedSizeDecoder<TToValue>, config: MapCodecConfig<NumberDecoder> & {
|
|
45
|
+
size: 'remainder';
|
|
46
|
+
}): VariableSizeDecoder<Map<TToKey, TToValue>>;
|
|
47
|
+
export declare function getMapDecoder<TToKey, TToValue>(key: Decoder<TToKey>, value: Decoder<TToValue>, config?: MapCodecConfig<NumberDecoder> & {
|
|
48
|
+
size?: number | NumberDecoder;
|
|
49
|
+
}): VariableSizeDecoder<Map<TToKey, TToValue>>;
|
|
28
50
|
/**
|
|
29
51
|
* Creates a codec for a map.
|
|
30
52
|
*
|
|
@@ -32,5 +54,16 @@ export declare function getMapDecoder<K, V>(key: Decoder<K>, value: Decoder<V>,
|
|
|
32
54
|
* @param value - The codec to use for the map's values.
|
|
33
55
|
* @param config - A set of config for the codec.
|
|
34
56
|
*/
|
|
35
|
-
export declare function getMapCodec<
|
|
57
|
+
export declare function getMapCodec<TFromKey, TFromValue, TToKey extends TFromKey = TFromKey, TToValue extends TFromValue = TFromValue>(key: Codec<TFromKey, TToKey>, value: Codec<TFromValue, TToValue>, config: MapCodecConfig<NumberCodec> & {
|
|
58
|
+
size: 0;
|
|
59
|
+
}): FixedSizeCodec<Map<TFromKey, TFromValue>, Map<TToKey, TToValue>, 0>;
|
|
60
|
+
export declare function getMapCodec<TFromKey, TFromValue, TToKey extends TFromKey = TFromKey, TToValue extends TFromValue = TFromValue>(key: FixedSizeCodec<TFromKey, TToKey>, value: FixedSizeCodec<TFromValue, TToValue>, config: MapCodecConfig<NumberCodec> & {
|
|
61
|
+
size: number;
|
|
62
|
+
}): FixedSizeCodec<Map<TFromKey, TFromValue>, Map<TToKey, TToValue>>;
|
|
63
|
+
export declare function getMapCodec<TFromKey, TFromValue, TToKey extends TFromKey = TFromKey, TToValue extends TFromValue = TFromValue>(key: FixedSizeCodec<TFromKey, TToKey>, value: FixedSizeCodec<TFromValue, TToValue>, config: MapCodecConfig<NumberCodec> & {
|
|
64
|
+
size: 'remainder';
|
|
65
|
+
}): VariableSizeCodec<Map<TFromKey, TFromValue>, Map<TToKey, TToValue>>;
|
|
66
|
+
export declare function getMapCodec<TFromKey, TFromValue, TToKey extends TFromKey = TFromKey, TToValue extends TFromValue = TFromValue>(key: Codec<TFromKey, TToKey>, value: Codec<TFromValue, TToValue>, config?: MapCodecConfig<NumberCodec> & {
|
|
67
|
+
size?: number | NumberCodec;
|
|
68
|
+
}): VariableSizeCodec<Map<TFromKey, TFromValue>, Map<TToKey, TToValue>>;
|
|
36
69
|
//# sourceMappingURL=map.d.ts.map
|
package/dist/types/map.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/map.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../src/map.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,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AAG,QAAQ,EAClC,QAAQ,SAAS,UAAU,GAAG,UAAU,EAExC,GAAG,EAAE,cAAc,CAAC,QAAQ,EAAE,MAAM,CAAC,EACrC,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,QAAQ,CAAC,EAC3C,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAC5D,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;AACvE,wBAAgB,WAAW,CACvB,QAAQ,EACR,UAAU,EACV,MAAM,SAAS,QAAQ,GAAG,QAAQ,EAClC,QAAQ,SAAS,UAAU,GAAG,UAAU,EAExC,GAAG,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,CAAC,EAC5B,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,EAClC,MAAM,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GACvE,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC"}
|
package/dist/types/nullable.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
|
+
import { FixedSizeNumberCodec, FixedSizeNumberDecoder, FixedSizeNumberEncoder, NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/** Defines the config for nullable codecs. */
|
|
4
|
-
export type NullableCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
4
|
+
export type NullableCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
5
5
|
/**
|
|
6
6
|
* The codec to use for the boolean prefix.
|
|
7
7
|
* @defaultValue u8 prefix.
|
|
@@ -23,19 +23,37 @@ export type NullableCodecConfig<TPrefix extends NumberCodec | NumberEncoder | Nu
|
|
|
23
23
|
* @param item - The encoder to use for the value that may be present.
|
|
24
24
|
* @param config - A set of config for the encoder.
|
|
25
25
|
*/
|
|
26
|
-
export declare function getNullableEncoder<
|
|
26
|
+
export declare function getNullableEncoder<TFrom>(item: FixedSizeEncoder<TFrom>, config: NullableCodecConfig<FixedSizeNumberEncoder> & {
|
|
27
|
+
fixed: true;
|
|
28
|
+
}): FixedSizeEncoder<TFrom | null>;
|
|
29
|
+
export declare function getNullableEncoder<TFrom>(item: FixedSizeEncoder<TFrom, 0>, config?: NullableCodecConfig<FixedSizeNumberEncoder>): FixedSizeEncoder<TFrom | null>;
|
|
30
|
+
export declare function getNullableEncoder<TFrom>(item: Encoder<TFrom>, config?: NullableCodecConfig<NumberEncoder> & {
|
|
31
|
+
fixed?: false;
|
|
32
|
+
}): VariableSizeEncoder<TFrom | null>;
|
|
27
33
|
/**
|
|
28
34
|
* Creates a decoder for an optional value using `null` as the `None` value.
|
|
29
35
|
*
|
|
30
36
|
* @param item - The decoder to use for the value that may be present.
|
|
31
37
|
* @param config - A set of config for the decoder.
|
|
32
38
|
*/
|
|
33
|
-
export declare function getNullableDecoder<
|
|
39
|
+
export declare function getNullableDecoder<TTo>(item: FixedSizeDecoder<TTo>, config: NullableCodecConfig<FixedSizeNumberDecoder> & {
|
|
40
|
+
fixed: true;
|
|
41
|
+
}): FixedSizeDecoder<TTo | null>;
|
|
42
|
+
export declare function getNullableDecoder<TTo>(item: FixedSizeDecoder<TTo, 0>, config?: NullableCodecConfig<FixedSizeNumberDecoder>): FixedSizeDecoder<TTo | null>;
|
|
43
|
+
export declare function getNullableDecoder<TTo>(item: Decoder<TTo>, config?: NullableCodecConfig<NumberDecoder> & {
|
|
44
|
+
fixed?: false;
|
|
45
|
+
}): VariableSizeDecoder<TTo | null>;
|
|
34
46
|
/**
|
|
35
47
|
* Creates a codec for an optional value using `null` as the `None` value.
|
|
36
48
|
*
|
|
37
49
|
* @param item - The codec to use for the value that may be present.
|
|
38
50
|
* @param config - A set of config for the codec.
|
|
39
51
|
*/
|
|
40
|
-
export declare function getNullableCodec<
|
|
52
|
+
export declare function getNullableCodec<TFrom, TTo extends TFrom = TFrom>(item: FixedSizeCodec<TFrom, TTo>, config: NullableCodecConfig<FixedSizeNumberCodec> & {
|
|
53
|
+
fixed: true;
|
|
54
|
+
}): FixedSizeCodec<TFrom | null, TTo | null>;
|
|
55
|
+
export declare function getNullableCodec<TFrom, TTo extends TFrom = TFrom>(item: FixedSizeCodec<TFrom, TTo, 0>, config?: NullableCodecConfig<FixedSizeNumberCodec>): FixedSizeCodec<TFrom | null, TTo | null>;
|
|
56
|
+
export declare function getNullableCodec<TFrom, TTo extends TFrom = TFrom>(item: Codec<TFrom, TTo>, config?: NullableCodecConfig<NumberCodec> & {
|
|
57
|
+
fixed?: false;
|
|
58
|
+
}): VariableSizeCodec<TFrom | null, TTo | null>;
|
|
41
59
|
//# sourceMappingURL=nullable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nullable.d.ts","sourceRoot":"","sources":["../../src/nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,
|
|
1
|
+
{"version":3,"file":"nullable.d.ts","sourceRoot":"","sources":["../../src/nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,EAIL,OAAO,EACP,OAAO,EACP,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EAC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I,CAAC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
1
|
+
import { FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
|
+
import { FixedSizeNumberCodec, FixedSizeNumberDecoder, FixedSizeNumberEncoder, NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
3
|
/**
|
|
4
4
|
* Defines a scalar enum as a type from its constructor.
|
|
5
5
|
*
|
|
@@ -13,7 +13,7 @@ export type ScalarEnum<T> = ({
|
|
|
13
13
|
[key: number | string]: string | number | T;
|
|
14
14
|
} | number | T) & NonNullable<unknown>;
|
|
15
15
|
/** Defines the config for scalar enum codecs. */
|
|
16
|
-
export type ScalarEnumCodecConfig<TDiscriminator extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
16
|
+
export type ScalarEnumCodecConfig<TDiscriminator extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
17
17
|
/**
|
|
18
18
|
* The codec to use for the enum discriminator.
|
|
19
19
|
* @defaultValue u8 discriminator.
|
|
@@ -26,19 +26,31 @@ export type ScalarEnumCodecConfig<TDiscriminator extends NumberCodec | NumberEnc
|
|
|
26
26
|
* @param constructor - The constructor of the scalar enum.
|
|
27
27
|
* @param config - A set of config for the encoder.
|
|
28
28
|
*/
|
|
29
|
-
export declare function getScalarEnumEncoder<
|
|
29
|
+
export declare function getScalarEnumEncoder<TFrom, TFromConstructor extends ScalarEnum<TFrom>>(constructor: TFromConstructor): FixedSizeEncoder<TFrom, 1>;
|
|
30
|
+
export declare function getScalarEnumEncoder<TFrom, TFromConstructor extends ScalarEnum<TFrom>, TSize extends number>(constructor: TFromConstructor, config: ScalarEnumCodecConfig<NumberEncoder> & {
|
|
31
|
+
size: FixedSizeNumberEncoder<TSize>;
|
|
32
|
+
}): FixedSizeEncoder<TFrom, TSize>;
|
|
33
|
+
export declare function getScalarEnumEncoder<TFrom, TFromConstructor extends ScalarEnum<TFrom>>(constructor: TFromConstructor, config?: ScalarEnumCodecConfig<NumberEncoder>): VariableSizeEncoder<TFrom>;
|
|
30
34
|
/**
|
|
31
35
|
* Creates a scalar enum decoder.
|
|
32
36
|
*
|
|
33
37
|
* @param constructor - The constructor of the scalar enum.
|
|
34
38
|
* @param config - A set of config for the decoder.
|
|
35
39
|
*/
|
|
36
|
-
export declare function getScalarEnumDecoder<
|
|
40
|
+
export declare function getScalarEnumDecoder<TTo, TToConstructor extends ScalarEnum<TTo>>(constructor: TToConstructor): FixedSizeDecoder<TTo, 1>;
|
|
41
|
+
export declare function getScalarEnumDecoder<TTo, TToConstructor extends ScalarEnum<TTo>, TSize extends number>(constructor: TToConstructor, config: ScalarEnumCodecConfig<NumberDecoder> & {
|
|
42
|
+
size: FixedSizeNumberDecoder<TSize>;
|
|
43
|
+
}): FixedSizeDecoder<TTo, TSize>;
|
|
44
|
+
export declare function getScalarEnumDecoder<TTo, TToConstructor extends ScalarEnum<TTo>>(constructor: TToConstructor, config?: ScalarEnumCodecConfig<NumberDecoder>): VariableSizeDecoder<TTo>;
|
|
37
45
|
/**
|
|
38
46
|
* Creates a scalar enum codec.
|
|
39
47
|
*
|
|
40
48
|
* @param constructor - The constructor of the scalar enum.
|
|
41
49
|
* @param config - A set of config for the codec.
|
|
42
50
|
*/
|
|
43
|
-
export declare function getScalarEnumCodec<
|
|
51
|
+
export declare function getScalarEnumCodec<TFrom, TFromConstructor extends ScalarEnum<TFrom>>(constructor: TFromConstructor): FixedSizeCodec<TFrom, TFrom, 1>;
|
|
52
|
+
export declare function getScalarEnumCodec<TFrom, TFromConstructor extends ScalarEnum<TFrom>, TSize extends number>(constructor: TFromConstructor, config: ScalarEnumCodecConfig<NumberCodec> & {
|
|
53
|
+
size: FixedSizeNumberCodec<TSize>;
|
|
54
|
+
}): FixedSizeCodec<TFrom, TFrom, TSize>;
|
|
55
|
+
export declare function getScalarEnumCodec<TFrom, TFromConstructor extends ScalarEnum<TFrom>>(constructor: TFromConstructor, config?: ScalarEnumCodecConfig<NumberCodec>): VariableSizeCodec<TFrom>;
|
|
44
56
|
//# sourceMappingURL=scalar-enum.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scalar-enum.d.ts","sourceRoot":"","sources":["../../src/scalar-enum.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"scalar-enum.d.ts","sourceRoot":"","sources":["../../src/scalar-enum.ts"],"names":[],"mappings":"AAAA,OAAO,EAKH,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAGhB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,oBAAoB,EACpB,sBAAsB,EACtB,sBAAsB,EAGtB,WAAW,EACX,aAAa,EACb,aAAa,EAChB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;;GAQG;AACH,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,CAAC,CAAA;CAAE,GAAG,MAAM,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;AAElH,iDAAiD;AACjD,MAAM,MAAM,qBAAqB,CAAC,cAAc,SAAS,WAAW,GAAG,aAAa,GAAG,aAAa,IAAI;IACpG;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;CACzB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,gBAAgB,SAAS,UAAU,CAAC,KAAK,CAAC,EAClF,WAAW,EAAE,gBAAgB,GAC9B,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;AAC9B,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,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,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;AACnC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,SAAS,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,SAAS,MAAM,EACtG,WAAW,EAAE,gBAAgB,EAC7B,MAAM,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,CAAA;CAAE,GACnF,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;AACvC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,gBAAgB,SAAS,UAAU,CAAC,KAAK,CAAC,EAChF,WAAW,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,qBAAqB,CAAC,WAAW,CAAC,GAC5C,iBAAiB,CAAC,KAAK,CAAC,CAAC"}
|
package/dist/types/set.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Codec, Decoder, Encoder, FixedSizeCodec, FixedSizeDecoder, FixedSizeEncoder, VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
|
|
2
2
|
import { NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';
|
|
3
|
-
import { ArrayLikeCodecSize } from './array
|
|
3
|
+
import { ArrayLikeCodecSize } from './array';
|
|
4
4
|
/** Defines the config for set codecs. */
|
|
5
|
-
export type SetCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> =
|
|
5
|
+
export type SetCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberDecoder> = {
|
|
6
6
|
/**
|
|
7
7
|
* The size of the set.
|
|
8
8
|
* @defaultValue u32 prefix.
|
|
@@ -15,19 +15,52 @@ export type SetCodecConfig<TPrefix extends NumberCodec | NumberEncoder | NumberD
|
|
|
15
15
|
* @param item - The encoder to use for the set's items.
|
|
16
16
|
* @param config - A set of config for the encoder.
|
|
17
17
|
*/
|
|
18
|
-
export declare function getSetEncoder<
|
|
18
|
+
export declare function getSetEncoder<TFrom>(item: Encoder<TFrom>, config: SetCodecConfig<NumberEncoder> & {
|
|
19
|
+
size: 0;
|
|
20
|
+
}): FixedSizeEncoder<Set<TFrom>, 0>;
|
|
21
|
+
export declare function getSetEncoder<TFrom>(item: FixedSizeEncoder<TFrom>, config: SetCodecConfig<NumberEncoder> & {
|
|
22
|
+
size: number;
|
|
23
|
+
}): FixedSizeEncoder<Set<TFrom>>;
|
|
24
|
+
export declare function getSetEncoder<TFrom>(item: FixedSizeEncoder<TFrom>, config: SetCodecConfig<NumberEncoder> & {
|
|
25
|
+
size: 'remainder';
|
|
26
|
+
}): VariableSizeEncoder<Set<TFrom>>;
|
|
27
|
+
export declare function getSetEncoder<TFrom>(item: Encoder<TFrom>, config?: SetCodecConfig<NumberEncoder> & {
|
|
28
|
+
size?: number | NumberEncoder;
|
|
29
|
+
}): VariableSizeEncoder<Set<TFrom>>;
|
|
19
30
|
/**
|
|
20
31
|
* Decodes an set of items.
|
|
21
32
|
*
|
|
22
33
|
* @param item - The encoder to use for the set's items.
|
|
23
34
|
* @param config - A set of config for the encoder.
|
|
24
35
|
*/
|
|
25
|
-
export declare function getSetDecoder<
|
|
36
|
+
export declare function getSetDecoder<TTo>(item: Decoder<TTo>, config: SetCodecConfig<NumberDecoder> & {
|
|
37
|
+
size: 0;
|
|
38
|
+
}): FixedSizeDecoder<Set<TTo>, 0>;
|
|
39
|
+
export declare function getSetDecoder<TTo>(item: FixedSizeDecoder<TTo>, config: SetCodecConfig<NumberDecoder> & {
|
|
40
|
+
size: number;
|
|
41
|
+
}): FixedSizeDecoder<Set<TTo>>;
|
|
42
|
+
export declare function getSetDecoder<TTo>(item: FixedSizeDecoder<TTo>, config: SetCodecConfig<NumberDecoder> & {
|
|
43
|
+
size: 'remainder';
|
|
44
|
+
}): VariableSizeDecoder<Set<TTo>>;
|
|
45
|
+
export declare function getSetDecoder<TTo>(item: Decoder<TTo>, config?: SetCodecConfig<NumberDecoder> & {
|
|
46
|
+
size?: number | NumberDecoder;
|
|
47
|
+
}): VariableSizeDecoder<Set<TTo>>;
|
|
26
48
|
/**
|
|
27
49
|
* Creates a codec for an set of items.
|
|
28
50
|
*
|
|
29
51
|
* @param item - The codec to use for the set's items.
|
|
30
52
|
* @param config - A set of config for the codec.
|
|
31
53
|
*/
|
|
32
|
-
export declare function getSetCodec<
|
|
54
|
+
export declare function getSetCodec<TFrom, TTo extends TFrom = TFrom>(item: Codec<TFrom, TTo>, config: SetCodecConfig<NumberCodec> & {
|
|
55
|
+
size: 0;
|
|
56
|
+
}): FixedSizeCodec<Set<TFrom>, Set<TTo>, 0>;
|
|
57
|
+
export declare function getSetCodec<TFrom, TTo extends TFrom = TFrom>(item: FixedSizeCodec<TFrom, TTo>, config: SetCodecConfig<NumberCodec> & {
|
|
58
|
+
size: number;
|
|
59
|
+
}): FixedSizeCodec<Set<TFrom>, Set<TTo>>;
|
|
60
|
+
export declare function getSetCodec<TFrom, TTo extends TFrom = TFrom>(item: FixedSizeCodec<TFrom, TTo>, config: SetCodecConfig<NumberCodec> & {
|
|
61
|
+
size: 'remainder';
|
|
62
|
+
}): VariableSizeCodec<Set<TFrom>, Set<TTo>>;
|
|
63
|
+
export declare function getSetCodec<TFrom, TTo extends TFrom = TFrom>(item: Codec<TFrom, TTo>, config?: SetCodecConfig<NumberCodec> & {
|
|
64
|
+
size?: number | NumberCodec;
|
|
65
|
+
}): VariableSizeCodec<Set<TFrom>, Set<TTo>>;
|
|
33
66
|
//# sourceMappingURL=set.d.ts.map
|
package/dist/types/set.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/set.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"set.d.ts","sourceRoot":"","sources":["../../src/set.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,EAEL,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CAAC,GAAG;IAAE,IAAI,EAAE,CAAC,CAAA;CAAE,GAClD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,GAAG,KAAK,EACxD,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,EAChC,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GACvD,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACxC,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,GAAG,KAAK,EACxD,IAAI,EAAE,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,EAChC,MAAM,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,GAC5D,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,SAAS,KAAK,GAAG,KAAK,EACxD,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,EACvB,MAAM,CAAC,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,CAAA;CAAE,GACvE,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
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 config - A set of config 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 config - A set of config 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 config - A set of config 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
|