HoldPeriodManager
Manage the Hold Period Transfer Hook — lock-up enforcement for Token-2022 tokens
Import
Properties
| Property | Type | Description |
|---|---|---|
configPDA | PublicKey | The HoldConfig PDA address |
extraAccountMetasPDA | PublicKey | The ExtraAccountMetas PDA address |
Methods
initialize(authority, holdPeriodSeconds)
Creates the HoldConfig PDA for the mint.
| Parameter | Type | Description |
|---|---|---|
authority | PublicKey | Admin who can manage the hold config |
holdPeriodSeconds | number | Lock-up duration in seconds |
initializeExtraAccountMetas(payer)
Creates the ExtraAccountMetaList PDA.
Must be called before any transfer.
recordAcquisition(payer, authority, wallet)
Records when a wallet acquires tokens. Sets unlockAt = now + holdPeriodSeconds.
| Parameter | Type | Description |
|---|---|---|
payer | PublicKey | Transaction fee payer |
authority | PublicKey | HoldConfig authority |
wallet | PublicKey | Wallet that acquired tokens |
updateHoldPeriod(authority, newSeconds)
Changes the hold period duration. Does not affect existing locks.
toggleActive(authority, isActive)
Kill switch. When isActive=false, hold periods are not enforced.
updateAuthority(authority, newAuthority)
Transfers admin rights.
fetchConfig()
Fetches the current on-chain hold config.
fetchWalletLock(wallet)
Fetches a specific wallet's lock state.
isUnlocked(wallet)
Checks if a wallet's hold period has expired. Returns true if no lock exists.