Skip to content

feat: add wallet utilities and C-API improvements#200

Merged
fpelliccioni merged 1 commit intomasterfrom
feat/wallet-utilities
Mar 26, 2026
Merged

feat: add wallet utilities and C-API improvements#200
fpelliccioni merged 1 commit intomasterfrom
feat/wallet-utilities

Conversation

@fpelliccioni
Copy link
Copy Markdown
Contributor

@fpelliccioni fpelliccioni commented Mar 24, 2026

Summary

  • Add P2SH unlocking script placeholder for transaction size estimation
  • Add encoded_token() method on payment_address for CashToken-aware addresses
  • Expose kth_ripemd160_hash() in C-API
  • Add outputpoint_list type to C-API
  • Skip tests in Emscripten WASM builds (build-create-ems.sh)
  • Clarify token_data id field documentation

Test plan

  • Verify WASM build with build-create-ems.sh
  • Verify native build compiles cleanly
  • Test encoded_token() returns correct CashToken address format
  • Test kth_ripemd160_hash() produces correct hashes

Note

Medium Risk
Medium risk because it adds new wallet address encoding and script-construction helpers that affect transaction sizing/serialization, plus expands the public C-API surface. Changes are mostly additive, but downstream integrations may need updates and outputs should be validated for correctness.

Overview
Adds several new C-API capabilities: kth_ripemd160_hash(), a new kth_outputpoint_list_t list type (wired into CMakeLists.txt, primitives.h, capi.h, and conversion helpers), and a BCH-only kth_wallet_payment_address_encoded_token() wrapper.

Extends domain wallet/script utilities by adding payment_address::encoded_token() (CashToken-aware CashAddr) and a new script(_basis)::to_pay_script_hash_pattern_unlocking_placeholder(script_size, multisig) helper for building placeholder P2SH unlocking scripts (with optional CHECKMULTISIG dummy) useful for size estimation. Build tooling is updated to skip tests in Emscripten Conan builds and to auto-enable ccache in native build.sh/rebuild.sh; token_data_t::id is clarified with a comment.

Written by Cursor Bugbot for commit 91308d6. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • C API: support for output-point lists with conversion utilities.
    • C API: RIPEMD-160 hashing exposed for byte-span inputs.
    • Domain: script pattern generator for pay-to-script-hash unlocking placeholders.
    • Wallet (BCH): token-aware address encoding accessor and corresponding C API.
  • Chores

    • Build tooling: option to disable tests during package/lock creation and optional use of ccache for faster builds.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 24, 2026

📝 Walkthrough

Walkthrough

Adds RIPEMD-160 C API hash, a new C outputpoint list type with converters and wiring, BCH token-aware address encoding (C++ and C API), script‑hash unlocking-placeholder factories, Conan lock/create option to disable tests, ccache usage in build scripts, and a minor token_data comment.

Changes

Cohort / File(s) Summary
Build scripts & presets
scripts/build-create-ems.sh, scripts/build.sh, scripts/rebuild.sh
Conan lock/create invocations now pass -o tests=False; build/rebuild scripts detect ccache and add -DCMAKE_*_COMPILER_LAUNCHER=ccache when available.
CMake / C-API build
src/c-api/CMakeLists.txt
Adds src/chain/outputpoint_list.cpp to sources and installs its public header.
C API — OutputPoint List
src/c-api/include/kth/capi/chain/outputpoint_list.h, src/c-api/include/kth/capi/primitives.h, src/c-api/include/kth/capi/conversions.hpp, src/c-api/src/chain/outputpoint_list.cpp
Introduces kth_outputpoint_list_t typedef, public list header, converter declaration, and list implementation bindings for chain output points (C↔C++).
C API — Hashing
src/c-api/include/kth/capi/hash.h, src/c-api/src/hash.cpp
Adds exported kth_ripemd160_hash(uint8_t const* data, kth_size_t size) -> kth_shorthash_t.
C API — Payment address (BCH)
src/c-api/include/kth/capi/wallet/payment_address.h, src/c-api/src/wallet/payment_address.cpp
Adds BCH-only kth_wallet_payment_address_encoded_token(kth_payment_address_t) returning a newly allocated C string.
Domain — Script placeholders
src/domain/include/kth/domain/chain/script.hpp, src/domain/include/kth/domain/chain/script_basis.hpp, src/domain/src/chain/script.cpp, src/domain/src/chain/script_basis.cpp
Adds to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size, bool multisig) declaration and implementation: basis creates zero-filled script chunk (optionally prepends OP_0 for multisig); script delegates to basis.
Domain — BCH Payment Address
src/domain/include/kth/domain/wallet/payment_address.hpp, src/domain/src/wallet/payment_address.cpp
Adds BCH-only payment_address::encoded_token() that returns token-aware CashAddr encoding.
Misc / Small changes
src/c-api/include/kth/capi/capi.h, src/domain/include/kth/domain/chain/token_data.hpp
Umbrella C API header now includes chain/outputpoint_list.h; added inline comment on token_data_t::id ("id or category").

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐇 I nibble bytes and weave a thread,
New lists and hashes hop ahead,
BCH tokens snug and neat,
Placeholder scripts with zeroed feet,
Builds skip tests — a tiny treat!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 29.41% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main changes: adding wallet utilities (payment_address::encoded_token) and C-API improvements (new functions and list type).

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wallet-utilities

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
src/domain/include/kth/domain/wallet/payment_address.hpp (1)

105-108: LGTM! Declaration follows existing patterns.

The method declaration is properly guarded with #if defined(KTH_CURRENCY_BCH) and uses [[nodiscard]] consistently with other encoding methods.

Optional consideration: The relevant code snippets show that encoded_legacy() and encoded_cashaddr() both have corresponding C API bindings in payment_address.h. You may want to add a kth_wallet_payment_address_encoded_token() binding for API consistency, though users can achieve the same result via kth_wallet_payment_address_encoded_cashaddr(addr, true).

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/domain/include/kth/domain/wallet/payment_address.hpp` around lines 105 -
108, Add a C API binding for the new encoded_token() C++ method to maintain API
consistency: implement a kth_wallet_payment_address_encoded_token(...) function
that mirrors the behavior of encoded_token() and follows the pattern used by
kth_wallet_payment_address_encoded_legacy() /
kth_wallet_payment_address_encoded_cashaddr(), delegating to
payment_address::encoded_token() (or the corresponding wrapper) and returning a
C string or error in the same way other encoded bindings do; ensure the new
binding is guarded by the same KTH_CURRENCY_BCH preprocessor condition and
included in the payment_address.h/C source pair.
src/domain/src/chain/script_basis.cpp (1)

580-586: Add a defensive upper bound on script_size before allocating.

This helper currently trusts script_size entirely; a simple cap avoids accidental large allocations from upstream misuse.

Proposed defensive guard
 operation::list script_basis::to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size) {
+    if (script_size > static_absolute_max_block_size()) {
+        return {};
+    }
     data_chunk placeholder_script(script_size, 0);
     return operation::list {
         operation(opcode::push_size_0),
         operation(std::move(placeholder_script))
     };
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/domain/src/chain/script_basis.cpp` around lines 580 - 586, The helper
script_basis::to_pay_script_hash_pattern_unlocking_placeholder currently
allocates data_chunk(script_size, 0) with an unchecked script_size; add a
defensive upper bound by clamping or validating script_size before allocation
(e.g., compare against a defined MAX_SCRIPT_PLACEHOLDER_SIZE constant and either
cap it or return/error if exceeded) so that data_chunk(…) cannot allocate
arbitrarily large memory; update the function to use the validated/clamped size
when constructing placeholder_script and document the
MAX_SCRIPT_PLACEHOLDER_SIZE constant near the function or in the header.
src/domain/include/kth/domain/chain/script.hpp (1)

249-250: Clarify what script_size represents in this API.

A short contract comment here (e.g., “redeem-script raw bytes length”) will reduce caller ambiguity and avoid estimation drift.

Proposed doc clarification
     static
+    // `script_size` is the raw redeem-script byte length (without outer scriptSig varint).
     operation::list to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/domain/include/kth/domain/chain/script.hpp` around lines 249 - 250, Add a
short contract comment for the function declaration to clarify what the
script_size parameter means: indicate that in
to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size) the
script_size represents the redeem script's raw byte length (i.e., the exact
serialized size of the script being paid-to) and any expectations about whether
it includes witness/version bytes or only scriptPubKey/redeemScript bytes; place
this one-line description immediately above the function declaration to remove
caller ambiguity and avoid size-estimation drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@scripts/build-create-ems.sh`:
- Around line 15-18: The first conan lock create that generates conan-wasm.lock
is missing the option overrides, causing inconsistent lockfile options; update
the initial `conan lock create conanfile.py --version="${VERSION}"
--lockfile=conan-wasm.lock --update -pr ems2` invocation to include `-o
consensus=False -o tests=False` so it matches the subsequent `conan lock create
... --lockfile-out=build/conan.lock -pr ems2 -o consensus=False -o tests=False`
and the later `conan create` call, ensuring consistent dependency resolution and
lockfile contents.

In `@src/c-api/CMakeLists.txt`:
- Line 240: The CMake kth_headers list is missing the header corresponding to
the newly added source src/chain/outputpoint_list.cpp; update the kth_headers
list to include include/kth/capi/chain/outputpoint_list.h alongside the other
chain headers (e.g. point_list.h and output_list.h) so the header is installed
by cmake --install.

In `@src/c-api/src/chain/outputpoint_list.cpp`:
- Line 16: The list definition outputpoint_list stores
std::vector<kth::domain::chain::point> but the converter
kth_chain_output_point_const_cpp produces kth::domain::chain::output_point,
causing object slicing of output_point-specific fields; fix by making the
container hold std::vector<kth::domain::chain::output_point> and keep using
kth_chain_output_point_const_cpp, or alternatively change the converter to
kth_chain_point_const_cpp so the converter and stored element type match; update
the KTH_LIST_DEFINE invocation for outputpoint_list (and the typedef
kth_outputpoint_list_t) to use the matching element type/converter pair
(kth::domain::chain::output_point with kth_chain_output_point_const_cpp or
kth::domain::chain::point with kth_chain_point_const_cpp).

---

Nitpick comments:
In `@src/domain/include/kth/domain/chain/script.hpp`:
- Around line 249-250: Add a short contract comment for the function declaration
to clarify what the script_size parameter means: indicate that in
to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size) the
script_size represents the redeem script's raw byte length (i.e., the exact
serialized size of the script being paid-to) and any expectations about whether
it includes witness/version bytes or only scriptPubKey/redeemScript bytes; place
this one-line description immediately above the function declaration to remove
caller ambiguity and avoid size-estimation drift.

In `@src/domain/include/kth/domain/wallet/payment_address.hpp`:
- Around line 105-108: Add a C API binding for the new encoded_token() C++
method to maintain API consistency: implement a
kth_wallet_payment_address_encoded_token(...) function that mirrors the behavior
of encoded_token() and follows the pattern used by
kth_wallet_payment_address_encoded_legacy() /
kth_wallet_payment_address_encoded_cashaddr(), delegating to
payment_address::encoded_token() (or the corresponding wrapper) and returning a
C string or error in the same way other encoded bindings do; ensure the new
binding is guarded by the same KTH_CURRENCY_BCH preprocessor condition and
included in the payment_address.h/C source pair.

In `@src/domain/src/chain/script_basis.cpp`:
- Around line 580-586: The helper
script_basis::to_pay_script_hash_pattern_unlocking_placeholder currently
allocates data_chunk(script_size, 0) with an unchecked script_size; add a
defensive upper bound by clamping or validating script_size before allocation
(e.g., compare against a defined MAX_SCRIPT_PLACEHOLDER_SIZE constant and either
cap it or return/error if exceeded) so that data_chunk(…) cannot allocate
arbitrarily large memory; update the function to use the validated/clamped size
when constructing placeholder_script and document the
MAX_SCRIPT_PLACEHOLDER_SIZE constant near the function or in the header.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9d8b307d-8875-45a6-8f73-e748d40302f3

📥 Commits

Reviewing files that changed from the base of the PR and between 6cc8bce and 6aaccbb.

📒 Files selected for processing (15)
  • scripts/build-create-ems.sh
  • src/c-api/CMakeLists.txt
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/include/kth/capi/conversions.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/c-api/include/kth/capi/primitives.h
  • src/c-api/src/chain/outputpoint_list.cpp
  • src/c-api/src/hash.cpp
  • src/domain/include/kth/domain/chain/script.hpp
  • src/domain/include/kth/domain/chain/script_basis.hpp
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/domain/include/kth/domain/wallet/payment_address.hpp
  • src/domain/src/chain/script.cpp
  • src/domain/src/chain/script_basis.cpp
  • src/domain/src/wallet/payment_address.cpp

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 24, 2026

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 47.58%. Comparing base (561b3fb) to head (91308d6).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/domain/src/chain/script_basis.cpp 0.00% 5 Missing ⚠️
src/domain/src/chain/script.cpp 0.00% 2 Missing ⚠️
src/domain/src/wallet/payment_address.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #200      +/-   ##
==========================================
- Coverage   47.61%   47.58%   -0.03%     
==========================================
  Files         326      326              
  Lines       16066    16075       +9     
  Branches     5826     5829       +3     
==========================================
  Hits         7650     7650              
