Enable clone()

Open
#52 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
30/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
typescript
Domain
api

Research direction

Read Web3 Issue 3573 and inspect the MetamaskInpageProvider implementation and its request-queue behavior. Define clone() so it produces an independent provider with separate request queues, then verify that direct web3 calls and TruffleContract calls can overlap without sharing provider state.

Written by the indexing model from the issue text.

Description

As identified in Web3 Issue 3573, when using both TruffleContract and web3 functions it is important that they have separate Provider objects.

In the browser, the injected web3 has a web3.currentProvider which is a MetamaskInpageProvider, but passing this same object to a TruffleContract's setProvider function seems likely to produce issues like that one identified in web3.

To address this, the MetamaskInpageProvider might benefit from a clone() function producing another copy of the object, so that there can be independent queues serving overlapping sequences of requests from calls to the web3 object directly + calls to TruffleContract objects.

Dominant language
TypeScript
Stars
268
Forks
130
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MetaMask/providers

All issues in MetaMask/providers

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.