Versions in this module Expand all Collapse all v0 v0.0.1 Jun 11, 2020 Changes in this version + const MaxDescriptionLength + var ErrAccountAssetNotExist = errors.New("account asset not exist") + var ErrAccountIDInvalid = errors.New("account id invalid") + var ErrAccountInvalid = errors.New("account not permission") + var ErrAccountIsDestroy = errors.New("account is destroy") + var ErrAccountIsExist = errors.New("account is exist") + var ErrAccountIsNil = errors.New("account object is empty") + var ErrAccountManagerNotExist = errors.New("account manager name not exist") + var ErrAccountNameInvalid = errors.New("account name is Invalid") + var ErrAccountNotExist = errors.New("account not exist") + var ErrAmountMustBeZero = errors.New("amount must be zero") + var ErrAmountMustZero = errors.New("amount must be zero") + var ErrAmountValueInvalid = errors.New("amount value is invalid") + var ErrAssetIDInvalid = errors.New("asset id invalid") + var ErrAssetOwnerInvalid = errors.New("asset owner Invalid ") + var ErrChargeRatioInvalid = errors.New("charge ratio value invalid ") + var ErrCodeIsEmpty = errors.New("code is empty") + var ErrCounterNotExist = errors.New("account global counter not exist") + var ErrCreateAccountError = errors.New("create account error") + var ErrHashIsEmpty = errors.New("hash is empty") + var ErrInsufficientBalance = errors.New("insufficient balance") + var ErrInvalidPubKey = errors.New("invalid public key") + var ErrInvalidReceipt = errors.New("invalid receipt") + var ErrInvalidReceiptAsset = errors.New("invalid receipt of asset") + var ErrNameIsExist = errors.New("name is exist") + var ErrNegativeAmount = errors.New("negative amount") + var ErrNegativeValue = errors.New("negative value") + var ErrNewAccountErr = errors.New("new account err") + var ErrSnapshotTimeNotExist = errors.New("next snapshot time not exist") + var ErrTimeInvalid = errors.New("input time invalid ") + var ErrTimeTypeInvalid = errors.New("get snapshot time type invalid ") + var ErrToNameInvalid = errors.New("action to name(Recipient) invalid") + var ErrUnKnownTxType = errors.New("not support action type") + var ErrkeyNotSame = errors.New("key not same") + func GetAccountNameLength() uint64 + func GetAccountNameLevel(accountName common.Name) (uint64, error) + func GetAccountNameRegExp() *regexp.Regexp + func GetAccountNameRegExpFork1() *regexp.Regexp + func SetAccountNameConfig(config *Config) bool + func SetAcctMangerName(name common.Name) + type Account struct + AccountID uint64 + AcctName common.Name + AuthorVersion common.Hash + Authors []*common.Author + Balances []*AssetBalance + Code []byte + CodeHash common.Hash + CodeSize uint64 + Description string + Destroy bool + Founder common.Name + Nonce uint64 + Number uint64 + Suicide bool + Threshold uint64 + UpdateAuthorThreshold uint64 + func NewAccount(accountName common.Name, founderName common.Name, pubkey common.PubKey, ...) (*Account, error) + func (a *Account) AddAuthor(author *common.Author) error + func (a *Account) AddBalanceByID(assetID uint64, value *big.Int) (bool, error) + func (a *Account) AddNewAssetByAssetID(p int64, assetID uint64, amount *big.Int) + func (a *Account) DeleteAuthor(author *common.Author) error + func (a *Account) EnoughAccountBalance(assetID uint64, value *big.Int) error + func (a *Account) GetAccountID() uint64 + func (a *Account) GetAccountNumber() uint64 + func (a *Account) GetAllBalances() (map[uint64]*big.Int, error) + func (a *Account) GetAuthorVersion() common.Hash + func (a *Account) GetBalanceByID(assetID uint64) (*big.Int, error) + func (a *Account) GetBalancesList() []*AssetBalance + func (a *Account) GetCode() ([]byte, error) + func (a *Account) GetCodeHash() (common.Hash, error) + func (a *Account) GetCodeSize() uint64 + func (a *Account) GetFounder() common.Name + func (a *Account) GetName() common.Name + func (a *Account) GetNonce() uint64 + func (a *Account) GetThreshold() uint64 + func (a *Account) GetUpdateAuthorThreshold() uint64 + func (a *Account) HaveCode() bool + func (a *Account) IsDestroyed() bool + func (a *Account) IsEmpty() bool + func (a *Account) IsSuicided() bool + func (a *Account) SetAccountID(id uint64) + func (a *Account) SetAccountNumber(number uint64) + func (a *Account) SetAuthorVersion() + func (a *Account) SetBalance(assetID uint64, amount *big.Int) error + func (a *Account) SetCode(code []byte) error + func (a *Account) SetDestroy() + func (a *Account) SetFounder(f common.Name) + func (a *Account) SetNonce(nonce uint64) + func (a *Account) SetSuicide() + func (a *Account) SetThreshold(t uint64) + func (a *Account) SetUpdateAuthorThreshold(t uint64) + func (a *Account) SubBalanceByID(assetID uint64, value *big.Int) error + func (a *Account) UpdateAuthor(author *common.Author) error + type AccountAuthorAction struct + AuthorActions []*AuthorAction + Threshold uint64 + UpdateAuthorThreshold uint64 + type AccountManager struct + func NewAccountManager(db *state.StateDB) (*AccountManager, error) + func (am *AccountManager) AccountHaveCode(accountName common.Name) (bool, error) + func (am *AccountManager) AccountIsEmpty(accountName common.Name) (bool, error) + func (am *AccountManager) AccountIsExist(accountName common.Name) (bool, error) + func (am *AccountManager) AccountIsExistByID(accountID uint64) (bool, error) + func (am *AccountManager) AddAccountBalanceByID(accountName common.Name, assetID uint64, value *big.Int) error + func (am *AccountManager) AddAccountBalanceByName(accountName common.Name, assetName string, value *big.Int) error + func (am *AccountManager) CanTransfer(accountName common.Name, assetID uint64, value *big.Int) (bool, error) + func (am *AccountManager) CheckAssetContract(contract common.Name, owner common.Name, from ...common.Name) bool + func (am *AccountManager) CreateAccount(fromName common.Name, accountName common.Name, founderName common.Name, ...) error + func (am *AccountManager) DeleteAccountByName(accountName common.Name) error + func (am *AccountManager) EnoughAccountBalance(accountName common.Name, assetID uint64, value *big.Int) error + func (am *AccountManager) GetAccountBalanceByID(accountName common.Name, assetID uint64, typeID uint64) (*big.Int, error) + func (am *AccountManager) GetAccountById(id uint64) (*Account, error) + func (am *AccountManager) GetAccountByName(accountName common.Name) (*Account, error) + func (am *AccountManager) GetAccountByTime(accountName common.Name, time uint64) (*Account, error) + func (am *AccountManager) GetAccountIDByName(accountName common.Name) (uint64, error) + func (am *AccountManager) GetAccountLastChange(accountName common.Name) (uint64, error) + func (am *AccountManager) GetAllAssetByAssetID(acct *Account, assetID uint64) (map[uint64]*big.Int, error) + func (am *AccountManager) GetAllBalanceByAssetID(acct *Account, assetID uint64) (*big.Int, error) + func (am *AccountManager) GetAssetAmountByTime(assetID uint64, time uint64) (*big.Int, error) + func (am *AccountManager) GetAssetFounder(assetID uint64) (common.Name, error) + func (am *AccountManager) GetAssetInfoByID(assetID uint64) (*asset.AssetObject, error) + func (am *AccountManager) GetAssetInfoByName(assetName string) (*asset.AssetObject, error) + func (am *AccountManager) GetAuthorVersion(accountName common.Name) (common.Hash, error) + func (am *AccountManager) GetBalanceByTime(accountName common.Name, assetID uint64, typeID uint64, time uint64) (*big.Int, error) + func (am *AccountManager) GetCode(accountName common.Name) ([]byte, error) + func (am *AccountManager) GetCodeSize(accountName common.Name) (uint64, error) + func (am *AccountManager) GetFounder(accountName common.Name) (common.Name, error) + func (am *AccountManager) GetNonce(accountName common.Name) (uint64, error) + func (am *AccountManager) GetSnapshotTime(num uint64, time uint64) (uint64, error) + func (am *AccountManager) IncAsset2Acct(fromName common.Name, toName common.Name, assetID uint64, amount *big.Int, ...) error + func (am *AccountManager) IsValidSign(accountName common.Name, pub common.PubKey) error + func (am *AccountManager) IssueAsset(fromName common.Name, asset IssueAsset, number uint64, curForkID uint64) (uint64, error) + func (am *AccountManager) Process(accountManagerContext *types.AccountManagerContext) ([]*types.InternalAction, error) + func (am *AccountManager) RecoverTx(signer types.Signer, tx *types.Transaction) error + func (am *AccountManager) SetAccount(acct *Account) error + func (am *AccountManager) SetCode(accountName common.Name, code []byte) (bool, error) + func (am *AccountManager) SetNonce(accountName common.Name, nonce uint64) error + func (am *AccountManager) SubAccountBalanceByID(accountName common.Name, assetID uint64, value *big.Int) error + func (am *AccountManager) TransferAsset(fromAccount common.Name, toAccount common.Name, assetID uint64, value *big.Int, ...) error + func (am *AccountManager) UpdateAccount(accountName common.Name, accountAction *UpdataAccountAction) error + func (am *AccountManager) UpdateAccountAuthor(accountName common.Name, acctAuth *AccountAuthorAction) error + func (am *AccountManager) ValidOneSign(acct *Account, index uint64, pub common.PubKey, ...) error + func (am *AccountManager) ValidSign(accountName common.Name, pub common.PubKey, index []uint64, ...) error + type AssetBalance struct + AssetID uint64 + Balance *big.Int + type AuthorAction struct + ActionType AuthorActionType + Author *common.Author + type AuthorActionType uint64 + const AddAuthor + const DeleteAuthor + const UpdateAuthor + type Config struct + AccountNameLevel uint64 + AccountNameMaxLength uint64 + MainAccountNameMaxLength uint64 + MainAccountNameMinLength uint64 + SubAccountNameMaxLength uint64 + SubAccountNameMinLength uint64 + type CreateAccountAction struct + AccountName common.Name + Description string + Founder common.Name + PublicKey common.PubKey + type IAccount interface + AddBalanceByID func(assetID uint64, value *big.Int) error + EnoughAccountBalance func(assetID uint64, value *big.Int) error + GetAllAccountBalance func() (map[uint64]*big.Int, error) + GetBalancesList func() ([]*AssetBalance, error) + GetCode func() ([]byte, error) + GetCodeHash func() (common.Hash, error) + GetCodeSize func() (uint64, error) + GetName func() common.Name + GetNonce func() uint64 + GetPubKey func() common.PubKey + IsDestroyed func() + IsSuicided func() bool + SetCode func(code []byte) (bool, error) + SetDestroy func() + SetNonce func(nonce uint64) + SetPubKey func(pubkey common.PubKey) + SetSuicide func() + SubBalanceByID func(assetID uint64, value *big.Int) error + type IAccountManager interface + AccountIsEmpty func(accountName common.Name) (bool, error) + AccountIsExist func(accountName common.Name) (bool, error) + AddBalanceByName func(accountName common.Name, assetID uint64, amount *big.Int) error + CanTransfer func(accountName common.Name, assetId uint64, value *big.Int) (bool, error) + CreateAccount func(accountName common.Name, pubkey common.PubKey) error + DeleteAccountByName func(accountName common.Name) error + GetAccountByName func(accountName common.Name) (*Account, error) + IncAsset2Acct func(fromName common.Name, toName common.Name, assetId uint64, amount *big.Int) error + IncreaseAsset func(accountName common.Name, assetID uint64, amount *big.Int) error + IsValidSign func(accountName common.Name, aType types.ActionType, pub common.PubKey) error + IssueAsset func(asset *asset.AssetObject) error + Process func(action *types.Action) error + RecoverTx func(signer types.Signer, tx *types.Transaction) error + SetAccount func(acct *Account) error + TransferAsset func(fromAccount common.Name, toAccount common.Name, assetID uint64, value *big.Int) error + type IStateDB interface + Get func(account string, key string) ([]byte, error) + Put func(account string, key string, value []byte) + RevertToSnapshot func(revisionID int) + type IncAsset struct + Amount *big.Int + AssetID uint64 + To common.Name + type IssueAsset struct + Amount *big.Int + AssetName string + Contract common.Name + Decimals uint64 + Description string + Founder common.Name + Owner common.Name + Symbol string + UpperLimit *big.Int + type UpdataAccountAction struct + Founder common.Name + type UpdateAsset struct + AssetID uint64 + Founder common.Name + type UpdateAssetContract struct + AssetID uint64 + Contract common.Name + type UpdateAssetOwner struct + AssetID uint64 + Owner common.Name