Integrate with Slope Wallet on Ethereum (Extension)
Last updated
Was this helpful?
Last updated
Was this helpful?
Slope Wallet injects a global API into websites visited by its users at window.slope
.
This API specification borrows heavily from API MetaMask provided, considering the massive adoption. So Web3 site developers can easily connect their dApps with the Slope Wallet. The APIs allow websites to request users' Ethereum addresses, read data from the blockchain the user is connected to, and prompt the users to sign messages and transactions.
The presence of the provider object window.slope
indicates a Slope Wallet user.
The API this extension wallet provides includes API specified by and API defined by (does not including some massively relied legacy ones).
Please read through this section if you are a web3 developer who has integrated with MetaMask and interested in integrating with Slope Wallet.
The biggest difference between Slope Wallet and MetaMask is we inject slope
rather than ethereum
(or web3
) to the web page. So user could keep two extensions at the same time.
We haven't supported the full complex APIs MetaMask provided, while we only provide standard JSON-RPC call.
The message
item in params for this request on MetaMask has to be hex-encoded keccak256 hash (otherwise the API would silent failure for dapp ). In contrast, web3 developers could pass any message in plaintext to this method, and our UI would render it as it is to the wallet users.
When this API is invoked without the user's approval, MetaMask would return an empty array.
In contrast, we would ask the user to unlock his wallet and return the address user connected to.
For any non-trivial Ethereum web application — a.k.a. web3 site — to work, you will have to:
Detect the Slope Wallet provider (window.slope
)
Detect which Ethereum network the user is connected to
Get the user's Ethereum account(s)
The provider API is all you need to create a full-featured web3 application.
That said, many developers use a convenience library, such as and web3.js, instead of using the provider directly. If you need higher-level abstractions than those provided by this API, we recommend that you use a convenience library.