ons

package
v0.18.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const HEIGHT_INTERVAL = 1

Variables

View Source
var (
	ErrDomainNameNotValid = errors.New("Domain name is invalid")
	ErrDomainNotFound     = errors.New("Domain doesn't exist")
)

Functions

func CalculateDomainExpiry added in v0.14.0

func CalculateDomainExpiry(amount balance.Amount, perBlockFees int64) uint64

Types

type Domain

type Domain struct {
	// addresses of the owner and the account the domain points to
	Owner       keys.Address `json:"owner"`
	Beneficiary keys.Address `json:"beneficiary"`

	// the domain name; this is als a unique identifier of
	// the domain object over the chain
	Name Name `json:"name"`

	// block heights at which the domain was first created and updated
	CreationHeight   int64 `json:"creationHeight"`
	LastUpdateHeight int64 `json:"lastUpdateHeight"`

	// expire block height
	ExpireHeight int64 `json:"expireHeight"`

	// flag to denote whether send2Domain is active on this domain
	ActiveFlag bool `json:"activeFlag"`

	// denotes whether the domain is for sale
	OnSaleFlag bool   `json:"onSaleFlag"`
	URI        string `json:"uri"`
	// the asking price in OLT set by the owner
	SalePrice *balance.Amount `json:"salePrice"`
}

func NewDomain

func NewDomain(ownerAddress, accountAddress keys.Address,
	name string,
	height int64,
	uri string,
	expiry int64,
	active bool,
) (*Domain, error)

func (*Domain) Activate

func (d *Domain) Activate()

func (*Domain) AddToExpire added in v0.14.0

func (d *Domain) AddToExpire(h int64)

func (*Domain) CancelSale

func (d *Domain) CancelSale()

func (*Domain) ChangeOwner

func (d *Domain) ChangeOwner(addr keys.Address)

func (*Domain) Data

func (d *Domain) Data() serialize.Data

func (*Domain) Deactivate

func (d *Domain) Deactivate()

func (Domain) IsActive added in v0.14.0

func (d Domain) IsActive(height int64) bool

func (*Domain) IsChangeable

func (d *Domain) IsChangeable(currentHeight int64) bool

func (Domain) IsExpired added in v0.14.0

func (d Domain) IsExpired(height int64) bool

func (*Domain) NewDataInstance

func (d *Domain) NewDataInstance() serialize.Data

func (*Domain) PutOnSale

func (d *Domain) PutOnSale(price balance.Amount)

func (*Domain) ResetAfterSale added in v0.14.0

func (d *Domain) ResetAfterSale(buyer, account keys.Address, nBlocks, currentHeight int64)

func (*Domain) SetAccountAddress

func (d *Domain) SetAccountAddress(addr keys.Address)

func (*Domain) SetData

func (d *Domain) SetData(a interface{}) error

func (*Domain) SetLastUpdatedHeight

func (d *Domain) SetLastUpdatedHeight(height int64)

type DomainStore

type DomainStore struct {
	State *storage.State
	// contains filtered or unexported fields
}

DomainStore wraps the persistent storage and the serializer giving handy methods to access Domain objects

func NewDomainStore

func NewDomainStore(prefix string, state *storage.State) *DomainStore

NewDomainStore creates a new storage object from filepath and other configurations

func (*DomainStore) DeleteASubdomain added in v0.14.0

func (ds *DomainStore) DeleteASubdomain(subdomainName Name) error

func (*DomainStore) DeleteAllSubdomains added in v0.14.0

func (ds *DomainStore) DeleteAllSubdomains(name Name) error

func (*DomainStore) Exists

func (ds *DomainStore) Exists(name Name) bool

func (*DomainStore) Get

func (ds *DomainStore) Get(name Name) (*Domain, error)

Get is used to retrieve the domain object from the domain name

func (*DomainStore) GetOptions added in v0.14.0

func (ds *DomainStore) GetOptions() *Options

func (*DomainStore) Iterate added in v0.12.0

func (ds *DomainStore) Iterate(fn func(name Name, domain *Domain) bool) (stopped bool)

func (*DomainStore) IterateSubDomain added in v0.14.0

func (ds *DomainStore) IterateSubDomain(parentName Name, fn func(name Name, domain *Domain) bool) (stopped bool)

func (*DomainStore) Set

func (ds *DomainStore) Set(d *Domain) error

func (*DomainStore) SetOptions added in v0.14.0

func (ds *DomainStore) SetOptions(opt *Options)

func (*DomainStore) WithState added in v0.12.0

func (ds *DomainStore) WithState(state *storage.State) *DomainStore

type Name added in v0.14.0

type Name string

func GetNameFromString added in v0.14.0

func GetNameFromString(s string) Name

func (Name) EqualTo added in v0.14.2

func (n Name) EqualTo(m Name) bool

func (Name) GetParentName added in v0.14.0

func (n Name) GetParentName() (Name, error)

func (Name) IsSub added in v0.14.0

func (n Name) IsSub() bool

func (Name) IsSubTo added in v0.14.2

func (n Name) IsSubTo(parent Name) bool

func (Name) IsValid added in v0.14.0

func (n Name) IsValid() bool

func (Name) String added in v0.14.0

func (n Name) String() string

type Options added in v0.14.0

type Options struct {
	Currency          string         `json:"currency"`
	PerBlockFees      balance.Amount `json:"perBlockFees"`
	BaseDomainPrice   balance.Amount `json:"baseDomainPrice"`
	FirstLevelDomains []string       `json:"firstLevelDomains"`
	// contains filtered or unexported fields
}

func (*Options) IsNameAllowed added in v0.14.0

func (opt *Options) IsNameAllowed(name Name) bool

func (*Options) IsValidURI added in v0.14.0

func (opt *Options) IsValidURI(uri string) bool

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL