Repository: onflow/flow-cli (go)

Issue:
Cannot import built-in contracts
### Problem

An error occurs when executing a script that imports a built-in contract (`Crypto` contract) with Flow CLI command.

### Steps to Reproduce

1. Create the following script

test.cdc
```
import Crypto

pub fun main() {
    log("test")
}
```

2. Execute the following command in the Flow CLI of v0.18.0 or later version

```sh
flow scripts execute ./test.cdc
```

The following error occurs
```
❌  Command Error: import Crypto could not be resolved from the configuration
```

### Context

It does not occur with v0.17.0, but with v0.18.0 and later. I am using macOS.
This may be due to `Resolve Contract Imports in Scripts and Transactions` feature.

Pull request:
Fix import detection
Closes #252 

## Description
Import detection was fixed so it only detects file imports.

Patch:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 642d7fb3..332dee36 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -242,9 +242,6 @@ Default command response should be to the stdout and not saved to a file. Anytim
 the output to be saved to a file we should explicitly specify so by using `--save filename.txt`
 flag and providing the path.
 
-Result output should include only information that is commonly used and relevant, 
-don't use too much of user screen drowning what’s truly important, 
-instead provide a way to include that data when the user requests by having include, exclude flags.
 
 ```
 Address  179b6b1cb6755e31
diff --git a/docs/build-transactions.md b/docs/build-transactions.md
index 2b2cca6e..7a50772c 100644
--- a/docs/build-transactions.md
+++ b/docs/build-transactions.md
@@ -124,7 +124,7 @@ The `Type` must be the same as type in the transaction source code for that argu
 
 ### Arguments JSON
 
-- Flag: `--args-json`
+- Flag: `--argsJSON`
 - Valid inputs: arguments in JSON-Cadence form.
 
 Arguments passed to the Cadence transaction in Cadence JSON format.
diff --git a/docs/execute-scripts.md b/docs/execute-scripts.md
index 3000762e..0e27d26e 100644
--- a/docs/execute-scripts.md
+++ b/docs/execute-scripts.md
@@ -42,7 +42,7 @@ The `Type` must be the same as type in the script source code for that argument.
 
 ### Arguments JSON
 
-- Flag: `--args-json`
+- Flag: `--argsJSON`
 - Valid inputs: arguments in JSON-Cadence form.
 
 Arguments passed to the Cadence script in `Type:Value` format.
diff --git a/pkg/flowcli/contracts/resolver.go b/pkg/flowcli/contracts/resolver.go
index 3963e611..42d74db4 100644
--- a/pkg/flowcli/contracts/resolver.go
+++ b/pkg/flowcli/contracts/resolver.go
@@ -112,8 +112,9 @@ func (r *Resolver) getFileImports() []string {
 	imports := make([]string, 0)
 
 	for _, importDeclaration := range r.program.ImportDeclarations() {
-		_, ok := importDeclaration.Location.(common.AddressLocation)
-		if !ok {
+		_, isFileImport := importDeclaration.Location.(common.StringLocation)
+
+		if isFileImport {
 			imports = append(imports, importDeclaration.Location.String())
 		}
 	}


Test patch:
diff --git a/pkg/flowcli/contracts/resolver_test.go b/pkg/flowcli/contracts/resolver_test.go
index d769d572..815be163 100644
--- a/pkg/flowcli/contracts/resolver_test.go
+++ b/pkg/flowcli/contracts/resolver_test.go
@@ -58,17 +58,22 @@ func TestResolver(t *testing.T) {
 	scripts := [][]byte{
 		[]byte(`
 			import Kibble from "./Kibble.cdc"
-      import FT from "./FT.cdc"
+			import FT from "./FT.cdc"
 			pub fun main() {}
     `), []byte(`
 			import Kibble from "../../tests/Kibble.cdc"
-      import FT from "../../tests/FT.cdc"
+			import FT from "../../tests/FT.cdc"
 			pub fun main() {}
     `), []byte(`
 			import Kibble from "../../tests/Kibble.cdc"
-      import NFT from "../../tests/NFT.cdc"
+			import NFT from "../../tests/NFT.cdc"
 			pub fun main() {}
-    `),
+    `), []byte(`
+			import Kibble from "../Kibble.cdc"
+			import crypto
+			import Foo from 0x0000000000000001
+			pub fun main() {}
+	`),
 	}
 
 	resolved := [][]byte{
@@ -89,33 +94,33 @@ func TestResolver(t *testing.T) {
 
 	t.Run("Import exists", func(t *testing.T) {
 		resolver, err := NewResolver([]byte(`
-      import Kibble from "./Kibble.cdc"
-      pub fun main() {}
-    `))
+			  import Kibble from "./Kibble.cdc"
+			  pub fun main() {}
+		`))
 		assert.NoError(t, err)
 		assert.True(t, resolver.HasFileImports())
 	})
 
 	t.Run("Import doesn't exists", func(t *testing.T) {
 		resolver, err := NewResolver([]byte(`
-      pub fun main() {}
-    `))
+		  	pub fun main() {}
+		`))
 		assert.NoError(t, err)
 		assert.False(t, resolver.HasFileImports())
 
 		resolver, err = NewResolver([]byte(`
 			import Foo from 0xf8d6e0586b0a20c7
-      pub fun main() {}
-    `))
+		  	pub fun main() {}
+		`))
 		assert.NoError(t, err)
 		assert.False(t, resolver.HasFileImports())
 	})
 
 	t.Run("Parse imports", func(t *testing.T) {
-		resolver, err := NewResolver(scripts[0])
+		resolver, err := NewResolver(scripts[3])
 		assert.NoError(t, err)
 		assert.Equal(t, resolver.getFileImports(), []string{
-			"./Kibble.cdc", "./FT.cdc",
+			"../Kibble.cdc",
 		})
 	})