How to use must method of cmd Package

Best K6 code snippet using cmd.must

chainsvrcmds.go

Source:chainsvrcmds.go Github

copy

Full Screen

...166 if val == float64(int64(val)) {167 return int64(val), nil168 }169 }170 str := fmt.Sprintf("the %s field must be unspecified, a boolean, or "+171 "a 64-bit integer", fieldName,172 )173 return nil, makeError(ErrInvalidType, str)174}175// UnmarshalJSON provides a custom Unmarshal method for TemplateRequest. This is necessary because the SigOpLimit and176// SizeLimit fields can only be specific types.177func (t *TemplateRequest) UnmarshalJSON(data []byte) (e error) {178 type templateRequest TemplateRequest179 request := (*templateRequest)(t)180 if e = json.Unmarshal(data, &request); E.Chk(e) {181 return e182 }183 // The SigOpLimit field can only be nil, bool, or int64.184 var val interface{}185 val, e = convertTemplateRequestField("sigoplimit", request.SigOpLimit)186 if e != nil {187 E.Ln(e)188 return e189 }190 request.SigOpLimit = val191 // The SizeLimit field can only be nil, bool, or int64.192 val, e = convertTemplateRequestField("sizelimit", request.SizeLimit)193 if e != nil {194 E.Ln(e)195 return e196 }197 request.SizeLimit = val198 return nil199}200// GetBlockTemplateCmd defines the getblocktemplate JSON-RPC command.201type GetBlockTemplateCmd struct {202 Request *TemplateRequest203}204// NewGetBlockTemplateCmd returns a new instance which can be used to issue a getblocktemplate JSON-RPC command. The205// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default206// value.207func NewGetBlockTemplateCmd(request *TemplateRequest) *GetBlockTemplateCmd {208 return &GetBlockTemplateCmd{209 Request: request,210 }211}212// GetCFilterCmd defines the getcfilter JSON-RPC command.213type GetCFilterCmd struct {214 Hash string215 FilterType wire.FilterType216}217// NewGetCFilterCmd returns a new instance which can be used to issue a getcfilter JSON-RPC command.218func NewGetCFilterCmd(hash string, filterType wire.FilterType) *GetCFilterCmd {219 return &GetCFilterCmd{220 Hash: hash,221 FilterType: filterType,222 }223}224// GetCFilterHeaderCmd defines the getcfilterheader JSON-RPC command.225type GetCFilterHeaderCmd struct {226 Hash string227 FilterType wire.FilterType228}229// NewGetCFilterHeaderCmd returns a new instance which can be used to issue a getcfilterheader JSON-RPC command.230func NewGetCFilterHeaderCmd(hash string,231 filterType wire.FilterType,232) *GetCFilterHeaderCmd {233 return &GetCFilterHeaderCmd{234 Hash: hash,235 FilterType: filterType,236 }237}238// GetChainTipsCmd defines the getchaintips JSON-RPC command.239type GetChainTipsCmd struct{}240// NewGetChainTipsCmd returns a new instance which can be used to issue a getchaintips JSON-RPC command.241func NewGetChainTipsCmd() *GetChainTipsCmd {242 return &GetChainTipsCmd{}243}244// GetConnectionCountCmd defines the getconnectioncount JSON-RPC command.245type GetConnectionCountCmd struct{}246// NewGetConnectionCountCmd returns a new instance which can be used to issue a getconnectioncount JSON-RPC command.247func NewGetConnectionCountCmd() *GetConnectionCountCmd {248 return &GetConnectionCountCmd{}249}250// GetDifficultyCmd defines the getdifficulty JSON-RPC command.251type GetDifficultyCmd struct {252 Algo string253}254// NewGetDifficultyCmd returns a new instance which can be used to issue a getdifficulty JSON-RPC command.255func NewGetDifficultyCmd(algo string) *GetDifficultyCmd {256 return &GetDifficultyCmd{257 Algo: algo,258 }259}260// GetGenerateCmd defines the getgenerate JSON-RPC command.261type GetGenerateCmd struct{}262// NewGetGenerateCmd returns a new instance which can be used to issue a getgenerate JSON-RPC command.263func NewGetGenerateCmd() *GetGenerateCmd {264 return &GetGenerateCmd{}265}266// GetHashesPerSecCmd defines the gethashespersec JSON-RPC command.267type GetHashesPerSecCmd struct{}268// NewGetHashesPerSecCmd returns a new instance which can be used to issue a gethashespersec JSON-RPC command.269func NewGetHashesPerSecCmd() *GetHashesPerSecCmd {270 return &GetHashesPerSecCmd{}271}272// GetInfoCmd defines the getinfo JSON-RPC command.273type GetInfoCmd struct{}274// NewGetInfoCmd returns a new instance which can be used to issue a getinfo JSON-RPC command.275func NewGetInfoCmd() *GetInfoCmd {276 return &GetInfoCmd{}277}278// GetMempoolEntryCmd defines the getmempoolentry JSON-RPC command.279type GetMempoolEntryCmd struct {280 TxID string281}282// NewGetMempoolEntryCmd returns a new instance which can be used to issue a getmempoolentry JSON-RPC command.283func NewGetMempoolEntryCmd(txHash string) *GetMempoolEntryCmd {284 return &GetMempoolEntryCmd{285 TxID: txHash,286 }287}288// GetMempoolInfoCmd defines the getmempoolinfo JSON-RPC command.289type GetMempoolInfoCmd struct{}290// NewGetMempoolInfoCmd returns a new instance which can be used to issue a getmempool JSON-RPC command.291func NewGetMempoolInfoCmd() *GetMempoolInfoCmd {292 return &GetMempoolInfoCmd{}293}294// GetMiningInfoCmd defines the getmininginfo JSON-RPC command.295type GetMiningInfoCmd struct{}296// NewGetMiningInfoCmd returns a new instance which can be used to issue a getmininginfo JSON-RPC command.297func NewGetMiningInfoCmd() *GetMiningInfoCmd {298 return &GetMiningInfoCmd{}299}300// GetNetworkInfoCmd defines the getnetworkinfo JSON-RPC command.301type GetNetworkInfoCmd struct{}302// NewGetNetworkInfoCmd returns a new instance which can be used to issue a getnetworkinfo JSON-RPC command.303func NewGetNetworkInfoCmd() *GetNetworkInfoCmd {304 return &GetNetworkInfoCmd{}305}306// GetNetTotalsCmd defines the getnettotals JSON-RPC command.307type GetNetTotalsCmd struct{}308// NewGetNetTotalsCmd returns a new instance which can be used to issue a getnettotals JSON-RPC command.309func NewGetNetTotalsCmd() *GetNetTotalsCmd {310 return &GetNetTotalsCmd{}311}312// GetNetworkHashPSCmd defines the getnetworkhashps JSON-RPC command.313type GetNetworkHashPSCmd struct {314 Blocks *int `jsonrpcdefault:"120"`315 Height *int `jsonrpcdefault:"-1"`316}317// NewGetNetworkHashPSCmd returns a new instance which can be used to issue a getnetworkhashps JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.318func NewGetNetworkHashPSCmd(numBlocks, height *int) *GetNetworkHashPSCmd {319 return &GetNetworkHashPSCmd{320 Blocks: numBlocks,321 Height: height,322 }323}324// GetPeerInfoCmd defines the getpeerinfo JSON-RPC command.325type GetPeerInfoCmd struct{}326// NewGetPeerInfoCmd returns a new instance which can be used to issue a getpeer JSON-RPC command.327func NewGetPeerInfoCmd() *GetPeerInfoCmd {328 return &GetPeerInfoCmd{}329}330// GetRawMempoolCmd defines the getmempool JSON-RPC command.331type GetRawMempoolCmd struct {332 Verbose *bool `jsonrpcdefault:"false"`333}334// NewGetRawMempoolCmd returns a new instance which can be used to issue a getrawmempool JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.335func NewGetRawMempoolCmd(verbose *bool) *GetRawMempoolCmd {336 return &GetRawMempoolCmd{337 Verbose: verbose,338 }339}340// GetRawTransactionCmd defines the getrawtransaction JSON-RPC command. NOTE: This field is an int versus a bool to remain compatible with Bitcoin Core even though it really should be a bool.341type GetRawTransactionCmd struct {342 Txid string343 Verbose *int `jsonrpcdefault:"0"`344}345// NewGetRawTransactionCmd returns a new instance which can be used to issue a getrawtransaction JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.346func NewGetRawTransactionCmd(txHash string, verbose *int) *GetRawTransactionCmd {347 return &GetRawTransactionCmd{348 Txid: txHash,349 Verbose: verbose,350 }351}352// GetTxOutCmd defines the gettxout JSON-RPC command.353type GetTxOutCmd struct {354 Txid string355 Vout uint32356 IncludeMempool *bool `jsonrpcdefault:"true"`357}358// NewGetTxOutCmd returns a new instance which can be used to issue a gettxout JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.359func NewGetTxOutCmd(txHash string, vout uint32, includeMempool *bool) *GetTxOutCmd {360 return &GetTxOutCmd{361 Txid: txHash,362 Vout: vout,363 IncludeMempool: includeMempool,364 }365}366// GetTxOutProofCmd defines the gettxoutproof JSON-RPC command.367type GetTxOutProofCmd struct {368 TxIDs []string369 BlockHash *string370}371// NewGetTxOutProofCmd returns a new instance which can be used to issue a gettxoutproof JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.372func NewGetTxOutProofCmd(txIDs []string, blockHash *string) *GetTxOutProofCmd {373 return &GetTxOutProofCmd{374 TxIDs: txIDs,375 BlockHash: blockHash,376 }377}378// GetTxOutSetInfoCmd defines the gettxoutsetinfo JSON-RPC command.379type GetTxOutSetInfoCmd struct{}380// NewGetTxOutSetInfoCmd returns a new instance which can be used to issue a gettxoutsetinfo JSON-RPC command.381func NewGetTxOutSetInfoCmd() *GetTxOutSetInfoCmd {382 return &GetTxOutSetInfoCmd{}383}384// GetWorkCmd defines the getwork JSON-RPC command.385type GetWorkCmd struct {386 Data *string387}388// NewGetWorkCmd returns a new instance which can be used to issue a getwork JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.389func NewGetWorkCmd(data *string) *GetWorkCmd {390 return &GetWorkCmd{391 Data: data,392 }393}394// HelpCmd defines the help JSON-RPC command.395type HelpCmd struct {396 Command *string397}398// NewHelpCmd returns a new instance which can be used to issue a help JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.399func NewHelpCmd(command *string) *HelpCmd {400 return &HelpCmd{401 Command: command,402 }403}404// InvalidateBlockCmd defines the invalidateblock JSON-RPC command.405type InvalidateBlockCmd struct {406 BlockHash string407}408// NewInvalidateBlockCmd returns a new instance which can be used to issue a invalidateblock JSON-RPC command.409func NewInvalidateBlockCmd(blockHash string) *InvalidateBlockCmd {410 return &InvalidateBlockCmd{411 BlockHash: blockHash,412 }413}414// PingCmd defines the ping JSON-RPC command.415type PingCmd struct{}416// NewPingCmd returns a new instance which can be used to issue a ping JSON-RPC command.417func NewPingCmd() *PingCmd {418 return &PingCmd{}419}420// PreciousBlockCmd defines the preciousblock JSON-RPC command.421type PreciousBlockCmd struct {422 BlockHash string423}424// NewPreciousBlockCmd returns a new instance which can be used to issue a preciousblock JSON-RPC command.425func NewPreciousBlockCmd(blockHash string) *PreciousBlockCmd {426 return &PreciousBlockCmd{427 BlockHash: blockHash,428 }429}430// ReconsiderBlockCmd defines the reconsiderblock JSON-RPC command.431type ReconsiderBlockCmd struct {432 BlockHash string433}434// NewReconsiderBlockCmd returns a new instance which can be used to issue a reconsiderblock JSON-RPC command.435func NewReconsiderBlockCmd(blockHash string) *ReconsiderBlockCmd {436 return &ReconsiderBlockCmd{437 BlockHash: blockHash,438 }439}440// SearchRawTransactionsCmd defines the searchrawtransactions JSON-RPC command.441type SearchRawTransactionsCmd struct {442 Address string443 Verbose *int `jsonrpcdefault:"1"`444 Skip *int `jsonrpcdefault:"0"`445 Count *int `jsonrpcdefault:"100"`446 VinExtra *int `jsonrpcdefault:"0"`447 Reverse *bool `jsonrpcdefault:"false"`448 FilterAddrs *[]string449}450// NewSearchRawTransactionsCmd returns a new instance which can be used to issue a sendrawtransaction JSON-RPC command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.451func NewSearchRawTransactionsCmd(address string, verbose, skip, count *int, vinExtra *int, reverse *bool,452 filterAddrs *[]string,453) *SearchRawTransactionsCmd {454 return &SearchRawTransactionsCmd{455 Address: address,456 Verbose: verbose,457 Skip: skip,458 Count: count,459 VinExtra: vinExtra,460 Reverse: reverse,461 FilterAddrs: filterAddrs,462 }463}464// SendRawTransactionCmd defines the sendrawtransaction JSON-RPC command.465type SendRawTransactionCmd struct {466 HexTx string467 AllowHighFees *bool `jsonrpcdefault:"false"`468}469// NewSendRawTransactionCmd returns a new instance which can be used to issue a sendrawtransaction JSON-RPC command. The470// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default471// value.472func NewSendRawTransactionCmd(hexTx string, allowHighFees *bool) *SendRawTransactionCmd {473 return &SendRawTransactionCmd{474 HexTx: hexTx,475 AllowHighFees: allowHighFees,476 }477}478// SetGenerateCmd defines the setgenerate JSON-RPC command.479type SetGenerateCmd struct {480 Generate bool481 GenProcLimit *int `jsonrpcdefault:"-1"`482}483// NewSetGenerateCmd returns a new instance which can be used to issue a setgenerate JSON-RPC command. The parameters484// which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.485func NewSetGenerateCmd(generate bool, genProcLimit *int) *SetGenerateCmd {486 return &SetGenerateCmd{487 Generate: generate,488 GenProcLimit: genProcLimit,489 }490}491// StopCmd defines the stop JSON-RPC command.492type StopCmd struct{}493// NewStopCmd returns a new instance which can be used to issue a stop JSON-RPC command.494func NewStopCmd() *StopCmd {495 return &StopCmd{}496}497// RestartCmd defines the restart JSON-RPC command.498type RestartCmd struct{}499// NewRestartCmd returns a new instance which can be used to issue a stop JSON-RPC command.500func NewRestartCmd() *RestartCmd {501 return &RestartCmd{}502}503// ResetChainCmd defines the resetchain JSON-RPC command504type ResetChainCmd struct{}505// NewResetChainCmd returns a new instance which can be used to issue a resetchain JSON-RPC command506func NewResetChainCmd() *ResetChainCmd {507 return &ResetChainCmd{}508}509// SubmitBlockOptions represents the optional options struct provided with a SubmitBlockCmd command.510type SubmitBlockOptions struct {511 // must be provided if server provided a workid with template.512 WorkID string `json:"workid,omitempty"`513}514// SubmitBlockCmd defines the submitblock JSON-RPC command.515type SubmitBlockCmd struct {516 HexBlock string517 Options *SubmitBlockOptions518}519// NewSubmitBlockCmd returns a new instance which can be used to issue a submitblock JSON-RPC command. The parameters520// which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.521func NewSubmitBlockCmd(hexBlock string, options *SubmitBlockOptions) *SubmitBlockCmd {522 return &SubmitBlockCmd{523 HexBlock: hexBlock,524 Options: options,525 }...

