Documentation ¶
Overview ¶
* Flow CLI * * Copyright 2019-2021 Dapper Labs, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BuildCommand = &command.Command{ Cmd: &cobra.Command{ Use: "build <code filename>", Short: "Build an unsigned transaction", Example: "flow transactions build ./transaction.cdc --proposer alice --authorizer alice --payer bob", Args: cobra.ExactArgs(1), }, Flags: &buildFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { globalFlags.Filter = "payload" build, err := services.Transactions.Build( buildFlags.Proposer, buildFlags.Authorizer, buildFlags.Payer, buildFlags.ProposerKeyIndex, args[0], buildFlags.Args, buildFlags.ArgsJSON, globalFlags.Network, ) if err != nil { return nil, err } return &TransactionResult{ tx: build.FlowTransaction(), }, nil }, }
var Cmd = &cobra.Command{ Use: "transactions", Short: "Utilities to send transactions", TraverseChildren: true, }
var GetCommand = &command.Command{ Cmd: &cobra.Command{ Use: "get <tx_id>", Aliases: []string{"status"}, Short: "Get the transaction by ID", Example: "flow transactions get 07a8...b433", Args: cobra.ExactArgs(1), }, Flags: &getFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { if cmd.CalledAs() == "status" { fmt.Println("⚠️ DEPRECATION WARNING: use \"flow transactions get\" instead") } tx, result, err := services.Transactions.GetStatus( args[0], getFlags.Sealed, ) if err != nil { return nil, err } return &TransactionResult{ result: result, tx: tx, code: getFlags.Code, }, nil }, }
var SendCommand = &command.Command{ Cmd: &cobra.Command{ Use: "send <code filename>", Short: "Send a transaction", Args: cobra.MaximumNArgs(1), Example: `flow transactions send tx.cdc --arg String:"Hello world"`, }, Flags: &sendFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { if sendFlags.Results { fmt.Println("⚠️ DEPRECATION WARNING: all transactions will provide results") } if sendFlags.Args != "" { fmt.Println("⚠️ DEPRECATION WARNING: use arg flag in Type:Value format or arg-json for JSON format") if len(sendFlags.Arg) == 0 && sendFlags.ArgsJSON == "" { sendFlags.ArgsJSON = sendFlags.Args } } filename := "" if len(args) == 1 { filename = args[0] } else if sendFlags.Code != "" { fmt.Println("⚠️ DEPRECATION WARNING: use filename as a command argument <filename>") filename = sendFlags.Code } tx, result, err := services.Transactions.Send( filename, sendFlags.Signer, sendFlags.Arg, sendFlags.ArgsJSON, globalFlags.Network, ) if err != nil { return nil, err } return &TransactionResult{ result: result, tx: tx, }, nil }, }
var SendSignedCommand = &command.Command{ Cmd: &cobra.Command{ Use: "send-signed <signed transaction filename>", Short: "Send signed transaction", Args: cobra.ExactArgs(1), Example: `flow transactions send-signed signed.rlp`, }, Flags: &sendSignedFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { tx, result, err := services.Transactions.SendSigned( args[0], ) if err != nil { return nil, err } return &TransactionResult{ result: result, tx: tx, }, nil }, }
var SignCommand = &command.Command{ Cmd: &cobra.Command{ Use: "sign <built transaction filename>", Short: "Sign built transaction", Example: "flow transactions sign ./built.rlp --signer alice", Args: cobra.ExactArgs(1), }, Flags: &signFlags, Run: func( cmd *cobra.Command, args []string, globalFlags command.GlobalFlags, services *services.Services, ) (command.Result, error) { signed, err := services.Transactions.Sign( args[0], signFlags.Signer, globalFlags.Yes, ) if err != nil { return nil, err } return &TransactionResult{ tx: signed.FlowTransaction(), }, nil }, }
Functions ¶
This section is empty.
Types ¶
type TransactionResult ¶
type TransactionResult struct {
// contains filtered or unexported fields
}
TransactionResult represent result from all account commands
func (*TransactionResult) JSON ¶
func (r *TransactionResult) JSON() interface{}
JSON convert result to JSON
func (*TransactionResult) Oneliner ¶
func (r *TransactionResult) Oneliner() string
Oneliner show result as one liner grep friendly
func (*TransactionResult) String ¶
func (r *TransactionResult) String() string
String convert result to string