Skip to content

Commit 7313daf

Browse files
authored
chore: Patch ledger connect kit (#8577)
<!-- Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md) first --> <!-- copilot:all --> ### <samp>🤖[[deprecated]](https://githubnext.com/copilot-for-prs-sunset) Generated by Copilot at 68b79d4</samp> ### Summary 🐛📦🛠️ <!-- 1. 🐛 - This emoji represents a bug fix, as the patch is intended to solve a problem with Ledger devices that prevents them from connecting to the app. 2. 📦 - This emoji represents a package update, as the patch modifies the `package.json` file and the `pnpm-lock.yaml` file to use a patched version of a dependency. 3. 🛠️ - This emoji represents a tooling change, as the patch uses the `patch-package` tool to apply the custom patch to the dependency. --> This pull request fixes a bug with Ledger devices by patching the `@ledgerhq/connect-kit-loader` package to use a different CDN. It updates the `pnpm-lock.yaml` and `package.json` files and adds a new patch file in the `patches` folder. > _To fix a bug with Ledger devices_ > _We patched a package with some slices_ > _We changed the CDN_ > _In a new patch file then_ > _And updated the `pnpm` advices_ ### Walkthrough * Add a patched dependency for `@ledgerhq/[email protected]` to fix a loading issue ([link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R82-R86), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-2416d7b3b8bdbd5144160f2252191d5f1f975dc0b2016b126b4f01252cab7fb0R1-R11), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbR7-R11), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL6189-R6196), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11163-R11169), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11208-R11214), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11250-R11256)) * Modify the `package.json` file to specify the patched dependency under the `pnpm` property ([link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R82-R86)) * Create a new patch file in the `patches` folder with the patch content for the `@ledgerhq/connect-kit-loader` package ([link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-2416d7b3b8bdbd5144160f2252191d5f1f975dc0b2016b126b4f01252cab7fb0R1-R11)) * Modify the `pnpm-lock.yaml` file to add the `patchedDependencies` property and the `patch_hash` parameters for the patched dependency and its references ([link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbR7-R11), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL6189-R6196), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11163-R11169), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11208-R11214), [link](https://github.com/pancakeswap/pancake-frontend/pull/8577/files?diff=unified&w=0#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL11250-R11256))
1 parent 62d80b9 commit 7313daf

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

package.json

+5
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,10 @@
7979
"crypto": "^1.0.1",
8080
"encoding": "^0.1.13",
8181
"ws": "^8.13.0"
82+
},
83+
"pnpm": {
84+
"patchedDependencies": {
85+
"@ledgerhq/[email protected]": "patches/@[email protected]"
86+
}
8287
}
8388
}

patches/@[email protected]

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
diff --git a/CHANGELOG.md b/CHANGELOG.md
2+
deleted file mode 100644
3+
index ffeae53fb00c02c1abf1491b4cc22c7332b1abfa..0000000000000000000000000000000000000000
4+
diff --git a/dist/esm/index.js b/dist/esm/index.js
5+
index 7c3ed40cc97a63eb4e52f8e9621c9eb1a03cbfa8..1c40b2f871df0c46262339df427e9a0773680a63 100644
6+
--- a/dist/esm/index.js
7+
+++ b/dist/esm/index.js
8+
@@ -1 +1 @@
9+
-function e(e,n,t,r){return new(t||(t=Promise))((function(o,c){function i(e){try{l(r.next(e))}catch(e){c(e)}}function u(e){try{l(r.throw(e))}catch(e){c(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}l((r=r.apply(e,n||[])).next())}))}function n(e,n){var t,r,o,c,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function u(u){return function(l){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}var t,r;function o(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"https://cdn.jsdelivr.net/npm/@ledgerhq/connect-kit@1",e="ledgerConnectKit",[2,new Promise((function(n,t){var r="ledger-ck-script-".concat(e);if("undefined"!=typeof document)if(document.getElementById(r))n(window[e]);else{var o=document.createElement("script");o.src="https://cdn.jsdelivr.net/npm/@ledgerhq/connect-kit@1",o.id=r,o.addEventListener("load",(function(){n(window[e])})),o.addEventListener("error",(function(e){t(e.error)})),document.head.appendChild(o)}else t("Connect Kit does not support server side")}))]}))}))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(t||(t={})),function(e){e.Ethereum="Ethereum"}(r||(r={}));export{t as SupportedProviderImplementations,r as SupportedProviders,o as loadConnectKit};
10+
\ No newline at end of file
11+
+function e(e,n,t,r){return new(t||(t=Promise))((function(o,c){function i(e){try{l(r.next(e))}catch(e){c(e)}}function u(e){try{l(r.throw(e))}catch(e){c(e)}}function l(e){var n;e.done?o(e.value):(n=e.value,n instanceof t?n:new t((function(e){e(n)}))).then(i,u)}l((r=r.apply(e,n||[])).next())}))}function n(e,n){var t,r,o,c,i={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return c={next:u(0),throw:u(1),return:u(2)},"function"==typeof Symbol&&(c[Symbol.iterator]=function(){return this}),c;function u(u){return function(l){return function(u){if(t)throw new TypeError("Generator is already executing.");for(;c&&(c=0,u[0]&&(i=0)),i;)try{if(t=1,r&&(o=2&u[0]?r.return:u[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,u[1])).done)return o;switch(r=0,o&&(u=[2&u[0],o.value]),u[0]){case 0:case 1:o=u;break;case 4:return i.label++,{value:u[1],done:!1};case 5:i.label++,r=u[1],u=[0];continue;case 7:u=i.ops.pop(),i.trys.pop();continue;default:if(!(o=i.trys,(o=o.length>0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]<o[3])){i.label=u[1];break}if(6===u[0]&&i.label<o[1]){i.label=o[1],o=u;break}if(o&&i.label<o[2]){i.label=o[2],i.ops.push(u);break}o[2]&&i.ops.pop(),i.trys.pop();continue}u=n.call(e,i)}catch(e){u=[6,e],r=0}finally{t=o=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}([u,l])}}}var t,r;function o(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"https://cdn.jsdelivr.net/npm/@ledgerhq/[email protected]",e="ledgerConnectKit",[2,new Promise((function(n,t){var r="ledger-ck-script-".concat(e);if("undefined"!=typeof document)if(document.getElementById(r))n(window[e]);else{var o=document.createElement("script");o.src="https://unpkg.com/@ledgerhq/[email protected]/dist/umd/index.js",o.id=r,o.addEventListener("load",(function(){n(window[e])})),o.addEventListener("error",(function(e){t(e.error)})),document.head.appendChild(o)}else t("Connect Kit does not support server side")}))]}))}))}"function"==typeof SuppressedError&&SuppressedError,function(e){e.LedgerConnect="LedgerConnect",e.WalletConnect="WalletConnect"}(t||(t={})),function(e){e.Ethereum="Ethereum"}(r||(r={}));export { t as SupportedProviderImplementations, r as SupportedProviders, o as loadConnectKit }

pnpm-lock.yaml

+10-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)