Releases: aragon/use-wallet
useWallet() v0.8.0
This version brings an API overhaul, making use-wallet
easier to use across the board! Please note that this is a breaking change.
New API
With the new API exposed by use-wallet
, boilerplate code is reduced to a minimum; all relevant state lives within the library itself you do not need to infer it for updating UI. The new spec is documented on the latest README.md. Here's the list of properties that we've deprecated:
-
activate()
anddeactivate()
: Replaced byconnect()
andreset()
. This improves consistency with the ecosystem's conventions and also aligns with our latest naming decisions across our apps. -
activating
andconnected
: Replaced bystatus
, which contains the current status of the wallet connection in a string. -
isContract
: Replaced bytype
, which will indicate if the account is a contract or not, in a string.
Apart from this, we've added some things which make using use-wallet
a breeze, so, make sure to check the new spec out! If you'd like a pointer on how to use it, we have examples that will set you right on track.
Related issue: #28. Thanks @bpierre for the super 🔥 new API spec!
useWallet() v0.7.1
This version is a small improvement over our recent 0.7.0
release, which brings a few things:
New chains
We've added new chains to the list so use-wallet
can detect them. These are:
- xDai (100)
- Goerli (5)
- Local (1337, added by convention)
useWallet() v0.7.0
This version adds the new ProvidedConnector
, which you can use when you want to provide your own EIP-1193
compatible provider object
Pull request
- API: Add
ProvidedConnector
and its configuration options (#39)
ProvidedConnector
The ProvidedConnector
is a special kind of connector: it acts just like the normal InjectedConnector
from web3-react
(use-wallet
's default connector), but with the ability to configure it to use any other EIP-1193
compatible provider object through the provided
key. This enables a lot of possibilities, such as developing a system to manage multiple providers in the future.
Here's an example:
import { useWallet, UseWalletProvider } from 'use-wallet'
function App() {
const { activate } = useWallet()
return (
<button
onClick={() => activate('provided')}
>
connect
</button>
)
}
export default () => (
<UseWalletProvider
connectors={{
// You can use window.ethereum, or any other compatible provider object
provided: { provider: window.ethereum },
}}
>
<App />
</UseWalletProvider>
)
useWallet() 0.6.0
This version enables two new connectors by default, and includes TypeScript definitions!
Contributors for this release: @bpierre, @JamesLefrere, @sohkai 🙏
TypeScript Definitions
If you are a TypeScript user, you can now benefit from type definitions.
Pull request
- Enable WalletConnect + add TypeScript definitions (#37)
WalletConnect
WalletConnect has been enabled again, and can be used with the walletconnect
identifier.
Its configurations requires the rpcUrl
parameter to be set. Example:
import { useWallet, UseWalletProvider } from 'use-wallet'
function App() {
const { activate } = useWallet()
return (
<button
onClick={() => activate('walletconnect')}
>
connect
</button>
)
}
export default () => (
<UseWalletProvider
connectors={{
walletconnect: { rpcUrl: 'https://<Ethereum JSON RPC endpoint>' },
}}
>
<App />
</UseWalletProvider>
)
Pull request
- Enable WalletConnect + add TypeScript definitions (#37)
Torus
A connector for the Torus wallet can now be used.
You can use it via the torus
identifier:
import { useWallet, UseWalletProvider } from 'use-wallet'
function App() {
const { activate } = useWallet()
return (
<button
onClick={() => activate('torus')}
>
connect
</button>
)
}
export default () => (
<UseWalletProvider>
<App />
</UseWalletProvider>
)
Pull request
- Re-enable the Torus connector (#35)