-
Notifications
You must be signed in to change notification settings - Fork 80
Pass arguments to scripts and transactions #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
38fa509
Add arguments parsing methods
MaxStalker ebabc91
Pass arguments to script
MaxStalker 8c0ceb4
Allow empty args for scripts execution
MaxStalker 4fcf1bf
Fix flag
MaxStalker dc038f8
Add arguments to transactions send
MaxStalker 67b1e8e
Use --code flag similar to transactions
MaxStalker 2931ead
Clean file name for readability
MaxStalker d25e38e
Refactor assignment statement
MaxStalker 5d3019c
Format code
MaxStalker 175eab1
Add new line at the end of the file
MaxStalker c5240a9
Fix check-headers script
MaxStalker ffa28f6
Add missing header
MaxStalker d5fa496
Update info with information about JSON-Cadence format
MaxStalker fc369df
Init variable with empty slice
MaxStalker e6c325e
Pass arguments to script
MaxStalker cbdab81
Allow empty args for scripts execution
MaxStalker 7c4f71b
Add arguments to transactions send
MaxStalker d76401f
Use --code flag similar to transactions
MaxStalker c8cb087
Refactor assignment statement
MaxStalker 77df9ac
Add new line at the end of the file
MaxStalker d718082
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,8 @@ | ||
| #!/bin/sh | ||
|
|
||
| files=$(find . -name \*.go -type f -print0 | xargs -0 egrep -L '(Licensed under the Apache License)|(Code generated from|by)') | ||
| files=$(find . -name \*.go -type f -print0 | xargs -0 grep -L -E '(Licensed under the Apache License)|(Code generated (from|by))') | ||
| if [ -n "$files" ]; then | ||
| echo "Missing license header in:" | ||
| echo "$files" | ||
| exit 1 | ||
| fi | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Flow CLI | ||
| * | ||
| * Copyright 2019-2020 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 cli | ||
|
|
||
| import ( | ||
| "encoding/json" | ||
| "github.com/onflow/cadence" | ||
| jsoncdc "github.com/onflow/cadence/encoding/json" | ||
| ) | ||
|
|
||
| type CadenceArgument struct { | ||
| Value cadence.Value | ||
| } | ||
|
|
||
| func (v CadenceArgument) MarshalJSON() ([]byte, error) { | ||
MaxStalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return jsoncdc.Encode(v.Value) | ||
| } | ||
| func (v *CadenceArgument) UnmarshalJSON(b []byte) (err error) { | ||
MaxStalker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| v.Value, err = jsoncdc.Decode(b) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| } | ||
| func ParseArguments(input string) ([]cadence.Value, error) { | ||
| var args []CadenceArgument | ||
| b := []byte(input) | ||
| err := json.Unmarshal(b, &args) | ||
|
|
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
|
|
||
| cadenceArgs := make([]cadence.Value, len(args)) | ||
| for i, arg := range args { | ||
| cadenceArgs[i] = arg.Value | ||
| } | ||
| return cadenceArgs, nil | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.