Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composites - food for thoughts #81

Open
lgalabru opened this issue Jun 8, 2024 · 0 comments
Open

Composites - food for thoughts #81

lgalabru opened this issue Jun 8, 2024 · 0 comments

Comments

@lgalabru
Copy link
Member

lgalabru commented Jun 8, 2024

command "stacks::send_contract_call" "std::command_specification" {
    // Warning: forbid collisions
    input "contract_id" {
        description = "contract_id"
        type = "string"
    }
    input "function_name" {
        description = "contract_id"
        type = "string"
    }
    input "contract_id" {
        description = "contract_id"
        type = "string"
    }
    input "wallet" {
        description = "wallet"
        type = "string"
    }
    command "encoding" "stacks::encode_contract_call" {
        // Warning: forbid recursion
        contract_id = "contract_id"
        function_name = "function_name"
        function_args = "function_args"
    }
    command "signing" "stacks::encode_contract_call" {
        transaction_payload_bytes = "encoding.bytes"
        signer = "wallet"
    }
    command "broadcasting" "stacks::encode_contract_call" {
        signed_transaction_bytes = "signing.signed_transaction_bytes"
        confirmations = "confirmations"
        function_args = "function_args"
    }
    output "signed_transaction_bytes" {
        value = action.broadcast_transaction
    }
}
input "contract_id" {
  description = "contract_id"
  type = "string"
}

input "function_name" {
  description = "function_name"
  type = "string"
}

input "function_args" {
  description = "function_args"
  type = "array"
}

input "nonce" {
  description = "nonce"
  type = "number"
}

input "fee" {
  description = "fee"
  type = "number"
}

input "confirmations" {
  description = "confirmations"
  type = "number"
}

input "network_id" {
  description = "network_id"
  type = "string"
}

input "stack_rpc_api_url" {
  description = "stack_rpc_api_url"
  type = "string"
}

input "wallet" {
  description = "wallet"
  type = "link" // ???
}

action "encode_contract_call" "stacks::encode_contract_call" {  
  contract_id = input.contract_id
  function_name = input.function_name
  function_args = input.function_args
}

action "send_contract_call" "action.sign_transaction" {
  transaction_payload_bytes = action.send_contract_call.bytes
  signer = input.wallet
}

action "broadcast_transaction" "stacks::broadcast_transaction" {
  signed_transaction_bytes = action.send_contract_call.signed_transaction_bytes
  confirmations = input.confirmations
}

output "signed_transaction_bytes" {
    value = action.broadcast_transaction
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant