Commit fed440f
feat: add comprehensive transaction building to wallet FFI
This commit adds production-ready transaction building functionality to the
key-wallet-ffi layer, enabling C/Swift clients to create and sign transactions.
New FFI Functions:
1. wallet_build_and_sign_transaction() - Comprehensive transaction builder that:
- Selects UTXOs using Branch and Bound coin selection algorithm
- Calculates fees based on fee_per_kb rate
- Generates change addresses from internal address pool
- Derives private keys from root extended key for signing
- Returns fully signed, serialized transaction bytes
2. transaction_get_txid_from_bytes() - Utility function that:
- Deserializes raw transaction bytes
- Returns hex-encoded TXID as C string
Implementation Details:
- Integrates with ManagedWalletInfo for UTXO tracking and address management
- Uses TransactionBuilder pattern with proper fee calculation
- Maps addresses to derivation paths for key derivation
- Comprehensive error handling with FFIError propagation
- Proper memory management following FFI safety patterns
- Updated wallet_build_transaction() to direct users to new combined function
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent bba5e0c commit fed440f
2 files changed
+415
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3182 | 3182 | | |
3183 | 3183 | | |
3184 | 3184 | | |
3185 | | - | |
| 3185 | + | |
| 3186 | + | |
| 3187 | + | |
| 3188 | + | |
3186 | 3189 | | |
3187 | 3190 | | |
3188 | 3191 | | |
| |||
3227 | 3230 | | |
3228 | 3231 | | |
3229 | 3232 | | |
| 3233 | + | |
| 3234 | + | |
| 3235 | + | |
| 3236 | + | |
| 3237 | + | |
| 3238 | + | |
| 3239 | + | |
| 3240 | + | |
| 3241 | + | |
| 3242 | + | |
| 3243 | + | |
| 3244 | + | |
| 3245 | + | |
| 3246 | + | |
| 3247 | + | |
| 3248 | + | |
| 3249 | + | |
| 3250 | + | |
| 3251 | + | |
| 3252 | + | |
| 3253 | + | |
| 3254 | + | |
| 3255 | + | |
| 3256 | + | |
| 3257 | + | |
| 3258 | + | |
| 3259 | + | |
| 3260 | + | |
| 3261 | + | |
| 3262 | + | |
| 3263 | + | |
| 3264 | + | |
| 3265 | + | |
| 3266 | + | |
3230 | 3267 | | |
3231 | 3268 | | |
3232 | 3269 | | |
| |||
3313 | 3350 | | |
3314 | 3351 | | |
3315 | 3352 | | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
3316 | 3367 | | |
3317 | 3368 | | |
3318 | 3369 | | |
| |||
0 commit comments