-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #394 from nxqbao/feat/integrate-trezor
Integrate with trezor wallet
- Loading branch information
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
import chalk from 'chalk'; | ||
|
||
function logError(...args: any[]) { | ||
console.log(chalk.red(...args)); | ||
} | ||
|
||
export function getDerivationPath(chainId: number): string | undefined { | ||
let coinType; | ||
|
||
switch (chainId) { | ||
case 1: | ||
case 2020 /* Ronin Mainnet */: | ||
case 2021 /* Ronin Testnet */: | ||
coinType = '60'; | ||
break; | ||
case 3: | ||
case 4: | ||
case 5: | ||
coinType = '1'; | ||
break; | ||
default: | ||
logError(`Network with chainId: ${chainId} not supported.`); | ||
return undefined; | ||
} | ||
|
||
const derivationPath = `m/44'/${coinType}'/0'/0`; | ||
return derivationPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters