subspace / subspace.js

Client library for easy get/put storage interaction with Subspace Network blockchain
3 stars 107 forks source link

Bug: web3Enable method, not injecting extension. #6

Open 1devNdogs opened 2 years ago

1devNdogs commented 2 years ago

The reason of using EMS was related to some issues loading and injecting the polkadot extension in the window object, looks like there was a tiny delay between extension-inject loading the extension and extension-dapp requesting the injection status (win.injectedWeb3)

There is an optional parameter in the web3Enable method, added an array of functions returning a promise, the promise will run before the checks on isWeb3Injected adding some milliseconds to await the extension to be injected.

Another option is checking the web3Enable output and if there is no extensions loaded run a retry, this adds extra code and i decided to use the the existing optional parameter from web3Enable call.

https://github.com/subspace/subspace.js/blob/4d3acfd2cb0dc7e82039cd25812182bb74896dfa/src/identity.ts#L32-L37

_Originally posted by @1devNdogs in https://github.com/subspace/subspace.js/pull/5#discussion_r772223504_