API Reference
Actions
The initiateHandshake
and makeRequest
methods accept a list of actions to perform. An Action
can be created using the Web3JsonRPC
class.
Below is a list of supported actions for each method:
Action | RPC method | initiateHandshake | makeRequest |
---|---|---|---|
RequestAccounts | eth_requestAccounts | ✔️ Supported | ✔️ Supported |
SignTransaction | eth_signTransaction | ❌ Not supported | ✔️ Supported |
SendTransaction | eth_sendTransaction | ❌ Not supported | ✔️ Supported |
- | eth_sign | ❌ Not supported | ❌ Not supported |
PersonalSign | personal_sign | ✔️ Supported | ✔️ Supported |
SignTypedDataV3 | eth_signTypedData_v3 | ✔️ Supported | ✔️ Supported |
SignTypedDataV4 | eth_signTypedData_v4 | ✔️ Supported | ✔️ Supported |
SwitchEthereumChain | wallet_switchEthereumChain | ✔️ Supported | ✔️ Supported |
AddEthereumChain | wallet_addEthereumChain | ✔️ Supported | ✔️ Supported |
WatchAsset | wallet_watchAsset | ✔️ Supported | ✔️ Supported |
RequestAccounts
Request that the user provides an account in the form of an Ethereum address.
Parameters
None.
Example
PersonalSign
Sign a message by calculating an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))
.
Adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious app can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
See personal_sign.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address to sign data with. |
message | String | Message data to sign. |
Example
SignTypedDataV3
Sign typed structured data.
See eth_signTypedData_v3.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address to sign data with. |
typedDataJson | String | Typed data to sign. Structured according to the JSON-Schema specified in EIP-712. |
Example
SignTypedDataV4
Sign typed structured data.
See eth_signTypedData_v4.
Parameters
Name | Type | Description |
---|---|---|
address | String | Address to sign data with. |
typedDataJson | String | Typed data to sign. Structured according to the JSON-Schema specified in EIP-712. |
Example
SignTransaction
Sign a transaction that can be submitted to the network at a later time.
See eth_signTransaction.
Parameters
Name | Type | Description |
---|---|---|
fromAddress | String | Address the transaction is sent from. |
toAddress | String | Optional. Address the transaction is sent to. |
weiValue | BigInt | Value for the transaction, in Wei. |
data | String | Compiled code of a contract or the hash of the invoked method signature and encoded parameters. |
nonce | Int | Optional. Nonce of the transaction. Allows for overwriting pending transactions that use an identical nonce. |
gasPriceInWei | BigInt | Optional. Gas price for the transaction, in Wei. |
maxFeePerGas | BigInt | Optional. Maximum fee per unit of gas for the transaction. |
maxPriorityFeePerGas | BigInt | Optional. Maximum priority fee per unit of gas for the transaction. |
gasLimit | BigInt | Optional. Gas limit for the transaction. |
chainId | String | Chain ID for the transaction, as an integer string. |
Example
SendTransaction
Send a transaction, or create a contract if the data
field contains code.
See eth_sendTransaction.
Parameters
Name | Type | Description |
---|---|---|
fromAddress | String | Address the transaction is sent from. |
toAddress | String | Optional. Address the transaction is sent to. |
weiValue | BigInt | Value for the transaction, in Wei. |
data | String | Compiled code of a contract or the hash of the invoked method signature and encoded parameters. |
nonce | Int | Optional. Nonce of the transaction. Allows for overwriting pending transactions that use an identical nonce. |
gasPriceInWei | BigInt | Optional. Gas price for the transaction, in Wei. |
maxFeePerGas | BigInt | Optional. Maximum fee per unit of gas for the transaction. |
maxPriorityFeePerGas | BigInt | Optional. Maximum priority fee per unit of gas for the transaction. |
gasLimit | BigInt | Optional. Gas limit for the transaction. |
chainId | String | Chain ID for the transaction, as an integer string. |
Example
SwitchEthereumChain
Switch a wallet’s currently active chain.
See wallet_switchEthereumChain.
Parameters
Name | Type | Description |
---|---|---|
chainId | String | ID of the chain to switch to, as an integer string. |
Example
AddEthereumChain
Add a chain to a wallet.
Parameters
Name | Type | Description |
---|---|---|
chainId | String | ID of the chain to add, as an integer string. |
blockExplorerUrls | List<String> | Optional. List of block explorer URL strings. |
chainName | String | Optional. Name of the chain to add. |
iconUrls | List<String> | Optional. List of image icons URL strings. |
nativeCurrency | AddChainNativeCurrency | Optional. Data for the chain’s native currency. |
rpcUrls | List<String> | List of RPC URL strings. Defaults to an empty list. |
Example
WatchAsset
Add and track a new asset within a wallet.
See wallet_watchAsset.
Parameters
Name | Type | Description |
---|---|---|
type | String | Type of token asset. (i.e. ERC20 , ERC721 ). |
options | WatchAssetOptions | Data of the asset to watch (i.e. contract address, name, icon, etc.) |
Example
Types
AddChainNativeCurrency
Defines a native currency to add when making a request to add a new Ethereum chain.
See AddEthereumChain.
Properties
Name | Type | Description |
---|---|---|
name | String | Name of native currency for the chain. |
symbol | String | Symbol of native currency for the chain. |
decimals | Int | Decimals of precision, as an integer. |
Example
WatchAssetOptions
Defines options when making a request to watch a new asset.
See WatchAsset.
Properties
Name | Type | Description |
---|---|---|
address | String | Contract address for the token asset. |
symbol | String | Optional. Symbol for the token asset. |
decimals | Int | Optional. Decimals of precision, as an integer. |
image | String | Optional. Logo image for the token asset. |