feat: add ShariboSDK facade so callers stop threading client #284 - #373
Open
midenotch wants to merge 2 commits into
Open
feat: add ShariboSDK facade so callers stop threading client #284#373midenotch wants to merge 2 commits into
midenotch wants to merge 2 commits into
Conversation
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
This PR adds an
ShariboSDKfacade to@sharibo/clientso callers stop threading an untypedclientthrough every contract call. Network config, signer, and retry policy are bound once at construction instead of being invisible at the call site. It also repairs the client package (facade-first typecheck + tests), the unparseablescripts/e2e.ts, and completes the app's half-migrated SDK adoption — then locks the boundary in an ADR.Related Issue
Closes #284
Changes
🧱
ShariboSDKfacadepackages/client/src/sdk.tsShariboSDK.connect(config, keypairOrSigner, options?)resolves the signer, builds the client, and returns an instance holdingnetworkConfig, signer, and retry policy.createCircle,fund,claim,getCircle,getCircleCount,getStatus(alias),hasClaimed.packages/client/src/index.ts— export the facade, keepexplorerTxUrl.🩹 Client package repair
packages/client/src/retry.ts—RetryPolicy,DEFAULT_RETRY_POLICY(maxRetries 3, baseDelayMs 500),withRetry(exponential backoff + jitter; never retries after submission).packages/client/src/contract.ts— annotate allwithRetrycall sites (ContractTx) so the runtime-anycontract client no longer breakstsc --noEmit.packages/client/src/artifacts.ts— drop module-load side effects (no auto-prefetch / indicator install on import; callers callprefetchMembershipArtifacts()explicitly).node:testimports tovitest.🛠️ Script adoption
scripts/e2e.ts— rewrite onShariboSDK.connectper signer (admin + members); noclientthreaded anywhere; restored parseable control flow; keeps--skip-replay/--reuse-circle/--verbose.scripts/smoke.ts— adoptShariboSDK.🎨 App adoption
app/src/App.tsx,app/src/hooks/useCircleFlow.ts,app/src/config.ts— everything throughShariboSDK;NETWORK/TOKENexports,EnvSetupScreen,NetworkBanner.app/src/components/Stepper.tsx— strings fromuseI18n.app/src/i18n.tsx—I18nProvider/useI18n/LanguageSwitcher(replaces the.tsfile that contained JSX).📚 Documentation
docs/adr/003-client-boundary.md— the client-package boundary, facade-first priority ordering, JUMP plan, deprecation rules.packages/client/README.md— facade-first quick start.Verification Results
scripts/e2e.tsno longer passesclientas an argument anywheresdk.*calls + facade internals remainShariboSDK.connect(config, signer)returns an instance holding client, network config, retry policycreateCircle,fund,claim,getCircle,getStatus,hasClaimed