- Misses       6242     6251       +9     
  Partials     2174     2174              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@fpelliccioni fpelliccioni force-pushed the feat/wallet-utilities branch from 6aaccbb to d295a3b Compare March 26, 2026 16:14
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/domain/include/kth/domain/wallet/payment_address.hpp`:
- Around line 106-107: Add a C-API wrapper to expose
payment_address::encoded_token(): declare and implement a function named e.g.
kth_payment_address_encoded_token that accepts the C payment_address handle
(kth_payment_address_t const* or equivalent), checks for null, calls the C++
method payment_address::encoded_token(), converts/allocates the returned
std::string into the C string/return type used by the existing C-API (consistent
with other wrappers), and ensure ownership/cleanup semantics match other C-API
string-returning functions; add the declaration to the C-API header and the
forwarding implementation to the C-API source alongside the other
payment_address wrappers.

In `@src/domain/src/chain/script_basis.cpp`:
- Around line 580-586: The placeholder function
script_basis::to_pay_script_hash_pattern_unlocking_placeholder currently always
prepends opcode::push_size_0 (the multisig dummy OP_0) which inflates size/fee;
change the signature to accept an optional flag (e.g., bool
include_multisig_dummy = false) and only push opcode::push_size_0 when that flag
is true, otherwise return only the placeholder_script operation; update callers
that expect a multisig placeholder to pass true and leave others unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 64a575ea-6780-4520-9192-cb672dee2509

📥 Commits

Reviewing files that changed from the base of the PR and between 6aaccbb and d295a3b.

📒 Files selected for processing (15)
  • scripts/build-create-ems.sh
  • src/c-api/CMakeLists.txt
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/include/kth/capi/conversions.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/c-api/include/kth/capi/primitives.h
  • src/c-api/src/chain/outputpoint_list.cpp
  • src/c-api/src/hash.cpp
  • src/domain/include/kth/domain/chain/script.hpp
  • src/domain/include/kth/domain/chain/script_basis.hpp
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/domain/include/kth/domain/wallet/payment_address.hpp
  • src/domain/src/chain/script.cpp
  • src/domain/src/chain/script_basis.cpp
  • src/domain/src/wallet/payment_address.cpp
✅ Files skipped from review due to trivial changes (6)
  • src/c-api/include/kth/capi/primitives.h
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/src/hash.cpp
  • src/c-api/CMakeLists.txt
  • src/c-api/src/chain/outputpoint_list.cpp
  • src/domain/include/kth/domain/chain/token_data.hpp
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/c-api/include/kth/capi/hash.h
  • src/domain/include/kth/domain/chain/script.hpp
  • src/c-api/include/kth/capi/conversions.hpp
  • src/domain/src/chain/script.cpp
  • src/domain/src/wallet/payment_address.cpp
  • scripts/build-create-ems.sh

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

@fpelliccioni fpelliccioni force-pushed the feat/wallet-utilities branch from d295a3b to a2151eb Compare March 26, 2026 16:26
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (1)
src/domain/src/chain/script_basis.cpp (1)

580-586: ⚠️ Potential issue | 🟠 Major

Make OP_0 optional in the generic P2SH unlocking placeholder.

Line 583 unconditionally adds opcode::push_size_0. That byte is only needed for CHECKMULTISIG-style redeem paths, so this overestimates size/fees for other P2SH scripts.

Proposed fix
-operation::list script_basis::to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size) {
+operation::list script_basis::to_pay_script_hash_pattern_unlocking_placeholder(size_t script_size, bool include_multisig_dummy) {
     data_chunk placeholder_script(script_size, 0);
-    return operation::list {
-        operation(opcode::push_size_0),
-        operation(std::move(placeholder_script))
-    };
+    operation::list ops;
+    ops.reserve(include_multisig_dummy ? 2 : 1);
+    if (include_multisig_dummy) {
+        ops.emplace_back(opcode::push_size_0);
+    }
+    ops.emplace_back(std::move(placeholder_script));
+    return ops;
 }

Based on learnings: prior fee over-estimation in this repository already caused false insufficient_amount outcomes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/domain/src/chain/script_basis.cpp` around lines 580 - 586, The current
to_pay_script_hash_pattern_unlocking_placeholder unconditionally prepends
opcode::push_size_0, which overestimates size for non-multisig P2SH; change the
function signature
(script_basis::to_pay_script_hash_pattern_unlocking_placeholder) to accept a
boolean flag (e.g., include_op0 or is_multisig) defaulting to false, and only
push opcode::push_size_0 into the returned operation::list when that flag is
true; keep creating the placeholder_script and pushing it as before
(operation(std::move(placeholder_script))), and update any callers to pass true
where a CHECKMULTISIG-style redeem path is expected.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@src/domain/src/chain/script_basis.cpp`:
- Around line 580-586: The current
to_pay_script_hash_pattern_unlocking_placeholder unconditionally prepends
opcode::push_size_0, which overestimates size for non-multisig P2SH; change the
function signature
(script_basis::to_pay_script_hash_pattern_unlocking_placeholder) to accept a
boolean flag (e.g., include_op0 or is_multisig) defaulting to false, and only
push opcode::push_size_0 into the returned operation::list when that flag is
true; keep creating the placeholder_script and pushing it as before
(operation(std::move(placeholder_script))), and update any callers to pass true
where a CHECKMULTISIG-style redeem path is expected.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a027e6c0-fcf0-4d1b-a2c2-eec5c9406c17

📥 Commits

Reviewing files that changed from the base of the PR and between d295a3b and a2151eb.

📒 Files selected for processing (15)
  • scripts/build-create-ems.sh
  • src/c-api/CMakeLists.txt
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/include/kth/capi/conversions.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/c-api/include/kth/capi/primitives.h
  • src/c-api/src/chain/outputpoint_list.cpp
  • src/c-api/src/hash.cpp
  • src/domain/include/kth/domain/chain/script.hpp
  • src/domain/include/kth/domain/chain/script_basis.hpp
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/domain/include/kth/domain/wallet/payment_address.hpp
  • src/domain/src/chain/script.cpp
  • src/domain/src/chain/script_basis.cpp
  • src/domain/src/wallet/payment_address.cpp
✅ Files skipped from review due to trivial changes (2)
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/CMakeLists.txt
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/domain/include/kth/domain/chain/script_basis.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/domain/include/kth/domain/chain/script.hpp
  • src/domain/include/kth/domain/wallet/payment_address.hpp
  • src/domain/src/chain/script.cpp
  • scripts/build-create-ems.sh
  • src/c-api/include/kth/capi/conversions.hpp
  • src/domain/src/wallet/payment_address.cpp
  • src/c-api/src/chain/outputpoint_list.cpp

@fpelliccioni fpelliccioni force-pushed the feat/wallet-utilities branch from a2151eb to 53d0887 Compare March 26, 2026 16:38
- Add P2SH unlocking script placeholder for transaction size estimation
- Add encoded_token() method on payment_address for CashToken addresses
- Expose kth_ripemd160_hash() in C-API
- Add outputpoint_list type to C-API
- Skip tests in Emscripten WASM builds (build-create-ems.sh)
- Clarify token_data id field documentation
@fpelliccioni fpelliccioni force-pushed the feat/wallet-utilities branch from 53d0887 to 91308d6 Compare March 26, 2026 22:25
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/rebuild.sh (1)

33-43: LGTM! Consistent with build.sh.

The ccache integration mirrors the changes in build.sh, which is good for consistency.

Note: Both build.sh and rebuild.sh now share identical ccache detection logic (lines 33-36). If these scripts continue to diverge, consider extracting common utilities to a shared helper script (e.g., scripts/common.sh) to reduce maintenance burden. This is optional for now given the small scope.

,

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@scripts/rebuild.sh` around lines 33 - 43, Duplicate ccache-detection logic
(the CCACHE_OPT variable and the `command -v ccache` check) exists in rebuild.sh
and build.sh; extract this into a shared helper (eg. a new function
detect_ccache or set_ccache_opts in a common script) and have both scripts
source that helper so they set CCACHE_OPT consistently, then ensure the cmake
invocation still uses $CCACHE_OPT; update rebuild.sh to remove the inline
detection and call the shared function/variable instead.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@scripts/rebuild.sh`:
- Around line 33-43: Duplicate ccache-detection logic (the CCACHE_OPT variable
and the `command -v ccache` check) exists in rebuild.sh and build.sh; extract
this into a shared helper (eg. a new function detect_ccache or set_ccache_opts
in a common script) and have both scripts source that helper so they set
CCACHE_OPT consistently, then ensure the cmake invocation still uses
$CCACHE_OPT; update rebuild.sh to remove the inline detection and call the
shared function/variable instead.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 14185056-9630-41fd-b017-b3bfccc06879

📥 Commits

Reviewing files that changed from the base of the PR and between a2151eb and 91308d6.

📒 Files selected for processing (20)
  • scripts/build-create-ems.sh
  • scripts/build.sh
  • scripts/rebuild.sh
  • src/c-api/CMakeLists.txt
  • src/c-api/include/kth/capi/capi.h
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/include/kth/capi/conversions.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/c-api/include/kth/capi/primitives.h
  • src/c-api/include/kth/capi/wallet/payment_address.h
  • src/c-api/src/chain/outputpoint_list.cpp
  • src/c-api/src/hash.cpp
  • src/c-api/src/wallet/payment_address.cpp
  • src/domain/include/kth/domain/chain/script.hpp
  • src/domain/include/kth/domain/chain/script_basis.hpp
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/domain/include/kth/domain/wallet/payment_address.hpp
  • src/domain/src/chain/script.cpp
  • src/domain/src/chain/script_basis.cpp
  • src/domain/src/wallet/payment_address.cpp
✅ Files skipped from review due to trivial changes (5)
  • src/c-api/include/kth/capi/capi.h
  • src/c-api/include/kth/capi/primitives.h
  • src/domain/include/kth/domain/chain/token_data.hpp
  • src/c-api/include/kth/capi/chain/outputpoint_list.h
  • src/c-api/src/chain/outputpoint_list.cpp
🚧 Files skipped from review as they are similar to previous changes (6)
  • scripts/build-create-ems.sh
  • src/domain/src/wallet/payment_address.cpp
  • src/c-api/include/kth/capi/conversions.hpp
  • src/domain/include/kth/domain/chain/script.hpp
  • src/c-api/include/kth/capi/hash.h
  • src/c-api/CMakeLists.txt

@fpelliccioni fpelliccioni merged commit aa19ea3 into master Mar 26, 2026
27 checks passed
@fpelliccioni fpelliccioni deleted the feat/wallet-utilities branch March 26, 2026 22:29
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

Successfully merging this pull request may close these issues.

1 participant