Skip to content

Initialiser for StarknetTypedData ignores the message parameter #233

@mluisbrown

Description

@mluisbrown

In the following initialiser for StarknetTypedData the message parameter is ignored:

guard let domainData = domain.data(using: .utf8), let messageData = domain.data(using: .utf8) else {

    public init(types: [String: [any TypeDeclaration]], primaryType: String, domain: String, message _: String) throws {
        guard let domainData = domain.data(using: .utf8), let messageData = domain.data(using: .utf8) else {
            throw StarknetTypedDataError.decodingError
        }

        guard let domain = try? JSONDecoder().decode(Domain.self, from: domainData),
              let message = try? JSONDecoder().decode([String: Element].self, from: messageData)
        else {
            throw StarknetTypedDataError.decodingError
        }

        try self.init(types: types, primaryType: primaryType, domain: domain, message: message)
    }

messageData is created from domain instead of from message so this initialiser will never work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions