Skip to content

Commit

Permalink
Merge branch 'protofire:rootstock-stg' into rootstock-stg
Browse files Browse the repository at this point in the history
  • Loading branch information
gofman8 authored Oct 20, 2023
2 parents adece0e + 79aa93b commit b6716dd
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions patches/@web3-onboard+ledger+2.3.2.patch
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
diff --git a/node_modules/@web3-onboard/ledger/dist/index.js b/node_modules/@web3-onboard/ledger/dist/index.js
index 12bf9df..64071cf 100644
index 12bf9df..2e183ec 100644
--- a/node_modules/@web3-onboard/ledger/dist/index.js
+++ b/node_modules/@web3-onboard/ledger/dist/index.js
@@ -1,7 +1,11 @@
@@ -1,7 +1,14 @@
// these cannot be dynamically imported
import { TypedDataUtils } from '@metamask/eth-sig-util';
+import { stripHexPrefix, keccak } from 'ethereumjs-util'
+
const LEDGER_LIVE_PATH = `m/44'/60'`;
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 = `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 +14,44 @@ const DEFAULT_BASE_PATHS = [
@@ -10,16 +17,52 @@ const DEFAULT_BASE_PATHS = [
{
label: 'Ledger Legacy',
value: LEDGER_DEFAULT_PATH
- }
+ },
+ {
+ label: 'Rootstock Path',
Expand All @@ -26,7 +30,15 @@ index 12bf9df..64071cf 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 @@ -60,7 +72,7 @@ index 12bf9df..64071cf 100644
/**
* Returns the correct ledger transport based on browser compatibility for webUSB.
* @returns
@@ -31,7 +63,9 @@ const getAccount = async (derivationPath, asset, index, provider, eth) => {
@@ -31,7 +74,9 @@ const getAccount = async (derivationPath, asset, index, provider, eth) => {
const dPath = derivationPath === LEDGER_LIVE_PATH
? `${derivationPath}/${index}'/0/0`
: `${derivationPath}/${index}`;
Expand All @@ -71,14 +83,20 @@ index 12bf9df..64071cf 100644
return {
derivationPath: dPath,
address,
@@ -95,7 +129,9 @@ function ledger({ customNetwork, filter } = {}) {
@@ -95,8 +140,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) {
const { address } = await eth.getAddress(derivationPath);
+ derivationPath !== ROOTSTOCK_TEST &&
+ derivationPath !== ROOTSTOCK_LEGACY &&
+ derivationPath !== ROOTSTOCK_TEST_LEGACY
+ ) {
+ let { address } = await eth.getAddress(derivationPath);
+ address = toChecksumAddress(address);
return [
{
derivationPath,

0 comments on commit b6716dd

Please sign in to comment.