github.com/onflow/flow-go@v0.35.7-crescendo-preview.23-atree-inlining/engine/access/rest/request/arguments.go (about) 1 package request 2 3 import ( 4 "fmt" 5 6 "github.com/onflow/flow-go/engine/access/rest/util" 7 ) 8 9 const maxArgumentsLength = 100 10 11 type Arguments [][]byte 12 13 func (a *Arguments) Parse(raw []string) error { 14 args := make([][]byte, 0) 15 for _, rawArg := range raw { 16 if rawArg == "" { // skip empty 17 continue 18 } 19 20 arg, err := util.FromBase64(rawArg) 21 if err != nil { 22 return fmt.Errorf("invalid argument encoding: %w", err) 23 } 24 args = append(args, arg) 25 } 26 27 if len(args) > maxArgumentsLength { 28 return fmt.Errorf("too many arguments. Maximum arguments allowed: %d", maxAllowedScriptArguments) 29 } 30 31 *a = args 32 return nil 33 } 34 35 func (a Arguments) Flow() [][]byte { 36 return a 37 }