Documentation
¶
Overview ¶
Context package defines primitives for generic context handling during execution.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// Throttled Rate Limiter
HttpRateLimiter throttled.HTTPRateLimiter
// Throttled Rate Limiter Store
Store throttled.GCRAStore
// SequenceMutex stores the current last sequence number of the account on the testnet
SequenceMutex sync.Mutex
// AccountNumberMutex stores the account number on the testnet for the respective wallet
AccountNumberMutex sync.Mutex
// BrokenFlagMutex stores if the last execution of the application was successful (tokens were sent)
BrokenFlagMutex sync.Mutex
// Deprecated: We only need to read AccountNumber once at startup, we store it for subsequent use
AccountNumber int64
// TestnetName returned from the full node
TestnetName string
// Application configuration
Cfg *config.Config
// Disable rate limiter for testing
DisableLimiter bool
// Disable sending of transaction to the network
DisableSend bool
// Disable ReCaptcha check for testing
DisableRecaptcha bool
// Amino MarshalBinary for transaction broadcast on blockchain network
Cdc *wire.Codec
// The new CLIContext for connecting to a network
CLIContext *sdkCtx.CLIContext
// The new TxContext for sending a transaction on the network
TxContest *authctx.TxContext
}
Context holds current execution details.
func (*Context) CheckAndFixAccountDetails ¶
CheckAndFixAccountDetails checks, if the last run was unsuccessful (node down, wrong parameters) and tries to fix the values from the testnet.
func (*Context) GetTestnetName ¶
GetTestnetName returns the testnet name from the node
func (*Context) RaiseBrokenAccountDetails ¶
RaiseBrokenAccountDetails raises the flag that the configuration is broken (parameter change, node timeout).
type ErrorMessage ¶
type ErrorMessage struct {
Message string `json:"message"`
}
ErrorMessage defines the message structure returned when an error happens.
type Handler ¶
type Handler struct {
C *Context
H func(*Context, http.ResponseWriter, *http.Request) (int, error)
}
Handler is an abstraction layer to standardize web API returns, if an error happens.
type InitialContext ¶
type InitialContext struct {
// --no-rdb disable RedisDB database usage
DisableRDb bool
// --send Send to a wallet locally
Send string
// --ip IP address of local webserver
WebserverIp string
// --port Port number of local webserver
WebserverPort uint
// --config Config file for local execution
ConfigFile string
// --webserver or --send was set
LocalExecution bool
// --no-limit Disable rate limiter
DisableLimiter bool
// --no-send Disable transaction send to the testnet (dry-run)
DisableSend bool
// --no-recaptcha Disable recaptcha
DisableRecaptcha bool
}
InitialContext holds the input parameter details at the start of execution.
func NewInitialContext ¶
func NewInitialContext() *InitialContext
NewInitialContext creates a fresh InitialContext.