Expose public client for chain via Actions SDK#352
Closed
its-applekid wants to merge 3 commits into
Closed
Conversation
👷 Deploy request for actions-ui pending review.Visit the deploys page to approve it
|
Contributor
|
Thanks. Closing this for now: we haven't landed on a clear consumer use case for exposing the public client directly via the SDK. Happy to revisit when there's a concrete reason to surface it. |
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
Closes #232
Exposes the internal
ChainManager.getPublicClient()method through theActionsclass, allowing SDK consumers to access viemPublicClientinstances for making on-chain calls without creating their own clients.Motivation
As noted in #230 (discussion), developers currently need to manually create public clients with
createPublicClient()to interact with on-chain contracts, even though the Actions SDK already manages properly configured clients internally. This leads to duplicated client creation logic and potentially misconfigured transports.Changes
packages/sdk/src/actions.ts: AddedgetPublicClient(chainId)method that delegates toChainManagerpackages/sdk/src/index.ts: Re-exportedPublicClienttype from viem for consumer conveniencepackages/sdk/src/__tests__/actions.test.ts: Added unit tests for the new method:PublicClientfor configured chainUsage
Testing