Skip to main content

hopper_token/
lib.rs

1//! Hopper-owned SPL Token builder surface.
2//!
3//! Thin first-class Hopper wrappers over the canonical runtime builders.
4//! This crate gives Hopper a native token CPI surface instead of forcing
5//! authored programs to depend on external helper crates.
6
7#![no_std]
8#![deny(unsafe_op_in_unsafe_fn)]
9
10pub mod layout;
11
12pub use hopper_runtime::token_mint::{InitializeMint2, MintConfig, MintPlan, MintProgram};
13
14pub use hopper_runtime::token::{
15    return_data_string, return_data_u64, AmountToUiAmount, ApproveChecked, BurnChecked,
16    CheckedMintDecimals, CheckedTokenAuthority, CheckedTokenMint, CloseAccount, FreezeAccount,
17    GetAccountDataSize, InitializeAccount, InitializeAccount2, InitializeAccount3,
18    InitializeImmutableOwner, InitializeMint, InitializeMultisig, InitializeMultisig2,
19    MintToChecked, Revoke, SetAuthority, SplMint, SplMintView, SplTokenAccount,
20    SplTokenAccountView, SyncNative, ThawAccount, TokenAmountSnapshot, TokenAuthorityType,
21    TokenBatch, TokenInstruction, TokenProgram, TokenSink, Trailing, TransferChecked,
22    UiAmountToAmount, UnwrapLamports, WithdrawExcessLamports, MAX_TOKEN_MULTISIG_SIGNERS,
23    MAX_UI_AMOUNT_LEN, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID,
24};
25pub use hopper_runtime::token_batch::{BATCH_DISCRIMINATOR, BATCH_INSTRUCTION_HEADER_LEN};
26
27#[cfg(feature = "legacy-token-instructions")]
28#[allow(deprecated)]
29pub use hopper_runtime::token::{Approve, Burn, MintTo, Transfer};
30
31/// SPL Token instruction builders exported by Hopper.
32///
33/// Safety-by-default exports include checked variants plus operations whose
34/// SPL semantics do not need a mint-decimals guard. Enable the explicit
35/// `legacy-token-instructions` feature to expose the deprecated plain
36/// `Transfer`, `MintTo`, `Burn`, and `Approve` builders for migration tests.
37pub mod instructions {
38    pub use hopper_runtime::token::{
39        AmountToUiAmount, ApproveChecked, BurnChecked, CloseAccount, FreezeAccount,
40        GetAccountDataSize, InitializeAccount, InitializeAccount2, InitializeAccount3,
41        InitializeImmutableOwner, InitializeMint, InitializeMultisig, InitializeMultisig2,
42        MintToChecked, Revoke, SetAuthority, SyncNative, ThawAccount, TokenAuthorityType,
43        TokenBatch, TokenInstruction, TokenProgram, TransferChecked, UiAmountToAmount,
44        UnwrapLamports, WithdrawExcessLamports,
45    };
46    pub use hopper_runtime::token_mint::InitializeMint2;
47
48    #[cfg(feature = "legacy-token-instructions")]
49    #[allow(deprecated)]
50    pub use hopper_runtime::token::{Approve, Burn, MintTo, Transfer};
51}