Documentation ¶
Index ¶
- Variables
- func ErrAccountBankNotFound() sdk.Error
- func ErrAccountInfoNotFound() sdk.Error
- func ErrAccountMetaNotFound() sdk.Error
- func ErrFailedToMarshalAccountBank(err error) sdk.Error
- func ErrFailedToMarshalAccountInfo(err error) sdk.Error
- func ErrFailedToMarshalAccountMeta(err error) sdk.Error
- func ErrFailedToMarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToMarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToMarshalReward(err error) sdk.Error
- func ErrFailedToUnmarshalAccountBank(err error) sdk.Error
- func ErrFailedToUnmarshalAccountInfo(err error) sdk.Error
- func ErrFailedToUnmarshalAccountMeta(err error) sdk.Error
- func ErrFailedToUnmarshalGrantPubKey(err error) sdk.Error
- func ErrFailedToUnmarshalPendingCoinDayQueue(err error) sdk.Error
- func ErrFailedToUnmarshalReward(err error) sdk.Error
- func ErrGrantPubKeyNotFound() sdk.Error
- func ErrPendingCoinDayQueueNotFound() sdk.Error
- func ErrRewardNotFound() sdk.Error
- func GetAccountBankKey(addr sdk.Address) []byte
- func GetAccountInfoKey(accKey types.AccountKey) []byte
- func GetAccountInfoPrefix() []byte
- func GetAccountMetaKey(accKey types.AccountKey) []byte
- func ParseGrantKey(key []byte) (user types.AccountKey, grantTo types.AccountKey)
- type AccountBank
- type AccountBankIR
- type AccountIR
- type AccountInfo
- type AccountMeta
- type AccountMetaIR
- type AccountStorage
- func (as AccountStorage) DeleteAllGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey)
- func (as AccountStorage) DoesAccountExist(ctx sdk.Context, accKey types.AccountKey) bool
- func (as AccountStorage) GetAllGrantPermissions(ctx sdk.Context, me types.AccountKey) ([]*GrantPermission, sdk.Error)
- func (as AccountStorage) GetBank(ctx sdk.Context, addr sdk.Address) (*AccountBank, sdk.Error)
- func (as AccountStorage) GetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey) ([]*GrantPermission, sdk.Error)
- func (as AccountStorage) GetInfo(ctx sdk.Context, accKey types.AccountKey) (*AccountInfo, sdk.Error)
- func (as AccountStorage) GetMeta(ctx sdk.Context, accKey types.AccountKey) *AccountMeta
- func (as AccountStorage) SetBank(ctx sdk.Context, addr sdk.Address, accBank *AccountBank)
- func (as AccountStorage) SetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey, ...)
- func (as AccountStorage) SetInfo(ctx sdk.Context, accKey types.AccountKey, accInfo *AccountInfo)
- func (as AccountStorage) SetMeta(ctx sdk.Context, accKey types.AccountKey, accMeta *AccountMeta)
- func (as AccountStorage) StoreMap(ctx sdk.Context) utils.StoreMap
- type AccountTablesIR
- type FrozenMoney
- type FrozenMoneyIR
- type GrantPermission
- type GrantPermissionIR
- type PermissionIR
- type Transaction
- type TxAndSequenceNumber
Constants ¶
This section is empty.
Variables ¶
var ( AccountInfoSubstore = []byte{0x00} AccountBankSubstore = []byte{0x01} AccountMetaSubstore = []byte{0x02} AccountGrantPubKeySubstore = []byte{0x03} )
Functions ¶
func ErrAccountBankNotFound ¶
ErrAccountBankNotFound - error if account bank is not found
func ErrAccountInfoNotFound ¶
ErrAccountInfoNotFound - error if account info is not found
func ErrAccountMetaNotFound ¶
ErrAccountMetaNotFound - error if account meta is not found
func ErrFailedToMarshalAccountBank ¶
ErrFailedToMarshalAccountBank - error if marshal account bank failed
func ErrFailedToMarshalAccountInfo ¶
ErrFailedToMarshalAccountInfo - error if marshal account info failed
func ErrFailedToMarshalAccountMeta ¶
ErrFailedToMarshalAccountMeta - error if marshal account meta failed
func ErrFailedToMarshalGrantPubKey ¶
ErrFailedToMarshalGrantPubKey - error if marshal grant public key failed
func ErrFailedToMarshalPendingCoinDayQueue ¶ added in v0.1.1
ErrFailedToMarshalPendingCoinDayQueue - error if marshal pending coin day queue failed
func ErrFailedToMarshalReward ¶
ErrFailedToMarshalReward - error if marshal reward failed
func ErrFailedToUnmarshalAccountBank ¶
ErrFailedToUnmarshalAccountBank - error if unmarshal account bank failed
func ErrFailedToUnmarshalAccountInfo ¶
ErrFailedToUnmarshalAccountInfo - error if unmarshal account info failed
func ErrFailedToUnmarshalAccountMeta ¶
ErrFailedToUnmarshalAccountMeta - error if unmarshal account meta failed
func ErrFailedToUnmarshalGrantPubKey ¶
ErrFailedToUnmarshalGrantPubKey - error if unmarshal grant public key failed
func ErrFailedToUnmarshalPendingCoinDayQueue ¶ added in v0.1.1
ErrFailedToUnmarshalPendingCoinDayQueue - error if unmarshal pending coin day queue failed
func ErrFailedToUnmarshalReward ¶
ErrFailedToUnmarshalReward - error if unmarshal account reward failed
func ErrGrantPubKeyNotFound ¶
ErrGrantPubKeyNotFound - error if grant public key is not found
func ErrPendingCoinDayQueueNotFound ¶ added in v0.1.1
ErrPendingCoinDayQueueNotFound - error if pending coin day queue is not found
func ErrRewardNotFound ¶
ErrRewardNotFound - error if reward is not found
func GetAccountBankKey ¶
GetAccountBankKey - "account bank substore" + "username"
func GetAccountInfoKey ¶
func GetAccountInfoKey(accKey types.AccountKey) []byte
GetAccountInfoKey - "account info substore" + "username"
func GetAccountInfoPrefix ¶ added in v0.1.1
func GetAccountInfoPrefix() []byte
GetAccountInfoPrefix - "account info substore"
func GetAccountMetaKey ¶
func GetAccountMetaKey(accKey types.AccountKey) []byte
GetAccountMetaKey - "account meta substore" + "username"
func ParseGrantKey ¶ added in v0.4.0
func ParseGrantKey(key []byte) (user types.AccountKey, grantTo types.AccountKey)
Types ¶
type AccountBank ¶
type AccountBank struct { Saving types.Coin `json:"saving"` FrozenMoneyList []FrozenMoney `json:"frozen_money_list"` PubKey crypto.PubKey `json:"public_key"` Sequence uint64 `json:"sequence"` Username types.AccountKey `json:"username"` }
AccountBank - user balance
type AccountBankIR ¶ added in v0.4.0
type AccountBankIR struct { Address []byte `json:"address"` // pk Saving types.Coin `json:"saving"` FrozenMoneyList []FrozenMoneyIR `json:"frozen_money_list"` PubKey crypto.PubKey `json:"public_key"` Sequence uint64 `json:"sequence"` Username types.AccountKey `json:"username"` }
AccountBankIR - user balance
type AccountIR ¶ added in v0.4.0
type AccountIR struct { Username types.AccountKey `json:"username"` CreatedAt int64 `json:"created_at"` SigningKey crypto.PubKey `json:"signing_key"` TransactionKey crypto.PubKey `json:"transaction_key"` Address sdk.AccAddress `json:"address"` }
AccountIR account related information when migrate, pk: Username
type AccountInfo ¶
type AccountInfo struct { Username types.AccountKey `json:"username"` CreatedAt int64 `json:"created_at"` SigningKey crypto.PubKey `json:"signing_key"` TransactionKey crypto.PubKey `json:"transaction_key"` Address sdk.AccAddress `json:"address"` }
AccountInfo - user information
type AccountMeta ¶
type AccountMeta struct {
JSONMeta string `json:"json_meta"`
}
AccountMeta - stores optional fields.
type AccountMetaIR ¶ added in v0.4.0
type AccountMetaIR struct { Username types.AccountKey `json:"username"` JSONMeta string `json:"json_meta"` }
AccountMetaIR - stores optional fields.
type AccountStorage ¶
type AccountStorage struct {
// contains filtered or unexported fields
}
AccountStorage - account storage
func NewAccountStorage ¶
func NewAccountStorage(key sdk.StoreKey) AccountStorage
NewLinoAccountStorage - creates and returns a account manager
func (AccountStorage) DeleteAllGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) DeleteAllGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey)
DeleteAllGrantPermissions - deletes all grant pubkeys from a granted user in KV.
func (AccountStorage) DoesAccountExist ¶
func (as AccountStorage) DoesAccountExist(ctx sdk.Context, accKey types.AccountKey) bool
DoesAccountExist - returns true when a specific account exist in the KVStore.
func (AccountStorage) GetAllGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) GetAllGrantPermissions(ctx sdk.Context, me types.AccountKey) ([]*GrantPermission, sdk.Error)
GetAllGrantPermissions - returns grant user info keyed with pubkey.
func (AccountStorage) GetBank ¶ added in v0.3.0
func (as AccountStorage) GetBank(ctx sdk.Context, addr sdk.Address) (*AccountBank, sdk.Error)
GetBank - returns bank info of a specific address, returns error if any.
func (AccountStorage) GetGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) GetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey) ([]*GrantPermission, sdk.Error)
GetGrantPermissions - returns grant user info keyed with pubkey.
func (AccountStorage) GetInfo ¶
func (as AccountStorage) GetInfo(ctx sdk.Context, accKey types.AccountKey) (*AccountInfo, sdk.Error)
GetInfo - returns general account info of a specific account, returns error otherwise.
func (AccountStorage) GetMeta ¶
func (as AccountStorage) GetMeta(ctx sdk.Context, accKey types.AccountKey) *AccountMeta
GetMeta - returns meta of a given account that are tiny and frequently updated fields.
func (AccountStorage) SetBank ¶ added in v0.3.0
func (as AccountStorage) SetBank(ctx sdk.Context, addr sdk.Address, accBank *AccountBank)
SetBank - sets bank info for a given address, returns error if any.
func (AccountStorage) SetGrantPermissions ¶ added in v0.2.0
func (as AccountStorage) SetGrantPermissions(ctx sdk.Context, me types.AccountKey, grantTo types.AccountKey, grantPubKeys []*GrantPermission)
SetGrantPermissions - sets a grant user to KV. Key is pubkey and value is grant user info
func (AccountStorage) SetInfo ¶
func (as AccountStorage) SetInfo(ctx sdk.Context, accKey types.AccountKey, accInfo *AccountInfo)
SetInfo - sets general account info to a specific account, returns error if any.
func (AccountStorage) SetMeta ¶
func (as AccountStorage) SetMeta(ctx sdk.Context, accKey types.AccountKey, accMeta *AccountMeta)
SetMeta - sets meta for a given account, returns error if any.
type AccountTablesIR ¶ added in v0.2.0
type AccountTablesIR struct { Version int `json:"version"` Accounts []AccountIR `json:"accounts"` Banks []AccountBankIR `json:"banks"` Metas []AccountMetaIR `json:"metas"` Grants []GrantPermissionIR `json:"grants"` }
AccountTablesIR -
type FrozenMoney ¶
type FrozenMoney struct { Amount types.Coin `json:"amount"` StartAt int64 `json:"start_at"` Times int64 `json:"times"` Interval int64 `json:"interval"` }
FrozenMoney - frozen money
type FrozenMoneyIR ¶ added in v0.4.0
type FrozenMoneyIR struct { Amount types.Coin `json:"amount"` StartAt int64 `json:"start_at"` Times int64 `json:"times"` Interval int64 `json:"interval"` }
FrozenMoneyIR - frozen money
type GrantPermission ¶ added in v0.2.0
type GrantPermission struct { GrantTo types.AccountKey `json:"grant_to"` Permission types.Permission `json:"permission"` CreatedAt int64 `json:"created_at"` ExpiresAt int64 `json:"expires_at"` Amount types.Coin `json:"amount"` }
GrantPermission - user grant permission to a user with a certain permission
type GrantPermissionIR ¶ added in v0.2.1
type GrantPermissionIR struct { Username types.AccountKey `json:"username"` GrantTo types.AccountKey `json:"grant_to"` Permissions []PermissionIR `json:"permissions"` }
GrantPubKeyIR also in account, no pk. must use AuthorizePermission for now. As this grant permission will be removed very soon, it is okay to let this happen.
type PermissionIR ¶ added in v0.4.0
type Transaction ¶ added in v0.2.8
type TxAndSequenceNumber ¶ added in v0.2.8
type TxAndSequenceNumber struct { Username string `json:"username"` Sequence uint64 `json:"sequence"` Tx *Transaction `json:"tx"` }