Documentation
¶
Index ¶
- Constants
- Variables
- func AllZeroParamFunctions(a *abi.ABI) []abi.Method
- func AnalyzeAndShowMsigTxInfo(multisigContract *msig.MultisigContract, txid *big.Int, network Network) (fc *FunctionCall, confirmed bool, executed bool)
- func CommonFunctionCallPreprocess(cmd *cobra.Command, args []string) (err error)
- func CommonTxPreprocess(cmd *cobra.Command, args []string) (err error)
- func HandleApproveOrRevokeOrExecuteMsig(method string, cmd *cobra.Command, args []string, postProcess PostProcessFunc)
- func HandlePostSign(signedTx *types.Transaction, reader *reader.EthReader, ...) (broadcasted bool, err error)
- func PromptArray(input abi.Argument, prefill string, network Network) (interface{}, error)
- func PromptFilePath(prompter string) string
- func PromptFunctionCallData(analyzer util.TxAnalyzer, contractAddress string, methodIndex uint64, ...) (method *abi.Method, params []interface{}, err error)
- func PromptIndex(prompter string, min, max int) int
- func PromptInput(prompter string) string
- func PromptInputWithValidation(prompter string, validator StringValidator) string
- func PromptItemInList(prompter string, options []string) string
- func PromptMethod(a *abi.ABI, methodIndex uint64, mode string) (*abi.Method, string, error)
- func PromptNonArray(input abi.Argument, prefill string, network Network) (interface{}, error)
- func PromptNumber(prompter string, validator NumberValidator, network Network) *big.Int
- func PromptParam(interactiveMode bool, input abi.Argument, prefill string, network Network) (interface{}, error)
- func PromptPercentageBps(prompter string, upbound int64, network Network) *big.Int
- func PromptTxConfirmation(analyzer util.TxAnalyzer, from Address, tx *types.Transaction, ...) error
- func PromptTxData(analyzer util.TxAnalyzer, contractAddress string, methodIndex uint64, ...) ([]byte, error)
- func ScanForTxs(para string) (nwks []string, addresses []string)
- func ValidTxType(r *reader.EthReader, network Network) (uint8, error)
- type ContextManager
- func (cm *ContextManager) Account(wallet common.Address) *account.Account
- func (cm *ContextManager) Analyzer(network Network) *TxAnalyzer
- func (cm *ContextManager) BroadcastRawTx(data string) (hash string, successful bool, allErrors error)
- func (cm *ContextManager) BroadcastTx(tx *types.Transaction) (hash string, broadcasted bool, allErrors error)
- func (cm *ContextManager) Broadcaster(network Network) *Broadcaster
- func (cm *ContextManager) BuildTx(txType uint8, from, to common.Address, nonce *big.Int, value *big.Int, ...) (tx *types.Transaction, err error)
- func (cm *ContextManager) GasSetting(network Network) (*GasInfo, error)
- func (cm *ContextManager) Nonce(wallet common.Address, network Network) (*big.Int, error)
- func (cm *ContextManager) PendingNonce(wallet common.Address, network Network) *big.Int
- func (cm *ContextManager) Reader(network Network) *EthReader
- func (cm *ContextManager) SignTx(wallet common.Address, tx *types.Transaction, network Network) (signedTx *types.Transaction, err error)
- func (cm *ContextManager) SignTxAndBroadcast(wallet common.Address, tx *types.Transaction, network Network) (signedTx *types.Transaction, successful bool, allErrors error)
- func (cm *ContextManager) UnlockAccount(addr common.Address) (*account.Account, error)
- type GasInfo
- type NumberValidator
- type PostProcessFunc
- type StringValidator
Constants ¶
View Source
const ( NEXT int = -1 BACK int = -2 CUSTOM int = -3 CONSTRUCTOR_METHOD_INDEX uint64 = 1000000 // assuming there is no contract with more than 1m methods )
Variables ¶
View Source
var GAS_INFO_TTL = 60 * time.Second
Functions ¶
func CommonFunctionCallPreprocess ¶
CommonFunctionCallPreprocess processes args passed to the command in order to initiate config's variables in a conventional way across many Function Call alike commands.
func CommonTxPreprocess ¶
CommonTxPreprocess processes args passed to the command in order to initiate config's variables in a conventional way across many commands that do txs.
func HandleApproveOrRevokeOrExecuteMsig ¶
func HandleApproveOrRevokeOrExecuteMsig( method string, cmd *cobra.Command, args []string, postProcess PostProcessFunc, )
func HandlePostSign ¶ added in v0.0.30
func HandlePostSign( signedTx *types.Transaction, reader *reader.EthReader, analyzer *txanalyzer.TxAnalyzer, a *abi.ABI, ) (broadcasted bool, err error)
func PromptArray ¶ added in v0.0.30
func PromptFilePath ¶ added in v0.0.30
func PromptFunctionCallData ¶ added in v0.0.30
func PromptIndex ¶ added in v0.0.30
func PromptInput ¶ added in v0.0.30
func PromptInputWithValidation ¶ added in v0.0.30
func PromptInputWithValidation(prompter string, validator StringValidator) string
func PromptItemInList ¶ added in v0.0.30
func PromptMethod ¶ added in v0.0.30
func PromptNonArray ¶ added in v0.0.30
func PromptNumber ¶ added in v0.0.30
func PromptNumber(prompter string, validator NumberValidator, network Network) *big.Int
func PromptParam ¶ added in v0.0.30
func PromptPercentageBps ¶ added in v0.0.30
func PromptTxConfirmation ¶ added in v0.0.30
func PromptTxConfirmation( analyzer util.TxAnalyzer, from Address, tx *types.Transaction, customABIs map[string]*abi.ABI, network Network, ) error
func PromptTxData ¶ added in v0.0.30
func ScanForTxs ¶ added in v0.0.30
Types ¶
type ContextManager ¶ added in v0.0.30
type ContextManager struct {
// contains filtered or unexported fields
}
ContextManager manages
- multiple wallets and their informations in its life time. It basically gives next nonce to do transaction for specific wallet and specific network. It queries the node to check the nonce in lazy maner, it also takes mining txs into account.
- multiple networks gas price. The gas price will be queried lazily prior to txs and will be stored as cache for a while
- txs in the context manager's life time
func NewContextManager ¶ added in v0.0.30
func NewContextManager() *ContextManager
func (*ContextManager) Account ¶ added in v0.0.30
func (cm *ContextManager) Account(wallet common.Address) *account.Account
func (*ContextManager) Analyzer ¶ added in v0.0.30
func (cm *ContextManager) Analyzer(network Network) *TxAnalyzer
func (*ContextManager) BroadcastRawTx ¶ added in v0.0.30
func (cm *ContextManager) BroadcastRawTx( data string, ) (hash string, successful bool, allErrors error)
func (*ContextManager) BroadcastTx ¶ added in v0.0.30
func (cm *ContextManager) BroadcastTx( tx *types.Transaction, ) (hash string, broadcasted bool, allErrors error)
func (*ContextManager) Broadcaster ¶ added in v0.0.30
func (cm *ContextManager) Broadcaster(network Network) *Broadcaster
func (*ContextManager) GasSetting ¶ added in v0.0.30
func (cm *ContextManager) GasSetting(network Network) (*GasInfo, error)
implement a cache mechanism to be more efficient
func (*ContextManager) Nonce ¶ added in v0.0.30
- get remote pending nonce
- get local pending nonce
- get mined nonce
- if mined nonce == remote == local, all good, lets return the mined nonce
- since mined nonce is always <= remote nonce, if mined nonce > local nonce, this session doesn't catch up with mined txs (in case there are txs that were from other apps and they were mined), return max(mined none, remote nonce) and set local nonce to max(mined none, remote nonce)
- if not, means mined nonce is smaller than both remote and local pending nonce 5.1 if remote == local: means all pending txs are from this session, we return local nonce 5.2 if remote > local: means there is pending txs from another app, we return remote nonce in order not to mess up with the other txs, but give a warning 5.3 if local > remote: means txs from this session are not broadcasted to the the notes, return local nonce and give warnings
func (*ContextManager) PendingNonce ¶ added in v0.0.30
func (cm *ContextManager) PendingNonce(wallet common.Address, network Network) *big.Int
func (*ContextManager) Reader ¶ added in v0.0.30
func (cm *ContextManager) Reader(network Network) *EthReader
func (*ContextManager) SignTx ¶ added in v0.0.30
func (cm *ContextManager) SignTx( wallet common.Address, tx *types.Transaction, network Network, ) (signedTx *types.Transaction, err error)
func (*ContextManager) SignTxAndBroadcast ¶ added in v0.0.30
func (cm *ContextManager) SignTxAndBroadcast( wallet common.Address, tx *types.Transaction, network Network, ) (signedTx *types.Transaction, successful bool, allErrors error)
func (*ContextManager) UnlockAccount ¶ added in v0.0.30
type NumberValidator ¶ added in v0.0.30
type PostProcessFunc ¶
type PostProcessFunc func(fc *FunctionCall) error
type StringValidator ¶ added in v0.0.30
Click to show internal directories.
Click to hide internal directories.