Handling Midnight SDK Breaking Changes: A Developer's Upgrade Playbook
This technical guide addresses common issues developers face when upgrading the Midnight SDK from version 3.x to 4.x. It highlights two primary categories of breaking changes: TypeScript API renames and Compact compiler artifact incompatibilities. A frequent error involves stale compiled artifacts in the managed directory causing version mismatches, which can be resolved by clearing old files. The most significant structural change is package consolidation, where six individual packages, such as @midnight-ntwrk/wallet and @midnight-ntwrk/zswap, are replaced by a single barrel export package, @midnight-ntwrk/midnight-js. Consequently, developers must update their package.json dependencies and refactor import statements to source modules from the new unified package. Additionally, the article details specific API renames, including changes to wallet initialization provider options. By understanding these migration steps, developers can efficiently resolve runtime errors and ensure compatibility with the latest SDK version, avoiding prolonged debugging sessions caused by outdated configurations and deprecated import paths.
Wire timeline
Handling Midnight SDK Breaking Changes: A Developer's Upgrade Playbook
This technical guide addresses common issues developers face when upgrading the Midnight SDK from version 3.x to 4.x. It highlights two primary categories of breaking changes: TypeScript API renames and Compact compiler artifact incompatibilities. A frequent error involves stale compiled artifacts in the managed directory causing version mismatches, which can be resolved by clearing old files. The most significant structural change is package consolidation, where six individual packages, such as @midnight-ntwrk/wallet and @midnight-ntwrk/zswap, are replaced by a single barrel export package, @midnight-ntwrk/midnight-js. Consequently, developers must update their package.json dependencies and refactor import statements to source modules from the new unified package. Additionally, the article details specific API renames, including changes to wallet initialization provider options. By understanding these migration steps, developers can efficiently resolve runtime errors and ensure compatibility with the latest SDK version, avoiding prolonged debugging sessions caused by outdated configurations and deprecated import paths.
DEV Community