Skip to main content

Crate satrush_client

Crate satrush_client 

Source

Modules§

accounts
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.
gpa
getProgramAccounts queries: scan the program’s accounts by discriminator (account type) plus field filters, returning decoded accounts.
instructions
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.
test_utils
Mock swap route support for validation environments.
types
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.

Structs§

BtcSharesValue
BTC value of a sats-vault share amount, as computed by sats_to_btc.
DecodedAccount
HashrateReward
The reward one settled play would credit, split into its channels for the emitted event, as computed by hashrate_reward. loyalty_points + skill_points == total by construction.

Enums§

BtcSharesValueError
BtcToSatsError
HashrateRewardError
MaybeAccount
SatrushError

Constants§

ASSOCIATED_TOKEN_PROGRAM_ID
SPL Associated Token Account program.
HASHRATE_DECIMALS
Display decimals of hashrate points, mirroring the program’s HASHRATE_DECIMALS: 1 raw unit = 0.01 point.
HASHRATE_PER_TICKET
Raw hashrate units per vault ticket, mirroring the program’s HASHRATE_PER_TICKET (10^HASHRATE_DECIMALS): one ticket costs 1.00 point.
LOYALTY_WEIGHT
Loyalty channel weight (α) in the hashrate reward formula, mirroring the program’s LOYALTY_WEIGHT.
REWARD_MAX_STREAK
Cap on the streak multiplier credited toward the hashrate reward, mirroring the program’s REWARD_MAX_STREAK. The miner’s live streak (Miner::current_streak_count) is uncapped; only the multiplier frozen onto a deployment is clamped here.
SATRUSH_ID
satrush program ID.
SHARE_OFFSET
Virtual share base used by the on-chain vault math (decimal offset of 3): conversions behave as if SHARE_OFFSET extra shares and 1 extra satoshi always exist, so an empty vault mints 1_000 shares per satoshi.
SKILL_WEIGHT
Skill channel weight (β) in the hashrate reward formula, mirroring the program’s SKILL_WEIGHT.
SLOT_HASHES_ID
SlotHashes sysvar.
SYSTEM_PROGRAM_ID
System program.
TILE_COUNT
Number of selectable tiles on the board.
TOKEN_PROGRAM_ID
SPL Token program.

Functions§

