Skip to content

docs(readme): fix provider.request usage in Basic SDK Usage - #381

Open
3822802 wants to merge 1 commit into
base:masterfrom
3822802:fix-readme-provider-request
Open

docs(readme): fix provider.request usage in Basic SDK Usage#381
3822802 wants to merge 1 commit into
base:masterfrom
3822802:fix-readme-provider-request

Conversation

@3822802

@3822802 3822802 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

Two issues in the Basic SDK Usage snippets in the README that will not work as written.

1. Missing await (step 3)

const addresses = provider.request({
  method: 'eth_requestAccounts',
});

request() returns Promise<unknown>, so addresses is a Promise, not an array. Step 4 then reads addresses[0], which is undefined.

2. Wrong call signature (step 4)

provider.request('personal_sign', [ ... ]);

The provider interface takes a single RequestArguments object, not positional arguments:

// packages/account-sdk/src/core/provider/interface.ts
export interface RequestArguments {
  readonly method: string;
  readonly params?: readonly unknown[] | object;
}

request(args: RequestArguments): Promise<unknown>;

Passing ('personal_sign', [...]) means args is the string 'personal_sign' and args.method is undefined.

This is also inconsistent with step 3 in the same section, which already uses the object form.

Fix

Adds the missing await and switches step 4 to the object form, matching both the type definition and EIP-1193.

@cb-heimdall

cb-heimdall commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

Two issues in the quickstart snippets:

1. Step 3 assigns provider.request(...) without awaiting it. request()
   returns Promise<unknown>, so addresses is a Promise and addresses[0]
   in step 4 is undefined.

2. Step 4 calls request('personal_sign', [...]) positionally, but the
   provider interface is request(args: RequestArguments) — a single
   object with method and optional params.
@3822802
3822802 force-pushed the fix-readme-provider-request branch from 73e8e97 to 22986eb Compare August 13, 2026 12:42
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.

2 participants