Documentation ¶
Index ¶
- Constants
- Variables
- func Alice() *flowkit.Account
- func Bob() *flowkit.Account
- func Charlie() *flowkit.Account
- func Donald() *flowkit.Account
- func HashAlgos() []crypto.HashAlgorithm
- func NewAccountCreateResult(address flow.Address) *flow.TransactionResult
- func NewAccountWithAddress(address string) *flow.Account
- func NewBlock() *flow.Block
- func NewCollection() *flow.Collection
- func NewEvent(index int, eventId string, fields []cadence.Field, values []cadence.Value) *flow.Event
- func NewTransaction() *flow.Transaction
- func NewTransactionResult(events []flow.Event) *flow.TransactionResult
- func PrivKeys() []crypto.PrivateKey
- func PubKeys() []crypto.PublicKey
- func ReaderWriter() afero.Afero
- func SigAlgos() []crypto.SignatureAlgorithm
- type TestGateway
Constants ¶
View Source
const ( GetAccountFunc = "GetAccount" SendSignedTransactionFunc = "SendSignedTransaction" GetCollectionFunc = "GetCollection" GetTransactionResultFunc = "GetTransactionResult" GetEventsFunc = "GetEvents" GetLatestBlockFunc = "GetLatestBlock" GetBlockByHeightFunc = "GetBlockByHeight" GetBlockByIDFunc = "GetBlockByID" ExecuteScriptFunc = "ExecuteScript" GetTransactionFunc = "GetTransaction" )
Variables ¶
View Source
var ContractA = resource{ Name: "ContractA", Filename: "contractA.cdc", Source: []byte(`pub contract ContractA {}`), }
View Source
var ContractB = resource{ Name: "ContractB", Filename: "contractB.cdc", Source: []byte(` import ContractA from "./contractA.cdc" pub contract ContractB {} `), }
View Source
var ContractC = resource{ Name: "ContractC", Filename: "contractC.cdc", Source: []byte(` import ContractB from "./contractB.cdc" import ContractA from "./contractA.cdc" pub contract ContractC { pub let x: String init(x: String) { self.x = x } } `), }
View Source
var ContractEvents = resource{ Name: "ContractEvents", Filename: "contractEvents.cdc", Source: []byte(` pub contract ContractEvents { pub struct S { pub var x: Int pub var y: String init(x: Int, y: String) { self.x = x self.y = y } } pub event EventA(x: Int) pub event EventB(x: Int, y: Int) pub event EventC(x: UInt8) pub event EventD(x: String) pub event EventE(x: UFix64) pub event EventF(x: Address) pub event EventG(x: [UInt8]) pub event EventH(x: [[UInt8]]) pub event EventI(x: {String: Int}) pub event EventJ(x: S) init() { emit EventA(x: 1) emit EventB(x: 4, y: 2) emit EventC(x: 1) emit EventD(x: "hello") emit EventE(x: 10.2) emit EventF(x: 0x436164656E636521) emit EventG(x: "hello".utf8) emit EventH(x: ["hello".utf8, "world".utf8]) emit EventI(x: { "hello": 1337 }) emit EventJ(x: S(x: 1, y: "hello world")) } } `), }
View Source
var ContractHelloString = resource{ Name: "Hello", Filename: "contractHello.cdc", Source: []byte(` pub contract Hello { pub let greeting: String init() { self.greeting = "Hello, World!" } pub fun hello(): String { return self.greeting } } `), }
View Source
var ContractSimple = resource{ Name: "Simple", Filename: "contractSimple.cdc", Source: []byte(` pub contract Simple {} `), }
View Source
var ContractSimpleUpdated = resource{ Name: "Simple", Filename: "contractSimpleUpdated.cdc", Source: []byte(` pub contract Simple { pub let greeting: String init() { self.greeting = "Foo" } } `), }
View Source
var ScriptArgString = resource{ Filename: "scriptArg.cdc", Source: []byte(` pub fun main(name: String): String { return "Hello ".concat(name) } `), }
View Source
var ScriptImport = resource{ Filename: "scriptImport.cdc", Source: []byte(` import Hello from "./contractHello.cdc" pub fun main(): String { return "Hello ".concat(Hello.greeting) } `), }
View Source
var ScriptWithError = resource{ Filename: "scriptError.cdc", Source: []byte(` pub fun main(name: String): Strin { return "Hello ".concat(name) } `), }
View Source
var TransactionArgString = resource{ Filename: "transactionArg.cdc", Source: []byte(` transaction(greeting: String) { let guest: Address prepare(authorizer: AuthAccount) { self.guest = authorizer.address } execute { log(greeting.concat(",").concat(self.guest.toString())) } } `), }
View Source
var TransactionImports = resource{ Filename: "transactionImport.cdc", Source: []byte(` import Hello from "./contractHello.cdc" transaction() { prepare(authorizer: AuthAccount) {} execute { Hello.hello() } } `), }
View Source
var TransactionMultipleDeclarations = resource{ Filename: "transactionMultipleDec.cdc", Source: []byte(` pub fun dummy(_ address: Address): Void {} transaction() { prepare(authorizer: AuthAccount) {} } `), }
View Source
var TransactionSimple = resource{ Filename: "transactionSimple.cdc", Source: []byte(` transaction() {} `), }
View Source
var TransactionSingleAuth = resource{ Filename: "transactionAuth1.cdc", Source: []byte(` transaction() { prepare(authorizer: AuthAccount) {} } `), }
View Source
var TransactionTwoAuth = resource{ Filename: "transactionAuth2.cdc", Source: []byte(` transaction() { prepare(auth1: AuthAccount, auth2: AuthAccount) {} } `), }
Functions ¶
func HashAlgos ¶ added in v0.30.3
func HashAlgos() []crypto.HashAlgorithm
func NewAccountCreateResult ¶
func NewAccountCreateResult(address flow.Address) *flow.TransactionResult
func NewAccountWithAddress ¶
func NewAccountWithAddress(address string) *flow.Account
func NewCollection ¶
func NewCollection() *flow.Collection
func NewTransaction ¶
func NewTransaction() *flow.Transaction
func NewTransactionResult ¶
func NewTransactionResult(events []flow.Event) *flow.TransactionResult
func PrivKeys ¶ added in v0.24.0
func PrivKeys() []crypto.PrivateKey
func ReaderWriter ¶ added in v0.24.0
func SigAlgos ¶ added in v0.30.3
func SigAlgos() []crypto.SignatureAlgorithm
Types ¶
type TestGateway ¶ added in v0.24.0
type TestGateway struct { Mock *mocks.Gateway SendSignedTransaction *mock.Call GetAccount *mock.Call GetCollection *mock.Call GetTransactionResult *mock.Call GetEvents *mock.Call GetLatestBlock *mock.Call GetBlockByHeight *mock.Call GetBlockByID *mock.Call ExecuteScript *mock.Call GetTransaction *mock.Call }
func DefaultMockGateway ¶ added in v0.24.0
func DefaultMockGateway() *TestGateway
Click to show internal directories.
Click to hide internal directories.