Skip to content

docs: README documents obsolete getPreAuthorizedWallets and starknetVersion API #324

Description

@mssystem1

Summary

The get-starknet README currently documents a GetStarknetResult interface that no longer matches the implementation exported by the core package.

In particular, the README documents:

getPreAuthorizedWallets(...)

and:

enable(
  wallet,
  options?: {
    starknetVersion?: "v4" | "v5"
  }
)

However, the current implementation exposes:

getAuthorizedWallets(...)

and enable() accepts RequestAccountsParameters.

The implementation also exposes discoverVirtualWallets(), which is missing from the README interface.

This can cause TypeScript users to implement against methods and options that do not exist in the current package.

Affected Files

Repository:

starknet-io/get-starknet

Documentation:

README.md

Implementation:

packages/core/src/main.ts
packages/core/src/types.ts

Current Documentation

The README currently shows:

interface GetStarknetResult {
  getAvailableWallets: (
    options?: GetWalletOptions,
  ) => Promise<StarknetWindowObject[]>

  getPreAuthorizedWallets: (
    options?: GetWalletOptions,
  ) => Promise<StarknetWindowObject[]>

  getDiscoveryWallets: (
    options?: GetWalletOptions
  ) => Promise<WalletProvider[]>

  getLastConnectedWallet:
    () => Promise<StarknetWindowObject | null>

  enable: (
    wallet: StarknetWindowObject,
    options?: {
      starknetVersion?: "v4" | "v5"
    },
  ) => Promise<ConnectedStarknetWindowObject>

  disconnect:
    (options?: { clearLastWallet?: boolean }) => Promise<void>
}

Actual API

The current GetStarknetResult interface contains:

export interface GetStarknetResult {
  getAvailableWallets: (
    options?: GetWalletOptions,
  ) => Promise<StarknetWindowObject[]>

  getAuthorizedWallets: (
    options?: GetWalletOptions,
  ) => Promise<StarknetWindowObject[]>

  getDiscoveryWallets: (
    options?: GetWalletOptions,
  ) => Promise<WalletProvider[]>

  getLastConnectedWallet:
    () => Promise<StarknetWindowObject | null | undefined>

  discoverVirtualWallets:
    () => Promise<void>

  enable: (
    wallet: StarknetWindowObject | VirtualWallet,
    options?: RequestAccountsParameters,
  ) => Promise<StarknetWindowObject>

  disconnect:
    (options?: DisconnectOptions) => Promise<void>
}

API Differences

1. Renamed method

Documented:

getPreAuthorizedWallets()

Actual:

getAuthorizedWallets()

A developer copying the README example will receive an error such as:

Property 'getPreAuthorizedWallets' does not exist on type 'GetStarknetResult'

2. enable() options are outdated

Documented:

{
  starknetVersion?: "v4" | "v5"
}

Actual:

RequestAccountsParameters

The implementation currently forwards:

options?.silent_mode

into:

wallet_requestAccounts

rather than reading starknetVersion.

3. Virtual wallets are missing from the documentation

The actual API accepts:

StarknetWindowObject | VirtualWallet

for enable().

The README only documents:

StarknetWindowObject

4. discoverVirtualWallets() is undocumented

The implementation exposes:

discoverVirtualWallets()

but this method is absent from the README's interface.

5. Return type differs

README:

Promise<ConnectedStarknetWindowObject>

Actual:

Promise<StarknetWindowObject>

Steps to Reproduce

  1. Install the current package.
pnpm add @starknet-io/get-starknet-core
  1. Copy the API from the README.

  2. Try:

const result = getStarknet()

await result.getPreAuthorizedWallets()
  1. TypeScript reports that the method does not exist.

The actual method is:

await result.getAuthorizedWallets()

Likewise:

await result.enable(wallet, {
  starknetVersion: "v5",
})

does not match the current enable() options type.

Expected Behavior

The README should match the public TypeScript interface exported by the package.

Suggested Fix

Replace the hand-maintained interface in the README with the current interface.

For example:

interface GetStarknetResult {
  getAvailableWallets(
    options?: GetWalletOptions
  ): Promise<StarknetWindowObject[]>

  getAuthorizedWallets(
    options?: GetWalletOptions
  ): Promise<StarknetWindowObject[]>

  getDiscoveryWallets(
    options?: GetWalletOptions
  ): Promise<WalletProvider[]>

  getLastConnectedWallet():
    Promise<StarknetWindowObject | null | undefined>

  discoverVirtualWallets():
    Promise<void>

  enable(
    wallet: StarknetWindowObject | VirtualWallet,
    options?: RequestAccountsParameters
  ): Promise<StarknetWindowObject>

  disconnect(
    options?: DisconnectOptions
  ): Promise<void>
}

Better Long-Term Fix

Avoid manually duplicating TypeScript interfaces in the README.

Instead, either:

  1. link directly to GetStarknetResult;
  2. generate API documentation from TypeScript declarations;
  3. include a CI check ensuring README snippets compile.

A compile-tested documentation example would have caught this drift automatically.

Impact

Severity: Low / Medium

Category:

  • developer experience
  • API documentation
  • TypeScript integration

Potential consequences:

  • broken copied examples;
  • failed TypeScript builds;
  • developers using removed API names;
  • incorrect wallet connection parameters;
  • virtual-wallet functionality being undiscoverable;
  • unnecessary debugging of library behavior.

Environment

Repository:

starknet-io/get-starknet

Branch:

master

Affected documentation:

README.md

Affected implementation:

packages/core/src/main.ts
packages/core/src/types.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions