Repository navigation
Conversation
…ion (fixes vouchlabsio#66) - Extract single implementation of get_vouches simulation into simulateGetVouches in packages/web/lib/shared/getVouches.ts - Update packages/web/lib/stellar.js getVouches to delegate to simulateGetVouches - Remove duplicate account declaration in packages/web/server/utils/chain.ts and delegate getVouchesOnChain to simulateGetVouches - Ensure browser bundle remains clean of Node-only imports - Verify all 9 vitest unit tests across stellar.test.js, chain.test.js, and chain.test.ts pass Closes vouchlabsio#66
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.
Overview
Resolves #66 by eliminating the duplicated
get_vouchescontract simulation across client and server runtimes, extracting a single, unified, server-safe read helper.Changes Made
packages/web/lib/shared/getVouches.ts):simulateGetVouches(params: GetVouchesParams)as the single source of truth for constructingContract("get_vouches"), setting fee and timeout options, executingsimulateTransaction, validating simulation errors viaApi.isSimulationError, and unpackingscValToNative.Buffer,node:crypto) so it can be safely imported by browser bundles.packages/web/lib/stellar.js):getVouches(cfg, _sourceAddress, contentHash32)to delegate simulation tosimulateGetVouches.packages/web/server/utils/chain.ts):const accountdeclaration.getVouchesOnChain(cfg, contentField)to convertcontentFieldtofieldToBytes32and delegate simulation tosimulateGetVoucheswith cachedgetReadSourceAccount.stellar.test.js,chain.test.js, andchain.test.ts), with 9 of 9 tests passing offline.Closes #66
Contributor Payout
TMqmJjRgVS21NL2eFtfyHciTxvE4BqGmEv