Documentation ¶
Overview ¶
Overflow is a DSL to help interact with the flow blockchain using go
By bjartek aka Bjarte Karlsen
Example ¶
// in order to start overflow use the Overflow function // it can be customized with lots of OverflowOption Overflow()
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug
Index ¶
- func GetNetworkFromAddress(input string) string
- func IsValidAddressForNetwork(address, network string, codeWord *big.Int) bool
- type Argument
- type CadenceArguments
- type EmbedWrapper
- type EventAssertion
- type FeeBalance
- type FilterFunction
- type Import
- type MetadataViews_Display_Http
- type MetadataViews_Display_IPFS
- type MetadataViews_Edition
- type MetadataViews_Editions
- type MetadataViews_ExternalURL
- type MetadataViews_HTTPFile
- type MetadataViews_IPFSFile
- type MetadataViews_Media_HTTP
- type MetadataViews_Media_IPFS
- type MetadataViews_Rarity
- type MetadataViews_Serial
- type MetadataViews_Trait
- type MetadataViews_Traits
- type MetadtaViews_Licensce
- type OverflowArgument
- type OverflowArgumentList
- type OverflowArguments
- type OverflowAuthorizers
- type OverflowBuilder
- type OverflowClient
- type OverflowCodeWithSpec
- type OverflowDeclarationInfo
- type OverflowEmulatorLogMessage
- type OverflowEvent
- type OverflowEventFilter
- type OverflowEventList
- type OverflowEvents
- func (overflowEvents OverflowEvents) FilterEvents(ignoreFields OverflowEventFilter) OverflowEvents
- func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) (OverflowEvents, FeeBalance)
- func (overflowEvents OverflowEvents) FilterTempWithdrawDeposit() OverflowEvents
- func (me OverflowEvents) GetStakeholders(stakeholders map[string][]string) map[string][]string
- func (overflowEvents OverflowEvents) Print(t *testing.T)
- type OverflowInteractionBuilder
- type OverflowInteractionOption
- func WithAddresses(name string, value ...string) OverflowInteractionOption
- func WithArg(name string, value interface{}) OverflowInteractionOption
- func WithArgDateTime(name string, dateString string, timezone string) OverflowInteractionOption
- func WithArgs(args ...interface{}) OverflowInteractionOption
- func WithArgsMap(args map[string]interface{}) OverflowInteractionOption
- func WithAssertEvent(t *testing.T, suffix string, fields map[string]interface{}) OverflowInteractionOption
- func WithAssertEventReplaceField(suffix string, field string, value interface{}) OverflowInteractionOption
- func WithAssertFailure(t *testing.T, message string) OverflowInteractionOption
- func WithAuthorizer(signer ...string) OverflowInteractionOption
- func WithContext(ctx context.Context) OverflowInteractionOption
- func WithEventAssertions(t *testing.T, ea ...EventAssertion) OverflowInteractionOption
- func WithEventsFilter(filter OverflowEventFilter) OverflowInteractionOption
- func WithExecuteScriptAtBlockHeight(height uint64) OverflowInteractionOption
- func WithExecuteScriptAtBlockIdHex(blockId string) OverflowInteractionOption
- func WithExecuteScriptAtBlockIdentifier(blockId flow.Identifier) OverflowInteractionOption
- func WithManualAuthorizer(signer ...*accounts.Account) OverflowInteractionOption
- func WithManualPayloadSigner(signer ...*accounts.Account) OverflowInteractionOption
- func WithManualProposer(account *accounts.Account) OverflowInteractionOption
- func WithManualSigner(account *accounts.Account) OverflowInteractionOption
- func WithMaxGas(gas uint64) OverflowInteractionOption
- func WithName(name string) OverflowInteractionOption
- func WithPanicInteractionOnError(stop bool) OverflowInteractionOption
- func WithPayloadSigner(signer ...string) OverflowInteractionOption
- func WithPrintOptions(opts ...OverflowPrinterOption) OverflowInteractionOption
- func WithProposer(proposer string) OverflowInteractionOption
- func WithProposerServiceAccount() OverflowInteractionOption
- func WithRequireEvent(t *testing.T, suffix string, fields map[string]interface{}) OverflowInteractionOption
- func WithRequireFailure(t *testing.T, message string) OverflowInteractionOption
- func WithSigner(signer string) OverflowInteractionOption
- func WithSignerServiceAccount() OverflowInteractionOption
- func WithStructArgCustomResolver(name string, resolver underflow.InputResolver, value interface{}) OverflowInteractionOption
- func WithStructArgsCustomQualifier(name string, resolver underflow.InputResolver, values ...interface{}) OverflowInteractionOption
- func WithoutGlobalEventFilter() OverflowInteractionOption
- func WithoutLog() OverflowInteractionOption
- type OverflowMeter
- type OverflowMeteredComputationIntensities
- type OverflowMeteredMemoryIntensities
- type OverflowOption
- func WithBasePath(path string) OverflowOption
- func WithCoverageReport() OverflowOption
- func WithEmbedFS(fs embed.FS) OverflowOption
- func WithEmptyDepositWithdrawEvents() OverflowOption
- func WithEmulatorOption(opt ...emulator.Option) OverflowOption
- func WithExistingEmulator() OverflowOption
- func WithFeesEvents() OverflowOption
- func WithFlowConfig(files ...string) OverflowOption
- func WithFlowForNewUsers(amount float64) OverflowOption
- func WithGas(gas int) OverflowOption
- func WithGlobalEventFilter(filter OverflowEventFilter) OverflowOption
- func WithGlobalPrintOptions(opts ...OverflowPrinterOption) OverflowOption
- func WithGrpcDialOption(opt ...grpc.DialOption) OverflowOption
- func WithInputResolver(ir underflow.InputResolver) OverflowOption
- func WithLogFull() OverflowOption
- func WithLogInfo() OverflowOption
- func WithLogNone() OverflowOption
- func WithNetwork(network string) OverflowOption
- func WithNetworkHost(host string) OverflowOption
- func WithNoPrefixToAccountNames() OverflowOption
- func WithPanicOnError() OverflowOption
- func WithPrintResults(opts ...OverflowPrinterOption) OverflowOption
- func WithReturnErrors() OverflowOption
- func WithScriptFolderName(name string) OverflowOption
- func WithServiceAccountSuffix(suffix string) OverflowOption
- func WithTransactionFolderName(name string) OverflowOption
- func WithUnderflowOptions(opt underflow.Options) OverflowOption
- func WithoutTransactionFees() OverflowOption
- type OverflowPrinterBuilder
- type OverflowPrinterOption
- func WithArguments() OverflowPrinterOption
- func WithEmulatorLog() OverflowPrinterOption
- func WithEventFilter(filter OverflowEventFilter) OverflowPrinterOption
- func WithFullMeter() OverflowPrinterOption
- func WithMeter() OverflowPrinterOption
- func WithTransactionUrl() OverflowPrinterOption
- func WithoutEvents() OverflowPrinterOption
- func WithoutId() OverflowPrinterOption
- func WithoutMeter(value int) OverflowPrinterOption
- type OverflowResult
- func (o OverflowResult) AssertComputationLessThenOrEqual(t *testing.T, computation int) OverflowResult
- func (o OverflowResult) AssertComputationUsed(t *testing.T, computation int) OverflowResult
- func (o OverflowResult) AssertDebugLog(t *testing.T, message ...string) OverflowResult
- func (o OverflowResult) AssertEmitEventName(t *testing.T, event ...string) OverflowResult
- func (o OverflowResult) AssertEmulatorLog(t *testing.T, message string) OverflowResult
- func (o OverflowResult) AssertEvent(t *testing.T, name string, fields map[string]interface{}) OverflowResult
- func (o OverflowResult) AssertEventCount(t *testing.T, number int) OverflowResult
- func (o OverflowResult) AssertFailure(t *testing.T, msg string) OverflowResult
- func (o OverflowResult) AssertNoEvents(t *testing.T) OverflowResult
- func (o OverflowResult) AssertSuccess(t *testing.T) OverflowResult
- func (o OverflowResult) GetByteArrayFromEvent(eventName string, fieldName string) ([]byte, error)
- func (o OverflowResult) GetEventsWithName(eventName string) []OverflowEvent
- func (o OverflowResult) GetIdFromEvent(eventName string, fieldName string) (uint64, error)
- func (o OverflowResult) GetIdsFromEvent(eventName string, fieldName string) []uint64
- func (o OverflowResult) MarshalEventsWithName(eventName string, result interface{}) error
- func (o OverflowResult) Print(opbs ...OverflowPrinterOption) OverflowResult
- func (o OverflowResult) PrintArguments(t *testing.T)
- func (o OverflowResult) RequireEvent(t *testing.T, name string, fields map[string]interface{}) OverflowResult
- func (o OverflowResult) RequireFailure(t *testing.T, msg string) OverflowResult
- func (o OverflowResult) RequireSuccess(t *testing.T) OverflowResult
- type OverflowScriptFunction
- type OverflowScriptOptsFunction
- type OverflowScriptResult
- func (osr *OverflowScriptResult) AssertLengthWithPointer(t *testing.T, pointer string, length int) *OverflowScriptResult
- func (osr *OverflowScriptResult) AssertWant(t *testing.T, want autogold.Value) *OverflowScriptResult
- func (osr *OverflowScriptResult) AssertWithPointer(t *testing.T, pointer string, value interface{}) *OverflowScriptResult
- func (osr *OverflowScriptResult) AssertWithPointerError(t *testing.T, pointer string, message string) *OverflowScriptResult
- func (osr *OverflowScriptResult) AssertWithPointerWant(t *testing.T, pointer string, want autogold.Value) *OverflowScriptResult
- func (osr *OverflowScriptResult) GetAsInterface() (interface{}, error)
- func (osr *OverflowScriptResult) GetAsJson() (string, error)
- func (osr *OverflowScriptResult) GetWithPointer(pointer string) (interface{}, error)
- func (osr *OverflowScriptResult) MarshalAs(marshalTo interface{}) error
- func (osr *OverflowScriptResult) MarshalPointerAs(pointer string, marshalTo interface{}) error
- func (osr *OverflowScriptResult) Print() *OverflowScriptResult
- func (osr *OverflowScriptResult) PrintArguments(t *testing.T)
- type OverflowSolution
- type OverflowSolutionMerged
- type OverflowSolutionMergedNetwork
- type OverflowSolutionNetwork
- type OverflowState
- func (o *OverflowState) Account(key string) *accounts.Account
- func (o *OverflowState) AccountE(key string) (*accounts.Account, error)
- func (o *OverflowState) AccountPublicKey(name string) (string, error)
- func (o *OverflowState) AddContract(ctx context.Context, name string, code []byte, args []cadence.Value, ...) error
- func (o *OverflowState) Address(key string) string
- func (o *OverflowState) BuildInteraction(filename string, interactionType string, opts ...OverflowInteractionOption) *OverflowInteractionBuilder
- func (o *OverflowState) CreateAccountsE(ctx context.Context) (*OverflowState, error)
- func (o *OverflowState) CreateOverflowTransaction(blockId string, transactionResult flow.TransactionResult, ...) (*OverflowTransaction, error)
- func (o *OverflowState) CreateTestAccounts(ctx context.Context, num int, flowTokens float64) (map[string]*accounts.Account, error)
- func (o *OverflowState) DownloadAndUploadFile(url string, accountName string) error
- func (o *OverflowState) DownloadImageAndUploadAsDataUrl(url, accountName string) error
- func (o *OverflowState) FillUpStorage(accountName string) *OverflowState
- func (o *OverflowState) FlixScript(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult
- func (o *OverflowState) FlixScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction
- func (o *OverflowState) FlixScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction
- func (o *OverflowState) FlixTx(filename string, opts ...OverflowInteractionOption) *OverflowResult
- func (o *OverflowState) FlixTxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction
- func (o *OverflowState) FlixTxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction
- func (o *OverflowState) FlowAddress(key string) flow.Address
- func (o *OverflowState) FlowAddressE(key string) (*flow.Address, error)
- func (o *OverflowState) GenerateStub(network, filePath string, standalone bool) (string, error)
- func (o *OverflowState) GetAccount(ctx context.Context, key string) (*flow.Account, error)
- func (o *OverflowState) GetBlockAtHeight(ctx context.Context, height uint64) (*flow.Block, error)
- func (o *OverflowState) GetBlockById(ctx context.Context, blockId string) (*flow.Block, error)
- func (o *OverflowState) GetCoverageReport() *runtime.CoverageReport
- func (o *OverflowState) GetFreeCapacity(accountName string) int
- func (o *OverflowState) GetLatestBlock(ctx context.Context) (*flow.Block, error)
- func (o *OverflowState) GetNetwork() string
- func (o *OverflowState) GetOverflowTransactionById(ctx context.Context, id flow.Identifier) (*OverflowTransaction, error)
- func (o *OverflowState) GetTransactionById(ctx context.Context, id flow.Identifier) (*flow.Transaction, error)
- func (o *OverflowState) GetTransactionsByBlockId(ctx context.Context, id flow.Identifier) ([]*flow.Transaction, []*flow.TransactionResult, error)
- func (o *OverflowState) InitializeContracts(ctx context.Context) *OverflowState
- func (o *OverflowState) MintFlowTokens(accountName string, amount float64) *OverflowState
- func (o *OverflowState) Parse(codeFileName string, code []byte, network config.Network) (string, error)
- func (o *OverflowState) ParseAll() (*OverflowSolution, error)
- func (o *OverflowState) ParseAllWithConfig(skipContracts bool, txSkip []string, scriptSkip []string) (*OverflowSolution, error)
- func (o *OverflowState) ParseEvents(events []flow.Event) (OverflowEvents, OverflowEvent)
- func (o *OverflowState) ParseEventsWithIdPrefix(events []flow.Event, idPrefix string) (OverflowEvents, OverflowEvent)
- func (o *OverflowState) QualifiedIdentifier(contract string, name string) (string, error)
- func (o *OverflowState) QualifiedIdentifierFromSnakeCase(typeName string) (string, error)
- func (o *OverflowState) RollbackToBlockHeight(height uint64) error
- func (o *OverflowState) Script(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult
- func (o *OverflowState) ScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction
- func (o *OverflowState) ScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction
- func (o *OverflowState) ServiceAccountName() string
- func (o *OverflowState) SignUserMessage(account string, message string) (string, error)
- func (o *OverflowState) Tx(filename string, opts ...OverflowInteractionOption) *OverflowResult
- func (o *OverflowState) TxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction
- func (o *OverflowState) TxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction
- func (o *OverflowState) UploadFile(filename string, accountName string) error
- func (o *OverflowState) UploadImageAsDataUrl(filename string, accountName string) error
- func (o *OverflowState) UploadString(content string, accountName string) error
- type OverflowTest
- type OverflowTestingAsssertions
- type OverflowTransaction
- type OverflowTransactionFunction
- type OverflowTransactionOptsFunction
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetNetworkFromAddress ¶
Types ¶
type CadenceArguments ¶
type EmbedWrapper ¶
type EventAssertion ¶
type FeeBalance ¶
type FilterFunction ¶
type FilterFunction func(OverflowTransaction) bool
type MetadataViews_Display_Http ¶
type MetadataViews_Display_Http struct { Name string Description string Thumbnail MetadataViews_HTTPFile }
type MetadataViews_Display_IPFS ¶
type MetadataViews_Display_IPFS struct { Thumbnail MetadataViews_IPFSFile Name string Description string }
type MetadataViews_Edition ¶
type MetadataViews_Editions ¶
type MetadataViews_Editions struct {
Editions []MetadataViews_Edition `cadence:"infoList"`
}
type MetadataViews_ExternalURL ¶
type MetadataViews_ExternalURL struct {
Url string
}
type MetadataViews_HTTPFile ¶
type MetadataViews_HTTPFile struct {
Url string
}
type MetadataViews_IPFSFile ¶
type MetadataViews_Media_HTTP ¶
type MetadataViews_Media_HTTP struct { File MetadataViews_HTTPFile MediaType string `cadence:"mediaType"` }
type MetadataViews_Media_IPFS ¶
type MetadataViews_Media_IPFS struct { File MetadataViews_IPFSFile MediaType string `cadence:"mediaType"` }
type MetadataViews_Rarity ¶
type MetadataViews_Serial ¶
type MetadataViews_Serial struct {
Number uint64
}
type MetadataViews_Trait ¶
type MetadataViews_Trait struct { Value interface{} Rarity *MetadataViews_Rarity Name string DisplayType string `cadence:"displayType"` }
type MetadataViews_Traits ¶
type MetadataViews_Traits struct {
Traits []MetadataViews_Trait
}
type MetadtaViews_Licensce ¶
type MetadtaViews_Licensce struct {
Spdx string `cadence:"spdxIdentifier"`
}
type OverflowArgument ¶
type OverflowArgumentList ¶
type OverflowArgumentList []OverflowArgument
func ExtractArguments ¶
func ExtractArguments(fileName string, code []byte, inputArgs map[string]interface{}) (OverflowArgumentList, error)
type OverflowArguments ¶
type OverflowArguments map[string]OverflowArgument
type OverflowAuthorizers ¶
type OverflowAuthorizers [][]string
type OverflowBuilder ¶
type OverflowBuilder struct { Ctx context.Context ReaderWriter flowkit.ReaderWriter Coverage *runtime.CoverageReport InputResolver *underflow.InputResolver PrintOptions *[]OverflowPrinterOption GlobalEventFilter OverflowEventFilter Path string NetworkHost string Network string ScriptFolderName string ServiceSuffix string TransactionFolderName string EmulatorOptions []emulator.Option GrpcDialOptions []grpc.DialOption ConfigFiles []string NewAccountFlowAmount float64 GasLimit int LogLevel int UnderflowOptions underflow.Options DeployContracts bool InMemory bool InitializeAccounts bool StopOnError bool TransactionFees bool FilterOutEmptyWithDrawDepositEvents bool FilterOutFeeEvents bool PrependNetworkName bool }
OverflowBuilder is the struct used to gather up configuration when building an overflow instance
func (*OverflowBuilder) StartE ¶
func (o *OverflowBuilder) StartE() (*OverflowState, error)
func (*OverflowBuilder) StartResult ¶
func (o *OverflowBuilder) StartResult() *OverflowState
StartE will start Overflow and return State and error if any
type OverflowClient ¶
type OverflowClient interface { ScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction ScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction Script(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult QualifiedIdentifierFromSnakeCase(typeName string) (string, error) QualifiedIdentifier(contract string, name string) (string, error) AddContract(ctx context.Context, name string, code []byte, args []cadence.Value, filename string, update bool) error GetNetwork() string AccountE(key string) (*accounts.Account, error) Address(key string) string Account(key string) *accounts.Account AccountPublicKey(name string) (string, error) // Note that this returns a flow account and not a flowkit account like the others, is this needed? GetAccount(ctx context.Context, key string) (*flow.Account, error) Tx(filename string, opts ...OverflowInteractionOption) *OverflowResult TxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction TxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction GetLatestBlock(ctx context.Context) (*flow.Block, error) GetBlockAtHeight(ctx context.Context, height uint64) (*flow.Block, error) GetBlockById(ctx context.Context, blockId string) (*flow.Block, error) UploadFile(filename string, accountName string) error DownloadAndUploadFile(url string, accountName string) error DownloadImageAndUploadAsDataUrl(url, accountName string) error UploadImageAsDataUrl(filename string, accountName string) error UploadString(content string, accountName string) error GetFreeCapacity(accountName string) int MintFlowTokens(accountName string, amount float64) *OverflowState FillUpStorage(accountName string) *OverflowState SignUserMessage(account string, message string) (string, error) GetTransactionById(ctx context.Context, id flow.Identifier) (*flow.Transaction, error) FlixTx(filename string, opts ...OverflowInteractionOption) *OverflowResult FlixTxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction FlixTxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction FlixScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction FlixScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction FlixScript(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult GetOverflowTransactionById(ctx context.Context, id flow.Identifier) (*OverflowTransaction, error) // NB! This will contain system chunk transactions on mainnet/testnet GetTransactionsByBlockId(ctx context.Context, id flow.Identifier) ([]*flow.Transaction, []*flow.TransactionResult, error) // parse flow events into overflow events, the last argument is the fee event, the id prefix is there for system chunk events since the id it generates must be unique ParseEvents(events []flow.Event) (OverflowEvents, OverflowEvent) // this method can be used to parse events emitted from system chunk transactions with a prefix ParseEventsWithIdPrefix(events []flow.Event, idPrefix string) (OverflowEvents, OverflowEvent) // use this method to transform a flow transactionResult and transaction into a overflow transaction CreateOverflowTransaction(blockId string, transactionResult flow.TransactionResult, transaction flow.Transaction, txIndex int) (*OverflowTransaction, error) CreateTestAccounts(ctx context.Context, num int, flowTokens float64) (map[string]*accounts.Account, error) }
Overflow client is an interface with the most used v1 api methods for overflow
type OverflowCodeWithSpec ¶
type OverflowCodeWithSpec struct { Spec *OverflowDeclarationInfo `json:"spec"` Code string `json:"code"` }
representing code with specification if parameters
type OverflowDeclarationInfo ¶
type OverflowDeclarationInfo struct { Parameters map[string]string `json:"parameters"` Authorizers OverflowAuthorizers `json:"-"` ParameterOrder []string `json:"order"` }
a type containing information about parameter types and orders
type OverflowEmulatorLogMessage ¶
type OverflowEmulatorLogMessage struct { Fields map[string]interface{} Level string Msg string ComputationUsed int }
OverflowEmulatorLogMessage a log message from the logrus implementation used in the flow emulator
func (OverflowEmulatorLogMessage) String ¶
func (me OverflowEmulatorLogMessage) String() string
type OverflowEvent ¶
type OverflowEvent struct { Fields map[string]interface{} `json:"fields"` Addresses map[string][]string `json:"addresses"` Id string `json:"id"` TransactionId string `json:"transactionID"` Name string `json:"name"` RawEvent cadence.Event `json:"rawEvent"` EventIndex uint32 `json:"eventIndex"` }
func (OverflowEvent) ExistIn ¶
func (o OverflowEvent) ExistIn(events []OverflowEvent) bool
Check if an event exist in the other events
func (OverflowEvent) GetStakeholders ¶
func (me OverflowEvent) GetStakeholders() map[string][]string
list of address to a list of roles for that address
func (OverflowEvent) MarshalAs ¶
func (e OverflowEvent) MarshalAs(marshalTo interface{}) error
type OverflowEventFilter ¶
Event parsing
a type alias to an OverflowEventFilter to filter out all events with a given suffix and the fields with given suffixes
type OverflowEventList ¶
type OverflowEventList []OverflowEvent
func (OverflowEventList) MarshalAs ¶
func (e OverflowEventList) MarshalAs(marshalTo interface{}) error
type OverflowEvents ¶
type OverflowEvents map[string]OverflowEventList
a type holding all events that are emitted from a Transaction
func (OverflowEvents) FilterEvents ¶
func (overflowEvents OverflowEvents) FilterEvents(ignoreFields OverflowEventFilter) OverflowEvents
Filter out events given the sent in filter
func (OverflowEvents) FilterFees ¶
func (overflowEvents OverflowEvents) FilterFees(fee float64, payer string) (OverflowEvents, FeeBalance)
Filtter out fee events
func (OverflowEvents) FilterTempWithdrawDeposit ¶
func (overflowEvents OverflowEvents) FilterTempWithdrawDeposit() OverflowEvents
func (OverflowEvents) GetStakeholders ¶
func (me OverflowEvents) GetStakeholders(stakeholders map[string][]string) map[string][]string
func (OverflowEvents) Print ¶
func (overflowEvents OverflowEvents) Print(t *testing.T)
type OverflowInteractionBuilder ¶
type OverflowInteractionBuilder struct { Ctx context.Context // the name of the integration, for inline variants Name string // force that this interaction will not print log, even if overflow state has specified it NoLog bool // The underlying state of overflow used to fetch some global settings Overflow *OverflowState // The file name of the interaction FileName string // The content of the interaction Content string // The list of raw arguments Arguments []cadence.Value NamedCadenceArguments CadenceArguments // The main signer used to sign the transaction // Payer: the account paying for the transaction fees. Payer *accounts.Account // The propser account // Proposer: the account that specifies a proposal key. Proposer *accounts.Account // The payload signers that will sign the payload // Authorizers: zero or more accounts authorizing the transaction to mutate their state. PayloadSigners []*accounts.Account // The gas limit to set for this given interaction GasLimit uint64 // The basepath on where to look for interactions BasePath string // An error object to store errors that arrive as you configure an interaction Error error // The code of the tranasction in bytes TransactionCode []byte // The named arguments NamedArgs map[string]interface{} // Event filters to apply to the interaction EventFilter OverflowEventFilter // Whether to ignore global event filters from OverflowState or not IgnoreGlobalEventFilters bool // Options to use when printing results PrintOptions *[]OverflowPrinterOption // Query to use for running scripts ScriptQuery *flowkit.ScriptQuery // StopOnError *bool Testing OverflowTestingAsssertions }
OverflowInteractionBuilder used to create a builder pattern for an interaction
func (OverflowInteractionBuilder) Send ¶
func (oib OverflowInteractionBuilder) Send() *OverflowResult
Send a interaction builder as a Transaction returning an overflow result
type OverflowInteractionOption ¶
type OverflowInteractionOption func(*OverflowInteractionBuilder)
A function to customize the transaction builder
func WithAddresses ¶
func WithAddresses(name string, value ...string) OverflowInteractionOption
Send in an array of addresses as an argument
func WithArg ¶
func WithArg(name string, value interface{}) OverflowInteractionOption
Send an argument into a transaction
The value is treated in the given way depending on type - cadence.Value is sent as straight argument - string argument are resolved into cadence.Value using flowkit - ofther values are converted to string with %v and resolved into cadence.Value using flowkit - if the type of the parameter is Address and the string you send in is a valid account in flow.json it will resolve
func WithArgDateTime ¶
func WithArgDateTime(name string, dateString string, timezone string) OverflowInteractionOption
sending in a timestamp as an arg is quite complicated, use this method with the name of the arg, the datestring and the given timezone to parse it at
func WithArgs ¶
func WithArgs(args ...interface{}) OverflowInteractionOption
set a list of args as key, value in an interaction, see Arg for options you can pass in
func WithArgsMap ¶
func WithArgsMap(args map[string]interface{}) OverflowInteractionOption
set arguments to the interaction from a map. See Arg for options on what you can pass in
func WithAssertEvent ¶
func WithAssertEvent(t *testing.T, suffix string, fields map[string]interface{}) OverflowInteractionOption
func WithAssertEventReplaceField ¶
func WithAssertEventReplaceField(suffix string, field string, value interface{}) OverflowInteractionOption
a helper to modify an event assertion if you have a sigle one and you want to change the value
func WithAssertFailure ¶
func WithAssertFailure(t *testing.T, message string) OverflowInteractionOption
func WithAuthorizer ¶
func WithAuthorizer(signer ...string) OverflowInteractionOption
func WithContext ¶
func WithContext(ctx context.Context) OverflowInteractionOption
func WithEventAssertions ¶
func WithEventAssertions(t *testing.T, ea ...EventAssertion) OverflowInteractionOption
func WithEventsFilter ¶
func WithEventsFilter(filter OverflowEventFilter) OverflowInteractionOption
set a filter for events
func WithExecuteScriptAtBlockHeight ¶
func WithExecuteScriptAtBlockHeight(height uint64) OverflowInteractionOption
set what block height to execute a script at! NB! if very old will not work on normal AN
func WithExecuteScriptAtBlockIdHex ¶
func WithExecuteScriptAtBlockIdHex(blockId string) OverflowInteractionOption
set what block height to execute a script at! NB! if very old will not work on normal AN
func WithExecuteScriptAtBlockIdentifier ¶
func WithExecuteScriptAtBlockIdentifier(blockId flow.Identifier) OverflowInteractionOption
set what block height to execute a script at! NB! if very old will not work on normal AN
func WithManualAuthorizer ¶
func WithManualAuthorizer(signer ...*accounts.Account) OverflowInteractionOption
alias for adding manual payload signers
func WithManualPayloadSigner ¶
func WithManualPayloadSigner(signer ...*accounts.Account) OverflowInteractionOption
set an aditional authorizer that will sign the payload
func WithManualProposer ¶
func WithManualProposer(account *accounts.Account) OverflowInteractionOption
set payer, proposer authorizer as the signer
func WithManualSigner ¶
func WithManualSigner(account *accounts.Account) OverflowInteractionOption
set payer, proposer authorizer as the signer
func WithName ¶
func WithName(name string) OverflowInteractionOption
set the name of this interaction, for inline interactions this will be the entire name for file interactions they will be combined
func WithPanicInteractionOnError ¶
func WithPanicInteractionOnError(stop bool) OverflowInteractionOption
func WithPayloadSigner ¶
func WithPayloadSigner(signer ...string) OverflowInteractionOption
set an aditional authorizer that will sign the payload
func WithPrintOptions ¶
func WithPrintOptions(opts ...OverflowPrinterOption) OverflowInteractionOption
print interactions using the following options
func WithProposerServiceAccount ¶
func WithProposerServiceAccount() OverflowInteractionOption
set the propser to be the service account
func WithRequireEvent ¶
func WithRequireEvent(t *testing.T, suffix string, fields map[string]interface{}) OverflowInteractionOption
func WithRequireFailure ¶
func WithRequireFailure(t *testing.T, message string) OverflowInteractionOption
func WithSigner ¶
func WithSigner(signer string) OverflowInteractionOption
set payer, proposer authorizer as the signer
func WithSignerServiceAccount ¶
func WithSignerServiceAccount() OverflowInteractionOption
set service account as payer, proposer, authorizer
func WithStructArgCustomResolver ¶
func WithStructArgCustomResolver(name string, resolver underflow.InputResolver, value interface{}) OverflowInteractionOption
use the `cadence` struct tag to name a field or it will be given the lowercase name of the field
func WithStructArgsCustomQualifier ¶
func WithStructArgsCustomQualifier(name string, resolver underflow.InputResolver, values ...interface{}) OverflowInteractionOption
use the `cadence` struct tag to name a field or it will be given the lowercase name of the field
func WithoutGlobalEventFilter ¶
func WithoutGlobalEventFilter() OverflowInteractionOption
ignore global events filters defined on OverflowState
func WithoutLog ¶
func WithoutLog() OverflowInteractionOption
force no printing for this interaction
type OverflowMeter ¶
type OverflowMeter struct { ComputationIntensities OverflowMeteredComputationIntensities `json:"computationIntensities"` MemoryIntensities OverflowMeteredMemoryIntensities `json:"memoryIntensities"` LedgerInteractionUsed int `json:"ledgerInteractionUsed"` ComputationUsed int `json:"computationUsed"` MemoryUsed int `json:"memoryUsed"` }
a type representing a meter that contains information about the inner workings of an interaction, only available on local emulator
func (OverflowMeter) FunctionInvocations ¶
func (m OverflowMeter) FunctionInvocations() int
get the number of functions invocations
func (OverflowMeter) Statements ¶
func (m OverflowMeter) Statements() int
get the number of statements
type OverflowMeteredComputationIntensities ¶
type OverflowMeteredComputationIntensities map[common.ComputationKind]uint
type collecting computatationIntensities
type OverflowMeteredMemoryIntensities ¶
type OverflowMeteredMemoryIntensities map[common.MemoryKind]uint
type collecting memoryIntensities
type OverflowOption ¶
type OverflowOption func(*OverflowBuilder)
OverflowOption and option function that you can send in to configure Overflow
func WithBasePath ¶
func WithBasePath(path string) OverflowOption
WithBasePath will change the standard basepath `.` to another folder
func WithCoverageReport ¶
func WithCoverageReport() OverflowOption
func WithEmbedFS ¶
func WithEmbedFS(fs embed.FS) OverflowOption
func WithEmptyDepositWithdrawEvents ¶
func WithEmptyDepositWithdrawEvents() OverflowOption
filter out empty deposit and withdraw events
func WithEmulatorOption ¶
func WithEmulatorOption(opt ...emulator.Option) OverflowOption
func WithExistingEmulator ¶
func WithExistingEmulator() OverflowOption
WithExistingEmulator will attach to an existing emulator, not deploying contracts and creating accounts
func WithFeesEvents ¶
func WithFeesEvents() OverflowOption
WithTransactionFolderName will overwite the default script subdir for transactions `transactions`
func WithFlowConfig ¶
func WithFlowConfig(files ...string) OverflowOption
WithFlowConfig will set the path to one or more flow.json config files The default is ~/flow.json and ./flow.json.
func WithFlowForNewUsers ¶
func WithFlowForNewUsers(amount float64) OverflowOption
Set the amount of flow for new account, default is 0.001
func WithGas ¶
func WithGas(gas int) OverflowOption
WithGas set the default gas limit, standard is 9999 (max)
func WithGlobalEventFilter ¶
func WithGlobalEventFilter(filter OverflowEventFilter) OverflowOption
set global filters to events
func WithGlobalPrintOptions ¶
func WithGlobalPrintOptions(opts ...OverflowPrinterOption) OverflowOption
automatically print interactions using the following options
func WithGrpcDialOption ¶
func WithGrpcDialOption(opt ...grpc.DialOption) OverflowOption
func WithInputResolver ¶
func WithInputResolver(ir underflow.InputResolver) OverflowOption
func WithLogFull ¶
func WithLogFull() OverflowOption
func WithLogInfo ¶
func WithLogInfo() OverflowOption
func WithLogNone ¶
func WithLogNone() OverflowOption
WithNoLog will not log anything from results or flowkit logger
func WithNetwork ¶
func WithNetwork(network string) OverflowOption
WithNetwork will start overflow with the given network. This function will also set up other options that are common for a given Network. embedded: starts in memory, will deploy contracts and create accounts, will panic on errors and show terse output testing: as embedeed, but will not stop on errors and turn off all logs emulator: will connect to running local emulator, deploy contracts and create account testnet|mainnet: will only set network, not deploy contracts or create accounts
func WithNetworkHost ¶
func WithNetworkHost(host string) OverflowOption
Set custom network host if different from the one in flow.json since we cannot env substs there
func WithNoPrefixToAccountNames ¶
func WithNoPrefixToAccountNames() OverflowOption
DoNotPrependNetworkToAccountNames will not prepend the name of the network to account names
func WithPanicOnError ¶
func WithPanicOnError() OverflowOption
If this option is used a panic will be called if an error occurs after an interaction is run
func WithPrintResults ¶
func WithPrintResults(opts ...OverflowPrinterOption) OverflowOption
alias for WithGLobalPrintOptions
func WithReturnErrors ¶
func WithReturnErrors() OverflowOption
If this option is used a panic will be called if an error occurs after an interaction is run
func WithScriptFolderName ¶
func WithScriptFolderName(name string) OverflowOption
WithScriptFolderName will overwite the default script subdir for scripts `scripts`
func WithServiceAccountSuffix ¶
func WithServiceAccountSuffix(suffix string) OverflowOption
WithServiceAccountSuffix will set the suffix of the service account
func WithTransactionFolderName ¶
func WithTransactionFolderName(name string) OverflowOption
WithTransactionFolderName will overwite the default script subdir for transactions `transactions`
func WithUnderflowOptions ¶
func WithUnderflowOptions(opt underflow.Options) OverflowOption
type OverflowPrinterBuilder ¶
type OverflowPrinterBuilder struct { // filter out some events EventFilter OverflowEventFilter // 0 to print no meter, 1 to print some, 2 to pritn all NB verbose Meter int // set to false to disable all events Events bool // print the emulator log, NB! Verbose EmulatorLog bool // print transaction id, useful to disable in tests Id bool Arguments bool TransactionUrl bool }
a type representing the accuumlated state in the builder
the default setting is to print one line for each transaction with meter and all events
type OverflowPrinterOption ¶
type OverflowPrinterOption func(*OverflowPrinterBuilder)
a type represneting seting an obtion in the printer builder
func WithArguments ¶
func WithArguments() OverflowPrinterOption
func WithEmulatorLog ¶
func WithEmulatorLog() OverflowPrinterOption
print the emulator log. NB! Verbose
func WithEventFilter ¶
func WithEventFilter(filter OverflowEventFilter) OverflowPrinterOption
filter out events that are printed
func WithMeter ¶
func WithMeter() OverflowPrinterOption
print meters as part of the transaction output line
func WithTransactionUrl ¶
func WithTransactionUrl() OverflowPrinterOption
func WithoutId ¶
func WithoutId() OverflowPrinterOption
type OverflowResult ¶
type OverflowResult struct { StopOnError bool // The error if any Err error // The id of the transaction Id flow.Identifier // If running on an emulator // the meter that contains useful debug information on memory and interactions Meter *OverflowMeter // The Raw log from the emulator RawLog []OverflowEmulatorLogMessage // The log from the emulator EmulatorLog []string // The computation used ComputationUsed int // The raw unfiltered events RawEvents []flow.Event // Events that are filtered and parsed into a terse format Events OverflowEvents // The underlying transaction if we need to look into that Transaction *flow.Transaction // The transaction result if we need to look into that TransactionResult *flow.TransactionResult // TODO: consider marshalling this as a struct for convenience // The fee event if any Fee map[string]interface{} FeeGas int Balance FeeBalance // The name of the Transaction Name string Arguments CadenceArguments UnderflowOptions underflow.Options DeclarationInfo OverflowDeclarationInfo }
OverflowResult represents the state after running an transaction
func (OverflowResult) AssertComputationLessThenOrEqual ¶
func (o OverflowResult) AssertComputationLessThenOrEqual(t *testing.T, computation int) OverflowResult
Assert that this transaction did not use more then the given amount of computation
func (OverflowResult) AssertComputationUsed ¶
func (o OverflowResult) AssertComputationUsed(t *testing.T, computation int) OverflowResult
Assert that the transaction uses exactly the given computation amount
func (OverflowResult) AssertDebugLog ¶
func (o OverflowResult) AssertDebugLog(t *testing.T, message ...string) OverflowResult
Assert that a Debug.Log event was emitted that contains the given messages
func (OverflowResult) AssertEmitEventName ¶
func (o OverflowResult) AssertEmitEventName(t *testing.T, event ...string) OverflowResult
Assert that events with the given suffixes are present
func (OverflowResult) AssertEmulatorLog ¶
func (o OverflowResult) AssertEmulatorLog(t *testing.T, message string) OverflowResult
Assert that the internal log of the emulator contains the given message
func (OverflowResult) AssertEvent ¶
func (o OverflowResult) AssertEvent(t *testing.T, name string, fields map[string]interface{}) OverflowResult
Assert that the event with the given name suffix and fields are present
func (OverflowResult) AssertEventCount ¶
func (o OverflowResult) AssertEventCount(t *testing.T, number int) OverflowResult
Assert that the transaction result contains the amount of events
func (OverflowResult) AssertFailure ¶
func (o OverflowResult) AssertFailure(t *testing.T, msg string) OverflowResult
Assert that this particular transaction was a failure that has a message that contains the sendt in assertion
func (OverflowResult) AssertNoEvents ¶
func (o OverflowResult) AssertNoEvents(t *testing.T) OverflowResult
Assert that this transaction emitted no events
func (OverflowResult) AssertSuccess ¶
func (o OverflowResult) AssertSuccess(t *testing.T) OverflowResult
Assert that this transaction was an success
func (OverflowResult) GetByteArrayFromEvent ¶
func (o OverflowResult) GetByteArrayFromEvent(eventName string, fieldName string) ([]byte, error)
Get a byteArray field with the given fieldname from an event with a given suffix
func (OverflowResult) GetEventsWithName ¶
func (o OverflowResult) GetEventsWithName(eventName string) []OverflowEvent
Get all events that end with the given suffix
func (OverflowResult) GetIdFromEvent ¶
func (o OverflowResult) GetIdFromEvent(eventName string, fieldName string) (uint64, error)
Get a uint64 field with the given fieldname(most often an id) from an event with a given suffix
func (OverflowResult) GetIdsFromEvent ¶
func (o OverflowResult) GetIdsFromEvent(eventName string, fieldName string) []uint64
func (OverflowResult) MarshalEventsWithName ¶
func (o OverflowResult) MarshalEventsWithName(eventName string, result interface{}) error
Get all events that end with the given suffix
func (OverflowResult) Print ¶
func (o OverflowResult) Print(opbs ...OverflowPrinterOption) OverflowResult
print out an result
func (OverflowResult) PrintArguments ¶
func (o OverflowResult) PrintArguments(t *testing.T)
func (OverflowResult) RequireEvent ¶
func (o OverflowResult) RequireEvent(t *testing.T, name string, fields map[string]interface{}) OverflowResult
Require that the event with the given name suffix and fields are present
func (OverflowResult) RequireFailure ¶
func (o OverflowResult) RequireFailure(t *testing.T, msg string) OverflowResult
Assert that this particular transaction was a failure that has a message that contains the sendt in assertion
func (OverflowResult) RequireSuccess ¶
func (o OverflowResult) RequireSuccess(t *testing.T) OverflowResult
Require that this transaction was an success
type OverflowScriptFunction ¶
type OverflowScriptFunction func(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult
a type used for composing scripts
type OverflowScriptOptsFunction ¶
type OverflowScriptOptsFunction func(opts ...OverflowInteractionOption) *OverflowScriptResult
a type used for composing scripts
type OverflowScriptResult ¶
type OverflowScriptResult struct { Err error Result cadence.Value Output interface{} Input *OverflowInteractionBuilder Log []OverflowEmulatorLogMessage }
result after running a script
func (*OverflowScriptResult) AssertLengthWithPointer ¶
func (osr *OverflowScriptResult) AssertLengthWithPointer(t *testing.T, pointer string, length int) *OverflowScriptResult
Assert that the length of a jsonPointer is equal to length
func (*OverflowScriptResult) AssertWant ¶
func (osr *OverflowScriptResult) AssertWant(t *testing.T, want autogold.Value) *OverflowScriptResult
Assert that the result is equal to the given autogold.Want
func (*OverflowScriptResult) AssertWithPointer ¶
func (osr *OverflowScriptResult) AssertWithPointer(t *testing.T, pointer string, value interface{}) *OverflowScriptResult
Assert that a jsonPointer into the result is equal to the given value
func (*OverflowScriptResult) AssertWithPointerError ¶
func (osr *OverflowScriptResult) AssertWithPointerError(t *testing.T, pointer string, message string) *OverflowScriptResult
Assert that a jsonPointer into the result is an error
func (*OverflowScriptResult) AssertWithPointerWant ¶
func (osr *OverflowScriptResult) AssertWithPointerWant(t *testing.T, pointer string, want autogold.Value) *OverflowScriptResult
Assert that a jsonPointer into the result is equal to the given autogold Want
func (*OverflowScriptResult) GetAsInterface ¶
func (osr *OverflowScriptResult) GetAsInterface() (interface{}, error)
get the script as interface{}
func (*OverflowScriptResult) GetAsJson ¶
func (osr *OverflowScriptResult) GetAsJson() (string, error)
get the script as json
func (*OverflowScriptResult) GetWithPointer ¶
func (osr *OverflowScriptResult) GetWithPointer(pointer string) (interface{}, error)
get the given jsonPointer as interface{}
func (*OverflowScriptResult) MarshalAs ¶
func (osr *OverflowScriptResult) MarshalAs(marshalTo interface{}) error
Marshal the script output as the given sent in type
func (*OverflowScriptResult) MarshalPointerAs ¶
func (osr *OverflowScriptResult) MarshalPointerAs(pointer string, marshalTo interface{}) error
Marshal the given jsonPointer as the given type
func (*OverflowScriptResult) Print ¶
func (osr *OverflowScriptResult) Print() *OverflowScriptResult
Print the result
func (*OverflowScriptResult) PrintArguments ¶
func (osr *OverflowScriptResult) PrintArguments(t *testing.T)
type OverflowSolution ¶
type OverflowSolution struct { // all transactions with name and what paremters they have Transactions map[string]*OverflowDeclarationInfo `json:"transactions"` // all scripts with name and parameter they have Scripts map[string]*OverflowDeclarationInfo `json:"scripts"` // all networks with associated scripts/tranasctions/contracts preresolved Networks map[string]*OverflowSolutionNetwork `json:"networks"` // warnings accumulated during parsing Warnings []string `json:"warnings"` }
a type representing the raw solutions that contains all transactions, scripts, networks and warnings of any
func (*OverflowSolution) MergeSpecAndCode ¶
func (s *OverflowSolution) MergeSpecAndCode() *OverflowSolutionMerged
merge the given Solution into a MergedSolution that is suited for exposing as an NPM module
type OverflowSolutionMerged ¶
type OverflowSolutionMerged struct {
Networks map[string]OverflowSolutionMergedNetwork `json:"networks"`
}
a type representing a merged solution that will be serialized as the json file for the npm module
type OverflowSolutionMergedNetwork ¶
type OverflowSolutionMergedNetwork struct { Scripts map[string]OverflowCodeWithSpec `json:"scripts"` Transactions map[string]OverflowCodeWithSpec `json:"transactions,omitempty"` Contracts *map[string]string `json:"contracts,omitempty"` }
a network in the merged solution
type OverflowSolutionNetwork ¶
type OverflowSolutionNetwork struct { Scripts map[string]string `json:"scripts"` Transactions map[string]string `json:"transactions,omitempty"` Contracts *map[string]string `json:"contracts,omitempty"` }
a type representing one network in a solution, so mainnet/testnet/emulator
type OverflowState ¶
type OverflowState struct { State *flowkit.State // the services from flowkit to performed operations on Flowkit *flowkit.Flowkit EmulatorGatway *gateway.EmulatorGateway ArchiveFlowkit *flowkit.Flowkit // Configured variables that are taken from the builder since we need them in the execution of overflow later on Network config.Network PrependNetworkToAccountNames bool ServiceAccountSuffix string Gas int // flowkit, emulator and emulator debug log uses three different logging technologies so we have them all stored here // this flowkit Logger can go away when we can remove deprecations! Logger output.Logger Log *bytes.Buffer LogLevel int // If there was an error starting overflow it is stored here Error error // Paths that points to where .cdc files are stored and the posibilty to specify something besides the standard `transactions`/`scripts`subdirectories BasePath string TransactionBasePath string ScriptBasePath string // Filters to events to remove uneeded noise FilterOutFeeEvents bool FilterOutEmptyWithDrawDepositEvents bool GlobalEventFilter OverflowEventFilter // Signal to overflow that if there is an error after running a single interaction we should panic StopOnError bool // Signal to overflow that if this is not nil we should print events on interaction completion PrintOptions *[]OverflowPrinterOption // Mint this amount of flow to new accounts NewUserFlowAmount float64 InputResolver underflow.InputResolver // the coverage report if any CoverageReport *runtime.CoverageReport UnderflowOptions underflow.Options Flixkit flixkit.FlixService }
OverflowState contains information about how to Overflow is confitured and the current runnig state
func Overflow ¶
func Overflow(opts ...OverflowOption) *OverflowState
Overflow will start an Overflow instance that panics if there are initialization errors
Will read the following ENV vars as default: OVERFLOW_ENV : set to "mainnet|testnet|emulator|embedded", default embedded OVERFLOW_LOGGING: set from 0-3. 0 is silent, 1 is print terse output, 2 is print output from flowkit, 3 is all lots we can OVERFLOW_CONTINUE: to continue this overflow on an already running emulator., default false OVERFLOW_STOP_ON_ERROR: will the process panic if an erorr is encountered. If set to false the result objects will have the error. default: false
Starting overflow without env vars will make it start in embedded mode deploying all contracts creating accounts ¶
You can then chose to override this setting with the builder methods example
Overflow(WithNetwork("mainnet"))
func OverflowTesting ¶
func OverflowTesting(opts ...OverflowOption) (*OverflowState, error)
func (*OverflowState) Account ¶
func (o *OverflowState) Account(key string) *accounts.Account
return the account of a given account
func (*OverflowState) AccountE ¶
func (o *OverflowState) AccountE(key string) (*accounts.Account, error)
AccountE fetch an account from State Note that if `PrependNetworkToAccountNames` is specified it is prefixed with the network so that you can use the same logical name across networks
func (*OverflowState) AccountPublicKey ¶
func (o *OverflowState) AccountPublicKey(name string) (string, error)
func (*OverflowState) AddContract ¶
func (*OverflowState) Address ¶
func (o *OverflowState) Address(key string) string
return the address of an given account
func (*OverflowState) BuildInteraction ¶
func (o *OverflowState) BuildInteraction(filename string, interactionType string, opts ...OverflowInteractionOption) *OverflowInteractionBuilder
create a flowInteractionBuilder from the sent in options
func (*OverflowState) CreateAccountsE ¶
func (o *OverflowState) CreateAccountsE(ctx context.Context) (*OverflowState, error)
CreateAccountsE ensures that all accounts present in the deployment block for the given network is present
func (*OverflowState) CreateOverflowTransaction ¶
func (o *OverflowState) CreateOverflowTransaction(blockId string, transactionResult flow.TransactionResult, transaction flow.Transaction, txIndex int) (*OverflowTransaction, error)
func (*OverflowState) CreateTestAccounts ¶
func (o *OverflowState) CreateTestAccounts(ctx context.Context, num int, flowTokens float64) (map[string]*accounts.Account, error)
this methods create test accounts that can be used in WithManualSigner, they are not in flow json
func (*OverflowState) DownloadAndUploadFile ¶
func (o *OverflowState) DownloadAndUploadFile(url string, accountName string) error
DownloadAndUploadFile reads a file, base64 encodes it and chunk upload to /storage/upload
func (*OverflowState) DownloadImageAndUploadAsDataUrl ¶
func (o *OverflowState) DownloadImageAndUploadAsDataUrl(url, accountName string) error
DownloadImageAndUploadAsDataUrl download an image and upload as data url
func (*OverflowState) FillUpStorage ¶
func (o *OverflowState) FillUpStorage(accountName string) *OverflowState
A method to fill up a users storage, useful when testing This has some issues with transaction fees
func (*OverflowState) FlixScript ¶
func (o *OverflowState) FlixScript(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult
run a script with the given code/filanem an options
func (*OverflowState) FlixScriptFN ¶
func (o *OverflowState) FlixScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction
compose interactionOptions into a new Script function
func (*OverflowState) FlixScriptFileNameFN ¶
func (o *OverflowState) FlixScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction
compose fileName and interactionOptions into a new Script function
func (*OverflowState) FlixTx ¶
func (o *OverflowState) FlixTx(filename string, opts ...OverflowInteractionOption) *OverflowResult
run a flix transaction with the given code/filanem an options
func (*OverflowState) FlixTxFN ¶
func (o *OverflowState) FlixTxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction
If you store this in a struct and add arguments to it it will not reset between calls
func (*OverflowState) FlixTxFileNameFN ¶
func (o *OverflowState) FlixTxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction
func (*OverflowState) FlowAddress ¶
func (o *OverflowState) FlowAddress(key string) flow.Address
return the flow Address of the given name DEPRECATED: use FlowAddressE
func (*OverflowState) FlowAddressE ¶
func (o *OverflowState) FlowAddressE(key string) (*flow.Address, error)
return the flow Address of the given name
func (*OverflowState) GenerateStub ¶
func (o *OverflowState) GenerateStub(network, filePath string, standalone bool) (string, error)
func (*OverflowState) GetAccount ¶
func (o *OverflowState) GetAccount(ctx context.Context, key string) (*flow.Account, error)
GetAccount takes the account name and returns the state of that account on the given network.
func (*OverflowState) GetBlockAtHeight ¶
func (o *OverflowState) GetBlockAtHeight(ctx context.Context, height uint64) (*flow.Block, error)
get block at a given height
func (*OverflowState) GetBlockById ¶
func (o *OverflowState) GetBlockById(ctx context.Context, blockId string) (*flow.Block, error)
blockId should be a hexadecimal string
func (*OverflowState) GetCoverageReport ¶
func (o *OverflowState) GetCoverageReport() *runtime.CoverageReport
func (*OverflowState) GetFreeCapacity ¶
func (o *OverflowState) GetFreeCapacity(accountName string) int
Get the free capacity in an account
func (*OverflowState) GetLatestBlock ¶
func (o *OverflowState) GetLatestBlock(ctx context.Context) (*flow.Block, error)
get the latest block
func (*OverflowState) GetNetwork ¶
func (o *OverflowState) GetNetwork() string
func (*OverflowState) GetOverflowTransactionById ¶
func (o *OverflowState) GetOverflowTransactionById(ctx context.Context, id flow.Identifier) (*OverflowTransaction, error)
func (*OverflowState) GetTransactionById ¶
func (o *OverflowState) GetTransactionById(ctx context.Context, id flow.Identifier) (*flow.Transaction, error)
func (*OverflowState) GetTransactionsByBlockId ¶
func (o *OverflowState) GetTransactionsByBlockId(ctx context.Context, id flow.Identifier) ([]*flow.Transaction, []*flow.TransactionResult, error)
func (*OverflowState) InitializeContracts ¶
func (o *OverflowState) InitializeContracts(ctx context.Context) *OverflowState
InitializeContracts installs all contracts in the deployment block for the configured network
func (*OverflowState) MintFlowTokens ¶
func (o *OverflowState) MintFlowTokens(accountName string, amount float64) *OverflowState
func (*OverflowState) Parse ¶
func (o *OverflowState) Parse(codeFileName string, code []byte, network config.Network) (string, error)
Parse a given file into a resolved version
func (*OverflowState) ParseAll ¶
func (o *OverflowState) ParseAll() (*OverflowSolution, error)
Parse the given overflow state into a solution/npm-module
func (*OverflowState) ParseAllWithConfig ¶
func (o *OverflowState) ParseAllWithConfig(skipContracts bool, txSkip []string, scriptSkip []string) (*OverflowSolution, error)
Parse the gieven overflow state with filters
func (*OverflowState) ParseEvents ¶
func (o *OverflowState) ParseEvents(events []flow.Event) (OverflowEvents, OverflowEvent)
func (*OverflowState) ParseEventsWithIdPrefix ¶
func (o *OverflowState) ParseEventsWithIdPrefix(events []flow.Event, idPrefix string) (OverflowEvents, OverflowEvent)
func (*OverflowState) QualifiedIdentifier ¶
func (o *OverflowState) QualifiedIdentifier(contract string, name string) (string, error)
account can either be a name from accounts or the raw value
func (*OverflowState) QualifiedIdentifierFromSnakeCase ¶
func (o *OverflowState) QualifiedIdentifierFromSnakeCase(typeName string) (string, error)
Qualified identifier from a snakeCase string Account_Contract_Struct
func (*OverflowState) RollbackToBlockHeight ¶
func (o *OverflowState) RollbackToBlockHeight(height uint64) error
func (*OverflowState) Script ¶
func (o *OverflowState) Script(filename string, opts ...OverflowInteractionOption) *OverflowScriptResult
run a script with the given code/filanem an options
Example ¶
o := Overflow(docOptions) // the other major interaction you can run on Flow is a script, it uses the script DSL. // Start it by specifying the script name from `scripts` folder o.Script("test", // the test script requires an address as arguments, Overflow is smart enough that it // sees this and knows that there is an account for the emulator network called // `emulator-first` so it will insert that address as the argument. // If you change the network to testnet/mainnet later and name your stakholders // accordingly it will just work WithArg("account", "first"), )
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug ⭐ Script test run result:"0x179b6b1cb6755e31"
Example (Inline) ¶
o := Overflow(docOptions) // Script can be run inline o.Script(` access(all) fun main(account: Address): String { return getAccount(account).address.toString() }`, WithArg("account", "first"), WithName("get_address"), )
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug ⭐ Script get_address run result:"0x179b6b1cb6755e31"
func (*OverflowState) ScriptFN ¶
func (o *OverflowState) ScriptFN(outerOpts ...OverflowInteractionOption) OverflowScriptFunction
compose interactionOptions into a new Script function
func (*OverflowState) ScriptFileNameFN ¶
func (o *OverflowState) ScriptFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowScriptOptsFunction
compose fileName and interactionOptions into a new Script function
func (*OverflowState) ServiceAccountName ¶
func (o *OverflowState) ServiceAccountName() string
ServiceAccountName return the name of the current service account Note that if `PrependNetworkToAccountNames` is specified it is prefixed with the network so that you can use the same logical name across networks
func (*OverflowState) SignUserMessage ¶
func (o *OverflowState) SignUserMessage(account string, message string) (string, error)
Sign a user message
func (*OverflowState) Tx ¶
func (o *OverflowState) Tx(filename string, opts ...OverflowInteractionOption) *OverflowResult
The main function for running an transasction in overflow
Example ¶
o := Overflow(docOptions) // start the Tx DSL with the name of the transactions file, by default this // is in the `transactions` folder in your root dit o.Tx("arguments", // Customize the Transaction by sending in more InteractionOptions, // at minimum you need to set Signer and Args if any WithSigner("first"), // Arguments are always passed by name in the DSL builder, order does not matter WithArg("test", "overflow ftw!"), )
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug 👌 Tx:arguments fee:0.00001000 gas:4
Example (Inline) ¶
o := Overflow(docOptions) // The Tx dsl can also contain an inline transaction o.Tx(` import Debug from "../contracts/Debug.cdc" transaction(message:String) { prepare(acct: &Account) { Debug.log(message) } }`, WithSigner("first"), WithArg("message", "overflow ftw!"), )
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug 👌 Tx: fee:0.00001000 gas:7 === Events === A.f8d6e0586b0a20c7.Debug.Log msg -> overflow ftw!
Example (Multisign) ¶
o := Overflow(docOptions) // The Tx dsl supports multiple signers, note that the mainSigner is the last account o.Tx(` import Debug from "../contracts/Debug.cdc" transaction { prepare(acct: &Account, acct2: &Account) { Debug.log("acct:".concat(acct.address.toString())) Debug.log("acct2:".concat(acct2.address.toString())) } }`, WithSigner("first"), WithPayloadSigner("second"), )
Output: 🧑 Created account: emulator-first with address: 179b6b1cb6755e31 with flow: 10.00 🧑 Created account: emulator-second with address: f3fcd2c1a78f5eee with flow: 10.00 📜 deploy contracts Debug 👌 Tx: fee:0.00001000 gas:7 === Events === A.f8d6e0586b0a20c7.Debug.Log msg -> acct:0xf3fcd2c1a78f5eee A.f8d6e0586b0a20c7.Debug.Log msg -> acct2:0x179b6b1cb6755e31
func (*OverflowState) TxFN ¶
func (o *OverflowState) TxFN(outerOpts ...OverflowInteractionOption) OverflowTransactionFunction
If you store this in a struct and add arguments to it it will not reset between calls
func (*OverflowState) TxFileNameFN ¶
func (o *OverflowState) TxFileNameFN(filename string, outerOpts ...OverflowInteractionOption) OverflowTransactionOptsFunction
func (*OverflowState) UploadFile ¶
func (o *OverflowState) UploadFile(filename string, accountName string) error
UploadFile reads a file, base64 encodes it and chunk upload to /storage/upload
func (*OverflowState) UploadImageAsDataUrl ¶
func (o *OverflowState) UploadImageAsDataUrl(filename string, accountName string) error
UploadImageAsDataUrl will upload a image file from the filesystem into /storage/upload of the given account
func (*OverflowState) UploadString ¶
func (o *OverflowState) UploadString(content string, accountName string) error
UploadString will upload the given string data in 1mb chunkts to /storage/upload of the given account
type OverflowTest ¶
type OverflowTest struct { O *OverflowState // contains filtered or unexported fields }
func SetupTest ¶
func SetupTest(opts []OverflowOption, setup func(o *OverflowState) error) (*OverflowTest, error)
func (*OverflowTest) Reset ¶
func (ot *OverflowTest) Reset() error
func (*OverflowTest) Teardown ¶
func (ot *OverflowTest) Teardown()
type OverflowTestingAsssertions ¶
type OverflowTestingAsssertions struct { T *testing.T Failure *string Events []EventAssertion Require bool }
type OverflowTransaction ¶
type OverflowTransaction struct { Error error AuthorizerTypes map[string][]string Stakeholders map[string][]string Payer string Id string Status string BlockId string Authorizers []string Arguments []Argument Events []OverflowEvent Imports []Import Script []byte ProposalKey flow.ProposalKey Fee float64 TransactionIndex int GasLimit uint64 GasUsed uint64 ExecutionEffort float64 Balances FeeBalance PayloadSignatures []flow.TransactionSignature EnvelopeSignatures []flow.TransactionSignature }
type OverflowTransactionFunction ¶
type OverflowTransactionFunction func(filename string, opts ...OverflowInteractionOption) *OverflowResult
a type to define a function used to compose Transaction interactions
type OverflowTransactionOptsFunction ¶
type OverflowTransactionOptsFunction func(opts ...OverflowInteractionOption) *OverflowResult
a type to define a function used to compose Transaction interactions