Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Token JS: Use COptionPubkeyLayout for all COption fields #6170

Closed
buffalojoec opened this issue Jan 23, 2024 · 1 comment · Fixed by #6173
Closed

Token JS: Use COptionPubkeyLayout for all COption fields #6170

buffalojoec opened this issue Jan 23, 2024 · 1 comment · Fixed by #6173
Labels

Comments

@buffalojoec
Copy link
Contributor

buffalojoec commented Jan 23, 2024

After #6164, we now have a serialization layout for COption<Pubkey>, where a None value is represented by a single 0, while Some(Pubkey) is represented by a 1 plus the public key bytes.

There are a handful more instructions in Token2022 that use COption<Pubkey>. Here are a few examples:

InitializeMint2 {
/// Number of base 10 digits to the right of the decimal place.
decimals: u8,
/// The authority/multisignature to mint tokens.
#[cfg_attr(feature = "serde-traits", serde(with = "As::<DisplayFromStr>"))]
mint_authority: Pubkey,
/// The freeze authority/multisignature of the mint.
#[cfg_attr(feature = "serde-traits", serde(with = "coption_fromstr"))]
freeze_authority: COption<Pubkey>,

InitializeMintCloseAuthority {
/// Authority that must sign the `CloseAccount` instruction on a mint
#[cfg_attr(feature = "serde-traits", serde(with = "coption_fromstr"))]
close_authority: COption<Pubkey>,
},

Update their JavaScript instruction builders to use the new layout!

@qiweiii
Copy link
Contributor

qiweiii commented Jan 24, 2024

would like to work on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants