/** * 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. * * @see https://github.com/codama-idl/codama */ import { getAddressEncoder, getBytesEncoder, getProgramDerivedAddress, type Address, type ProgramDerivedAddress, } from '@solana/kit'; import { getMinorFactionIdEncoder, getRegionIdEncoder, type MinorFactionIdArgs, type RegionIdArgs, } from '../types'; export type EncounterTreasurySeeds = { gameId: Address; regionId: RegionIdArgs; minorFaction: MinorFactionIdArgs; }; /** * The finite, pre-funded reserve + per-epoch ATLAS-out circuit-breaker for one `(region, faction)` pool. * * All economic value lives here (decisions #1/#3): the ATLAS `vault` pays sell-backs and receives * player buys; `reserves` is the finite cargo stock (no minting — Asks draw down, Bids credit back). * Kept separate from [`EncounterPool`] (config) so the value account is written on trades while the * envelope stays a rarely-written config account. Modeled on `LocalMarket`'s vault + `CargoPod`'s map. */ export async function findEncounterTreasuryPda( seeds: EncounterTreasurySeeds, config: { programAddress?: Address | undefined } = {}, ): Promise { const { programAddress = 'C4SAgeKLgb3pTLWhVr6NRwWyYFuTR7ZeSXFrzoLwfMzF' as Address<'C4SAgeKLgb3pTLWhVr6NRwWyYFuTR7ZeSXFrzoLwfMzF'>, } = config; return await getProgramDerivedAddress({ programAddress, seeds: [ getBytesEncoder().encode( new Uint8Array([ 69, 110, 99, 111, 117, 110, 116, 101, 114, 84, 114, 101, 97, 115, 117, 114, 121, ]), ), getAddressEncoder().encode(seeds.gameId), getRegionIdEncoder().encode(seeds.regionId), getMinorFactionIdEncoder().encode(seeds.minorFaction), ], }); }