Documentation ¶
Overview ¶
Package x contains some standard extensions
Extensions implement common functionality (Handler, Decorator, etc.) and can be combined together to construct an application
All sub-packages are various extensions, useful to build applications, but not necessary to use the framework. All of them provide functionality commonly needed by blockchains. You are welcome to import them if desired, but if they don't match your particular needs, you may also write your own extensions and use them instead.
Index ¶
- func GetAddresses(ctx weave.Context, auth Authenticator) []weave.Address
- func HasAllAddresses(ctx weave.Context, auth Authenticator, required []weave.Address) bool
- func HasAllConditions(ctx weave.Context, auth Authenticator, required []weave.Condition) bool
- func HasNAddresses(ctx weave.Context, auth Authenticator, required []weave.Address, n int) bool
- func HasNConditions(ctx weave.Context, auth Authenticator, requested []weave.Condition, n int) bool
- func MainSigner(ctx weave.Context, auth Authenticator) weave.Condition
- func MarshalValid(obj MarshalValidater) ([]byte, error)
- func MustMarshal(obj weave.Marshaller) []byte
- func MustMarshalValid(obj MarshalValidater) []byte
- func MustUnmarshal(obj weave.Persistent, bz []byte)
- func MustValidate(obj Validater)
- type Authenticator
- type MarshalValidater
- type MultiAuth
- type Validater
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAddresses ¶ added in v0.3.0
func GetAddresses(ctx weave.Context, auth Authenticator) []weave.Address
GetAddresses wraps the GetConditions method of any Authenticator
func HasAllAddresses ¶ added in v0.3.0
HasAllAddresses returns true if all elements in required are also in context.
func HasAllConditions ¶ added in v0.4.0
HasAllConditions returns true if all elements in required are also in context.
func HasNAddresses ¶ added in v0.8.0
HasNAddresses returns true if at least n elements in requested are also in context.
func HasNConditions ¶ added in v0.4.0
HasNConditions returns true if at least n elements in requested are also in context. Useful for threshold conditions (1 of 3, 3 of 5, etc...)
func MainSigner ¶
func MainSigner(ctx weave.Context, auth Authenticator) weave.Condition
MainSigner returns the first permission if any, otherwise nil
func MarshalValid ¶
func MarshalValid(obj MarshalValidater) ([]byte, error)
MarshalValid validates the object, then marshals
func MustMarshalValid ¶
func MustMarshalValid(obj MarshalValidater) []byte
MustMarshalValid marshals the object, but panics if the object is not valid or has trouble marshalling
func MustUnmarshal ¶
func MustUnmarshal(obj weave.Persistent, bz []byte)
MustUnmarshal will succeed or panic
Types ¶
type Authenticator ¶
type Authenticator interface { // GetConditions reveals all Conditions fulfilled, // you may want GetAddresses helper GetConditions(weave.Context) []weave.Condition // HasAddress checks if any condition matches this address HasAddress(weave.Context, weave.Address) bool }
Authenticator is an interface we can use to extract authentication info from the context. This should be passed into the constructor of handlers, so we can plug in another authentication system, rather than hardcoding x/auth for all extensions.
type MarshalValidater ¶
type MarshalValidater interface { weave.Marshaller Validater }
MarshalValidater is something that can be validated and serialized
type MultiAuth ¶
type MultiAuth struct {
// contains filtered or unexported fields
}
MultiAuth chains together many Authenticators into one
func ChainAuth ¶
func ChainAuth(impls ...Authenticator) MultiAuth
ChainAuth groups together a series of Authenticator
func (MultiAuth) GetConditions ¶ added in v0.4.0
GetConditions combines all Conditions from all Authenenticators
Directories ¶
Path | Synopsis |
---|---|
Package aswap implements an atomic swap.
|
Package aswap implements an atomic swap. |
Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions.
|
Package batch provides batch transaction support middleware to support multiple operations in one transaction Package batch implements batch transactions. |
Package cash defines a simple implementation of sending coins between multi-signature wallets.
|
Package cash defines a simple implementation of sending coins between multi-signature wallets. |
Package currency provides an implementation of a token registry.
|
Package currency provides an implementation of a token registry. |
Package distribution implements a revenue stream that is periodically distributing collected coins between defined recipients.
|
Package distribution implements a revenue stream that is periodically distributing collected coins between defined recipients. |
Package escrow implements an Escrow.
|
Package escrow implements an Escrow. |
Package gov contains on chain governance process protocols.
|
Package gov contains on chain governance process protocols. |
Package hashlock implements token locking.
|
Package hashlock implements token locking. |
Package msgfee allows to define and charge an additional fee per transaction type.
|
Package msgfee allows to define and charge an additional fee per transaction type. |
> Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document.
|
> Multisignature (multi-signature) is a digital signature scheme which allows a group of users to sign a single document. |
package namecoin is an extension of x/cash from weave, allowing more information for wallets and tokens.
|
package namecoin is an extension of x/cash from weave, allowing more information for wallets and tokens. |
Package nft provides a core of a Non-fungible token implementation (NFT).
|
Package nft provides a core of a Non-fungible token implementation (NFT). |
Package paychan implements payment side channel functionality.
|
Package paychan implements payment side channel functionality. |
Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection.
|
Package sigs provides basic authentication middleware to verify the signatures on the transaction, and maintain nonces for replay protection. |