{"modulePath":"github.com/stickychin/code-server","version":"v0.0.0-20250522011653-c6effd41c6ef","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package timelock\n\n## Variables\n\n```go\nvar (\n\tErrTimelockNotFound   = errors.New(\"no records could be found\")\n\tErrInvalidTimelock    = errors.New(\"invalid timelock\")\n\tErrStaleTimelockState = errors.New(\"timelock state is stale\")\n)\n```\n\n## Types\n\n```go\ntype Record struct {\n\tId uint64\n\n\tAddress string\n\tBump    uint8\n\n\tVaultAddress string\n\tVaultBump    uint8\n\tVaultOwner   string\n\tVaultState   timelock_token_v1.TimelockState // Uses the original Timelock account state since the CVM only defines enum states for unlock\n\n\tDepositPdaAddress string\n\tDepositPdaBump    uint8\n\n\tUnlockAt *uint64\n\n\tBlock uint64\n\n\tLastUpdatedAt time.Time\n}\n```\nTime/close authorities and lock duration are configured at the VM level\n\ntodo: Assumes a single VM.\n\n```go\nfunc (r *Record) Clone() *Record\n```\n\n```go\nfunc (r *Record) CopyTo(dst *Record)\n```\n\n```go\nfunc (r *Record) ExistsOnBlockchain() bool\n```\n\n```go\nfunc (r *Record) IsClosed() bool\n```\n\n```go\nfunc (r *Record) IsLocked() bool\n```\n\n```go\nfunc (r *Record) Validate() error\n```\n\n```go\ntype Store interface {\n\t// Save saves a timelock account's state\n\tSave(ctx context.Context, record *Record) error\n\n\t// GetByAddress gets a timelock account's state by the state address\n\tGetByAddress(ctx context.Context, address string) (*Record, error)\n\n\t// GetByVault gets a timelock account's state by the vault address it's locking\n\tGetByVault(ctx context.Context, vault string) (*Record, error)\n\n\t// GetByDepositPda gets a timelock account's state by the deposit PDA address\n\tGetByDepositPda(ctx context.Context, depositPda string) (*Record, error)\n\n\t// GetByVaultBatch is like GetByVault, but for multiple accounts. If any one account\n\t// is missing, ErrTimelockNotFound is returned.\n\tGetByVaultBatch(ctx context.Context, vaults ...string) (map[string]*Record, error)\n\n\t// GetAllByState gets all timelock accounts in the provided state\n\tGetAllByState(ctx context.Context, state timelock_token.TimelockState, cursor query.Cursor, limit uint64, direction query.Ordering) ([]*Record, error)\n\n\t// GetCountByState gets the count of records in the provided state\n\tGetCountByState(ctx context.Context, state timelock_token.TimelockState) (uint64, error)\n}\n```\n\n","path":"github.com/stickychin/code-server/pkg/code/data/timelock","name":"timelock","synopsis":"","isRedistributable":true}