Full Screen

Full Screen

walletsvrcmds.go

Source:walletsvrcmds.go Github

copy

Full Screen

1package btcjson2// AddMultisigAddressCmd defines the addmutisigaddress JSON-RPC command.3type AddMultisigAddressCmd struct {4 NRequired int5 Keys []string6 Account *string7}8// NewAddMultisigAddressCmd returns a new instance which can be used to issue a addmultisigaddress JSON-RPC command. The9// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default10// value.11func NewAddMultisigAddressCmd(nRequired int, keys []string, account *string) *AddMultisigAddressCmd {12 return &AddMultisigAddressCmd{13 NRequired: nRequired,14 Keys: keys,15 Account: account,16 }17}18// AddWitnessAddressCmd defines the addwitnessaddress JSON-RPC command.19type AddWitnessAddressCmd struct {20 Address string21}22// NewAddWitnessAddressCmd returns a new instance which can be used to issue a23// addwitnessaddress JSON-RPC command.24func NewAddWitnessAddressCmd(address string) *AddWitnessAddressCmd {25 return &AddWitnessAddressCmd{26 Address: address,27 }28}29// CreateMultisigCmd defines the createmultisig JSON-RPC command.30type CreateMultisigCmd struct {31 NRequired int32 Keys []string33}34// NewCreateMultisigCmd returns a new instance which can be used to issue a createmultisig JSON-RPC command.35func NewCreateMultisigCmd(nRequired int, keys []string) *CreateMultisigCmd {36 return &CreateMultisigCmd{37 NRequired: nRequired,38 Keys: keys,39 }40}41// DropWalletHistoryCmd defines the restart JSON-RPC command.42type DropWalletHistoryCmd struct{}43// NewDropWalletHistoryCmd returns a new instance which can be used to issue a stop JSON-RPC command.44func NewDropWalletHistoryCmd() *DropWalletHistoryCmd {45 return &DropWalletHistoryCmd{}46}47// DumpPrivKeyCmd defines the dumpprivkey JSON-RPC command.48type DumpPrivKeyCmd struct {49 Address string50}51// NewDumpPrivKeyCmd returns a new instance which can be used to issue a dumpprivkey JSON-RPC command.52func NewDumpPrivKeyCmd(address string) *DumpPrivKeyCmd {53 return &DumpPrivKeyCmd{54 Address: address,55 }56}57// EncryptWalletCmd defines the encryptwallet JSON-RPC command.58type EncryptWalletCmd struct {59 Passphrase string60}61// NewEncryptWalletCmd returns a new instance which can be used to issue a encryptwallet JSON-RPC command.62func NewEncryptWalletCmd(passphrase string) *EncryptWalletCmd {63 return &EncryptWalletCmd{64 Passphrase: passphrase,65 }66}67// EstimateFeeCmd defines the estimatefee JSON-RPC command.68type EstimateFeeCmd struct {69 NumBlocks int6470}71// NewEstimateFeeCmd returns a new instance which can be used to issue a estimatefee JSON-RPC command.72func NewEstimateFeeCmd(numBlocks int64) *EstimateFeeCmd {73 return &EstimateFeeCmd{74 NumBlocks: numBlocks,75 }76}77// EstimatePriorityCmd defines the estimatepriority JSON-RPC command.78type EstimatePriorityCmd struct {79 NumBlocks int6480}81// NewEstimatePriorityCmd returns a new instance which can be used to issue a estimatepriority JSON-RPC command.82func NewEstimatePriorityCmd(numBlocks int64) *EstimatePriorityCmd {83 return &EstimatePriorityCmd{84 NumBlocks: numBlocks,85 }86}87// GetAccountCmd defines the getaccount JSON-RPC command.88type GetAccountCmd struct {89 Address string90}91// NewGetAccountCmd returns a new instance which can be used to issue a getaccount JSON-RPC command.92func NewGetAccountCmd(address string) *GetAccountCmd {93 return &GetAccountCmd{94 Address: address,95 }96}97// GetAccountAddressCmd defines the getaccountaddress JSON-RPC command.98type GetAccountAddressCmd struct {99 Account string100}101// NewGetAccountAddressCmd returns a new instance which can be used to issue a getaccountaddress JSON-RPC command.102func NewGetAccountAddressCmd(account string) *GetAccountAddressCmd {103 return &GetAccountAddressCmd{104 Account: account,105 }106}107// GetAddressesByAccountCmd defines the getaddressesbyaccount JSON-RPC command.108type GetAddressesByAccountCmd struct {109 Account string110}111// NewGetAddressesByAccountCmd returns a new instance which can be used to issue a getaddressesbyaccount JSON-RPC112// command.113func NewGetAddressesByAccountCmd(account string) *GetAddressesByAccountCmd {114 return &GetAddressesByAccountCmd{115 Account: account,116 }117}118// GetBalanceCmd defines the getbalance JSON-RPC command.119type GetBalanceCmd struct {120 Account *string121 MinConf *int `jsonrpcdefault:"1"`122}123// NewGetBalanceCmd returns a new instance which can be used to issue a getbalance JSON-RPC command. The parameters that124// are pointers indicate they are optional. Passing nil for optional parameters will use the default value.125func NewGetBalanceCmd(account *string, minConf *int) *GetBalanceCmd {126 return &GetBalanceCmd{127 Account: account,128 MinConf: minConf,129 }130}131// GetNewAddressCmd defines the getnewaddress JSON-RPC command.132type GetNewAddressCmd struct {133 Account *string134}135// NewGetNewAddressCmd returns a new instance which can be used to issue a getnewaddress JSON-RPC command. The136// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default137// value.138func NewGetNewAddressCmd(account *string) *GetNewAddressCmd {139 return &GetNewAddressCmd{140 Account: account,141 }142}143// GetRawChangeAddressCmd defines the getrawchangeaddress JSON-RPC command.144type GetRawChangeAddressCmd struct {145 Account *string146}147// NewGetRawChangeAddressCmd returns a new instance which can be used to issue a getrawchangeaddress JSON-RPC command.148// The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the149// default value.150func NewGetRawChangeAddressCmd(account *string) *GetRawChangeAddressCmd {151 return &GetRawChangeAddressCmd{152 Account: account,153 }154}155// GetReceivedByAccountCmd defines the getreceivedbyaccount JSON-RPC command.156type GetReceivedByAccountCmd struct {157 Account string158 MinConf *int `jsonrpcdefault:"1"`159}160// NewGetReceivedByAccountCmd returns a new instance which can be used to issue a getreceivedbyaccount JSON-RPC command.161// The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the162// default value.163func NewGetReceivedByAccountCmd(account string, minConf *int) *GetReceivedByAccountCmd {164 return &GetReceivedByAccountCmd{165 Account: account,166 MinConf: minConf,167 }168}169// GetReceivedByAddressCmd defines the getreceivedbyaddress JSON-RPC command.170type GetReceivedByAddressCmd struct {171 Address string172 MinConf *int `jsonrpcdefault:"1"`173}174// NewGetReceivedByAddressCmd returns a new instance which can be used to issue a getreceivedbyaddress JSON-RPC command.175// The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the176// default value.177func NewGetReceivedByAddressCmd(address string, minConf *int) *GetReceivedByAddressCmd {178 return &GetReceivedByAddressCmd{179 Address: address,180 MinConf: minConf,181 }182}183// GetTransactionCmd defines the gettransaction JSON-RPC command.184type GetTransactionCmd struct {185 Txid string186 IncludeWatchOnly *bool `jsonrpcdefault:"false"`187}188// NewGetTransactionCmd returns a new instance which can be used to issue a gettransaction JSON-RPC command. The189// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default190// value.191func NewGetTransactionCmd(txHash string, includeWatchOnly *bool) *GetTransactionCmd {192 return &GetTransactionCmd{193 Txid: txHash,194 IncludeWatchOnly: includeWatchOnly,195 }196}197// GetWalletInfoCmd defines the getwalletinfo JSON-RPC command.198type GetWalletInfoCmd struct{}199// NewGetWalletInfoCmd returns a new instance which can be used to issue a getwalletinfo JSON-RPC command.200func NewGetWalletInfoCmd() *GetWalletInfoCmd {201 return &GetWalletInfoCmd{}202}203// ImportPrivKeyCmd defines the importprivkey JSON-RPC command.204type ImportPrivKeyCmd struct {205 PrivKey string206 Label *string207 Rescan *bool `jsonrpcdefault:"true"`208}209// NewImportPrivKeyCmd returns a new instance which can be used to issue a importprivkey JSON-RPC command. The210// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default211// value.212func NewImportPrivKeyCmd(privKey string, label *string, rescan *bool) *ImportPrivKeyCmd {213 return &ImportPrivKeyCmd{214 PrivKey: privKey,215 Label: label,216 Rescan: rescan,217 }218}219// KeyPoolRefillCmd defines the keypoolrefill JSON-RPC command.220type KeyPoolRefillCmd struct {221 NewSize *uint `jsonrpcdefault:"100"`222}223// NewKeyPoolRefillCmd returns a new instance which can be used to issue a keypoolrefill JSON-RPC command. The224// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default225// value.226func NewKeyPoolRefillCmd(newSize *uint) *KeyPoolRefillCmd {227 return &KeyPoolRefillCmd{228 NewSize: newSize,229 }230}231// ListAccountsCmd defines the listaccounts JSON-RPC command.232type ListAccountsCmd struct {233 MinConf *int `jsonrpcdefault:"1"`234}235// NewListAccountsCmd returns a new instance which can be used to issue a listaccounts JSON-RPC command. The parameters236// which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.237func NewListAccountsCmd(minConf *int) *ListAccountsCmd {238 return &ListAccountsCmd{239 MinConf: minConf,240 }241}242// ListAddressGroupingsCmd defines the listaddressgroupings JSON-RPC command.243type ListAddressGroupingsCmd struct{}244// NewListAddressGroupingsCmd returns a new instance which can be used to issue a listaddressgroupings JSON-RPC245// command.246func NewListAddressGroupingsCmd() *ListAddressGroupingsCmd {247 return &ListAddressGroupingsCmd{}248}249// ListLockUnspentCmd defines the listlockunspent JSON-RPC command.250type ListLockUnspentCmd struct{}251// NewListLockUnspentCmd returns a new instance which can be used to issue a listlockunspent JSON-RPC command.252func NewListLockUnspentCmd() *ListLockUnspentCmd {253 return &ListLockUnspentCmd{}254}255// ListReceivedByAccountCmd defines the listreceivedbyaccount JSON-RPC command.256type ListReceivedByAccountCmd struct {257 MinConf *int `jsonrpcdefault:"1"`258 IncludeEmpty *bool `jsonrpcdefault:"false"`259 IncludeWatchOnly *bool `jsonrpcdefault:"false"`260}261// NewListReceivedByAccountCmd returns a new instance which can be used to issue a listreceivedbyaccount JSON-RPC262// command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use263// the default value.264func NewListReceivedByAccountCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAccountCmd {265 return &ListReceivedByAccountCmd{266 MinConf: minConf,267 IncludeEmpty: includeEmpty,268 IncludeWatchOnly: includeWatchOnly,269 }270}271// ListReceivedByAddressCmd defines the listreceivedbyaddress JSON-RPC command.272type ListReceivedByAddressCmd struct {273 MinConf *int `jsonrpcdefault:"1"`274 IncludeEmpty *bool `jsonrpcdefault:"false"`275 IncludeWatchOnly *bool `jsonrpcdefault:"false"`276}277// NewListReceivedByAddressCmd returns a new instance which can be used to issue a listreceivedbyaddress JSON-RPC278// command. The parameters which are pointers indicate they are optional. Passing nil for optional parameters will use279// the default value.280func NewListReceivedByAddressCmd(minConf *int, includeEmpty, includeWatchOnly *bool) *ListReceivedByAddressCmd {281 return &ListReceivedByAddressCmd{282 MinConf: minConf,283 IncludeEmpty: includeEmpty,284 IncludeWatchOnly: includeWatchOnly,285 }286}287// ListSinceBlockCmd defines the listsinceblock JSON-RPC command.288type ListSinceBlockCmd struct {289 BlockHash *string290 TargetConfirmations *int `jsonrpcdefault:"1"`291 IncludeWatchOnly *bool `jsonrpcdefault:"false"`292}293// NewListSinceBlockCmd returns a new instance which can be used to issue a listsinceblock JSON-RPC command. The294// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default295// value.296func NewListSinceBlockCmd(blockHash *string, targetConfirms *int, includeWatchOnly *bool) *ListSinceBlockCmd {297 return &ListSinceBlockCmd{298 BlockHash: blockHash,299 TargetConfirmations: targetConfirms,300 IncludeWatchOnly: includeWatchOnly,301 }302}303// ListTransactionsCmd defines the listtransactions JSON-RPC command.304type ListTransactionsCmd struct {305 Account *string306 Count *int `jsonrpcdefault:"10"`307 From *int `jsonrpcdefault:"0"`308 IncludeWatchOnly *bool `jsonrpcdefault:"false"`309}310// NewListTransactionsCmd returns a new instance which can be used to issue a listtransactions JSON-RPC command.311// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default312// value.313func NewListTransactionsCmd(account *string, count, from *int, includeWatchOnly *bool) *ListTransactionsCmd {314 return &ListTransactionsCmd{315 Account: account,316 Count: count,317 From: from,318 IncludeWatchOnly: includeWatchOnly,319 }320}321// ListUnspentCmd defines the listunspent JSON-RPC command.322type ListUnspentCmd struct {323 MinConf *int `jsonrpcdefault:"1"`324 MaxConf *int `jsonrpcdefault:"9999999"`325 Addresses *[]string326}327// NewListUnspentCmd returns a new instance which can be used to issue a listunspent JSON-RPC command. The parameters328// which are pointers indicate they are optional. Passing nil for optional parameters will use the default value.329func NewListUnspentCmd(minConf, maxConf *int, addresses *[]string) *ListUnspentCmd {330 return &ListUnspentCmd{331 MinConf: minConf,332 MaxConf: maxConf,333 Addresses: addresses,334 }335}336// LockUnspentCmd defines the lockunspent JSON-RPC command.337type LockUnspentCmd struct {338 Unlock bool339 Transactions []TransactionInput340}341// NewLockUnspentCmd returns a new instance which can be used to issue a lockunspent JSON-RPC command.342func NewLockUnspentCmd(unlock bool, transactions []TransactionInput) *LockUnspentCmd {343 return &LockUnspentCmd{344 Unlock: unlock,345 Transactions: transactions,346 }347}348// MoveCmd defines the move JSON-RPC command.349type MoveCmd struct {350 FromAccount string351 ToAccount string352 Amount float64 // In DUO353 MinConf *int `jsonrpcdefault:"1"`354 Comment *string355}356// NewMoveCmd returns a new instance which can be used to issue a move JSON-RPC command. The parameters which are357// pointers indicate they are optional. Passing nil for optional parameters will use the default value.358func NewMoveCmd(fromAccount, toAccount string, amount float64, minConf *int, comment *string) *MoveCmd {359 return &MoveCmd{360 FromAccount: fromAccount,361 ToAccount: toAccount,362 Amount: amount,363 MinConf: minConf,364 Comment: comment,365 }366}367// SendFromCmd defines the sendfrom JSON-RPC command.368type SendFromCmd struct {369 FromAccount string370 ToAddress string371 Amount float64 // In DUO372 MinConf *int `jsonrpcdefault:"1"`373 Comment *string374 CommentTo *string375}376// NewSendFromCmd returns a new instance which can be used to issue a sendfrom JSON-RPC command. The parameters which377// are pointers indicate they are optional. Passing nil for optional parameters will use the default value.378func NewSendFromCmd(fromAccount, toAddress string, amount float64, minConf *int, comment, commentTo *string,379) *SendFromCmd {380 return &SendFromCmd{381 FromAccount: fromAccount,382 ToAddress: toAddress,383 Amount: amount,384 MinConf: minConf,385 Comment: comment,386 CommentTo: commentTo,387 }388}389// SendManyCmd defines the sendmany JSON-RPC command.390type SendManyCmd struct {391 FromAccount string392 Amounts map[string]float64 `jsonrpcusage:"{\"address\":amount,...}"` // In DUO393 MinConf *int `jsonrpcdefault:"1"`394 Comment *string395}396// NewSendManyCmd returns a new instance which can be used to issue a sendmany JSON-RPC command. The parameters which397// are pointers indicate they are optional. Passing nil for optional parameters will use the default value.398func NewSendManyCmd(fromAccount string, amounts map[string]float64, minConf *int, comment *string) *SendManyCmd {399 return &SendManyCmd{400 FromAccount: fromAccount,401 Amounts: amounts,402 MinConf: minConf,403 Comment: comment,404 }405}406// SendToAddressCmd defines the sendtoaddress JSON-RPC command.407type SendToAddressCmd struct {408 Address string409 Amount float64410 Comment *string411 CommentTo *string412}413// NewSendToAddressCmd returns a new instance which can be used to issue a sendtoaddress JSON-RPC command. The414// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default415// value.416func NewSendToAddressCmd(address string, amount float64, comment, commentTo *string) *SendToAddressCmd {417 return &SendToAddressCmd{418 Address: address,419 Amount: amount,420 Comment: comment,421 CommentTo: commentTo,422 }423}424// SetAccountCmd defines the setaccount JSON-RPC command.425type SetAccountCmd struct {426 Address string427 Account string428}429// NewSetAccountCmd returns a new instance which can be used to issue a setaccount JSON-RPC command.430func NewSetAccountCmd(address, account string) *SetAccountCmd {431 return &SetAccountCmd{432 Address: address,433 Account: account,434 }435}436// SetTxFeeCmd defines the settxfee JSON-RPC command.437type SetTxFeeCmd struct {438 Amount float64 // In DUO439}440// NewSetTxFeeCmd returns a new instance which can be used to issue a settxfee JSON-RPC command.441func NewSetTxFeeCmd(amount float64) *SetTxFeeCmd {442 return &SetTxFeeCmd{443 Amount: amount,444 }445}446// SignMessageCmd defines the signmessage JSON-RPC command.447type SignMessageCmd struct {448 Address string449 Message string450}451// NewSignMessageCmd returns a new instance which can be used to issue a signmessage JSON-RPC command.452func NewSignMessageCmd(address, message string) *SignMessageCmd {453 return &SignMessageCmd{454 Address: address,455 Message: message,456 }457}458// RawTxInput models the data needed for raw transaction input that is used in the SignRawTransactionCmd struct.459type RawTxInput struct {460 Txid string `json:"txid"`461 Vout uint32 `json:"vout"`462 ScriptPubKey string `json:"scriptPubKey"`463 RedeemScript string `json:"redeemScript"`464}465// SignRawTransactionCmd defines the signrawtransaction JSON-RPC command.466type SignRawTransactionCmd struct {467 RawTx string468 Inputs *[]RawTxInput469 PrivKeys *[]string470 Flags *string `jsonrpcdefault:"\"ALL\""`471}472// NewSignRawTransactionCmd returns a new instance which can be used to issue a signrawtransaction JSON-RPC command. The473// parameters which are pointers indicate they are optional. Passing nil for optional parameters will use the default474// value.475func NewSignRawTransactionCmd(hexEncodedTx string, inputs *[]RawTxInput, privKeys *[]string, flags *string,476) *SignRawTransactionCmd {477 return &SignRawTransactionCmd{478 RawTx: hexEncodedTx,479 Inputs: inputs,480 PrivKeys: privKeys,481 Flags: flags,482 }483}484// WalletLockCmd defines the walletlock JSON-RPC command.485type WalletLockCmd struct{}486// NewWalletLockCmd returns a new instance which can be used to issue a walletlock JSON-RPC command.487func NewWalletLockCmd() *WalletLockCmd {488 return &WalletLockCmd{}489}490// WalletPassphraseCmd defines the walletpassphrase JSON-RPC command.491type WalletPassphraseCmd struct {492 Passphrase string493 Timeout int64494}495// NewWalletPassphraseCmd returns a new instance which can be used to issue a walletpassphrase JSON-RPC command.496func NewWalletPassphraseCmd(passphrase string, timeout int64) *WalletPassphraseCmd {497 return &WalletPassphraseCmd{498 Passphrase: passphrase,499 Timeout: timeout,500 }501}502// WalletPassphraseChangeCmd defines the walletpassphrase JSON-RPC command.503type WalletPassphraseChangeCmd struct {504 OldPassphrase string505 NewPassphrase string506}507// NewWalletPassphraseChangeCmd returns a new instance which can be used to issue a walletpassphrasechange JSON-RPC508// command.509func NewWalletPassphraseChangeCmd(oldPassphrase, newPassphrase string) *WalletPassphraseChangeCmd {510 return &WalletPassphraseChangeCmd{511 OldPassphrase: oldPassphrase,512 NewPassphrase: newPassphrase,513 }514}515func init() {516 517 // The commands in this file are only usable with a wallet server.518 flags := UFWalletOnly519 MustRegisterCmd("addmultisigaddress", (*AddMultisigAddressCmd)(nil), flags)520 MustRegisterCmd("addwitnessaddress", (*AddWitnessAddressCmd)(nil), flags)521 MustRegisterCmd("createmultisig", (*CreateMultisigCmd)(nil), flags)522 MustRegisterCmd("dropwallethistory", (*DropWalletHistoryCmd)(nil), flags)523 MustRegisterCmd("dumpprivkey", (*DumpPrivKeyCmd)(nil), flags)524 MustRegisterCmd("encryptwallet", (*EncryptWalletCmd)(nil), flags)525 MustRegisterCmd("estimatefee", (*EstimateFeeCmd)(nil), flags)526 MustRegisterCmd("estimatepriority", (*EstimatePriorityCmd)(nil), flags)527 MustRegisterCmd("getaccount", (*GetAccountCmd)(nil), flags)528 MustRegisterCmd("getaccountaddress", (*GetAccountAddressCmd)(nil), flags)529 MustRegisterCmd("getaddressesbyaccount", (*GetAddressesByAccountCmd)(nil), flags)530 MustRegisterCmd("getbalance", (*GetBalanceCmd)(nil), flags)531 MustRegisterCmd("getnewaddress", (*GetNewAddressCmd)(nil), flags)532 MustRegisterCmd("getrawchangeaddress", (*GetRawChangeAddressCmd)(nil), flags)533 MustRegisterCmd("getreceivedbyaccount", (*GetReceivedByAccountCmd)(nil), flags)534 MustRegisterCmd("getreceivedbyaddress", (*GetReceivedByAddressCmd)(nil), flags)535 MustRegisterCmd("gettransaction", (*GetTransactionCmd)(nil), flags)536 MustRegisterCmd("getwalletinfo", (*GetWalletInfoCmd)(nil), flags)537 MustRegisterCmd("importprivkey", (*ImportPrivKeyCmd)(nil), flags)538 MustRegisterCmd("keypoolrefill", (*KeyPoolRefillCmd)(nil), flags)539 MustRegisterCmd("listaccounts", (*ListAccountsCmd)(nil), flags)540 MustRegisterCmd("listaddressgroupings", (*ListAddressGroupingsCmd)(nil), flags)541 MustRegisterCmd("listlockunspent", (*ListLockUnspentCmd)(nil), flags)542 MustRegisterCmd("listreceivedbyaccount", (*ListReceivedByAccountCmd)(nil), flags)543 MustRegisterCmd("listreceivedbyaddress", (*ListReceivedByAddressCmd)(nil), flags)544 MustRegisterCmd("listsinceblock", (*ListSinceBlockCmd)(nil), flags)545 MustRegisterCmd("listtransactions", (*ListTransactionsCmd)(nil), flags)546 MustRegisterCmd("listunspent", (*ListUnspentCmd)(nil), flags)547 MustRegisterCmd("lockunspent", (*LockUnspentCmd)(nil), flags)548 MustRegisterCmd("move", (*MoveCmd)(nil), flags)549 MustRegisterCmd("sendfrom", (*SendFromCmd)(nil), flags)550 MustRegisterCmd("sendmany", (*SendManyCmd)(nil), flags)551 MustRegisterCmd("sendtoaddress", (*SendToAddressCmd)(nil), flags)552 MustRegisterCmd("setaccount", (*SetAccountCmd)(nil), flags)553 MustRegisterCmd("settxfee", (*SetTxFeeCmd)(nil), flags)554 MustRegisterCmd("signmessage", (*SignMessageCmd)(nil), flags)555 MustRegisterCmd("signrawtransaction", (*SignRawTransactionCmd)(nil), flags)556 MustRegisterCmd("walletlock", (*WalletLockCmd)(nil), flags)557 MustRegisterCmd("walletpassphrase", (*WalletPassphraseCmd)(nil), flags)558 MustRegisterCmd("walletpassphrasechange", (*WalletPassphraseChangeCmd)(nil), flags)559}...

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 out, err := cmd.Output()5 if err != nil {6 fmt.Println(err)7 }8 fmt.Println(string(out))9}10import (11func main() {12 cmd := exec.Command("ls", "-l")13 out, err := cmd.Output()14 if err != nil {15 fmt.Println(err)16 }17 fmt.Println(string(out))18}19import (20func main() {21 cmd := exec.Command("ls", "-l")22 out, err := cmd.Output()23 if err != nil {24 fmt.Println(err)25 }26 fmt.Println(string(out))27}28import (29func main() {30 cmd := exec.Command("ls", "-l")31 out, err := cmd.Output()32 if err != nil {33 fmt.Println(err)34 }35 fmt.Println(string(out))36}37import (38func main() {39 cmd := exec.Command("ls", "-l")40 out, err := cmd.Output()41 if err != nil {42 fmt.Println(err)43 }44 fmt.Println(string(out))45}46import (47func main() {48 cmd := exec.Command("ls", "-l")49 out, err := cmd.Output()50 if err != nil {51 fmt.Println(err)52 }53 fmt.Println(string(out))54}55import (56func main() {57 cmd := exec.Command("ls", "-l")58 out, err := cmd.Output()59 if err != nil {60 fmt.Println(err

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 stdout, err := cmd.StdoutPipe()5 if err != nil {6 fmt.Println(err)7 }8 if err := cmd.Start(); err != nil {9 fmt.Println(err)10 }11 buf := make([]byte, 1024)12 for {13 n, err := stdout.Read(buf)14 if err != nil {15 }16 fmt.Println(string(buf[:n]))17 }18}19import (20func main() {21 cmd := exec.Command("ls", "-l")22 out, err := cmd.Output()23 if err != nil {24 fmt.Println(err)25 }26 fmt.Println(string(out))27}28import (29func main() {30 cmd := exec.Command("ls", "-l")31 out, err := cmd.Output()32 if err != nil {33 fmt.Println(err)34 }35 fmt.Println(string(out))36}

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 err := cmd.Run()5 if err != nil {6 panic(err)7 }8}9import (10func main() {11 cmd := exec.Command("ls", "-l")12 out, err := cmd.Output()13 if err != nil {14 panic(err)15 }16 fmt.Println(string(out))17}18import (19func main() {20 cmd := exec.Command("ls", "-l")21 out, err := cmd.CombinedOutput()22 if err != nil {23 panic(err)24 }25 fmt.Println(string(out))26}27import (28func main() {29 cmd := exec.Command("wc", "-l")30 in, err := cmd.StdinPipe()31 if err != nil {32 panic(err)33 }34 err = cmd.Start()35 if err != nil {36 panic(err)37 }38 _, err = in.Write([]byte("hello39 if err != nil {40 panic(err)41 }42 err = in.Close()43 if err != nil {44 panic(err)45 }46 out, err := cmd.Output()47 if err != nil {48 panic(err)49 }50 fmt.Println(string(out))51}52import (53func main() {54 cmd := exec.Command("wc", "-l")55 in, err := cmd.StdinPipe()56 if err != nil {57 panic(err)58 }59 err = cmd.Start()60 if err != nil {61 panic(err)62 }63 _, err = in.Write([]byte("hello64 if err != nil {65 panic(err)66 }67 err = in.Close()68 if err != nil {69 panic(err)

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-la")4 stdout, err := cmd.StdoutPipe()5 if err != nil {6 fmt.Println(err)7 os.Exit(1)8 }9 if err := cmd.Start(); err != nil {10 fmt.Println(err)11 os.Exit(1)12 }13 buf := make([]byte, 1024)14 for {15 n, err := stdout.Read(buf)16 if err != nil {17 }18 fmt.Println(string(buf[:n]))19 }20}

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l")4 out, err := cmd.Output()5 if err != nil {6 fmt.Println(err)7 }8 fmt.Printf("The output is %s9}10import (11func main() {12 cmd := exec.Command("ls", "-l")13 err := cmd.Run()14 if err != nil {15 fmt.Println(err)16 }17}18import (19func main() {20 cmd := exec.Command("ls", "-l")21 err := cmd.Start()22 if err != nil {23 fmt.Println(err)24 }25}26import (27func main() {28 cmd := exec.Command("ls", "-l")29 out, err := cmd.CombinedOutput()30 if err != nil {31 fmt.Println(err)32 }33 fmt.Printf("The output is %s34}

Full Screen

Full Screen

must

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 cmd := exec.Command("ls", "-l", "-a")4 output, err := cmd.Output()5 if err != nil {6 fmt.Println("Error: ", err)7 }8 fmt.Println(string(output))9}

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run K6 automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful