gwtf

package
v2.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2020 License: MIT Imports: 19 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventsToWebhookParams

func EventsToWebhookParams(events []*FormatedEvent) *discordgo.WebhookParams

EventsToWebhookParams convert events to rich webhook

Types

type FlowScriptBuilder

type FlowScriptBuilder struct {
	GoWithTheFlow *GoWithTheFlow
	FileName      string
	Arguments     []cadence.Value
}

FlowScriptBuilder is a struct to hold information for running a script

func (FlowScriptBuilder) AccountArgument

func (t FlowScriptBuilder) AccountArgument(key string) FlowScriptBuilder

AccountArgument add an account as an argument

func (FlowScriptBuilder) Argument

Argument add an argument to the transaction

func (FlowScriptBuilder) Run

func (t FlowScriptBuilder) Run()

Run executes a read only script

func (FlowScriptBuilder) RunReturns

func (t FlowScriptBuilder) RunReturns() cadence.Value

RunReturns executes a read only script

func (FlowScriptBuilder) StringArgument

func (t FlowScriptBuilder) StringArgument(value string) FlowScriptBuilder

StringArgument add an argument to the transaction

func (FlowScriptBuilder) UFix64Argument

func (t FlowScriptBuilder) UFix64Argument(key string) FlowScriptBuilder

UFix64Argument add an account as an argument

type FlowTransactionBuilder

type FlowTransactionBuilder struct {
	GoWithTheFlow  *GoWithTheFlow
	FileName       string
	Arguments      []cadence.Value
	MainSigner     *GoWithTheFlowAccount
	PayloadSigners []*GoWithTheFlowAccount
}

FlowTransactionBuilder used to create a builder pattern for a transaction

func (FlowTransactionBuilder) AccountArgument

func (t FlowTransactionBuilder) AccountArgument(key string) FlowTransactionBuilder

AccountArgument add an account as an argument

func (FlowTransactionBuilder) Argument

Argument add an argument to the transaction

func (FlowTransactionBuilder) PayloadSigner

func (t FlowTransactionBuilder) PayloadSigner(value string) FlowTransactionBuilder

PayloadSigner set a signer for the payload

func (FlowTransactionBuilder) Run

func (t FlowTransactionBuilder) Run()

Run run the transaction

func (FlowTransactionBuilder) SignProposeAndPayAs

func (t FlowTransactionBuilder) SignProposeAndPayAs(signer string) FlowTransactionBuilder

SignProposeAndPayAs set the payer, proposer and envelope signer

func (FlowTransactionBuilder) StringArgument

func (t FlowTransactionBuilder) StringArgument(value string) FlowTransactionBuilder

StringArgument add an argument to the transaction

func (FlowTransactionBuilder) UFix64Argument

UFix64Argument add an account as an argument

type FormatedEvent

type FormatedEvent struct {
	Name        string            `json:"name"`
	BlockHeight uint64            `json:"blockHeight,omitempty"`
	Time        time.Time         `json:"time,omitempty"`
	Fields      map[string]string `json:"fields"`
}

FormatedEvent event in a more condensed formated form

func ParseEvent

func ParseEvent(ev flow.Event) (*FormatedEvent, error)

Not really happy with this code, would love something simpler ParseEvent parses a flow.Event into a more condensed form without type info for viewing

type GoWithTheFlow

type GoWithTheFlow struct {
	Service  GoWithTheFlowAccount
	Accounts map[string]GoWithTheFlowAccount
	Address  string
	Gas      uint64
}

GoWithTheFlow Entire configuration to work with Go With the Flow

func NewGoWithTheFlowDevNet

func NewGoWithTheFlowDevNet() *GoWithTheFlow

NewGoWithTheFlowDevNet setup devnot like in https://www.notion.so/Accessing-Flow-Devnet-ad35623797de48c08d8b88102ea38131

func NewGoWithTheFlowEmulator

func NewGoWithTheFlowEmulator() *GoWithTheFlow

NewGoWithTheFlowEmulator create a new client

func NewGoWithTheFlowError

func NewGoWithTheFlowError(fileName string) (*GoWithTheFlow, error)

NewGoWithTheFlowError creates a new local go with the flow client

func (*GoWithTheFlow) CreateAccount added in v2.0.3

func (f *GoWithTheFlow) CreateAccount(accountName string)

CreateAccount will create an account for running transactions without a contract

func (*GoWithTheFlow) DeployContract added in v2.0.3

func (f *GoWithTheFlow) DeployContract(contractName string)

DeployContract will deploy a contract with the given name to an account with the same name from wallet.json

func (*GoWithTheFlow) FetchEvents added in v2.0.3

func (f *GoWithTheFlow) FetchEvents(query client.EventRangeQuery) ([]*FormatedEvent, error)

FetchEvents fetches events for the given query and formats them

func (*GoWithTheFlow) FindAddress added in v2.0.3

func (f *GoWithTheFlow) FindAddress(key string) cadence.Address

FindAddress finds an candence.Address value from a given key in your wallet

func (*GoWithTheFlow) ScriptFromFile

func (f *GoWithTheFlow) ScriptFromFile(filename string) FlowScriptBuilder

ScriptFromFile will start a flow script builder

func (*GoWithTheFlow) TransactionFromFile

func (f *GoWithTheFlow) TransactionFromFile(filename string) FlowTransactionBuilder

TransactionFromFile will start a flow transaction builder

type GoWithTheFlowAccount added in v2.0.3

type GoWithTheFlowAccount struct {
	Address    flow.Address
	SigAlgo    crypto.SignatureAlgorithm
	HashAlgo   crypto.HashAlgorithm
	PrivateKey crypto.PrivateKey

	//These three are set the first time they are accessed
	Signer  *crypto.InMemorySigner
	Account *flow.Account
	Key     *flow.AccountKey
}

GoWithTheFlowAccount represents an account for flow with resolves types

func (*GoWithTheFlowAccount) EnrichWithAccountSignerAndKey added in v2.0.3

func (a *GoWithTheFlowAccount) EnrichWithAccountSignerAndKey(c *client.Client) (*GoWithTheFlowAccount, error)

EnrichWithAccountSignerAndKey enriches and Account

func (*GoWithTheFlowAccount) NewAccountKey added in v2.0.3

func (a *GoWithTheFlowAccount) NewAccountKey() *flow.AccountKey

NewAccountKey creates a NewFlowAccountKey

type RawAccount added in v2.0.3

type RawAccount struct {
	Address    string `json:"address"`
	PrivateKey string `json:"privateKey"`
	SigAlgo    string `json:"sigAlgorithm"`
	HashAlgo   string `json:"hashAlgorithm"`
}

RawAccount flow accounts struct for marshalling into primitive types

type RawFlowConfig added in v2.0.3

type RawFlowConfig struct {
	Address          string
	GasLimit         uint64
	Accounts         map[string]RawAccount
	EmulatorAccounts map[string]string
}

RawFlowConfig for marshalling into simple types

func NewRawFlowConfig added in v2.0.3

func NewRawFlowConfig(path string) (*RawFlowConfig, error)

NewRawFlowConfig will read the flow.json file

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL