Skip to content

README "Token Transfer" example is out of date (uses removed automatic argument) #1027

Description

@JRVector9

The code snippets in the README are generated from examples/src by scripts/updateExamples.ts (run in prepublishOnly), but the "Token Transfer" snippet on main has drifted from its source.

It still calls wh.tokenTransfer with the old automatic boolean argument and a trailing nativeGas argument:

  const xfer = await wh.tokenTransfer(
    route.token,
    route.amount,
    route.source.address,
    route.destination.address,
    route.delivery?.automatic ?? false,
    route.payload,
    route.delivery?.nativeGas,
  );

Since #1020 removed the AutomaticTokenBridge route, the fifth argument is the protocol name ("TokenBridge" | "ExecutorTokenBridge") and there is no trailing nativeGas argument (see the tokenTransfer overloads in connect/src/wormhole.ts). examples/src/tokenBridge.ts was updated in #1020 but the README wasn't regenerated, so the snippet no longer matches the source it is generated from.

Running scripts/updateExamples.ts locally regenerates the README — mainly the Token Transfer example, plus the CCTP example's CircleTransfer.track loop and a few See example line links. Happy to open a PR with the regenerated README if that's the preferred fix.

Related: #982 — the example still passes xfer.transfer to TokenTransfer.quoteTransfer, so regenerating the README syncs the docs but doesn't touch that type-narrowing question.

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