btc_to_sats
Shares minted for depositing btc_amount BTC into a vault holding vault_amount BTC with vault_shares shares issued (SatsVault::btc_amount / SatsVault::btc_shares): scaled by the vault’s virtual (shares + SHARE_OFFSET) / (assets + 1) ratio and floored, so an empty vault mints SHARE_OFFSET shares per satoshi. Errors when the result exceeds u64::MAX.
get_associated_token_address
Derive the canonical associated token account for wallet holding mint.
get_board_address
get_cancel_public_automation_instruction
cancel_public_automation: refund the full escrow balance and close the automation and its token account. Unconditional; in-flight deployments settle to the miner profile later.
get_claim_usd_instruction
claim_usd: withdraw amount of the miner authority’s unclaimed USD winnings from the board’s USD pool to the authority’s USD account. No exit fee — the full amount transfers.
get_close_round_instruction
close_round: tear down a Finished round, sweeping a no-winner round’s orphaned pot (USD and BTC) into the treasury. Signed by the config’s admin authority, which receives the round account’s rent.
get_create_board_instruction
create_board: the board singleton, its USD/BTC pools and the initial round (id 1). Signed by the config’s admin authority.
get_create_epoch_vault_instruction
create_epoch_vault: the epoch vault singleton, its USD/BTC pools and the first iteration (id 1).
get_create_one_btc_vault_instruction
create_one_btc_vault: the 1 BTC vault singleton, its USD/BTC pools and the first iteration (id 1).
get_create_public_automation_instruction
create_public_automation: escrow deposit_usd_amount and configure the crank to deploy per_round_usd_amount per round with the given strategy. One automation per authority.
get_create_satrush_config_instruction
create_satrush_config: the config PDA holding authorities, mints and fee parameters. authority pays and must equal the program’s upgrade authority.
get_create_sats_vault_instruction
create_sats_vault: the sats vault singleton and its BTC reserve pool.
get_create_treasury_instruction
create_treasury: the treasury singleton and its USD fee pool.
get_deploy_public_instruction
deploy_public: stake amount USD (base units; all fees are deducted from it, so the miner parts with exactly amount) on the tiles in selection_mask for round round_id, as the miner authority. The round must be the board’s current one and open for deploys; the miner profile and deployment record PDAs are created by the instruction.
get_epoch_vault_address
get_epoch_vault_entry_address
get_epoch_vault_iteration_address
get_epoch_vault_page_address
get_event_authority_address
Anchor’s event-CPI authority PDA — the extra signer every #[event_cpi] instruction takes alongside the program account.
get_execute_public_automation_instruction
execute_public_automation: crank-signed per-round deploy funded from automation_authority’s escrow. selection_mask must be Some for Discretionary automations and None otherwise.
get_hashrate_tickets_count
Whole vault tickets purchasable with hashrate raw units, flooring at HASHRATE_PER_TICKET raw units (1.00 point) per ticket.
get_hashrate_ui_amount
Format raw hashrate units as the UI points amount with 2 decimals (HASHRATE_DECIMALS): raw 101 → "1.01". Lossless for the full u64 range, unlike an f64 conversion.
get_miner_address
get_one_btc_vault_address
get_one_btc_vault_iteration_address
get_public_automation_address
get_public_deployment_address
get_rotate_round_instruction
rotate_round: reveal current_round_id’s winning tile, sweep the round’s accumulated fee legs from the board pool to the epoch/1 BTC/treasury pools, and deploy round current_round_id + 1 as the board’s new active round. Signed by the config’s round authority; valid once the round’s window elapsed.
get_round_address
get_satrush_config_address
get_sats_vault_address
get_settle_deploy_public_instruction
settle_deploy_public: settle deployment_authority’s deployment in a Settled round. authority signs (the owner, or the round authority for automated deployments); rent_recipient must be the round authority for automated deployments and the owner for manual ones.
get_swap_round_stake_instruction
swap_round_stake: relay a pre-built aggregator route that converts part of the revealed round’s USD into BTC. swap_data and route_accounts are the route’s opaque instruction data and account list; the on-chain handler enforces the economics against observed balance deltas. Signed by the config’s round authority.
get_top_up_public_automation_instruction
top_up_public_automation: move amount USD from the authority’s account into the automation’s escrow.
get_treasury_address
get_update_board_round_duration_instruction
update_board_round_duration: overwrite the board’s round_duration (slots). Applies to future round activations only; the active round keeps its window. Signed by the config’s admin authority.
get_update_deployment_settle_grace_duration_instruction
update_deployment_settle_grace_duration: admin retunes the settle grace window (slots after a round settles before stale deployments may be force-cleaned; 0 disables cleanup).
get_update_epoch_vault_iteration_duration_instruction
update_epoch_vault_iteration_duration: overwrite the config’s epoch vault iteration length (slots). Applies to the currently accumulating iteration immediately. Signed by the config’s admin authority.
get_update_min_deploy_usd_amount_instruction
update_min_deploy_usd_amount: overwrite the config’s minimum gross deploy size (USD mint base units). Applies to every subsequent manual deploy, automation creation and automation execution. Signed by the config’s admin authority.
get_update_strike_trigger_modulus_instruction
update_strike_trigger_modulus: admin retunes the Sat Strike odds (the jackpot fires when rng % modulus == 0). Signed by the config’s admin authority.
get_update_unclaimed_hashrate_bps_instruction
update_unclaimed_hashrate_bps: overwrite the config’s deferred hashrate bonus ratio (bps of each settled play’s reward). Signed by the config’s admin authority.
hashrate_reward
Hashrate points a play would credit, mirroring the program’s hashrate_reward so a caller can preview them before deploying or settling.
next_streak_multiplier
Streak multiplier a deploy into next_round_id would freeze onto its PublicDeployment, computed from the miner’s live state without submitting a transaction. Mirrors Miner::record_play followed by Miner::get_hashrate_streak_multiplier; feed the result into crate::hashrate_reward to preview the points a deploy would earn.
sats_to_btc
BTC value of shares against a vault holding vault_amount BTC with vault_shares shares issued (SatsVault::btc_amount / SatsVault::btc_shares). claim_fee_bps is SatrushConfig::sats_vault_claim_fee_bps; pass 0 when only the gross value matters. Zero shares value to zero without error; shares exceeding vault_shares is rejected.
selection_mask_from_tiles
Convert a fixed-size array of tile selections into the packed u32 selection mask expected by deploy_public: bit i is set when tiles[i] is true.
tiles_from_selection_mask
Inverse of selection_mask_from_tiles: unpack a u32 selection mask into a per-tile boolean array. Bits above TILE_COUNT are ignored.