Skip to content

feat: allow string RPC URL for provider configuration in verify and validate - #221

Open
lx3133584 wants to merge 1 commit into
spruceid:mainfrom
lx3133584:feat/provider-rpc-url
Open

feat: allow string RPC URL for provider configuration in verify and validate#221
lx3133584 wants to merge 1 commit into
spruceid:mainfrom
lx3133584:feat/provider-rpc-url

Conversation

@lx3133584

Copy link
Copy Markdown

Problem

SiweMessage.verify and SiweMessage.validate require an instantiated Ethers Provider object for EIP-1271 contract wallet verification. This forces consumers to take on a direct runtime dependency on Ethers even when they only need to specify an RPC endpoint URL.

Solution

  • Expanded VerifyOpts.provider type to accept providers.Provider | string.
  • Added getJsonRpcProvider(url) helper in ethersCompat.ts to construct a JsonRpcProvider across ethers v5 and v6.
  • Updated checkContractWalletSignature in utils.ts to automatically instantiate a JsonRpcProvider when a string URL is supplied.

Testing

  • Added unit tests in packages/siwe/lib/client.test.ts verifying that string RPC URLs are accepted and correctly instantiated as provider runners.
  • Verified compilation and test suite execution pass cleanly.

…alidate

Fixes spruceid#180

Signed-off-by: Liang Xu <lx3133584@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant