Skip to content

SwiftExampleApp: Register Contract paste re-sorts nested schema members #6080

Open

Description

@QuantumExplorer

Problem

The Register Contract flow's pasteboard importer (PasteboardContractCandidate.classify in RegisterContractSourceView.swift) parses the pasted contract with Foundation JSONSerialization and writes each section back with jsonString, which uses .sortedKeys. That reorders the members of every nested object in a document schema. A document type's properties are stored in position order: from protocol version 15, registration refuses an object whose members are out of position order. So a valid contract pasted from the clipboard can come back reordered, and registering it then fails.

Proposal

Split the pasted contract with the Rust splitter added in #6053 (split_contract_update_source, exported as platform_wallet_split_contract_update_source), or a create-flow sibling of it. It returns each section as JSON text in source order, so Swift fills the form without re-serializing.

Context

Found while fixing the same problem for the Update Contract screen in #6053.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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