solana_conditional_liquidity

Function is_invoked_by_segmenter

Source
pub fn is_invoked_by_segmenter(
    registry: &AccountInfo<'_>,
    segmenter: &AccountInfo<'_>,
) -> bool
Expand description

Checks whether the invocation was signed by a segmenter. Use this if you don’t need to branch on the origin of the invocation.

Examples

use solana_conditional_liquidity::is_invoked_by_segmenter;
use solana_program::account_info::AccountInfo;

fn handler(registry: &AccountInfo<'_>, segmenter: &AccountInfo<'_>) {
    if !is_invoked_by_segmenter(registry, segmenter) {
        // The invocation wasn't signed by a segmenter
        return;
    }

    // Do stuff that you only allow when the invocation was signed by a segmenter
    // ...
}