-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(experimental): rename fixCodec and prefixCodec to fixCodecSi…
…ze and prefixCodecSize (#2411) This PR renames `fixCodec` to `fixCodecSize` and `prefixCodec` to `prefixCodecSize` [as discussed here](#2397 (comment)). Note that I created a new changeset describing the change for `fixCodec` but not for `prefixCodec` as this is not yet merged and I thought it'd be better to update the changeset created by a previous PR of this stack.
- Loading branch information
1 parent
4ae78f5
commit 2e5af9f
Showing
24 changed files
with
204 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
'@solana/codecs-data-structures': patch | ||
'@solana/codecs-strings': patch | ||
'@solana/codecs-core': patch | ||
'@solana/addresses': patch | ||
'@solana/rpc-types': patch | ||
'@solana/options': patch | ||
'@solana/rpc-api': patch | ||
--- | ||
|
||
Renamed `fixCodec` to `fixCodecSize` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
packages/codecs-core/src/__typetests__/fix-codec-size-typetest.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
Codec, | ||
Decoder, | ||
Encoder, | ||
FixedSizeCodec, | ||
FixedSizeDecoder, | ||
FixedSizeEncoder, | ||
VariableSizeCodec, | ||
VariableSizeDecoder, | ||
VariableSizeEncoder, | ||
} from '../codec'; | ||
import { fixCodecSize, fixDecoderSize, fixEncoderSize } from '../fix-codec-size'; | ||
|
||
{ | ||
// [fixEncoderSize]: It transforms any encoder into a fixed size encoder. | ||
fixEncoderSize({} as FixedSizeEncoder<string>, 42) satisfies FixedSizeEncoder<string, 42>; | ||
fixEncoderSize({} as VariableSizeEncoder<string>, 42) satisfies FixedSizeEncoder<string, 42>; | ||
fixEncoderSize({} as Encoder<string>, 42) satisfies FixedSizeEncoder<string, 42>; | ||
} | ||
|
||
{ | ||
// [fixDecoderSize]: It transforms any decoder into a fixed size decoder. | ||
fixDecoderSize({} as FixedSizeDecoder<string>, 42) satisfies FixedSizeDecoder<string, 42>; | ||
fixDecoderSize({} as VariableSizeDecoder<string>, 42) satisfies FixedSizeDecoder<string, 42>; | ||
fixDecoderSize({} as Decoder<string>, 42) satisfies FixedSizeDecoder<string, 42>; | ||
} | ||
|
||
{ | ||
// [fixCodecSize]: It transforms any codec into a fixed size codec. | ||
fixCodecSize({} as FixedSizeCodec<string>, 42) satisfies FixedSizeCodec<string, string, 42>; | ||
fixCodecSize({} as VariableSizeCodec<string>, 42) satisfies FixedSizeCodec<string, string, 42>; | ||
fixCodecSize({} as Codec<string>, 42) satisfies FixedSizeCodec<string, string, 42>; | ||
} |
Oops, something went wrong.