Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
9c31373
refactor(addon-kit): add Strum traits to Type enum and structured Fun…
cds-amal Oct 18, 2025
4fa1f05
refactor(addon-kit): replace string namespaces with Namespace enum
cds-amal Oct 18, 2025
f0604ad
refactor(addon-kit): apply idiomatic Rust patterns to function APIs
cds-amal Oct 18, 2025
e122d3a
refactor(addon-kit): extract type compatibility logic into dedicated …
cds-amal Oct 18, 2025
902e9a0
refactor(addon-kit): derive Display for DiagnosticLevel using Strum
cds-amal Oct 18, 2025
f921c55
Replace string constants with type-safe enums using Strum derives
cds-amal Oct 18, 2025
0ed15dd
Replace internal_key string field with ActionItemKey enum
cds-amal Oct 19, 2025
47e4076
Add enum variants and Ord traits to txtx-addon-kit constants
cds-amal Oct 22, 2025
cb04459
Migrate txtx-core to type-safe constant enums
cds-amal Oct 22, 2025
6eb43e1
Fix Namespace type conversions in txtx-cli
cds-amal Oct 22, 2025
eed812e
Migrate txtx-cloud and txtx-gql to type-safe constant enums
cds-amal Oct 22, 2025
2f003a4
Migrate bitcoin addon to type-safe function signatures
cds-amal Oct 22, 2025
bedaae1
Migrate evm addon to type-safe constant enums
cds-amal Oct 22, 2025
1889b81
Migrate stacks addon to type-safe constant enums
cds-amal Oct 22, 2025
4df7f27
Migrate svm addon to type-safe constant enums
cds-amal Oct 22, 2025
e838e6e
Update Cargo dependency versions
cds-amal Oct 22, 2025
2d64c57
Eliminate DRY violation in Diagnostic constructors
cds-amal Oct 20, 2025
02020b9
Remove redundant per-variant attributes from ActionItemKey
cds-amal Oct 21, 2025
0dcd1c5
Improve ValueStore API ergonomics with impl AsRef<str> and impl ToString
cds-amal Oct 22, 2025
89e349d
Fix post-rebase integration with validation infrastructure
cds-amal Dec 12, 2025
592577d
Add notes for long-lived branch
cds-amal Dec 12, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 46 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ members = [
"crates/txtx-addon-kit",
"crates/txtx-cloud",
"crates/txtx-lsp",
"crates/txtx-supervisor-ui",
"crates/txtx-serve",
"addons/bitcoin",
"addons/evm",
Expand Down Expand Up @@ -46,3 +45,6 @@ txtx-addon-network-svm = { path = "addons/svm/core" }
txtx-addon-telegram = { path = "addons/telegram" }
txtx-addon-sp1 = { path = "addons/sp1" }
uuid = { version = "1.15.1", features = ["v4", "serde", "js"] }

[alias]
build-cli = "build --package txtx-cli --no-default-features --features cli"
7 changes: 4 additions & 3 deletions addons/bitcoin/src/functions/mod.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
use txtx_addon_kit::types::{
diagnostics::Diagnostic,
functions::{arg_checker_with_ctx, fn_diag_with_ctx, FunctionSpecification},
namespace::Namespace,
types::Value,
};

use crate::constants::NAMESPACE;

pub mod opcodes;

pub fn arg_checker(fn_spec: &FunctionSpecification, args: &Vec<Value>) -> Result<(), Diagnostic> {
let checker = arg_checker_with_ctx(NAMESPACE.to_string());
pub fn arg_checker(fn_spec: &FunctionSpecification, args: &[Value]) -> Result<(), Diagnostic> {
let checker = arg_checker_with_ctx(Namespace::from(NAMESPACE));
checker(fn_spec, args)
}
pub fn to_diag(fn_spec: &FunctionSpecification, e: String) -> Diagnostic {
let error_fn = fn_diag_with_ctx(NAMESPACE.to_string());
let error_fn = fn_diag_with_ctx(Namespace::from(NAMESPACE));
error_fn(fn_spec, e)
}

Expand Down
4 changes: 2 additions & 2 deletions addons/bitcoin/src/functions/opcodes/bitwise_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ impl FunctionImplementation for EqualVerify {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Value>,
_args: &[Value],
) -> Result<Value, Diagnostic> {
Ok(BitcoinValue::opcode(BitcoinOpcode::OpEqualVerify.get_code()))
}
Expand Down
12 changes: 6 additions & 6 deletions addons/bitcoin/src/functions/opcodes/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ impl FunctionImplementation for OpZero {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Value>,
_args: &[Value],
) -> Result<Value, Diagnostic> {
Ok(BitcoinValue::opcode(BitcoinOpcode::Op0.get_code()))
}
Expand All @@ -115,15 +115,15 @@ impl FunctionImplementation for PushData {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
args: &Vec<Value>,
args: &[Value],
) -> Result<Value, Diagnostic> {
arg_checker(fn_spec, args)?;
let expected_bytes_length = args.get(0).unwrap().as_integer().unwrap();
Expand Down Expand Up @@ -165,15 +165,15 @@ impl FunctionImplementation for PushData1 {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
args: &Vec<Value>,
args: &[Value],
) -> Result<Value, Diagnostic> {
arg_checker(fn_spec, args)?;
let expected_bytes_length = args.get(0).unwrap().as_integer().unwrap();
Expand Down
8 changes: 4 additions & 4 deletions addons/bitcoin/src/functions/opcodes/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ impl FunctionImplementation for Hash160 {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Value>,
_args: &[Value],
) -> Result<Value, Diagnostic> {
Ok(BitcoinValue::opcode(BitcoinOpcode::OpHash160.get_code()))
}
Expand All @@ -75,15 +75,15 @@ impl FunctionImplementation for CheckSig {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Value>,
_args: &[Value],
) -> Result<Value, Diagnostic> {
Ok(BitcoinValue::opcode(BitcoinOpcode::OpCheckSig.get_code()))
}
Expand Down
4 changes: 2 additions & 2 deletions addons/bitcoin/src/functions/opcodes/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ impl FunctionImplementation for Dup {
fn check_instantiability(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Type>,
_args: &[Type],
) -> Result<Type, Diagnostic> {
unimplemented!()
}

fn run(
_fn_spec: &FunctionSpecification,
_auth_ctx: &AuthorizationContext,
_args: &Vec<Value>,
_args: &[Value],
) -> Result<Value, Diagnostic> {
Ok(BitcoinValue::opcode(BitcoinOpcode::OpDup.get_code()))
}
Expand Down
13 changes: 7 additions & 6 deletions addons/evm/src/commands/actions/call_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ use crate::commands::actions::check_confirmations::CheckEvmConfirmations;
use crate::commands::actions::sign_transaction::SignEvmTransaction;
use crate::constants::{
ABI_ENCODED_RESULT, ADDRESS_ABI_MAP, CONTRACT_ABI, CONTRACT_ADDRESS, RESULT, RPC_API_URL,
TX_HASH,
};
use crate::rpc::EvmRpc;
use crate::typing::{DECODED_LOG_OUTPUT, EVM_ADDRESS, EVM_SIM_RESULT, RAW_LOG_OUTPUT};
use txtx_addon_kit::constants::TX_HASH;
use txtx_addon_kit::constants::SignerKey;

use super::{get_expected_address, get_signer_did};

Expand Down Expand Up @@ -231,14 +232,14 @@ impl CommandImplementation for SignEvmContractCall {
let auth_context = auth_context.clone();

let future = async move {
use txtx_addon_kit::constants::META_DESCRIPTION;
use txtx_addon_kit::constants::DocumentationKey;

use crate::{commands::actions::get_meta_description, constants::CHAIN_ID};

let mut actions = Actions::none();
let mut signer_state = signers.pop_signer_state(&signer_did).unwrap();
if let Some(_) =
signer_state.get_scoped_value(&construct_did.value().to_string(), TX_HASH)
signer_state.get_scoped_value(&construct_did.value().to_string(), SignerKey::TxHash)
{
return Ok((signers, signer_state, Actions::none()));
}
Expand Down Expand Up @@ -297,7 +298,7 @@ impl CommandImplementation for SignEvmContractCall {

let mut values = values.clone();
values.insert(TRANSACTION_PAYLOAD_BYTES, payload.clone());
values.insert(META_DESCRIPTION, Value::string(meta_description));
values.insert(DocumentationKey::MetaDescription, Value::string(meta_description));

signer_state.insert_scoped_value(
&construct_did.to_string(),
Expand Down Expand Up @@ -387,7 +388,7 @@ impl CommandImplementation for SignEvmContractCall {
Err(err) => return Err(err),
};
result.append(&mut res_signing);
values.insert(TX_HASH, result.outputs.get(TX_HASH).unwrap().clone());
values.insert(SignerKey::TxHash, result.outputs.get(SignerKey::TxHash.as_ref()).unwrap().clone());

let mut res = match CheckEvmConfirmations::run_execution(
&construct_did,
Expand Down Expand Up @@ -431,7 +432,7 @@ impl CommandImplementation for SignEvmContractCall {

let future = async move {
let mut result = CommandExecutionResult::new();
result.outputs.insert(TX_HASH.to_string(), inputs.get_value(TX_HASH).unwrap().clone());
result.outputs.insert(SignerKey::TxHash.to_string(), inputs.get_value(SignerKey::TxHash).unwrap().clone());

let call_result = outputs.get_expected_value(RESULT)?;
result.outputs.insert(RESULT.to_string(), call_result.clone());
Expand Down
3 changes: 2 additions & 1 deletion addons/evm/src/commands/actions/check_confirmations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use txtx_addon_kit::types::{
types::Type,
};
use txtx_addon_kit::uuid::Uuid;
use txtx_addon_kit::constants::SignerKey;

use crate::constants::{DEFAULT_CONFIRMATIONS_NUMBER, RPC_API_URL};

Expand Down Expand Up @@ -175,7 +176,7 @@ impl CommandImplementation for CheckEvmConfirmations {
return return_synchronous_result(Ok(result));
}

let tx_hash_bytes = inputs.get_expected_buffer_bytes(TX_HASH)?;
let tx_hash_bytes = inputs.get_expected_buffer_bytes(SignerKey::TxHash)?;
let rpc_api_url = inputs.get_expected_string(RPC_API_URL)?.to_owned();

let progress_symbol = ["|", "/", "-", "\\", "|", "/", "-", "\\"];
Expand Down
Loading
Loading