Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- fix: make sure `getUniqueId` is called on each `windowPostMessageTransport` request to avoid `RPC request with id already seen.` error on extension when using firefox ([#91](https://github.com/MetaMask/multichain-api-client/pull/91))

## [0.10.0]

### Added
Expand Down
3 changes: 1 addition & 2 deletions src/transports/windowPostMessageTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export function getWindowPostMessageTransport(
const { defaultTimeout = DEFAULT_REQUEST_TIMEOUT, warmupTimeout = DEFAULT_WARMUP_TIMEOUT } = params;
let messageListener: ((event: MessageEvent) => void) | null = null;
const pendingRequests: Map<number, (value: any) => void> = new Map();
let requestId = getUniqueId();
/**
* Storing notification callbacks.
* If we detect a "notification" (a message without an id) coming from the extension, we'll call each callback in here.
Expand Down Expand Up @@ -115,7 +114,7 @@ export function getWindowPostMessageTransport(
throw new TransportError('Transport not connected');
}

const id = requestId++;
const id = getUniqueId();
const request = {
jsonrpc: '2.0' as const,
id,
Expand Down
Loading