Documentation ¶
Index ¶
- Constants
- Variables
- func BoolToBytes(b bool) []byte
- func BytesConverter(source []byte, t string) interface{}
- func BytesToFloat32(bytes []byte) float32
- func BytesToFloat64(bytes []byte) float64
- func BytesToInt32(b []byte) int32
- func BytesToInt64(b []byte) int64
- func DeployContract(abiFilePath string, codeFilePath string) error
- func Float32ToBytes(float float32) []byte
- func Float64ToBytes(float float64) []byte
- func GetFuncNameAndParams(f string) (string, []string)
- func GetNonce(addr string) uint64
- func GetTransactionReceipt(txHash string, ch chan string, exit chan string)
- func HttpPost(param JsonParam) (string, error)
- func Int32ToBytes(n int32) []byte
- func Int64ToBytes(n int64) []byte
- func InvokeContract(contractAddr string, abiPath string, funcParams string, txType int) error
- func PrepareAccount(size int, pkFile, value string) error
- func Send(params interface{}, action string) (string, error)
- func SendRawTransaction(from, to, value string, pkFilePath string) (string, error)
- func SendRawTransactionWithData(configPath string, from string, to string, value int64, priv *ecdsa.PrivateKey, ...) (string, error)
- func SendTransaction(from, to, value string) (string, error)
- func StabilityTest(pkFile string, times, interval int) error
- func StringConverter(source string, t string) ([]byte, error)
- func TestMain(m *testing.M)
- type Config
- type DeployParams
- type FuncDesc
- type JsonParam
- type PriAccount
- type RawTxParams
- type Receipt
- type Response
- type TxParams
Constants ¶
View Source
const (
DefaultConfigFilePath = "/config.json"
)
Variables ¶
View Source
var ( DeployCmd = cli.Command{ Name: "deploy", Usage: "deploy a contract", Action: deploy, Flags: deployCmdFlags, } InvokeCmd = cli.Command{ Name: "invoke", Aliases: []string{"i"}, Usage: "invoke contract function", Action: invoke, Flags: invokeCmdFlags, } )
View Source
var ( ConfigPathFlag = cli.StringFlag{ Name: "config", Usage: "config path", } PKFilePathFlag = cli.StringFlag{ Name: "pkfile", Value: "", Usage: "private key file path", } StabExecTimesFlag = cli.IntFlag{ Name: "times", Value: 1000, Usage: "execute times", } SendTxIntervalFlag = cli.IntFlag{ Name: "interval", Value: 10, Usage: "Time interval for sending transactions", } AccountSizeFlag = cli.IntFlag{ Name: "size", Value: 10, Usage: "account size", } TxJsonDataFlag = cli.StringFlag{ Name: "data", Usage: "transaction data", } ContractWasmFilePathFlag = cli.StringFlag{ Name: "code", Usage: "wasm file path", } ContractAddrFlag = cli.StringFlag{ Name: "addr", Usage: "the contract address", } ContractFuncNameFlag = cli.StringFlag{ Name: "func", Usage: "function and param ,eg :set(1,\"a\")", } TransactionTypeFlag = cli.IntFlag{ Name: "type", Value: 2, Usage: "tx type ,default 2", } ContractAbiFilePathFlag = cli.StringFlag{ Name: "abi", Usage: "abi file path", } TransactionHashFlag = cli.StringFlag{ Name: "hash", Usage: "tx hash", } TxFromFlag = cli.StringFlag{ Name: "from", Usage: "transaction sender addr", } TxToFlag = cli.StringFlag{ Name: "to", Usage: "transaction acceptor addr", } TransferValueFlag = cli.StringFlag{ Name: "value", Value: "0xDE0B6B3A7640000", Usage: "transfer value", } TxStressSourceFilesPathFlag = cli.StringSliceFlag{ Name: "sourceFile", Usage: "the tps source file path", } TxStressStatisticTimeFlag = cli.IntFlag{ Name: "statisticTime", Usage: "Statistics every few seconds", } TxStressOutPutFileFlag = cli.StringFlag{ Name: "output", Usage: "the output file path", } )
View Source
var ( SendTransactionCmd = cli.Command{ Name: "sendTransaction", Usage: "send a transaction", Action: sendTransactionCmd, Flags: sendTransactionCmdFlags, } SendRawTransactionCmd = cli.Command{ Name: "sendRawTransaction", Usage: "send a raw transaction", Action: sendRawTransactionCmd, Flags: sendRawTransactionCmdFlags, } GetTxReceiptCmd = cli.Command{ Name: "getTxReceipt", Usage: "get transaction receipt by hash", Action: getTxReceiptCmd, Flags: getTxReceiptCmdFlags, } )
View Source
var ( StressTransferValue = 1000 DefaultPrivateKeyFilePath = "./test/privateKeys.txt" DefaultAccountAddrFilePath = "./test/addr.json" StabilityCmd = cli.Command{ Name: "stability", Aliases: []string{"stab"}, Usage: "start stability test ", Action: stabilityTest, Flags: stabilityCmdFlags, } StabPrepareCmd = cli.Command{ Name: "prepare", Aliases: []string{"pre"}, Usage: "prepare some accounts are used for stability test ", Action: prepareAccount, Flags: stabPrepareCmdFlags, } )
View Source
var (
AnalyzeStressTestCmd = cli.Command{
Name: "analyzeStressTest",
Usage: "analyze the tx stress test source file to generate result data",
Action: analyzeStressTest,
Flags: txStressFlags,
}
)
View Source
var (
RpcUrl = "http://127.0.0.1:6789"
)
Functions ¶
func BoolToBytes ¶
func BytesConverter ¶
func BytesToFloat32 ¶
func BytesToFloat64 ¶
func BytesToInt32 ¶
func BytesToInt64 ¶
func DeployContract ¶
func Float32ToBytes ¶
func Float64ToBytes ¶
func GetTransactionReceipt ¶
Loop call to get transactionReceipt... until 200s timeout
func Int32ToBytes ¶
func Int64ToBytes ¶
func InvokeContract ¶
*
func PrepareAccount ¶
func SendRawTransaction ¶
func SendTransaction ¶
func StabilityTest ¶
Types ¶
type DeployParams ¶
type PriAccount ¶
type PriAccount struct { Priv *ecdsa.PrivateKey Nonce uint64 Address common.Address }
type RawTxParams ¶
type Receipt ¶
type Receipt struct { Jsonrpc string `json:"jsonrpc"` Id int `json:"id"` Result struct { BlockHash string `json:"blockHash"` BlockNumber string `json:"blockNumber"` ContractAddress string `json:"contractAddress"` CumulativeGasUsed string `json:"cumulativeGas_used"` From string `json:"from"` GasUsed string `json:"gasUsed"` Root string `json:"root"` To string `json:"to"` TransactionHash string `json:"transactionHash"` TransactionIndex string `json:"transactionIndex"` } `json:"result"` }
func GetTxReceipt ¶
Click to show internal directories.
Click to hide internal directories.