diff --git a/icepick.toml b/icepick.toml index b3d8ecf..fc47140 100644 --- a/icepick.toml +++ b/icepick.toml @@ -29,16 +29,17 @@ inputs = { token = "token_name" } # we want to store, and the value is the name to be assigned in storage. outputs = { token_address = "token_address", token_decimals = "token_decimals" } -# Load the Blockhash from the SD card +# Load the transaction nonce from the SD card [[module.workflow.step]] type = "internal-load-file" -# Pre-defined values to be passed to the module -values = { filename = "blockhash.json" } +# Pre-defined values to be passed to the module. +# In this case, the `filename` field is reserved for marking which file to load. +values = { filename = "nonce.json" } # This value is marked to be saved in-memory, and can be used as an input for # later steps. -outputs = { blockhash = "blockhash" } +outputs = { nonce_authority = "nonce_authority", nonce_data = "nonce_data", nonce_address = "nonce_address" } [[module.workflow.step]] # Generate an unsigned Transaction @@ -68,7 +69,9 @@ type = "sol-compile" [module.workflow.step.inputs] instructions = "instructions" derivation_accounts = "derivation_accounts" -blockhash = "blockhash" +nonce_address = "nonce_address" +nonce_authority = "nonce_authority" +nonce_data = "nonce_data" [module.workflow.step.outputs] transaction = "unsigned_transaction" @@ -79,7 +82,7 @@ type = "sol-sign" [module.workflow.step.inputs] transaction = "unsigned_transaction" -blockhash = "blockhash" +blockhash = "nonce_data" [module.workflow.step.outputs] transaction = "signed_transaction" @@ -96,19 +99,22 @@ values = { filename = "transaction.json" } # contain the signed transaction. inputs = { transaction = "signed_transaction" } +# NOTE: To get a nonce address, the `generate-nonce-account` workflow should be +# run. It is the only workflow that uses a blockhash, which is why a +# `broadcast-with-blockhash` or similar is not, and should not be, implemented. [[module.workflow]] name = "broadcast" -inputs = ["cluster"] +inputs = ["nonce_address", "cluster"] [[module.workflow.step]] -type = "sol-get-blockhash" -inputs = { cluster = "cluster" } -outputs = { blockhash = "blockhash" } +type = "sol-get-nonce-account-data" +inputs = { nonce_address = "nonce_address", cluster = "cluster" } +outputs = { authority = "nonce_authority", durable_nonce = "nonce" } [[module.workflow.step]] type = "internal-save-file" -values = { filename = "blockhash.json" } -inputs = { blockhash = "blockhash" } +values = { filename = "nonce.json" } +inputs = { nonce_authority = "nonce_authority", nonce_data = "nonce", nonce_address = "nonce_address" } [[module.workflow.step]] type = "internal-load-file" @@ -176,13 +182,14 @@ inputs = { status = "status", url = "url", nonce_account = "nonce_pubkey" } outputs = { status = "status", url = "url", nonce_account = "nonce_account" } [[module.workflow]] -name = "transfer-online-nonced" -inputs = ["nonce_address", "to_address", "from_address", "amount", "cluster"] +# Transfer SOL from one address to another. +name = "transfer" +inputs = ["to_address", "from_address", "amount"] [[module.workflow.step]] -type = "sol-get-nonce-account-data" -inputs = { nonce_address = "nonce_address", cluster = "cluster" } -outputs = { authority = "nonce_authority", durable_nonce = "nonce" } +type = "internal-load-file" +values = { filename = "nonce.json" } +outputs = { nonce_authority = "nonce_authority", nonce_data = "nonce_data", nonce_address = "nonce_address" } [[module.workflow.step]] type = "sol-transfer" @@ -195,9 +202,9 @@ type = "sol-compile" [module.workflow.step.inputs] instructions = "instructions" derivation_accounts = "derivation_accounts" -nonce_data = "nonce" nonce_address = "nonce_address" -nonce_authority = "from_address" +nonce_authority = "nonce_authority" +nonce_data = "nonce_data" [module.workflow.step.outputs] transaction = "unsigned_transaction" @@ -205,46 +212,11 @@ transaction = "unsigned_transaction" [[module.workflow.step]] type = "sol-sign" -inputs = { blockhash = "nonce", transaction = "unsigned_transaction" } +inputs = { blockhash = "nonce_data", transaction = "unsigned_transaction" } outputs = { transaction = "signed_transaction" } [[module.workflow.step]] -type = "sol-broadcast" -inputs = { cluster = "cluster", transaction = "signed_transaction" } -outputs = { status = "status", url = "url" } +type = "internal-save-file" -[[module.workflow]] -name = "transfer-online" -inputs = ["to_address", "from_address", "amount", "cluster"] - -[[module.workflow.step]] -type = "sol-get-blockhash" -inputs = { cluster = "cluster" } -outputs = { blockhash = "blockhash" } - -[[module.workflow.step]] -type = "sol-transfer" -inputs = { from_address = "from_address", to_address = "to_address", amount = "amount" } -outputs = { instructions = "instructions", derivation_accounts = "derivation_accounts" } - -[[module.workflow.step]] -type = "sol-compile" - -[module.workflow.step.inputs] -instructions = "instructions" -derivation_accounts = "derivation_accounts" -blockhash = "blockhash" - -[module.workflow.step.outputs] -transaction = "unsigned_transaction" - -[[module.workflow.step]] -type = "sol-sign" - -inputs = { blockhash = "blockhash", transaction = "unsigned_transaction" } -outputs = { transaction = "signed_transaction" } - -[[module.workflow.step]] -type = "sol-broadcast" -inputs = { cluster = "cluster", transaction = "signed_transaction" } -outputs = { status = "status", url = "url" } +values = { filename = "transaction.json" } +inputs = { transaction = "signed_transaction" }