[[module]] name = "sol" derivation_prefix = "m/44'/501'/0'" algorithm = "Ed25519" [[module.workflow]] # The name of the workflow, which can be called by: # `icepick workflow sol transfer-token` name = "transfer-token" # These values are used as inputs for other workflows, acquired from the CLI. # These values can only be strings, but other values can be any value that can # be serialized by serde_json::Value. # These values can also be loaded using "internal-load-file", using some form # of later-defined signature validation. inputs = ["from_address", "to_address", "token_name", "token_amount"] ## Load the Blockhash from the SD card #[[module.workflow.step]] #type = "internal-load-file" # ## Pre-defined values to be passed to the module #values = { filename = "blockhash.json" } # ## This value is marked to be saved in-memory, and can be used as an input for ## later steps. #outputs = { blockhash = "blockhash" } # Get the token address and token decimals for the given token [[module.workflow.step]] type = "sol-get-token-info" # The key is the key that is passed to the program in the # `values` field. The value is the item in storage. In this case, # we read a `token-name` from our input, but the operation expects `token`. inputs = { token = "token_name" } # Because these two fields are currently unused in our storage, we can grab # them from the outputs of our module. The key is the key of the output value # we want to store, and the value is the name to be assigned in storage. outputs = { token_address = "token_address", token_decimals = "token_decimals" } # Get a blockhash [[module.workflow.step]] type = "sol-get-blockhash" outputs = { blockhash = "blockhash" } [[module.workflow.step]] # Generate an unsigned Transaction # This step MUST run immediately before sol-sign, as in the current version of # Icepick, keys are only held in memory in-between a single module invocation. type = "sol-transfer-token" # If using a lot of inputs, it may be best to use a non-inline table. # Non-inline tables _must_ be the last step, as otherwise, `outputs` for # example would be considered a member of `inputs`. In this case, we use a # non-inline table for `outputs` even though it would fit on one line, to avoid # the ambiguity. [module.workflow.step.inputs] amount = "token_amount" token_address = "token_address" decimals = "token_decimals" to_address = "to_address" from_address = "from_address" [module.workflow.step.outputs] transaction = "unsigned_transaction" # Sign the transaction [[module.workflow.step]] type = "sol-sign" [module.workflow.step.inputs] transaction = "unsigned_transaction" blockhash = "blockhash" [module.workflow.step.outputs] transaction = "signed_transaction" ## Write the signed transaction to a file #[[module.workflow.step]] #type = "internal-save-file" # ## We are using a static filename here, so we use `values` instead of `inputs`. #values = { filename = "transaction.json" } # ## All fields in both `inputs` and `values`, other than `filename`, will be ## persisted to the file. In this case, the `transaction` field of the file will ## contain the signed transaction. #inputs = { transaction = "signed_transaction" }