Skip to content

kykungz/crypto-wallet-changer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crypto Wallet Changer

Connect to DApps using someone else's wallet through bookmarklets!
https://kykungz.github.io/crypto-wallet-changer


Why?

Sometimes you want "login" as other people's wallet on DApps (such as PancakeSwap, Uniswap, etc.) whether you just want to see their assets, or you're just debugging something.

You can't really do that because crypto wallet like MetaMask requires you to import that wallet using Seed Phrase or Private Key.

This bookmarklet aims to help you perform a "view-as"-like functionality, by injecting scripts that tells the DApps to read your wallet address that you filled in.

Supported wallets

Installation

Easy, this project works as a Bookmarklet, so you can simply visit https://kykungz.github.io/crypto-wallet-changer and drag a wallet into your Bookmarks bar of your browser.

Once you have it added to your Bookmarks bar, go to your favorite DApps site, and simply click on the saved bookmarklet to run the scripts.

A prompt will be shown, then you can paste any wallet address you want it to be viewed as.

Note that this only tricks the webpage to think that you have changed your wallet to the one you filled in. You can't really sign transactions using this method since you don't have the private key.

How this works?

Most crypto wallet extensions injects a variable into browser's global variable window.

For example, MetaMask injects a variable named ethereum into browser's window, so you could use window.ethereum to perform operations on the wallet extension.

DApps sites like PancakeSwap retrieve wallet information from that window.ethereum variable when you connects to their website. These DApps are also listening on events that are sent from the extension, important events such as "Account Connected" or "Account Changed".

This bookmarklet just simply try to emit those events and tricks the website to think that you have changed your wallet to the one you filled it.

For example, emitting account changed to <user_input> event.

Contribute

Feel free to contribute to this repository!

To create a new bookmarket:

  1. Add a new JavaScript file in bookmarklets folder
  2. Add module.exports with the following structure:
module.exports = {
  name: "MetaMask",
  logo: "https://....",
  script: function () {
    // Code goes here
  },
};
  1. Run the following script to auto-generate the newly added bookmarklet:
node generate.js
  1. Open index.html to see changes and test it out
  2. Send a Pull Request!