Skip to content

Commit

Permalink
@nimiq/ledger-api: quick-fix patch to adapt path to Hub's @nimiq/core…
Browse files Browse the repository at this point in the history
… files

Patch @nimiq/ledger-api to adapt the path to where the Hub's @nimiq/core files are located.
This quick-fix currently hardcodes @nimiq/core's version number, which will be addressed in
a follow up change. The version number should be either adapted automatically (in the patch
or the Ledger API), or ideally, @nimiq/core should become an external dependency in the
Ledger API, and then be injected via the Hub's vue.config.js
  • Loading branch information
danimoh committed Dec 1, 2024
1 parent 5c35ed7 commit ad0ce95
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions patches/@nimiq+ledger-api+3.1.1.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
diff --git a/node_modules/@nimiq/ledger-api/dist/high-level-api/lazy-chunk-request-nimiq.es.js b/node_modules/@nimiq/ledger-api/dist/high-level-api/lazy-chunk-request-nimiq.es.js
index b05f20b..abab1bc 100644
index b05f20b..b609e35 100644
--- a/node_modules/@nimiq/ledger-api/dist/high-level-api/lazy-chunk-request-nimiq.es.js
+++ b/node_modules/@nimiq/ledger-api/dist/high-level-api/lazy-chunk-request-nimiq.es.js
@@ -46,7 +46,7 @@ async function loadNimiqAlbatrossCore(preloadWasm = true) {
@@ -27,7 +27,10 @@ const nimiqCoreBasePath = isNimiqAlbatrossHub
// On a Nimiq Hub with Albatross support, use the Hub's copy of the core (copied from @nimiq/albatross-wasm in the
// Hub's vue.config.js, which is an alias for @nimiq/core@next), same as the Hub itself is doing, to avoid using and
// loading an additional version.
- ? '/albatross-client/web/'
+ // TODO either automatically adapt the version, based on @nimiq/core's package.json (here in the patch, or in the
+ // the Ledger API itself), or ideally make the dependency an external one in the Ledger API, and try to inject it
+ // in vue.config.js.
+ ? '/nimiq/v2.0.5/web/'
// In other cases load @nimiq/core-web@next from jsdelivr. Load from cdn to avoid bundling a copy of core if it's
// not needed. This way, we also don't need to handle the wasm file in the rollup config.
: 'https://cdn.jsdelivr.net/npm/@nimiq/core@next/web/';
@@ -46,7 +49,7 @@ async function loadNimiqAlbatrossCore(preloadWasm = true) {
// exact same files as loaded by the Hub, i.e. there is no double loading happening as files will be already
// cached. Also, calling init again when the wasm is already initialized, does not unnecessarily initialize
// or fetch anything again.
Expand Down Expand Up @@ -58,10 +70,22 @@ index 21e723b..be9606b 100644
export declare function loadNimiq<Version extends NimiqVersion>(nimiqVersion: Version, inlcudeNimiqLegacyCryptography: boolean, preloadWasm?: boolean): Promise<Nimiq<Version>>;
declare module './load-nimiq' {
diff --git a/node_modules/@nimiq/ledger-api/dist/low-level-api/low-level-api.es.js b/node_modules/@nimiq/ledger-api/dist/low-level-api/low-level-api.es.js
index 5b18143..4984515 100644
index 5b18143..6a45b5f 100644
--- a/node_modules/@nimiq/ledger-api/dist/low-level-api/low-level-api.es.js
+++ b/node_modules/@nimiq/ledger-api/dist/low-level-api/low-level-api.es.js
@@ -49,7 +49,7 @@ async function loadNimiqAlbatrossCore(preloadWasm = true) {
@@ -30,7 +30,10 @@ const nimiqCoreBasePath = isNimiqAlbatrossHub
// On a Nimiq Hub with Albatross support, use the Hub's copy of the core (copied from @nimiq/albatross-wasm in the
// Hub's vue.config.js, which is an alias for @nimiq/core@next), same as the Hub itself is doing, to avoid using and
// loading an additional version.
- ? '/albatross-client/web/'
+ // TODO either automatically adapt the version, based on @nimiq/core's package.json (here in the patch, or in the
+ // the Ledger API itself), or ideally make the dependency an external one in the Ledger API, and try to inject it
+ // in vue.config.js.
+ ? '/nimiq/v2.0.5/web/'
// In other cases load @nimiq/core-web@next from jsdelivr. Load from cdn to avoid bundling a copy of core if it's
// not needed. This way, we also don't need to handle the wasm file in the rollup config.
: 'https://cdn.jsdelivr.net/npm/@nimiq/core@next/web/';
@@ -49,7 +52,7 @@ async function loadNimiqAlbatrossCore(preloadWasm = true) {
// exact same files as loaded by the Hub, i.e. there is no double loading happening as files will be already
// cached. Also, calling init again when the wasm is already initialized, does not unnecessarily initialize
// or fetch anything again.
Expand Down

0 comments on commit ad0ce95

Please sign in to comment.