0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Send a Transaction

Last updated at Posted at 2024-12-08

Previous << Execute a Script
Next >> Get a Transaction

Flow CLIは、トランザクションに署名してFlow Access APIに送信するためのコマンドを提供しています。

flow transactions send <code filename> [<argument> <argument>...] [flags]

Example Usage

> flow transactions send ./tx.cdc "Hello"
    
Status		 SEALED
ID		b04b6bcc3164f5ee6b77fa502c3a682e0db57fc47e5b8a8ef3b56aae50ad49c8
Payer		f8d6e0586b0a20c7
Authorizers	[f8d6e0586b0a20c7]

Proposal Key:	
    Address	f8d6e0586b0a20c7
    Index	0
    Sequence	0

No Payload Signatures

Envelope Signature 0: f8d6e0586b0a20c7
Signatures (minimized, use --include signatures)

Events:	 None

Code (hidden, use --include code)

Payload (hidden, use --include payload)

複数の引数の例:

> flow transactions send tx1.cdc Foo 1 2 10.9 0x1 '[123,222]' '["a","b"]'

トランザクションコード:

transaction(a: String, b: Int, c: UInt16, d: UFix64, e: Address, f: [Int], g: [String]) {
	prepare(authorizer: &Account) {}
}

上の例では、flow.jsonファイルは次のようになっていると思います。

{
  "accounts": {
    "my-testnet-account": {
      "address": "a2c4941b5f3c7151",
      "key": "12c5dfde...bb2e542f1af710bd1d40b2"
    }
  }
}

ファイルからのJSON形式の引数の例:

> flow transactions send tx1.cdc --args-json "$(cat args.json)"

Arguments

Code Filename

  • Name: code filename
  • Valid inputs: Any filename and path valid on the system.

第1引数は実行するトランザクションを含むCadenceファイルへのパスです。

Arguments

  • Name: argument
  • Valid inputs: valid cadence values matching argument type in transaction code.

ソースコードの型に一致する引数の値を、同じ順序で入力して渡します。オプショナルの引数がある場合にはあなたはnilを値として次のように渡すことができます。:flow transactions send tx.cdc nil

Flags

Include Fields

  • Flag: --include
  • Valid inputs: code, payload

出力結果に含めるフィールドを指定します。テキスト出力のみに適用されます。

Code

  • Flag: --code

⚠️ No longer supported: use filename argument.

Results

  • Flag: --results

⚠️ No longer supported: all transactions will provide result.

Exclude Fields

  • Flag: --exclude
  • Valid inputs: events

出力結果から除外するフィールドを指定します。テキスト出力のみに適用されます。

Signer

  • Flag: --signer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

トランザクションに署名する際に使用するアカウントの名前を指定します。

Proposer

  • Flag: --proposer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

トランザクションに署名する際に提案者として使用するアカウントの名前を指定します。

Payer

  • Flag: --payer
  • Valid inputs: the name of an account defined in the configuration (flow.json)

トランザクションに署名する際にトランザクションフィーの支払者として使用するアカウントの名前を指定します。

Authorizer

  • Flag: --authorizer
  • Valid inputs: the name of a single or multiple comma-separated accounts defined in the configuration (flow.json)

トランザクションで承認者として使用されるアカウントの名前を指定します。複数の承認者を使用する場合は、カンマで区切ってください(例:alice,bob

Arguments JSON

  • Flag: --args-json
  • Valid inputs: arguments in JSON-Cadence form.
  • Example: flow transactions send ./tx.cdc '[{"type": "String", "value": "Hello World"}]'

Cadenceトランザクションに渡される引数はCadence JSONフォーマットで指定します。Cadence JSONフォーマットは、typeおよびvalueのキーを含みます。それぞれこちらで説明されています。

Gas Limit

  • Flag: --gas-limit
  • Valid inputs: an integer greater than zero.
  • Default: 1000

このトランザクションのガスリミットを指定します。

Host

  • Flag: --host
  • Valid inputs: an IP address or hostname.
  • Default: 127.0.0.1:3569 (Flow Emulator)

コマンドの実行に使用する Access API のホスト名を指定します。このフラグは、--network フラグで定義されたホストをすべて上書きします。

Network Key

  • Flag: --network-key
  • Valid inputs: ホストの有効なネットワーク公開鍵の 16 進数文字列

コマンドを実行する際に、セキュアなGRPCクライアントを作成するために使用するAccess APIのネットワーク公開鍵を指定します。

Network

  • Flag: --network
  • Short Flag: -n
  • Valid inputs: the name of a network defined in the configuration (flow.json)
  • Default: emulator

どのネットワークに対してコマンドを実行するのかを指定します。

Filter

  • Flag: --filter
  • Short Flag: -x
  • Valid inputs: a case-sensitive name of the result property.

結果から、唯一の値として取得したいプロパティの名前を指定します。

Output

  • Flag: --output
  • Short Flag: -o
  • Valid inputs: json, inline

コマンド結果のフォーマットを指定します。

Save

  • Flag: --save
  • Short Flag: -s
  • Valid inputs: a path in the current filesystem.

結果を保存したいファイル名を指定してください。

Log

  • Flag: --log
  • Short Flag: -l
  • Valid inputs: none, error, debug
  • Default: info

ログレベルを指定します。コマンド実行中に表示する出力を制御します。

Configuration

  • Flag: --config-path
  • Short Flag: -f
  • Valid inputs: a path in the current filesystem.
  • Default: flow.json

flow.json コンフィギュレーションファイルへのパスを指定します。-f フラグを複数回使用して複数のコンフィグレーションファイルをマージすることもできます。

Version Check

  • Flag: --skip-version-check
  • Default: false

低速な接続を避けて処理を高速化するために、起動時のバージョンチェックをスキップします。

Last updated on Nov 26, 2024 by Giovanni Sanchez

翻訳元


Previous << Execute a Script

Flow BlockchainのCadence version1.0ドキュメント (Send a Transaction)

Next >> Get a Transaction

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?