feat(compression): add compressMetadata and decompressMetadata helpers (#619) - #804
Draft
s6pa1rta3n-lab wants to merge 1 commit into
Draft
feat(compression): add compressMetadata and decompressMetadata helpers (#619)#804s6pa1rta3n-lab wants to merge 1 commit into
s6pa1rta3n-lab wants to merge 1 commit into
Conversation
s6pa1rta3n-lab
force-pushed
the
fix-issue
branch
from
August 31, 2026 14:22
175e147 to
1fb08a6
Compare
s6pa1rta3n-lab
force-pushed
the
fix-issue
branch
from
August 31, 2026 14:29
1fb08a6 to
7cdc63b
Compare
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 of Changes
compressMetadata(obj: Record<string, unknown>, maxBytes = 512): stringinsrc/compression.ts— serializes metadata to JSON and encodes as unpadded base64url.decompressMetadata(encoded: string): Record<string, unknown>insrc/compression.ts— decodes base64url and parses JSON into a plain object.SdkErrorwithSdkErrorCode.CONTRACT_REJECTEDon invalid base64url characters, non-string/empty inputs, malformed JSON, or non-object payloads.maxBytessize limit (default 512 bytes), throwingSdkErrorwithSdkErrorCode.CONTRACT_REJECTEDwhen the resulting payload exceeds the limit.compressMetadataanddecompressMetadataalongside existing compression utilities and types insrc/index.ts.test/metadataCompression.test.tsverifying round-trip deep equality, empty object handling, nested/unicode objects, custom and defaultmaxBytesboundaries, and various invalid input conditions.Acceptance Criteria Checklist
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.tsCloses #619
/claim #619
Payout Routing
0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC