docs: add missing await to README provider.request() examples#279
Open
golldyck wants to merge 1 commit intobase:masterfrom
Open
docs: add missing await to README provider.request() examples#279golldyck wants to merge 1 commit intobase:masterfrom
golldyck wants to merge 1 commit intobase:masterfrom
Conversation
Per the Provider interface in core/provider/interface.ts (request returns Promise<unknown>), the quickstart examples in both READMEs need to await the call. Without await, 'const addresses = provider.request(...)' binds a Promise to 'addresses', so the next step's 'addresses[0]' is undefined and personal_sign fires unawaited. Closes base#272
Collaborator
🟡 Heimdall Review Status
|
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.
Problem
Two quickstart code blocks in
README.md(lines 176, 184) and the duplicated block inpackages/account-sdk/README.md(lines 81, 89) callprovider.request()withoutawait. Perpackages/account-sdk/src/core/provider/interface.tsthe Provider signature isrequest(args: RequestArguments): Promise<unknown>, so the examples as written assign a Promise toaddressesand the following step indexes it asaddresses[0]— which isundefined. Thepersonal_signcall in step 4 is also fire-and-forget.Fix
Added
awaitto bothprovider.request()invocations in both READMEs so the quickstart actually works when copied.Changes
README.md— Prefixedawaiton theeth_requestAccountscall (line 176) and on thepersonal_signcall (line 184) in the Basic SDK Usage sectionpackages/account-sdk/README.md— Same fix applied to the mirrored quickstart (lines 81, 89)Testing
requestis typed asrequest(args: RequestArguments): Promise<unknown>;inpackages/account-sdk/src/core/provider/interface.tsawait,addresses[0]in thepersonal_signstep isundefinedprovider.requestwithout awaitingCloses #272