This repository was archived by the owner on Mar 11, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
token-js: Support InterestBearingMint instructions #3263
Copy link
Copy link
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
Problem
token-2022 includes a new mint extension to set an interest rate for tokens, but it isn't supported in the JS bindings. The relevant top-level instruction definition can be found here:
| InterestBearingMintExtension, |
and the sub-instructions here:
solana-program-library/token/program-2022/src/extension/interest_bearing_mint/instruction.rs
Lines 18 to 57 in 056948b
| /// Interesting-bearing mint extension instructions | |
| #[derive(Clone, Copy, Debug, PartialEq, IntoPrimitive, TryFromPrimitive)] | |
| #[repr(u8)] | |
| pub enum InterestBearingMintInstruction { | |
| /// Initialize a new mint with interest accrual. | |
| /// | |
| /// Fails if the mint has already been initialized, so must be called before | |
| /// `InitializeMint`. | |
| /// | |
| /// The mint must have exactly enough space allocated for the base mint (82 | |
| /// bytes), plus 83 bytes of padding, 1 byte reserved for the account type, | |
| /// then space required for this extension, plus any others. | |
| /// | |
| /// Accounts expected by this instruction: | |
| /// | |
| /// 0. `[writable]` The mint to initialize. | |
| /// | |
| /// Data expected by this instruction: | |
| /// `crate::extension::interest_bearing::instruction::InitializeInstructionData` | |
| /// | |
| Initialize, | |
| /// Update the interest rate. Only supported for mints that include the | |
| /// `InterestBearingConfig` extension. | |
| /// | |
| /// Accounts expected by this instruction: | |
| /// | |
| /// * Single authority | |
| /// 0. `[writable]` The mint. | |
| /// 1. `[signer]` The mint rate authority. | |
| /// | |
| /// * Multisignature authority | |
| /// 0. `[writable]` The mint. | |
| /// 1. `[]` The mint's multisignature rate authority. | |
| /// 2. ..2+M `[signer]` M signer accounts. | |
| /// | |
| /// Data expected by this instruction: | |
| /// `crate::extension::interest_bearing::BasisPoints` | |
| /// | |
| UpdateRate, | |
| } |
Solution
Following the model in #2951 , add support for these new instructions, state, and extension type, including some end-to-end tests.
This is the first step for support, since we also need a client-side way to convert from token amount to tokens + interest accrued.
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers
Type
Projects
Status
Closed