Skip to content

Instantly share code, notes, and snippets.

@alisinabh
Last active January 17, 2022 13:38
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alisinabh/6a28d5e4782a9089a94ead8f2ffb1216 to your computer and use it in GitHub Desktop.
Save alisinabh/6a28d5e4782a9089a94ead8f2ffb1216 to your computer and use it in GitHub Desktop.
Metamask EIP712 Trezor

Manually build metamask to claim your $LOOKS

This document will help you to build and install metamask with ability to sign typed data using trezor model T devices. (Model one does not support this yet). Please only follow this guide if you have enough technical knowledge. NEVER install anything from any other source rather than the official chrome and firefox marketplaces or metamask original website.

NOTE Do NOT install any binaries from third parties who claim they have a build version of this guide. If you want it you should build it yourself to be 100% sure that it is not tampered with. This solution is only a last resort, If you can wait a few more days I would stongly suggest to wait for an official release.

Steps

1. Install git and clone metamask

First of all install git and clone the project.

Git official website

To clone the metamask project copy and paste the following line to your terminal.

git clone https://github.com/alisinabh/metamask-extension.git
cd metamask-extension
git checkout 606065f885a7cb48bc67bab1e6bdfe06fc9e4f2b

2. Install prerequisits

You need to install these in order to build metamask.

  • Install Node.js version 14
    • If you are using nvm (recommended) running nvm use will automatically choose the right node version for you.
  • Install Yarn

3. Setup the project

  • Install dependencies: yarn setup
  • Copy the .metamaskrc.dist file to .metamaskrc
    • Replace the INFURA_PROJECT_ID value with your own personal Infura Project ID or use this one 82cf609870b148c7b77f5ca76a0d947e.

4. Build metamask

You can now simply run yarn dist for building metamask. This will actually take some time depending on your computer.

5. Install the custom metamask to your browser

Now you can install metamask into your browser. The installable files are located in the builds directory.

In order to install on chrome, open chrom then go to Settings > Extensions and then you can just drag and drop the related file (metamask-chrome-10.8.2.zip) onto that screen.

After that you just need to create/import a fake wallet in metamask initiation page and then select Connect hardware wallet From Metamasks accounts menu.

Congrats 🎉 You can now claim your looks. Don't forget to thank @aloisklink for his work on this.

In case there are any questions or problems you can ask them here in the comments or contact me on twitter at @alisinabh.

Also please NEVER EVER share your seeds with ANYONE.

Cheers 🍺

@xastor
Copy link

xastor commented Jan 17, 2022

I tried building it (hash 606065f885a7cb48bc67bab1e6bdfe06fc9e4f2b) and had the following error when trying this build on looksrare :

MetaMask Message Signature: Error: signTypedData is currently only supported on Trezor Model T. Your model is "undefined"

Using OSX + Chrome + Trezor T (firmware 2.4.3). Any ideas on what I could be doing wrong?

@alisinabh
Copy link
Author

alisinabh commented Jan 17, 2022

Hi @xastor
I tried replying to you in twitter but it thinks I'm spamming :(

I have reported this issue in the PR. meanwhile can you delete this if statement in node_modules/eth-trezor-keyring/index.js and try again. There is an issue with the model fetching function.

Basically it should look something like this:

...
await wait(status === 'just unlocked' ? DELAY_BETWEEN_POPUPS : 0);

// if (this.getModel() !== 'T') {
//  throw new Error(
//    `signTypedData is currently only supported on Trezor Model T. Your model is "${this.getModel()}"`,
//  );
// }

const response = await TrezorConnect.ethereumSignTypedData({
...

I will update this page after the issue is resolved. Please let me know if there are any other errors.

@aloisklink
Copy link

I have reported this issue in the PR. meanwhile can you delete this if statement and try again. There is an issue with the model fetching function.

The file should appear in node_modules/eth-trezor-keyring/index.js on your local PC in the metamask folder.

You just be able to delete the lines (or comment them out using //), and then rerun yarn dist, and then do step 5 again to add the new extension to your browser

@xastor
Copy link

xastor commented Jan 17, 2022

I can confirm that removing the model-check fixes things! Just claimed and staked my looks tokens :-) There appears to be an issue with the model fetching function indeed. Thanks so much for your support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment