v1.2.0
What's Changed
Every adapter config takes an optional fetchImpl, exported as the FetchImpl type. It defaults to the global fetch, so nothing changes for existing callers.
It exists so a test can assert on the requests an adapter builds without standing up a server or reassigning globalThis.fetch. Reassigning the global is process-wide, which makes tests order-dependent and leaks into anything else sharing the process.
import { PrivyAdapter, type FetchImpl } from "@opensea/wallet-adapters"
const calls: string[] = []
const fetchImpl: FetchImpl = async (input, init) => {
calls.push(String(input))
return new Response(JSON.stringify({ data: { signature: "0x00" } }), {
status: 200,
headers: { "content-type": "application/json" },
})
}
const wallet = new PrivyAdapter({
appId: "app",
appSecret: "secret",
walletId: "wallet",
fetchImpl,
})
await wallet.signMessage({ message: "hello" })
void callsFetchImpl is typeof globalThis.fetch, so any spec-compatible implementation satisfies it. Covers PrivyConfig, TurnkeyConfig, FireblocksConfig, BankrConfig and PrivateKeyConfig.
Full Changelog: v1.1.0...v1.2.0