From e8e5e6bb0269146364159906c67cc76cdcbc8a29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Germ=C3=A1n=20Mart=C3=ADnez?= Date: Fri, 12 Jan 2024 18:53:40 +0100 Subject: [PATCH] Fix Vale errors --- pages/smart-account-signatures.md | 2 +- pages/smart-account-signatures/eip-1271.md | 40 +++++++++++----------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/pages/smart-account-signatures.md b/pages/smart-account-signatures.md index 04020c67..522643b5 100644 --- a/pages/smart-account-signatures.md +++ b/pages/smart-account-signatures.md @@ -42,7 +42,7 @@ To be able to use `eth_sign` we need to take the parameters `r`, `s` and `v` fro `{32-bytes signature verifier}{32-bytes data position}{1-byte signature type}` -**Signature verifier** - Padded address of the contract that implements the EIP 1271 interface to verify the signature +**Signature verifier** - Padded address of the contract that implements the EIP-1271 interface to verify the signature **Data position** - Position of the start of the signature data (offset relative to the beginning of the signature data) diff --git a/pages/smart-account-signatures/eip-1271.md b/pages/smart-account-signatures/eip-1271.md index 9956a719..f40bd576 100644 --- a/pages/smart-account-signatures/eip-1271.md +++ b/pages/smart-account-signatures/eip-1271.md @@ -6,27 +6,27 @@ This doc explains signing and verifying messages off-chain. All examples use [Wa ## Signing messages -It is possible to sign [EIP-191](https://eips.ethereum.org/EIPS/eip-191) compliant messages as well as [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data messages. +It's possible to sign [EIP-191](https://eips.ethereum.org/EIPS/eip-191) compliant messages as well as [EIP-712](https://eips.ethereum.org/EIPS/eip-712) typed data messages. ### Restrictions - Only Safe contracts of version `>=1.1.0` are supported. -- Signing off-chain messages with smart contract wallets is not yet supported. +- Signing off-chain messages with smart contract wallets isn't yet supported. ### Enabling off-chain signing -Multiple dApps rely on on-chain signing. +Multiple dapps rely on on-chain signing. However, off-chain signing is the new default for Safe Apps that use the [safe-apps-sdk](https://www.npmjs.com/package/@safe-global/safe-apps-sdk) version `>=7.11`. In order to enable off-chain signing in a Safe App, the `safe-apps-sdk` package needs to be updated. ### EIP-191 messages -To sign a message we have to call the `signMessage` function and pass in the message as hex string. +To sign a message we've to call the `signMessage` function and pass in the message as hex string. The signing request will be blocked until the message is fully signed and then return the `signature` as a string. As Safe{Wallet} is a multi signature wallet, this process can take some time because multiple signers may need to sign the message. -#### Example: sign message +#### Example: Sign message ```typescript import { hashMessage, hexlify, toUtf8Bytes } from 'ethers/lib/utils' @@ -41,12 +41,12 @@ After signing a message it will be available in the Safe's Message list (Transac ### EIP-712 typed data -To sign typed data we have to call the `signTypedData` function and pass in the typed data object. +To sign typed data we've to call the `signTypedData` function and pass in the typed data object. The signing request will be blocked until the message is fully signed and then return the `signature` as a string. As Safe{Wallet} is a multi signature wallet, this process can take some time because multiple signers may need to sign the message. -### Example: sign typed data +### Example: Sign typed data ```typescript const getExampleData = () => { @@ -88,9 +88,9 @@ After signing, the message will be available in the Safe's Message list (Transac You can fetch the signature asynchronously instead of waiting for the RPC response via the [Safe Transaction Service](https://github.com/safe-global/safe-transaction-service). -To do so we have to generate a hash of the `message` or `typedData` using ethers `hashMessage(message)` or `_TypedDataEncoder.hash(domain, types, message)` and then compute the `Safe message hash` by calling `getMessageHash(messageHash)` on the Safe contract. +To do so we've to generate a hash of the `message` or `typedData` using ethers `hashMessage(message)` or `_TypedDataEncoder.hash(domain, types, message)` and then compute the `Safe message hash` by calling `getMessageHash(messageHash)` on the Safe contract. -### Example: get Safe message hash +### Example: Get Safe message hash ```typescript const getSafeInterface = () => { @@ -121,13 +121,13 @@ const getSafeMessageHash = async ( } ``` -Then we can query the state of the message from the network-specific transaction service endpoint for messages: `https://safe-transaction-.safe.global/api/v1/messages/`. +Then we can query the state of the message from the network-specific Transaction Service endpoint for messages: `https://safe-transaction-.safe.global/api/v1/messages/`. An example message on Goerli can be found here: `https://safe-transaction-goerli.safe.global/api/v1/messages/0x7f4032fd13f27c5fce4694a1a6b79f65c68656da4eee4347a414f5bcec915b39/`. For other network endpoints, see [Available Services](../../safe-core-api/supported-networks.md). -### Example: Loading message from transaction service +### Example: Loading message from Transaction Service ```typescript const fetchMessage = async ( @@ -181,9 +181,9 @@ The signature of the message will be returned in the `preparedSignature` field. We verify the signature by calling the Safe contract's `isValidSignature(hash, signature)` function on-chain. This function returns the `MAGIC VALUE BYTES 0x20c13b0b` if the `signature` is correct for the `messageHash`. -_Note: A common pitfall is to pass the `safeMessageHash` to the `isValidSignature` call which is not correct. It needs to be the hash of the original message._ +_Note: A common pitfall is to pass the `safeMessageHash` to the `isValidSignature` call which isn't correct. It needs to be the hash of the original message._ -### Example: verify signature +### Example: Verify signature ```typescript const MAGIC_VALUE_BYTES = '0x20c13b0b' @@ -209,22 +209,22 @@ const isValidSignature = async ( } ``` -### Example dApps +### Example dapps -- [Small test dApp](https://github.com/5afe/eip-1271-dapp) +- [Small test dapp](https://github.com/5afe/eip-1271-dapp) ## Troubleshooting -### Off-chain signing is not being used +### Off-chain signing isn't being used If your signing requests fallback to on-chain signing this could be because of multiple reasons: -- The Safe App is not using `safe-apps-sdk` version `>=7.11.0`. +- The Safe App isn't using `safe-apps-sdk` version `>=7.11.0`. - The Safe{Wallet} is set to always use on-chain signing. This can be toggled in the Settings of the Safe{Wallet} (Settings -> Safe Apps). -- The connected Safe does not have a _fallback handler_ set. This can happen if Safes were not created through the official interface such as a CLI or third party interface. -- The Safe version is not compatible - off-chain signing is only available for Safes with version `>1.0.0` +- The connected Safe doesn't have a _fallback handler_ set. This can happen if Safes weren't created through the official interface such as a CLI or third party interface. +- The Safe version isn't compatible - off-chain signing is only available for Safes with version `>1.0.0` -### Confusion of messageHash and safeMessageHash +### Confusion of `messageHash` and `safeMessageHash` `message`, `messageHash` and `safeMessageHash` often get mixed up: