Skip to main content

Crate btctax_forms

Crate btctax_forms 

Source
Expand description

btctax-forms — fill the OFFICIAL IRS fillable PDFs (Form 8949 + Schedule D) from btctax’s already-computed tax data. Offline, deterministic, and geometry-verified: every fill is read back from its own serialized bytes and each value’s widget /Rect is checked against a map-independent column/row band re-derived from the PDF itself. A mis-mapped cell fails closed.

§Sub-project 1 (TY2025)

  • Form 8949 — Bitcoin under Box I (short-term) / Box L (long-term), the 1099-DA revision (NOT Box C/F, which read “other than digital asset transactions”). 11 rows per part per page.
  • Schedule D — lines 3 & 7 (ST), 10 & 15 (LT), 16 (total), QOF = No. Lines 17-22 are scoped out (the caller prints a notice).
  • These are static XFA-hybrid PDFs: the fill removes the /AcroForm /XFA layer (else Acrobat shows blank), sets /NeedAppearances, and pins determinism (drops /Info dates + the trailer /ID).

The tax data is REUSED verbatim from the projection (btctax_core::form_8949 / btctax_core::schedule_d) — this crate never recomputes gains.

Structs§

Form1040Fill
The result of a Form 1040 cap-gains fill: the bytes + what was actually written (drives the CLI’s partial-scope + loss notices).
Form1040Inputs
The btctax-evidenced signals that drive the two Form 1040 cells.
Form1040Map
The Form 1040 capital-gains field map for one tax year: the capital-gain amount cell (line 7a in 2025 / line 7 in 2024 / line 13 in 2017) + the Digital-Asset question (absent in 2017).
Form8283Map
The Form 8283 (Rev. 12-2025) field map for one tax year.
Form8949Map
The full Form 8949 field map for one tax year.
ScheduleDMap
The Schedule D field map for one tax year.
ScheduleSeMap
The Schedule SE (Form 1040) field map for one tax year — the filled §1401 line chain.

Enums§

FormsError
Anything that can go wrong filling an official IRS PDF.

Constants§

SE_FLOOR
The §1401 net-earnings STOP floor: Schedule SE is not owed when line 4c (base) is below $400.
SUPPORTED_YEARS
The tax years this build bundles forms + maps for. Each fill dispatches to the year’s committed map + bundled PDF via the Map::for_year constructors; an unlisted year fails closed with FormsError::UnsupportedYear.

Functions§

fill_form_8283
Fill Form 8283 (Noncash Charitable Contributions, Rev. 12-2025) for year from the projected donation rows + DonationDetails. Returns Ok(None) when there are no donations in the year. Fills the donee/appraiser IDENTITY + per-row property data (and, for Section B, checks the “k Digital assets” property-type box); leaves BLANK every OTHER party’s declaration/signature (a LOUD partial-scope notice is the caller’s). More rows than a section holds (4 in Section A / 3 in Section B) overflow onto additional form copies via [overflow::merge_copies].
fill_form_8949
Fill Form 8949 (Part I + Part II) for year from the projection rows and return the PDF bytes. Bitcoin is filed under Box I/L. Parts with > 11 rows paginate: ⌈rows/11⌉ page copies per part, each with its own totals; the copies are merged with per-copy field renaming so no two share a value. Every copy is geometry-verified before merge.
fill_form_1040_capgains
Fill the capital-gains cells of Form 1040 for year: line 7a (only when Schedule D is ACTIVE and line 16 ≥ 0; active-and-zero → “-0-”) and the Digital-Asset Yes/No question (YES iff there is btctax-evidenced qualifying activity). Returns Ok(None)skip the whole 1040 — when there is no reportable activity (the DA answer would be blank and there is no 7a value). 7b checkboxes are left untouched; a NET LOSS leaves 7a blank (the §1211 line-21 cap is the filer’s). A partial-scope notice enumerating exactly what was filled is the caller’s.
fill_schedule_d
Fill Schedule D for year from the part totals and return the PDF bytes.
fill_schedule_se
Fill Schedule SE (Form 1040) for year from the computed §1401 SeTaxResult, the filer’s Form W-2 Social Security wages (line 8a), and the year’s Social Security wage base (line 7). Returns Ok(None) when net SE earnings are below the $400 floor (no SE tax owed — the form is not written). Line 12 = SS + regular Medicare only (the 0.9% Additional Medicare Tax is a Form 8959 item, not on Schedule SE); when se.addl > 0 the caller prints a Form 8959 advisory.
rows_possibly_broker_reported
[I5] How many rows might belong on a SEPARATE 1099-DA-reported Form 8949 (Box G/H/J/K) — i.e. disposals on an exchange that may have issued broker basis reporting. SP1 files EVERY Bitcoin row under Box I/L and says so; a non-zero count is a loud advisory, not a refusal.
stamp_draft_watermark
Stamp a diagonal DRAFT — ESTIMATE, NOT FOR FILING watermark on every page of a filled form. Applied by the CLI when the ledger is pseudo-reconciled (an estimate). The overlay carries its own embedded standard font resource, orthogonal to /NeedAppearances.