The Majority of EVM functionality within Finnie is handled by the same methods as the Metamask standard, and provides the same injected methods. Some useful examples are below.
eth_requestAccounts
The eth_requestAccounts RPC method is the only way to obtain the necessary permissions required to use Finnie for signing transactions. This RPC call will return a promise, allowing you to await the result of connect approval. A popup will appear, allowing you to either accept or reject the request. You can also select a specific wallet address to connect to. If the request is approved, the returned promise will be resolved with an array of the connected addresses; otherwise, the returned promise will be rejected.
type WalletAddress = String
window.ethereum.request({
method: 'eth_requestAccounts'
}): Promise<WalletAddress[]>
This RPC call retrieves all connected wallet addresses. It can also be used to check if the Finnie wallet is connected to the current page. An empty array will be returned if the page is not connected to the Finnie wallet. This RPC call does not require any permission.
type WalletAddress = String
window.ethereum.request({
method: 'eth_accounts'
}): Promise<WalletAddress[]>
This RPC method signs and sends a transaction. The transaction is added as an argument within the eth_sendTransaction method. A popup will appear, allowing you to approve or reject the transaction, and the details of your transaction will be displayed. If the transaction is approved, the returned promise will be resolved with the transaction hash; otherwise, the returned promise will be rejected.
This RPC call is used for signing messages. When calling this method, a hex string is passed as a parameter. A popup appears, allowing you to either sign the message or not. The returned promise will be resolved with a signature if the request is approved; if not, it will be rejected.
type Signature = String
type Message = String
type WalletAddress = String
window.ethereum.request({
method: 'eth_sign',
params: [connectedWalletAddress: WalletAddress, message: Message]
}): Promise<Signature>