Sign Message

circle-exclamation

Once your app is connected to Blocto wallet, it can send sign EVMBase message on behalf of the user, with the user's permission.

Currently we support these sign types:

public enum EVMBaseSignType: String {
    case sign // stand for eth_sign
    case personalSign = "personal_sign"
    case typedSignV3 = "typed_data_sign_v3"
    case typedSignV4 = "typed_data_sign_v4"
    case typedSign = "typed_data_sign" // same as the latest, it's same as default v4 for now.
}
circle-exclamation
circle-exclamation

Let's take Ethereum for example. Arbitrum, Optimism, BSC, Polygon and Avalanche use the same signMessage method as below.

Sign message

Sign

BloctoSDK.shared.evm.signMessage(
    blockchain: .ethereum,
    from: "0x...", // user address
    message: "0x50...3A", // must be hex string with 0x prefix
    signType: .sign) { [weak self] result in
        guard let self = self else { return }
        switch result {
        case let .success(signature):
            // handle signature here.
        case let .failure(error):
            // handle error here.
        }
    }

Personal sign

Typed sign v3

Typed sign v4

Last updated

Was this helpful?