func (t FlowScriptBuilder) RunReturnsInterface() interface{} {
	return CadenceValueToInterface(t.RunFailOnError())
}
RunReturnsInterface runs the script and returns interface{}
package gwtf
import (
	"fmt"
	"log"
	"os"
	"github.com/enescakir/emoji"
	"github.com/onflow/cadence"
	"github.com/onflow/flow-go-sdk"
)
type FlowScriptBuilder struct {
	GoWithTheFlow  *GoWithTheFlow
	FileName       string
	Arguments      []cadence.Value
	ScriptAsString string
}
func (f *GoWithTheFlow) Script(content string) FlowScriptBuilder {
	return FlowScriptBuilder{
		GoWithTheFlow:  f,
		FileName:       "inline",
		Arguments:      []cadence.Value{},
		ScriptAsString: content,
	}
}
func (f *GoWithTheFlow) ScriptFromFile(filename string) FlowScriptBuilder {
	return FlowScriptBuilder{
		GoWithTheFlow:  f,
		FileName:       filename,
		Arguments:      []cadence.Value{},
		ScriptAsString: "",
	}
}
func (t FlowScriptBuilder) AccountArgument(key string) FlowScriptBuilder {
	f := t.GoWithTheFlow
	account := f.Account(key)
	return t.Argument(cadence.BytesToAddress(account.Address().Bytes()))
}
func (t FlowScriptBuilder) RawAccountArgument(key string) FlowScriptBuilder {
	account := flow.HexToAddress(key)
	accountArg := cadence.BytesToAddress(account.Bytes())
	return t.Argument(accountArg)
}
func (t FlowScriptBuilder) DateStringAsUnixTimestamp(dateString string, timezone string) FlowScriptBuilder {
	return t.UFix64Argument(parseTime(dateString, timezone))
}
func (t FlowScriptBuilder) Argument(value cadence.Value) FlowScriptBuilder {
	t.Arguments = append(t.Arguments, value)
	return t
}
func (t FlowScriptBuilder) StringArgument(value string) FlowScriptBuilder {
	return t.Argument(cadence.String(value))
}
func (t FlowScriptBuilder) BooleanArgument(value bool) FlowScriptBuilder {
	return t.Argument(cadence.NewBool(value))
}
func (t FlowScriptBuilder) BytesArgument(value []byte) FlowScriptBuilder {
	return t.Argument(cadence.NewBytes(value))
}
func (t FlowScriptBuilder) IntArgument(value int) FlowScriptBuilder {
	return t.Argument(cadence.NewInt(value))
}
func (t FlowScriptBuilder) Int8Argument(value int8) FlowScriptBuilder {
	return t.Argument(cadence.NewInt8(value))
}
func (t FlowScriptBuilder) Int16Argument(value int16) FlowScriptBuilder {
	return t.Argument(cadence.NewInt16(value))
}
func (t FlowScriptBuilder) Int32Argument(value int32) FlowScriptBuilder {
	return t.Argument(cadence.NewInt32(value))
}
func (t FlowScriptBuilder) Int64Argument(value int64) FlowScriptBuilder {
	return t.Argument(cadence.NewInt64(value))
}
func (t FlowScriptBuilder) Int128Argument(value int) FlowScriptBuilder {
	return t.Argument(cadence.NewInt128(value))
}
func (t FlowScriptBuilder) Int256Argument(value int) FlowScriptBuilder {
	return t.Argument(cadence.NewInt256(value))
}
func (t FlowScriptBuilder) UIntArgument(value uint) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt(value))
}
func (t FlowScriptBuilder) UInt8Argument(value uint8) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt8(value))
}
func (t FlowScriptBuilder) UInt16Argument(value uint16) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt16(value))
}
func (t FlowScriptBuilder) UInt32Argument(value uint32) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt32(value))
}
func (t FlowScriptBuilder) UInt64Argument(value uint64) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt64(value))
}
func (t FlowScriptBuilder) UInt128Argument(value uint) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt128(value))
}
func (t FlowScriptBuilder) UInt256Argument(value uint) FlowScriptBuilder {
	return t.Argument(cadence.NewUInt256(value))
}
func (t FlowScriptBuilder) Word8Argument(value uint8) FlowScriptBuilder {
	return t.Argument(cadence.NewWord8(value))
}
func (t FlowScriptBuilder) Word16Argument(value uint16) FlowScriptBuilder {
	return t.Argument(cadence.NewWord16(value))
}
func (t FlowScriptBuilder) Word32Argument(value uint32) FlowScriptBuilder {
	return t.Argument(cadence.NewWord32(value))
}
func (t FlowScriptBuilder) Word64Argument(value uint64) FlowScriptBuilder {
	return t.Argument(cadence.NewWord64(value))
}
func (t FlowScriptBuilder) Fix64Argument(value string) FlowScriptBuilder {
	amount, err := cadence.NewFix64(value)
	if err != nil {
		panic(err)
	}
	return t.Argument(amount)
}
func (t FlowScriptBuilder) UFix64Argument(value string) FlowScriptBuilder {
	amount, err := cadence.NewUFix64(value)
	if err != nil {
		panic(err)
	}
	return t.Argument(amount)
}
func (t FlowScriptBuilder) Run() {
	result := t.RunFailOnError()
	log.Printf("%v Script run from result: %v\n", emoji.Star, CadenceValueToJsonString(result))
}
func (t FlowScriptBuilder) RunReturns() (cadence.Value, error) {
	f := t.GoWithTheFlow
	scriptFilePath := fmt.Sprintf("./scripts/%s.cdc", t.FileName)
	var err error
	script := []byte(t.ScriptAsString)
	if t.ScriptAsString == "" {
		script, err = f.State.ReaderWriter().ReadFile(scriptFilePath)
		if err != nil {
			return nil, err
		}
	}
	result, err := f.Services.Scripts.Execute(
		script,
		t.Arguments,
		scriptFilePath,
		f.Network)
	if err != nil {
		return nil, err
	}
	f.Logger.Info(fmt.Sprintf("%v Script run from path %s\n", emoji.Star, scriptFilePath))
	return result, nil
}
func (t FlowScriptBuilder) RunFailOnError() cadence.Value {
	result, err := t.RunReturns()
	if err != nil {
		t.GoWithTheFlow.Logger.Error(fmt.Sprintf("%v Error executing script: %s output %v", emoji.PileOfPoo, t.FileName, err))
		os.Exit(1)
	}
	return result
}
func (t FlowScriptBuilder) RunReturnsJsonString() string {
	return CadenceValueToJsonString(t.RunFailOnError())
}