satrush-client 0.1.14

Rust client to interact with SatRush's on-chain program.
Documentation
//! This code was AUTOGENERATED using the codama library.
//! Please DO NOT EDIT THIS FILE, instead use visitors
//! to add features, then rerun codama to update it.
//!
//! <https://github.com/codama-idl/codama>
//!

use num_derive::FromPrimitive;
use thiserror::Error;

#[derive(Clone, Debug, Eq, Error, FromPrimitive, PartialEq)]
pub enum SatrushError {
    /// 6000 - Signer is not authorized to execute this instruction
    #[error("Signer is not authorized to execute this instruction")]
    Unauthorized = 0x1770,
    /// 6001 - Ongoing round is not yet finished
    #[error("Ongoing round is not yet finished")]
    RoundInProgress = 0x1771,
    /// 6002 - Invalid round id supplied to create round
    #[error("Invalid round id supplied to create round")]
    InvalidRoundId = 0x1772,
    /// 6003 - Round duration must be greater than zero
    #[error("Round duration must be greater than zero")]
    InvalidRoundDuration = 0x1773,
    /// 6004 - Entropy value is invalid
    #[error("Entropy value is invalid")]
    InvalidEntropy = 0x1774,
    /// 6005 - Round is not accepting deploys
    #[error("Round is not accepting deploys")]
    RoundNotActive = 0x1775,
    /// 6006 - Deployment amount must be greater than zero
    #[error("Deployment amount must be greater than zero")]
    InvalidDeploymentAmount = 0x1776,
    /// 6007 - Selection mask must pick between 1 and 21 tiles within the 21-bit range
    #[error("Selection mask must pick between 1 and 21 tiles within the 21-bit range")]
    InvalidSelectionMask = 0x1777,
    /// 6008 - Arithmetic overflow
    #[error("Arithmetic overflow")]
    MathOverflow = 0x1778,
    /// 6009 - Arithmetic underflow
    #[error("Arithmetic underflow")]
    MathUnderflow = 0x1779,
    /// 6010 - Round winning tile has already been revealed
    #[error("Round winning tile has already been revealed")]
    AlreadyRevealed = 0x177A,
    /// 6011 - Slot hash entropy is unavailable or invalid
    #[error("Slot hash entropy is unavailable or invalid")]
    InvalidSlotHash = 0x177B,
    /// 6012 - Round winning tile has not been revealed yet
    #[error("Round winning tile has not been revealed yet")]
    RoundNotRevealed = 0x177C,
    /// 6013 - Round is not in the finished state
    #[error("Round is not in the finished state")]
    RoundNotFinished = 0x177D,
    /// 6014 - Round is not in the settled state
    #[error("Round is not in the settled state")]
    RoundNotSettled = 0x177E,
    /// 6015 - Swap program account does not match the configured swap program
    #[error("Swap program account does not match the configured swap program")]
    InvalidSwapProgram = 0x177F,
    /// 6016 - Round stake has already been swapped into BTC
    #[error("Round stake has already been swapped into BTC")]
    AlreadySwapped = 0x1780,
    /// 6017 - Swap spent more USD than the budgeted amount
    #[error("Swap spent more USD than the budgeted amount")]
    SwapOverspent = 0x1781,
    /// 6018 - Swap output is below the minimum acceptable amount
    #[error("Swap output is below the minimum acceptable amount")]
    SlippageExceeded = 0x1782,
    /// 6019 - Share amount must be greater than zero
    #[error("Share amount must be greater than zero")]
    InvalidShareAmount = 0x1783,
    /// 6020 - Miner does not hold enough Sats Vault shares
    #[error("Miner does not hold enough Sats Vault shares")]
    InsufficientShares = 0x1784,
    /// 6021 - Strike jackpot was already triggered on the provided round
    #[error("Strike jackpot was already triggered on the provided round")]
    StrikeAlreadyTriggered = 0x1785,
    /// 6022 - Epoch iteration is not accepting ticket purchases
    #[error("Epoch iteration is not accepting ticket purchases")]
    EpochNotOpen = 0x1786,
    /// 6023 - Epoch iteration window has not elapsed yet
    #[error("Epoch iteration window has not elapsed yet")]
    EpochWindowNotElapsed = 0x1787,
    /// 6024 - Epoch iteration is not in the settling state
    #[error("Epoch iteration is not in the settling state")]
    EpochNotSettling = 0x1788,
    /// 6025 - Epoch iteration is not sealed awaiting entropy
    #[error("Epoch iteration is not sealed awaiting entropy")]
    EpochNotSealed = 0x1789,
    /// 6026 - Epoch iteration is not in the settled state
    #[error("Epoch iteration is not in the settled state")]
    EpochNotSettled = 0x178A,
    /// 6027 - Supplied page does not contain the current winning ticket
    #[error("Supplied page does not contain the current winning ticket")]
    EpochInvalidPage = 0x178B,
    /// 6028 - Signer is not a winner of this epoch draw
    #[error("Signer is not a winner of this epoch draw")]
    EpochNotAWinner = 0x178C,
    /// 6029 - Epoch reward has already been distributed
    #[error("Epoch reward has already been distributed")]
    EpochAlreadyDistributed = 0x178D,
    /// 6030 - Epoch iteration has reached the maximum number of participants
    #[error("Epoch iteration has reached the maximum number of participants")]
    EpochMaxParticipants = 0x178E,
    /// 6031 - Tickets count must be greater than zero
    #[error("Tickets count must be greater than zero")]
    InvalidTicketsCount = 0x178F,
    /// 6032 - Miner does not have enough hashrate
    #[error("Miner does not have enough hashrate")]
    InsufficientHashrate = 0x1790,
    /// 6033 - 1 BTC Vault iteration is not accepting ticket purchases
    #[error("1 BTC Vault iteration is not accepting ticket purchases")]
    OneBtcNotOpen = 0x1791,
    /// 6034 - 1 BTC Vault iteration is not in the settled state
    #[error("1 BTC Vault iteration is not in the settled state")]
    OneBtcNotSettled = 0x1792,
    /// 6035 - 1 BTC Vault iteration is not sealed awaiting entropy
    #[error("1 BTC Vault iteration is not sealed awaiting entropy")]
    OneBtcNotSealed = 0x1793,
    /// 6036 - 1 BTC Vault has not accumulated enough BTC to trigger a draw
    #[error("1 BTC Vault has not accumulated enough BTC to trigger a draw")]
    OneBtcNotTriggerable = 0x1794,
    /// 6037 - 1 BTC Vault draw has no participants
    #[error("1 BTC Vault draw has no participants")]
    OneBtcNoParticipants = 0x1795,
    /// 6038 - Ticket does not hold the winning ticket for this draw
    #[error("Ticket does not hold the winning ticket for this draw")]
    OneBtcNotAWinner = 0x1796,
    /// 6039 - The winning ticket cannot be closed until the prize is claimed
    #[error("The winning ticket cannot be closed until the prize is claimed")]
    OneBtcWinningTicketLocked = 0x1797,
    /// 6040 - Epoch page has already been sealed
    #[error("Epoch page has already been sealed")]
    EpochPageAlreadySealed = 0x1798,
    /// 6041 - Epoch page is not sealed yet
    #[error("Epoch page is not sealed yet")]
    EpochPageNotSealed = 0x1799,
    /// 6042 - Epoch sealed page chain does not reconcile with the iteration's ticket total
    #[error("Epoch sealed page chain does not reconcile with the iteration's ticket total")]
    EpochSealMismatch = 0x179A,
    /// 6043 - Treasury has no accrued fees to withdraw
    #[error("Treasury has no accrued fees to withdraw")]
    TreasuryEmpty = 0x179B,
    /// 6044 - Claim amount must be greater than zero
    #[error("Claim amount must be greater than zero")]
    InvalidClaimAmount = 0x179C,
    /// 6045 - Miner does not hold enough unclaimed USD
    #[error("Miner does not hold enough unclaimed USD")]
    InsufficientUnclaimedUsd = 0x179D,
    /// 6046 - Automation balance cannot cover the per-round deploy amount
    #[error("Automation balance cannot cover the per-round deploy amount")]
    InsufficientAutomationBalance = 0x179E,
    /// 6047 - Automation amount must be greater than zero
    #[error("Automation amount must be greater than zero")]
    InvalidAutomationAmount = 0x179F,
    /// 6048 - Selection mask does not match the automation strategy
    #[error("Selection mask does not match the automation strategy")]
    InvalidAutomationStrategyMask = 0x17A0,
    /// 6049 - Deploy amount is below the 1 USD minimum
    #[error("Deploy amount is below the 1 USD minimum")]
    DeployAmountBelowMinimum = 0x17A1,
    /// 6050 - Epoch iteration duration must be greater than zero
    #[error("Epoch iteration duration must be greater than zero")]
    InvalidEpochIterationDuration = 0x17A2,
    /// 6051 - Unclaimed hashrate bps must not exceed 10_000
    #[error("Unclaimed hashrate bps must not exceed 10_000")]
    InvalidUnclaimedHashrateBps = 0x17A3,
    /// 6052 - Strike trigger modulus must be greater than zero
    #[error("Strike trigger modulus must be greater than zero")]
    InvalidStrikeTriggerModulus = 0x17A4,
    /// 6053 - Sats Vault round fee bps plus deploy fee bps must stay below 10_000
    #[error("Sats Vault round fee bps plus deploy fee bps must stay below 10_000")]
    InvalidSwapBps = 0x17A5,
    /// 6054 - Mint account data is too short to contain the decimals field
    #[error("Mint account data is too short to contain the decimals field")]
    InvalidMintData = 0x17A6,
    /// 6055 - Deploy fee legs must each be at least 1 bps and sum to exactly 800 bps
    #[error("Deploy fee legs must each be at least 1 bps and sum to exactly 800 bps")]
    InvalidDeployFees = 0x17A7,
    /// 6056 - Grubstake amount must be greater than zero
    #[error("Grubstake amount must be greater than zero")]
    InvalidGrubstakeAmount = 0x17A8,
    /// 6057 - Withdrawal exceeds the unreserved grubstake balance
    #[error("Withdrawal exceeds the unreserved grubstake balance")]
    InsufficientGrubstake = 0x17A9,
    /// 6058 - Grubstake airdrop expiration must be in the future
    #[error("Grubstake airdrop expiration must be in the future")]
    InvalidGrubstakeExpiration = 0x17AA,
    /// 6059 - Grubstake airdrop has expired and can only be reclaimed
    #[error("Grubstake airdrop has expired and can only be reclaimed")]
    GrubstakeAirdropExpired = 0x17AB,
    /// 6060 - Grubstake airdrop has not expired yet
    #[error("Grubstake airdrop has not expired yet")]
    GrubstakeAirdropNotExpired = 0x17AC,
    /// 6061 - Miner's grubstake spend window has expired
    #[error("Miner's grubstake spend window has expired")]
    GrubstakeExpired = 0x17AD,
    /// 6062 - Amount exceeds the miner's grubstake balance
    #[error("Amount exceeds the miner's grubstake balance")]
    InsufficientMinerGrubstake = 0x17AE,
    /// 6063 - Miner's grubstake spend window has not expired yet
    #[error("Miner's grubstake spend window has not expired yet")]
    GrubstakeNotExpired = 0x17AF,
    /// 6064 - Automation is not grubstake-funded
    #[error("Automation is not grubstake-funded")]
    NotGrubstakeFunded = 0x17B0,
    /// 6065 - Affiliate tag must be 3-16 characters of a-z, 0-9, '_' or '-'
    #[error("Affiliate tag must be 3-16 characters of a-z, 0-9, '_' or '-'")]
    InvalidAffiliateTag = 0x17B1,
    /// 6066 - An affiliate cannot refer their own miner
    #[error("An affiliate cannot refer their own miner")]
    SelfReferralNotAllowed = 0x17B2,
    /// 6067 - Affiliate account does not match the miner's bound affiliate
    #[error("Affiliate account does not match the miner's bound affiliate")]
    AffiliateMismatch = 0x17B3,
    /// 6068 - Redemption exceeds the affiliate's unclaimed points
    #[error("Redemption exceeds the affiliate's unclaimed points")]
    InsufficientAffiliatePoints = 0x17B4,
    /// 6069 - Treasury has not accrued enough to cover the redemption
    #[error("Treasury has not accrued enough to cover the redemption")]
    InsufficientTreasuryBalance = 0x17B5,
    /// 6070 - Affiliate rate cannot exceed 10000 bps
    #[error("Affiliate rate cannot exceed 10000 bps")]
    InvalidAffiliateRate = 0x17B6,
    /// 6071 - Account is not the configured rng program
    #[error("Account is not the configured rng program")]
    InvalidRngProgram = 0x17B7,
    /// 6072 - Account is not the rng program's config PDA
    #[error("Account is not the rng program's config PDA")]
    InvalidRngConfig = 0x17B8,
    /// 6073 - Account is not the expected rotor of the rng program
    #[error("Account is not the expected rotor of the rng program")]
    InvalidRotor = 0x17B9,
    /// 6074 - Rotor has not settled fresh randomness past the arm-time snapshot
    #[error("Rotor has not settled fresh randomness past the arm-time snapshot")]
    RotorNotSettled = 0x17BA,
    /// 6075 - Account is not the configured token mint
    #[error("Account is not the configured token mint")]
    InvalidTokenMint = 0x17BB,
    /// 6076 - Account is not the satrush-mint program
    #[error("Account is not the satrush-mint program")]
    InvalidMintProgram = 0x17BC,
    /// 6077 - Account is not the expected satrush-mint PDA
    #[error("Account is not the expected satrush-mint PDA")]
    InvalidMintAccount = 0x17BD,
    /// 6078 - Token account data is too short to read its balance
    #[error("Token account data is too short to read its balance")]
    InvalidTokenAccountData = 0x17BE,
    /// 6079 - Account is not a program-owned miner account
    #[error("Account is not a program-owned miner account")]
    InvalidMinerAccount = 0x17BF,
    /// 6080 - Miner account already carries the v2 layout
    #[error("Miner account already carries the v2 layout")]
    MinerAlreadyMigrated = 0x17C0,
    /// 6081 - Account is not the program's config account
    #[error("Account is not the program's config account")]
    InvalidConfigAccount = 0x17C1,
    /// 6082 - Config account already carries the v2 layout
    #[error("Config account already carries the v2 layout")]
    ConfigAlreadyMigrated = 0x17C2,
    /// 6083 - Account is not the program's board account
    #[error("Account is not the program's board account")]
    InvalidBoardAccount = 0x17C3,
    /// 6084 - Board account already carries the v2 layout
    #[error("Board account already carries the v2 layout")]
    BoardAlreadyMigrated = 0x17C4,
    /// 6085 - Account is not the program's treasury account
    #[error("Account is not the program's treasury account")]
    InvalidTreasuryAccount = 0x17C5,
    /// 6086 - Treasury account already carries the v2 layout
    #[error("Treasury account already carries the v2 layout")]
    TreasuryAlreadyMigrated = 0x17C6,
}

impl From<SatrushError> for solana_program_error::ProgramError {
    fn from(e: SatrushError) -> Self {
        solana_program_error::ProgramError::Custom(e as u32)
    }
}