feat: Download receipt as PDF#875
Conversation
|
@C0mberry is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThis PR adds a "Download as PDF" feature to the Solana Explorer receipt page, generating a structured jsPDF document client-side that includes all on-chain payment details (sender, receiver, amount, fee, signature, memo), an editable supplier/items section for accounting use, a QR code linking to the receipt, and an optional live USD value fetched from a new internal Jupiter Price v3 proxy API. Key additions:
Minor findings:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant ReceiptPage as ReceiptContent (receipt-page.tsx)
participant useTokenPrice
participant PriceAPI as /api/receipt/price/[mint]
participant Jupiter as Jupiter Price v3 API
participant DownloadBtn as DownloadReceiptItem
participant useDownloadReceipt
participant generateReceiptPdf
ReceiptPage->>useTokenPrice: useTokenPrice(mint)
useTokenPrice->>PriceAPI: GET /api/receipt/price/{mintAddress}
PriceAPI->>Jupiter: fetch price/v3?ids={mint}
Jupiter-->>PriceAPI: { usdPrice: number }
PriceAPI-->>useTokenPrice: { price: number } (cached 4h CDN)
useTokenPrice-->>ReceiptPage: PriceResult { price, status }
ReceiptPage->>ReceiptPage: formatUsdValue(parseFloat(total.formatted), price)
ReceiptPage->>DownloadBtn: downloadPdf callback (with usdValue)
User->>DownloadBtn: clicks Download > PDF
DownloadBtn->>useDownloadReceipt: trigger()
useDownloadReceipt->>useDownloadReceipt: stateRef → 'downloading'
useDownloadReceipt->>generateReceiptPdf: download() → loadPdfDeps() + generateReceiptPdf(...)
generateReceiptPdf->>generateReceiptPdf: build jsPDF doc (layout, fields, QR, logo)
generateReceiptPdf-->>useDownloadReceipt: resolved
useDownloadReceipt->>useDownloadReceipt: stateRef → 'downloaded', scheduleReset(2s)
DownloadBtn-->>User: shows ✓ Downloaded!, resets to idle after 2s
Last reviewed commit: d29ad15 |
|
@greptile-apps issue was addressed |
|
@greptile-apps issue was addressed |
dd50d0a to
0ce635e
Compare
|
@greptile-apps issue was addressed |
|
@greptile-apps issue was addressed |
|
@greptile-apps issue was addressed |
rogaldh
left a comment
There was a problem hiding this comment.
Let's fix conflicts, and this is gtg. LGTM
b0fe018 to
1ba0b44
Compare
…g analytics enum values
fd2ef32 to
eddd80c
Compare
Description
Type of change
Screenshots
Testing
Related Issues
HOO-326
Checklist
build:infoscript to update build information