EVM Dapp Integration
Integration
Last updated
Integration
Last updated
Welcome to Ramper Wallet Extension Developer Guide. This documentation contains guides for developers to get started developing Ramper Wallet on EVM networks
Check if the provider is window.ramper2
, if not, please replace it with the exclusive Ramper Wallet provider window.ramper2
.
For example, see below:
ChainID:
Use eth_chainId
or net_version
to return the current network/chain ID
To connect Ramper Extension means to access the user's [blockchain - like Ethereum] account(s).
We recommend providing a button to allow users to connect Ramper Wallet to your dapp. Selecting this button should call eth_requestAccounts
to access the user's accounts.
Use the eth_accounts
RPC method to handle user accounts. Listen to the accountsChanged
provider event to be notified when the user changes accounts.
Requests that the Ramper Extension switches its active Ethereum chain.
To disconnect Ramper Extension, please use:
Once your account is connected, let's start experiencing more functions.
return Promise<Array[String]>
If the wallet can not be found, return []
instead of throw Error
Important
eth_signTypedData_v1
, and eth_signTypedData_v3
are deprecated. We highly recommend users use eth_signTypedData_v4
or personal_sign
.
personal_sign
provides a simple means to request signatures that are human-readable and don't require efficient processing on-chain. It's commonly used for signature challenges authenticated on a web server.
Ramper Wallet implements both personal_sign
and eth_sign
. You might need to check what method your supported signers use for a given implementation.
eth_signTypedData_v4
offers highly legible signatures that can be processed efficiently on-chain. Adheres to the EIP-712 standard, enabling users to sign typed structured data that can be confirmed on-chain.
Note:
Gas limit
: is an optional parameter, since Ramper Wallet automatically calculates a reasonable gas price.
chainid
: The chain ID is derived from the user's current selected network at window.ramper2.provider.net_version
.
personal_ecRecover
returns the address associated with the private key that was used to calculate a signature.
method: 'personal_ecRecover', params: [message, signature],
This method requires that the user has granted permission to interact with their account first, so please make sure to call eth_requestAccounts
or wallet_requestPermissions
first.
return Promise<hash>
Requests that Ramper Wallet decrypt the specified encrypted message.
The message must have been encrypted using the public encryption key of the specified Ethereum address.
return Promise<string>
Requests that the user share their public encryption key. Returns a public encryption key, or rejects if the user denies the request.
return Promise<string>
- The public encryption key of the Ethereum account whose encryption key should be retrieved
Currently, we only support some action events from the wallet extension
Hex
Decimal
Network
0x1
1
Ethereum (Mainnet)
0x58
88
TomoChain (Mainnet)
0x38
56
BNB Smart Chain (Mainnet)
0x89
137
Polygon (Mainnet)
Events
Trigger
accountsChanged
Receive when active account changed in Extension
chainChanged
Receive when active chain changed in Extension
Method
Description
on(event, callback)
Add event listener
off(event, callback)
Remove event listener