2018-02-14 08:16:06 -08:00
|
|
|
package baseapp
|
|
|
|
|
|
|
|
import (
|
2019-02-05 19:11:57 -08:00
|
|
|
"regexp"
|
2018-12-10 06:27:25 -08:00
|
|
|
|
2019-02-07 17:52:24 -08:00
|
|
|
abci "github.com/tendermint/tendermint/abci/types"
|
|
|
|
|
2018-12-10 06:27:25 -08:00
|
|
|
sdk "github.com/cosmos/cosmos-sdk/types"
|
2018-02-14 08:16:06 -08:00
|
|
|
)
|
|
|
|
|
2019-02-05 19:11:57 -08:00
|
|
|
var isAlphaNumeric = regexp.MustCompile(`^[a-zA-Z0-9]+$`).MatchString
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
func (app *BaseApp) Check(tx sdk.Tx) (sdk.GasInfo, *sdk.Result, error) {
|
2018-06-26 18:53:41 -07:00
|
|
|
return app.runTx(runTxModeCheck, nil, tx)
|
|
|
|
}
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
func (app *BaseApp) Simulate(txBytes []byte, tx sdk.Tx) (sdk.GasInfo, *sdk.Result, error) {
|
2019-02-04 15:35:12 -08:00
|
|
|
return app.runTx(runTxModeSimulate, txBytes, tx)
|
2018-06-26 18:53:41 -07:00
|
|
|
}
|
|
|
|
|
2019-12-27 09:57:54 -08:00
|
|
|
func (app *BaseApp) Deliver(tx sdk.Tx) (sdk.GasInfo, *sdk.Result, error) {
|
2018-06-26 18:53:41 -07:00
|
|
|
return app.runTx(runTxModeDeliver, nil, tx)
|
|
|
|
}
|
2019-02-07 17:52:24 -08:00
|
|
|
|
2019-09-04 10:33:32 -07:00
|
|
|
// Context with current {check, deliver}State of the app used by tests.
|
2019-02-07 17:52:24 -08:00
|
|
|
func (app *BaseApp) NewContext(isCheckTx bool, header abci.Header) sdk.Context {
|
|
|
|
if isCheckTx {
|
|
|
|
return sdk.NewContext(app.checkState.ms, header, true, app.logger).
|
|
|
|
WithMinGasPrices(app.minGasPrices)
|
|
|
|
}
|
|
|
|
|
|
|
|
return sdk.NewContext(app.deliverState.ms, header, false, app.logger)
|
|
|
|
}
|