Skip to content

Commit

Permalink
Merge branch 'master' into tests/state-test
Browse files Browse the repository at this point in the history
  • Loading branch information
devbugging authored Nov 17, 2021
2 parents 7df5862 + f3eb6a1 commit 25ab3b9
Show file tree
Hide file tree
Showing 55 changed files with 2,051 additions and 263 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Reporting a Problem/Bug
about: Reporting a Problem/Bug
title: ''
labels: bug, Feedback
assignees: psiemens
assignees: sideninja

---
### Instructions
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Requesting a Feature or Improvement
about: "For feature requests. Please search for existing issues first. Also see CONTRIBUTING.md"
title: ''
labels: Feedback, Feature
assignees: psiemens
assignees: sideninja

---

Expand Down
22 changes: 21 additions & 1 deletion .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ on:
types: [published]

jobs:
security:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-go@v1
with:
go-version: '1.16.2'
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -30,4 +41,13 @@ jobs:
credentials: ${{ secrets.FLOW_HOSTING_PROD_SA }}
path: ./
glob: 'version.txt'
destination: flow-cli/
destination: flow-cli/
homebrew:
name: Bump Homebrew formula
runs-on: ubuntu-latest
steps:
- uses: mislav/bump-homebrew-formula-action@v1
with:
formula-name: flow-cli
env:
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<br />
<p align="center">
<a href="https://docs.onflow.org/flow-cli/install/">
<img src="./cli-banner.png" alt="Logo" width="290" height="auto">
<img src="./cli-banner.svg" alt="Logo" width="270" height="auto">
</a>

