Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants