npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@layerzerolabs/pubkey-policy-hook-solana-contracts

v1.2.95

Published

Readme

Pubkey policy hook — Solana

pubkey_policy_hook is an optional Token-2022 transfer hook. On every transfer it checks the source owner, the destination owner and the executing authority against the pubkey policy bound into the mint's manifest; the Permanent Delegate is exempt. The mint's hook-update authority binds or re-binds the policy with init_transfer_hook, and only a policy for the mint binds. Handing that authority to a token-manager root's TransferHook signer puts rebinding under its DefaultAdmin (set_transfer_hook_policy).

init_transfer_hook's authority is an unchecked account, so generated clients mark it as a non-signer. A plain key or a CPI-signing PDA must be passed as a signer; a native multisig is passed as a non-signer, with its member signers appended as signing remaining accounts.

The hook screens transfers only. Token-2022's SetAuthority(AccountOwner) reassigns a token account, balance included, without a transfer, so it never runs the hook: a blocked owner of a non-ATA account can hand it to an allowed key. ATAs (ImmutableOwner) and frozen accounts cannot be reassigned, so blocking a holder means freezing their accounts too.

It is used alongside the token manager, whose README and usage doc cover setup with Token ACL; the cross-program scenarios that exercise the hook live in token-manager's integration suite.

Build and test

pnpm build       # anchor build + IDL and TS type generation
pnpm test:rust   # host tests in programs/pubkey_policy_hook/tests
pnpm lint        # rustfmt --check + clippy -D warnings

Every command runs through the repo Docker VM tooling (lz-tool anchor).

PUBKEY_POLICY_HOOK_ID sets the program ID compiled into the binary and IDL; the default is the development ID 7HTVK1Jwzjd4yRGCZnLT4QmwhmZidurFxwz2RMAiUyzk. lz-tool does not pass host environment variables into its container, so pass it explicitly:

pnpm exec lz-tool --env PUBKEY_POLICY_HOOK_ID=<pubkey> --script 'sh scripts/build.sh' anchor