<p align="center">
Expand Down
Binary file removed cli-banner.png
Binary file not shown.
30 changes: 30 additions & 0 deletions cli-banner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions cmd/flow/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"github.com/onflow/flow-cli/internal/project"
"github.com/onflow/flow-cli/internal/quick"
"github.com/onflow/flow-cli/internal/scripts"
"github.com/onflow/flow-cli/internal/signatures"
"github.com/onflow/flow-cli/internal/status"
"github.com/onflow/flow-cli/internal/transactions"
"github.com/onflow/flow-cli/internal/version"
Expand Down Expand Up @@ -63,6 +64,7 @@ func main() {
cmd.AddCommand(collections.Cmd)
cmd.AddCommand(project.Cmd)
cmd.AddCommand(config.Cmd)
cmd.AddCommand(signatures.Cmd)

command.InitFlags(cmd)

Expand Down
14 changes: 11 additions & 3 deletions docs/build-transactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ Use this functionality in the following order:
3. Use the `send-signed` command to submit the signed transaction to the Flow network.

```shell
flow transactions build <code filename>
flow transactions build <code filename> [<argument> <argument>...] [flags]
```

## Example Usage

```shell
> flow transactions build ./transaction.cdc \
> flow transactions build ./transaction.cdc "Meow" \
--authorizer alice \
--proposer bob \
--payer charlie \
--arg "String:Meow" \
--filter payload --save built.rlp

ID e8c0a69952fbe50a66703985e220307c8d44b8fa36c76cbca03f8c43d0167847
Expand Down Expand Up @@ -76,6 +75,13 @@ f9013df90138b8d17472616e...73616374696f6e286eeec0c0
The first argument is a path to a Cadence file containing the
transaction to be executed.

### Arguments
- Name: `argument`
- Valid inputs: valid [cadence values](https://docs.onflow.org/cadence/json-cadence-spec/)
matching argument type in transaction code.

Input arguments values matching corresponding types in the source code and passed in the same order.
For passing complex argument values see [send transaction](https://docs.onflow.org/flow-cli/send-transactions/#example-usage) document.

## Flags

Expand Down Expand Up @@ -122,6 +128,8 @@ Read more about authorizers [here](https://docs.onflow.org/concepts/accounts-and
Arguments passed to the Cadence transaction in `Type:Value` format.
The `Type` must be the same as type in the transaction source code for that argument.

⚠️ Deprecated: use command arguments instead.

### Arguments JSON

- Flag: `--args-json`
Expand Down
187 changes: 187 additions & 0 deletions docs/complex-transactions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
---
title: Send Complex Transaction with the Flow CLI
sidebar_title: Build a Complex Transaction
description: How to build and send a complex Flow transaction from the command line
---

The Flow CLI provides commands to build, sign and send transactions allowing you to specify different authorizers, signers and proposers.

The process of sending a complex transactions includes three steps:
1. [build a transaction](/build-transactions/)
2. [sign the built transaction](/sign-transaction/)
3. [send signed transaction](/send-signed-transactions/)

Read more about each command flags and arguments in the above links.

## Examples
We will describe common examples for complex transactions. All examples are using an [example configuration](#configuration).

### Single payer, proposer and authorizer
The simplest Flow transaction declares a single account as the proposer, payer and authorizer.

Build the transaction:
```shell
> flow transactions build tx.cdc
--proposer alice
--payer alice
--authorizer alice
--filter payload --save tx1
```
Sign the transaction:
```shell
> flow transactions sign tx1 --signer alice
--filter payload --save tx2
```
Submit the signed transaction:
```shell
> flow transactions send-signed tx2
```
Transaction content (`tx.cdc`):
```
transaction {
preapre(signer: AuthAccount) {}
execute { ... }
}
```

### Single payer and proposer, multiple authorizers
A transaction that declares same payer and proposer but multiple authorizers each required to sign the transaction. Please note that the order of signing is important, and [the payer must sign last](https://docs.onflow.org/concepts/transaction-signing/#payer-signs-last).

Build the transaction:
```shell
> flow transactions build tx.cdc
--proposer alice
--payer alice
--authorizer bob
--authorizer charlie
--filter payload --save tx1
```
Sign the transaction with authorizers:
```shell
> flow transactions sign tx1 --signer bob
--filter payload --save tx2
```
```shell
> flow transactions sign tx2 --signer charlie
--filter payload --save tx3
```
Sign the transaction with payer:
```shell
> flow transactions sign tx3 --signer alice
--filter payload --save tx4
```
Submit the signed transaction:
```shell
> flow transactions send-signed tx4
```
Transaction content (`tx.cdc`):
```
transaction {
preapre(bob: AuthAccount, charlie: AuthAccount) {}
execute { ... }
}
```

### Different payer, proposer and authorizer
A transaction that declares different payer, proposer and authorizer each signing separately.
Please note that the order of signing is important, and [the payer must sign last](https://docs.onflow.org/concepts/transaction-signing/#payer-signs-last).

Build the transaction:
```shell
> flow transactions build tx.cdc
--proposer alice
--payer bob
--authorizer charlie
--filter payload --save tx1
```
Sign the transaction with proposer:
```shell
> flow transactions sign tx1 --signer alice
--filter payload --save tx2
```
Sign the transaction with authorizer:
```shell
> flow transactions sign tx2 --signer charlie
--filter payload --save tx3
```
Sign the transaction with payer:
```shell
> flow transactions sign tx3 --signer bob
--filter payload --save tx4
```
Submit the signed transaction:
```shell
> flow transactions send-signed tx4
```
Transaction content (`tx.cdc`):
```
transaction {
preapre(charlie: AuthAccount) {}
execute { ... }
}
```

### Single payer, proposer and authorizer but multiple keys
A transaction that declares same payer, proposer and authorizer but the signer account has two keys with half weight, required to sign with both.


Build the transaction:
```shell
> flow transactions build tx.cdc
--proposer dylan1
--payer dylan1
--authorizer dylan1
--filter payload --save tx1
```
Sign the transaction with the first key:
```shell
> flow transactions sign tx1 --signer dylan1
--filter payload --save tx2
```
Sign the transaction with the second key:
```shell
> flow transactions sign tx2 --signer dylan2
--filter payload --save tx3
```
Submit the signed transaction:
```shell
> flow transactions send-signed tx3
```
Transaction content (`tx.cdc`):
```
transaction {
preapre(signer: AuthAccount) {}
execute { ... }
}
```

### Configuration
This is an example configuration using mock values:
```json
{
...
"accounts": {
"alice": {
"address": "0x1",
"key": "111...111"
},
"bob": {
"address": "0x2",
"key": "222...222"
},
"charlie": {
"address": "0x3",
"key": "333...333"
},
"dylan1": {
"address": "0x4",
"key": "444...444"
},
"dylan2": {
"address": "0x4",
"key": "555...555"
}
}
...
}
```
Loading

0 comments on commit 25ab3b9

Please sign in to comment.