{"version":3,"file":"types.cjs","sources":["../../../../src/staking/types.ts"],"sourcesContent":["import {\n  getInitializeInstruction,\n  getDelegateStakeInstruction,\n} from \"@solana-program/stake\";\nimport { getCreateAccountInstruction } from \"@solana-program/system\";\nimport { type Address, KeyPairSigner, TransactionSigner } from \"@solana/kit\";\n\n/** Native Stake program address. */\nexport const STAKE_PROGRAM_ID: Address =\n  \"Stake11111111111111111111111111111111111111\" as Address;\n\n/** Sysvar Clock address. */\nexport const SYSVAR_CLOCK =\n  \"SysvarC1ock11111111111111111111111111111111\" as Address;\n\n/** Sysvar Stake History address. */\nexport const SYSVAR_STAKE_HISTORY =\n  \"SysvarStakeHistory1111111111111111111111111\" as Address;\n\n/** Unused stake config account (required by legacy instructions). */\nexport const UNUSED_STAKE_CONFIG_ACC =\n  \"StakeConfig11111111111111111111111111111111\" as Address;\n\n/** Helius validator vote account address. */\nexport const HELIUS_VALIDATOR_ID: Address =\n  \"he1iusunGwqrNtafDtLdhsUQDFvo13z9sUa36PauBtk\" as Address;\n\n/** Max u64 value — active stake accounts have their deactivation epoch set to this. */\nexport const U64_MAX = \"18446744073709551615\" as unknown as bigint;\n\n/** Size of a stake account in bytes. */\nexport const STAKE_STATE_LEN = 200;\n\n/** Lamports per SOL as a BigInt-compatible value. */\nexport const LAMPORTS_PER_SOL_BIGINT = \"1_000_000_000\" as unknown as bigint;\n\n/** Create a signed stake transaction delegating to the Helius validator. Returns the serialized tx and new stake account pubkey. */\nexport type CreateStakeTransactionFn = (\n  owner: KeyPairSigner<string>,\n  amountSol: number\n) => Promise<{\n  serializedTx: string;\n  stakeAccountPubkey: Address;\n}>;\n\n/** Create a signed deactivation (unstake) transaction. Returns the serialized tx. */\nexport type createUnstakeTransactionFn = (\n  ownerSigner: KeyPairSigner<string>,\n  stakeAccount: Address\n) => Promise<{ serializedTx: string }>;\n\n/** Create a signed withdrawal transaction. Returns the serialized tx. */\nexport type CreateWithdrawTransactionFn = (\n  withdrawAuthority: KeyPairSigner<string>,\n  stakeAccount: Address,\n  destination: Address,\n  lamports: number | bigint\n) => Promise<{ serializedTx: string }>;\n\n/** Fetch all stake accounts delegated to the Helius validator for a given wallet. */\nexport type GetHeliusStakeAccountsFn = (\n  wallet: string | Address\n) => Promise<any[]>;\n\n/** Get the withdrawable lamport amount for a stake account. */\nexport type GetWithdrawableAmountFn = (\n  stakeAccount: Address | string,\n  includeRentExempt?: boolean\n) => Promise<number>;\n\n/** Result from `getStakeInstructions` — the instructions and generated stake account signer. */\nexport interface StakeInstructionsResult {\n  /** Instructions to create, initialize, and delegate the stake account. */\n  instructions: ReadonlyArray<\n    ReturnType<\n      | typeof getCreateAccountInstruction\n      | typeof getInitializeInstruction\n      | typeof getDelegateStakeInstruction\n    >\n  >;\n  /** The generated stake account signer (keypair). */\n  stakeAccount: TransactionSigner<string>;\n}\n\n/** Build the instructions needed to create and delegate a stake account. */\nexport type GetStakeInstructionsFn = (\n  owner: TransactionSigner<string>,\n  amountSol: number\n) => Promise<StakeInstructionsResult>;\n\n/** Build a deactivation (unstake) instruction. */\nexport type GetUnstakeInstructionFn = (\n  owner: Address,\n  stakeAccount: Address\n) => any;\n\n/** Build a withdrawal instruction. */\nexport type GetWithdrawIxFn = (\n  owner: Address,\n  stakeAccount: Address,\n  destination: Address,\n  lamports: number | bigint\n) => any;\n"],"names":[],"mappings":";;AAOA;AACO,MAAM,gBAAgB,GAC3B;AAEF;AACO,MAAM,YAAY,GACvB;AAEF;AACO,MAAM,oBAAoB,GAC/B;AAEF;AACO,MAAM,uBAAuB,GAClC;AAEF;AACO,MAAM,mBAAmB,GAC9B;AAEF;AACO,MAAM,OAAO,GAAG;AAEvB;AACO,MAAM,eAAe,GAAG;AAE/B;AACO,MAAM,uBAAuB,GAAG;;;;;;;;;;;"}