feat(invoice): emit EscrowReleasedEvent with minimal payload on release_escrow#183
Open
Markadrian6399 wants to merge 2 commits into
Open
Conversation
…se_escrow Define a dedicated EscrowReleasedEvent contracttype with only the fields indexers need (id, merchant, amount_usdc, released_at) and update escrow_released() to publish it instead of the full Invoice struct. Leaner payloads reduce Soroban event storage costs and make deserialization simpler for consumers that should not need to import all contract types. Also add abis/invoice.json snapshot to the workspace root (required by the existing ABI snapshot test), and repair pre-existing test file corruption in invoice_test.rs (interleaved function bodies, duplicate old-API blocks) that prevented the suite from compiling. Closes #[issue_id]
|
@Markadrian6399 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EscrowReleasedEventstruct with#[contracttype]incontracts/invoice/src/events.rs, carrying onlyid,merchant,amount_usdc, andreleased_atescrow_released()to publish the new lean struct instead of the fullInvoice— reduces Soroban event storage costs and removes the need for indexers/frontend to import full contract typesEscrowReleasedEventfrom the crate root (lib.rs) so consumers can import it directlyabis/invoice.jsonto the workspace root (required by the existingtest_abi_snapshot_matches_contracttest)invoice_test.rscorruption: interleaved test function bodies and a duplicated old-API block that prevented the file from compilingTest plan
cargo test -p comebackhere-invoice --test invoice_test— 42 tests pass including newtest_escrow_released_event_emits_minimal_payloadid,merchant,amount_usdc, andreleased_at— no gross_usdc, payer, metadata, etc.released_atcapturesenv.ledger().timestamp()at the moment of releasetest_release_escrow_transitions_paid_to_released,test_release_escrow_requires_paid_status,test_release_escrow_requires_admin) continue to passCloses #3