Skip to content
LogoLogo

Sign message

To request a signature from a user, use the SignMessage method. This implements the EIP-191 personal_sign standard.

Usage

do {
    let result = try await OFSDK.shared.signMessage(params: OFSignMessageParams(message: "Hello World!"))
    print("Signed: \(result)")
} catch {
    print("Failed to sign message:", error)
}

Parameters

struct OFSignMessageParams: OFCodableSendable {
    public let message: String
    public let options: Options?
}

struct Options: OFCodableSendable {
    public let hashMessage: Bool?
    public let arrayifyMessage: Bool?
}

Returns

OFSignMessageResponse: String

Throws

{
    method: method,
    success: false,
    error: error
}