Repository navigation
Add compressMetadata and decompressMetadata to compression.ts #619
Description
Activity
- addedgrantfoxIssue for GrantFox programIssue for GrantFox programMaybe RewardedIssue may be eligible for a GrantFox rewardIssue may be eligible for a GrantFox rewardGrantFox OSSIssue tracked in GrantFox OSSIssue tracked in GrantFox OSSOfficial CampaignCampaign: Official CampaignCampaign: Official CampaignfeatureNew SDK featureNew SDK feature
on Aug 19, 2026 Hi @Emmanuel-Chukwunyere, I noticed PR #782 was closed without merging. Could you share what was missing or if you'd prefer a different approach? Happy to revise and resubmit.
Submitted a PR for this: #839
Scoped to #619 only —
src/compression.ts, the root export, and a separate
test file that leaves the existingcompression.test.tsuntouched. I ran that
existing suite alongside the new one as a regression check; 33/33 pass.Three things worth confirming:
BigIntand circular values are rejected asSdkError, not as the raw
TypeErrorthatJSON.stringifythrows, so a caller switching onerr.code
sees them like any other SDK failure.BigIntis the easy mistake here, since
amounts elsewhere in this SDK arebigint.Decode is strict about shape. A value that decodes to an array, number,
string ornullis rejected, sodecompressMetadataeither returns a
Recordor throws — never a surprise array from aRecord-typed function.Padding is tolerated on decode but never emitted. Output has no
=, per
the criteria; decoding still accepts a padded value so one padded elsewhere in
a caller's pipeline round-trips rather than failing on a cosmetic difference.I noticed PR #815 also covers this issue. It bundles
dedup.ts,
horizonPaginator.ts,invoiceReminderScheduler.ts,search.tsand
webhooks/verify.tsalongside it and currently shows as conflicting, so I
kept this one single-purpose — take or drop it without touching the other
issues. Happy to close mine if you would rather land the bundle.tsc --noEmitshows the same 210 errors as unmodifiedmain, none added.@ZacLou — correction from me.
You asked about picking this up on 29 August, after #782 closed, and PR #815
is open against it too. I opened PR #839 today without requesting assignment,
which CONTRIBUTING is explicit about: coding starts only once a maintainer
assigns the issue. I had not read it before starting, and that is on me.Other contributors' earlier requests and the authorship of PR #815 remain acknowledged. Please assess my own submitted contribution in PR #839 and its payment claim under the project's assignment and bounty requirements.
Claim correction (2026-10-09): My contribution/payment claim remains ACTIVE. I demand payment for my submitted contribution under the applicable bounty terms. Please provide the review outcome, any specific remaining acceptance or registration requirement, and the payment date. Any assignment dispute or closed issue/PR status leaves this payment demand active. Recipient: Bryce / Token Junkie Labs, @woahwhattheheck. I will provide verified receiving details through the project's official payment channel. No waiver, withdrawal, transfer, split, or reduction of my claim is authorized.
Hey team,
I would love to take this on. My planned approach:
- Deliver a clean, well-tested implementation for
Add compressMetadata and decompressMetadata to compression.tsfollowingStellar-split/split-sdkconventions. - Include automated test coverage verifying the implementation meets expected requirements.
Excited to work on this—please assign to me and I will submit a clean PR shortly!
- Deliver a clean, well-tested implementation for
Greetings,
I would like to work on this issue.
Implementation approach:
- Audit storage layout and state invariants ensuring strict auth guards.
- Implement deterministic state transitions with safe checked arithmetic.
- Add hermetic unit and regression tests covering authorized, unauthorized, and boundary edge cases.
- Profile instruction and CPU/gas limits under Soroban host environment.
I can deliver a clean, tested PR within 24 hours. Please assign!
Description
src/compression.tsexists but has no standardised encode/decode for invoice metadata objects that need to be stored compactly (e.g. in a Stellar transaction memo or IPFS payload). This issue adds a JSON + base64url round-trip helper with size validation.Acceptance Criteria
compressMetadata(obj: Record<string, unknown>): stringexported — serializes to JSON then encodes as base64url (no padding=)decompressMetadata(encoded: string): Record<string, unknown>exported — decodes base64url and parses JSON; throwsSdkErrorwithCONTRACT_REJECTEDcode on invalid inputcompressMetadatathrowsSdkErrorwithCONTRACT_REJECTEDcode if the resulting base64 string exceedsmaxBytes(default 512 bytes, configurable via second argument)decompressMetadata(compressMetadata(obj))deep-equalsobjfor any JSON-serialisable inputsrc/index.tsContext
src/compression.ts,src/index.tsBuffer.from(json).toString('base64url')— no external compression library