-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to prefix string type (#148)
* Add support for prefix string * Update tests * Add changeset
- Loading branch information
Showing
13 changed files
with
422 additions
and
135 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@metaplex-foundation/kinobi': patch | ||
--- | ||
|
||
Add support to prefix string type in Rust client |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { Codec, Decoder, Encoder, combineCodec } from '@solana/codecs-core'; | ||
import { | ||
getStructDecoder, | ||
getStructEncoder, | ||
} from '@solana/codecs-data-structures'; | ||
import { getU8Decoder, getU8Encoder } from '@solana/codecs-numbers'; | ||
import { getStringDecoder, getStringEncoder } from '@solana/codecs-strings'; | ||
|
||
export type Link = { name: string; uri: string }; | ||
|
||
export type LinkArgs = Link; | ||
|
||
export function getLinkEncoder() { | ||
return getStructEncoder<LinkArgs>([ | ||
['name', getStringEncoder({ size: getU8Encoder() })], | ||
['uri', getStringEncoder({ size: getU8Encoder() })], | ||
]) satisfies Encoder<LinkArgs>; | ||
} | ||
|
||
export function getLinkDecoder() { | ||
return getStructDecoder<Link>([ | ||
['name', getStringDecoder({ size: getU8Decoder() })], | ||
['uri', getStringDecoder({ size: getU8Decoder() })], | ||
]) satisfies Decoder<Link>; | ||
} | ||
|
||
export function getLinkCodec(): Codec<LinkArgs, Link> { | ||
return combineCodec(getLinkEncoder(), getLinkDecoder()); | ||
} |
36 changes: 36 additions & 0 deletions
36
test/packages/js-experimental/src/generated/types/links.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,36 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { Codec, Decoder, Encoder, combineCodec } from '@solana/codecs-core'; | ||
import { | ||
getArrayDecoder, | ||
getArrayEncoder, | ||
getStructDecoder, | ||
getStructEncoder, | ||
} from '@solana/codecs-data-structures'; | ||
import { Link, LinkArgs, getLinkDecoder, getLinkEncoder } from '.'; | ||
|
||
export type Links = { values: Array<Link> }; | ||
|
||
export type LinksArgs = { values: Array<LinkArgs> }; | ||
|
||
export function getLinksEncoder() { | ||
return getStructEncoder<LinksArgs>([ | ||
['values', getArrayEncoder(getLinkEncoder(), { size: 'remainder' })], | ||
]) satisfies Encoder<LinksArgs>; | ||
} | ||
|
||
export function getLinksDecoder() { | ||
return getStructDecoder<Links>([ | ||
['values', getArrayDecoder(getLinkDecoder(), { size: 'remainder' })], | ||
]) satisfies Decoder<Links>; | ||
} | ||
|
||
export function getLinksCodec(): Codec<LinksArgs, Links> { | ||
return combineCodec(getLinksEncoder(), getLinksDecoder()); | ||
} |
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,28 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { | ||
Serializer, | ||
string, | ||
struct, | ||
u8, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
|
||
export type Link = { name: string; uri: string }; | ||
|
||
export type LinkArgs = Link; | ||
|
||
export function getLinkSerializer(): Serializer<LinkArgs, Link> { | ||
return struct<Link>( | ||
[ | ||
['name', string({ size: u8() })], | ||
['uri', string({ size: u8() })], | ||
], | ||
{ description: 'Link' } | ||
) as Serializer<LinkArgs, Link>; | ||
} |
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,25 @@ | ||
/** | ||
* This code was AUTOGENERATED using the kinobi library. | ||
* Please DO NOT EDIT THIS FILE, instead use visitors | ||
* to add features, then rerun kinobi to update it. | ||
* | ||
* @see https://github.com/metaplex-foundation/kinobi | ||
*/ | ||
|
||
import { | ||
Serializer, | ||
array, | ||
struct, | ||
} from '@metaplex-foundation/umi/serializers'; | ||
import { Link, LinkArgs, getLinkSerializer } from '.'; | ||
|
||
export type Links = { values: Array<Link> }; | ||
|
||
export type LinksArgs = { values: Array<LinkArgs> }; | ||
|
||
export function getLinksSerializer(): Serializer<LinksArgs, Links> { | ||
return struct<Links>( | ||
[['values', array(getLinkSerializer(), { size: 'remainder' })]], | ||
{ description: 'Links' } | ||
) as Serializer<LinksArgs, Links>; | ||
} |
Oops, something went wrong.