Documentation ¶
Index ¶
- Variables
- type Record
- func (r *Record) Clone() *Record
- func (r *Record) CopyTo(dst *Record)
- func (r *Record) ExistsOnBlockchain() bool
- func (r *Record) IsClosed() bool
- func (r *Record) IsLocked() bool
- func (r *Record) UpdateFromLegacy2022ProgramAccount(data *timelock_token_legacy.TimelockAccount, block uint64) error
- func (r *Record) UpdateFromV1ProgramAccount(data *timelock_token_v1.TimelockAccount, block uint64) error
- func (r *Record) Validate() error
- type Store
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Record ¶
type Record struct { Id uint64 DataVersion timelock_token_v1.TimelockDataVersion Address string Bump uint8 VaultAddress string VaultBump uint8 VaultOwner string VaultState timelock_token_v1.TimelockState TimeAuthority string CloseAuthority string NumDaysLocked uint8 UnlockAt *uint64 Block uint64 LastUpdatedAt time.Time }
Based off of https://github.com/code-payments/code-program-library/blob/main/timelock-token/programs/timelock-token/src/state.rs
This record supports both the legacy 2022 (pre-privacy) and v1 versions of the timelock program, since they're easily interchangeable. All legacy fields will be converted accordingly, or dropped if never used.
func (*Record) ExistsOnBlockchain ¶
func (*Record) UpdateFromLegacy2022ProgramAccount ¶
func (r *Record) UpdateFromLegacy2022ProgramAccount(data *timelock_token_legacy.TimelockAccount, block uint64) error
func (*Record) UpdateFromV1ProgramAccount ¶
func (r *Record) UpdateFromV1ProgramAccount(data *timelock_token_v1.TimelockAccount, block uint64) error
type Store ¶
type Store interface { // Save saves a timelock account's state Save(ctx context.Context, record *Record) error // GetByAddress gets a timelock account's state by the state address GetByAddress(ctx context.Context, address string) (*Record, error) // GetByVault gets a timelock account's state by the vault address it's locking GetByVault(ctx context.Context, vault string) (*Record, error) // GetByVaultBatch is like GetByVault, but for multiple accounts. If any one account // is missing, ErrTimelockNotFound is returned. GetByVaultBatch(ctx context.Context, vaults ...string) (map[string]*Record, error) // GetAllByState gets all timelock accounts in the provided state GetAllByState(ctx context.Context, state timelock_token.TimelockState, cursor query.Cursor, limit uint64, direction query.Ordering) ([]*Record, error) // GetCountByState gets the count of records in the provided state GetCountByState(ctx context.Context, state timelock_token.TimelockState) (uint64, error) }
Click to show internal directories.
Click to hide internal directories.