/** * 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, type MinorFactionIdArgs } from '../types'; export type FactionAccountSeeds = { gameId: Address; factionId: MinorFactionIdArgs; }; /** * The per-faction record in the dynamic registry (decision D1/D8). Sized, packed, 209 bytes. * * Modeled on `ProfileFactionAccount` (a sized * `ProgramAccount` embedding the [`Faction`] enum) + the [`EncounterPool`](crate::state::EncounterPool) * header (`(game, …, minor_faction)` scoping). Growth is by carving from `_reserved` (version-gated), * never by appending. */ export async function findFactionAccountPda( seeds: FactionAccountSeeds, config: { programAddress?: Address | undefined } = {}, ): Promise { const { programAddress = 'C4SAgeKLgb3pTLWhVr6NRwWyYFuTR7ZeSXFrzoLwfMzF' as Address<'C4SAgeKLgb3pTLWhVr6NRwWyYFuTR7ZeSXFrzoLwfMzF'>, } = config; return await getProgramDerivedAddress({ programAddress, seeds: [ getBytesEncoder().encode( new Uint8Array([ 70, 97, 99, 116, 105, 111, 110, 65, 99, 99, 111, 117, 110, 116, ]), ), getAddressEncoder().encode(seeds.gameId), getMinorFactionIdEncoder().encode(seeds.factionId), ], }); }