Skip to content

Commit

Permalink
merge with head
Browse files Browse the repository at this point in the history
  • Loading branch information
gofman8 committed Oct 27, 2023
2 parents b6716dd + dd83ee2 commit 5fe8931
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions patches/@web3-onboard+ledger+2.3.2.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git a/node_modules/@web3-onboard/ledger/dist/index.js b/node_modules/@web3-onboard/ledger/dist/index.js
index 12bf9df..2e183ec 100644
index 12bf9df..01fb4f1 100644
--- a/node_modules/@web3-onboard/ledger/dist/index.js
+++ b/node_modules/@web3-onboard/ledger/dist/index.js
@@ -1,7 +1,14 @@
@@ -1,7 +1,12 @@
// these cannot be dynamically imported
import { TypedDataUtils } from '@metamask/eth-sig-util';
+import { stripHexPrefix, keccak } from 'ethereumjs-util'
Expand All @@ -11,13 +11,11 @@ index 12bf9df..2e183ec 100644
const LEDGER_DEFAULT_PATH = `m/44'/60'/0'`;
+const ROOTSTOCK = `m/44'/137'/0'/0`;
+const ROOTSTOCK_TEST = `m/44'/37310'/0'/0`;
+const ROOTSTOCK_LEGACY = `m/44'/137'/0'/0'`;
+const ROOTSTOCK_TEST_LEGACY = `m/44'/37310'/0'/0'`;
+
const DEFAULT_BASE_PATHS = [
{
label: 'Ledger Live',
@@ -10,16 +17,52 @@ const DEFAULT_BASE_PATHS = [
@@ -10,16 +15,44 @@ const DEFAULT_BASE_PATHS = [
{
label: 'Ledger Legacy',
value: LEDGER_DEFAULT_PATH
Expand All @@ -30,14 +28,6 @@ index 12bf9df..2e183ec 100644
+ {
+ label: 'Rootstock Testnet Path',
+ value: ROOTSTOCK_TEST
+ },
+ {
+ label: 'RSK Legacy',
+ value: ROOTSTOCK_LEGACY
+ },
+ {
+ label: 'RSK Test Legacy',
+ value: ROOTSTOCK_TEST_LEGACY
+ },
];
const assets = [
Expand Down Expand Up @@ -72,7 +62,7 @@ index 12bf9df..2e183ec 100644
/**
* Returns the correct ledger transport based on browser compatibility for webUSB.
* @returns
@@ -31,7 +74,9 @@ const getAccount = async (derivationPath, asset, index, provider, eth) => {
@@ -31,7 +64,9 @@ const getAccount = async (derivationPath, asset, index, provider, eth) => {
const dPath = derivationPath === LEDGER_LIVE_PATH
? `${derivationPath}/${index}'/0/0`
: `${derivationPath}/${index}`;
Expand All @@ -83,20 +73,20 @@ index 12bf9df..2e183ec 100644
return {
derivationPath: dPath,
address,
@@ -95,8 +140,14 @@ function ledger({ customNetwork, filter } = {}) {
@@ -95,8 +130,14 @@ function ledger({ customNetwork, filter } = {}) {
// Checks to see if this is a custom derivation path
// If it is then just return the single account
if (derivationPath !== LEDGER_LIVE_PATH &&
- derivationPath !== LEDGER_DEFAULT_PATH) {
- const { address } = await eth.getAddress(derivationPath);
+ derivationPath !== LEDGER_DEFAULT_PATH &&
+ derivationPath !== ROOTSTOCK &&
+ derivationPath !== ROOTSTOCK_TEST &&
+ derivationPath !== ROOTSTOCK_LEGACY &&
+ derivationPath !== ROOTSTOCK_TEST_LEGACY
+ derivationPath !== ROOTSTOCK_TEST
+ ) {
+ let { address } = await eth.getAddress(derivationPath);
+ address = toChecksumAddress(address);
+ if(derivationPath.includes("m/44'/137") || derivationPath.includes("m/44'/37310")){
+ address = toChecksumAddress(address)
+ }
return [
{
derivationPath,

0 comments on commit 5fe8931

Please sign in to comment.