Documentation ¶
Overview ¶
Package accounts
@author: xwc1125
Package accounts ¶
@author: xwc1125
Index ¶
- Constants
- Variables
- func DecodeAccountOpData(input []byte, data *AccountOpData) error
- type AccountMap
- type AccountOp
- type AccountOpData
- type AccountStore
- func (store *AccountStore) AccountName() string
- func (store *AccountStore) AuthorizedRegisterDomain() bool
- func (store *AccountStore) AuthorizedRegisterUser() bool
- func (store *AccountStore) CodeHash() []byte
- func (store *AccountStore) ContainAddress(address types.Address) bool
- func (store *AccountStore) Copy() *AccountStore
- func (store *AccountStore) DecodeRLP(s *rlp.Stream) error
- func (store *AccountStore) EncodeRLP(w io.Writer) error
- func (store *AccountStore) GetAddressStore(address types.Address) (*AddressStore, error)
- func (store *AccountStore) IsContract() bool
- func (store *AccountStore) MarshalJSON() ([]byte, error)
- func (store *AccountStore) Normalize()
- func (store *AccountStore) Partner() string
- func (store *AccountStore) SetAddress(addr types.Address, addrStore *AddressStore)
- func (store *AccountStore) SetCodeHash(hash []byte)
- func (store *AccountStore) SetPartner(cn, domain string)
- func (store *AccountStore) SetStorageRoot(hash types.Hash)
- func (store *AccountStore) StorageRoot() types.Hash
- type AddressStore
- type DomainStore
- type FrozenAccountData
- type LostRequest
- type LostStore
- type PartnerData
- type Permissions
- type UpdatePermissionData
Constants ¶
View Source
const ( ContractDomain = "chain5j.contract" // 合约域 DomainLinkFlag = "@" // 域连接符 CodeHashKey = "code_hash" // codeHash的键 RootKey = "root_hash" // root的键 PartnerKey = "partner" // 配偶的键 LostKey = "lost" // 丢失的键 )
Variables ¶
View Source
var (
ErrFormatAddrNotExist = "address not exists: addr=%s"
)
Functions ¶
func DecodeAccountOpData ¶
func DecodeAccountOpData(input []byte, data *AccountOpData) error
DecodeAccountOpData 从交易input中解析出操作处理对象
Types ¶
type AccountMap ¶
type AccountMap struct {
// contains filtered or unexported fields
}
AccountMap 地址到账户名称的映射
type AccountOpData ¶
AccountOpData 账户操作处理的对象
type AccountStore ¶
type AccountStore struct { Nonce uint64 `json:"nonce,omitempty"` // nonce,只要账户信息被修改,此值就得修改 Balance *big.Int `json:"balance,omitempty"` // balance Addresses map[types.Address]*AddressStore `json:"addresses,omitempty"` // 地址集合 CN string `json:"cn"` // 用户名称 common name,不带域的 Domain string `json:"domain"` // 所在域 IsAdmin bool `json:"is_admin,omitempty"` // 是否为管理员 IsFrozen bool `json:"is_frozen,omitempty"` // 账户是否被冻结 EnableDeployContract bool `json:"enable_deploy_contract,omitempty"` // 是否允许部署合约 Permissions *Permissions `json:"permissions,omitempty" rlp:"nil"` // 管理员权限 XXX map[string][]byte `json:"xxx,omitempty" rlp:"nil"` // 扩展字段 }
AccountStore 账户存储
func NewAccountStore ¶
func NewAccountStore(cn, domain string) *AccountStore
func (*AccountStore) AuthorizedRegisterDomain ¶
func (store *AccountStore) AuthorizedRegisterDomain() bool
AuthorizedRegisterDomain 注册域的权限是否已授予
func (*AccountStore) AuthorizedRegisterUser ¶
func (store *AccountStore) AuthorizedRegisterUser() bool
AuthorizedRegisterUser 注册用户的权限是否已授予
func (*AccountStore) ContainAddress ¶
func (store *AccountStore) ContainAddress(address types.Address) bool
ContainAddress 账户是否存在指定地址
func (*AccountStore) Copy ¶
func (store *AccountStore) Copy() *AccountStore
func (*AccountStore) GetAddressStore ¶
func (store *AccountStore) GetAddressStore(address types.Address) (*AddressStore, error)
GetAddressStore 根据地址获取地址集
func (*AccountStore) IsContract ¶
func (store *AccountStore) IsContract() bool
IsContract 判断账户是否为合约地址
func (*AccountStore) MarshalJSON ¶
func (store *AccountStore) MarshalJSON() ([]byte, error)
func (*AccountStore) SetAddress ¶
func (store *AccountStore) SetAddress(addr types.Address, addrStore *AddressStore)
SetAddress 设置地址集
func (*AccountStore) SetCodeHash ¶
func (store *AccountStore) SetCodeHash(hash []byte)
SetCodeHash 设置codeHash
func (*AccountStore) SetPartner ¶
func (store *AccountStore) SetPartner(cn, domain string)
SetPartner 设置配偶[用于密码丢失找回]
func (*AccountStore) SetStorageRoot ¶
func (store *AccountStore) SetStorageRoot(hash types.Hash)
SetStorageRoot 设置存储的rootHash
func (*AccountStore) StorageRoot ¶
func (store *AccountStore) StorageRoot() types.Hash
StorageRoot 获取存储的rootHash
type AddressStore ¶
AddressStore 账户下的地址属性
type DomainStore ¶
type DomainStore struct { Admin string `json:"admin"` // 管理员名称、不包含域 Number uint64 `json:"number"` // 域生成时所在区块 }
DomainStore 域名存储
type FrozenAccountData ¶
FrozenAccountData 冻结/解冻账户的数据对象
func (*FrozenAccountData) Normalize ¶
func (data *FrozenAccountData) Normalize()
type LostRequest ¶
LostRequest 密钥丢失处理的数据对象
func (*LostRequest) Normalize ¶
func (req *LostRequest) Normalize()
type PartnerData ¶
PartnerData 合作伙伴的数据对象
func (*PartnerData) Normalize ¶
func (data *PartnerData) Normalize()
type Permissions ¶
type Permissions struct { EnableRegisterUser bool `json:"enable_register_user,omitempty"` // 是否允许注册用户 EnableUpdateUser bool `json:"enable_update_user,omitempty"` // 是否允许更新用户权限 EnableFrozenUser bool `json:"enable_frozen_user,omitempty"` // 是否允许冻结用户 EnableRegisterDomain bool `json:"enable_register_domain,omitempty"` // 是否允许建立新的域名 EnableRegisterSubdomain bool `json:"enable_register_subdomain,omitempty"` // 是否允许建立子域 }
Permissions 用户权限
type UpdatePermissionData ¶
type UpdatePermissionData struct { CN string Domain string Permissions Permissions }
UpdatePermissionData 更新账户权限的数据对象
func (*UpdatePermissionData) Normalize ¶
func (data *UpdatePermissionData) Normalize()
Click to show internal directories.
Click to hide internal directories.