add account resource
+/*
+ * Flow CLI
+ *
+ * Copyright 2019-2021 Dapper Labs, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package tests
-import "github.com/spf13/afero"
+import (
+ "github.com/onflow/flow-cli/pkg/flowkit"
+ "github.com/onflow/flow-go-sdk"
+ "github.com/onflow/flow-go-sdk/crypto"
+ "github.com/spf13/afero"
+)
type resource struct {
Name string
@@ -39,9 +62,19 @@ var TransactionArgString = resource{
`),
}
+var ScriptArgString = resource{
+ Name: "scriptArg.cdc",
+ Source: []byte(`
+ pub fun main(name: String): String {
+ return "Hello ".concat(name)
+ }
+ `),
+}
+
var resources = []resource{
ContractHelloString,
TransactionArgString,
+ ScriptArgString,
}
func ReaderWriter() afero.Afero {
@@ -53,3 +86,13 @@ func ReaderWriter() afero.Afero {
return afero.Afero{mockFS}
}
+
+func Alice() *flowkit.Account {
+ a := &flowkit.Account{}
+ a.SetAddress(flow.HexToAddress("0x1"))
+ a.SetName("Alice")
+ pk, _ := crypto.GeneratePrivateKey(crypto.ECDSA_P256, []byte("seedseedseedseedseedseed"))
+ a.SetKey(flowkit.NewHexAccountKeyFromPrivateKey(0, crypto.SHA3_256, pk))
+
+ return a
+}
