Previous << Create Emulator Snapshot
Next >> Send a Transaction
Flow CLIは、いずれかのFlow Access APIを通してFlow実行ノード上にCadenceスクリプトを実行するコマンドを提供しています。
flow scripts execute <filename> [<argument> <argument>...] [flags]
Example Usage
# Execute a script on Flow Testnet
> flow scripts execute script.cdc "Hello" "World"
"Hello World"
Script source code:
access(all) fun main(greeting: String, who: String): String {
return greeting.concat(" ").concat(who)
}
Arguments
Filename
- Name:
filename
- Valid inputs: a path in the current filesystem.
最初の引数は、実行するスクリプトを含むCadenceファイルへのパスです。
Arguments
- Name:
argument
- Valid inputs: valid cadence values matching argument type in script code.
ソースコードの型に一致する引数の値を、同じ順序で入力して渡します。オプショナルの引数がある場合にはあなたはnil
を値として次のように渡すことができます。:flow scripts execute script.cdc nil
Flags
Arguments JSON
- Flag:
--args-json
- Valid inputs: arguments in JSON-Cadence form.
- Example:
flow scripts execute script.cdc '[{"type": "String", "value": "Hello World"}]'
Cadenceスクリプトに渡される引数はCadence JSONフォーマットで指定します。Cadence JSONフォーマットは、type
およびvalue
のキーを含みます。それぞれこちらで説明されています。
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 20, 2024 by Chase Fleming
翻訳元
Previous << Create Emulator Snapshot
Flow BlockchainのCadence version1.0ドキュメント (Execute a Script)