openzeppelin-network.js
openzeppelin-network.js copied to clipboard
Add a context factory with GSN fallback for onboarding
Add a factory and corresponding hook that creates a reasonable provider according to the following:
- If there is no injected provider (ie metamask), create a new key pair (or load one from local storage if found), and set up a GSN provider with it backed by a fallback provider (such as infura).
- If there is an injected provider, but without funds on the current network, create a new GSN provider that relies on the injected provider for signing (ie do not set a specific key, and let the RelayClient use eth_sign)
- If there is an injected provider with funds, use it.