generateRandomRelayerFeesPoolOffset
Umbra SDK reference for Generate Random Relayer Fees Pool Offset.
generateRandomRelayerFeesPoolOffset(
_instructionSeed,_mintAddress):U16
Defined in: src/utils/miscellaneous.ts:198
Generates a cryptographically secure random offset for selecting a relayer fees pool account.
Parameters
_instructionSeed
The instruction seed (currently unused, reserved for future deterministic generation)
_mintAddress
The mint address of the token (currently unused, reserved for future deterministic generation)
Returns
A random 16-bit unsigned integer (U16) account offset within the valid range
Throws
AccountOffsetGenerationError When random generation fails or conversion errors occur
Remarks
This function generates a random offset used to select a specific relayer fees pool account from multiple available pools. The offset is used to derive the Program Derived Address (PDA) for the selected pool account.
Security: This function uses cryptographically secure random number generation to ensure the offset is unpredictable and cannot be manipulated by attackers.
Current Implementation:
Currently, there is only one relayer fees pool account (NUMBER_OF_ACCOUNTS = 1), so this
function will always return 0. The parameters _instructionSeed and _mintAddress are
currently unused but reserved for future deterministic generation based on instruction
context and token type.
Account Offset: The returned offset is a 16-bit unsigned integer (U16) that must be less than the number of available accounts. It's used as part of the seed derivation for the pool account PDA.
Example
// Generate a random offset for relayer fees pool selection
const offset = generateRandomRelayerFeesPoolOffset(instructionSeed, mintAddress);
// Use the offset to derive the pool account address
const poolAccount = deriveRelayerFeesPoolAccount(offset);