Last active
October 22, 2022 00:47
-
-
Save lukaw3d/4575bc197ba0f238ad3ee151b032d75d to your computer and use it in GitHub Desktop.
bookmarklet: generate random wallet. Use on e.g. https://wallet.oasisprotocol.org
This file contains hidden or 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
| javascript: | |
| /* use on https://wallet.oasisprotocol.org */ | |
| reactContainerField = Object.keys(document.querySelector('#root')).find(field => field.startsWith('__reactContainer')); | |
| store = document.querySelector('#root')[reactContainerField].memoizedState.element.props.store; | |
| function requireUnscrambled(moduleName) { | |
| const parcelRequire = Object.entries(window).find(a => a[0].startsWith('parcelRequire'))[1]; | |
| const scrambledName = Object.values(parcelRequire.modules) | |
| .flatMap(a => Object.entries(a[1])) | |
| .find(a => a[0] === moduleName)[1]; | |
| return parcelRequire(scrambledName); | |
| } | |
| store.dispatch({ type: 'network/selectNetwork', payload: 'testnet' }); | |
| store.dispatch({ | |
| type: 'wallet/openWalletFromPrivateKey', | |
| payload: { | |
| privateKey: requireUnscrambled('app/lib/helpers').uint2hex( | |
| requireUnscrambled('app/lib/key').OasisKey.fromPrivateKey(crypto.getRandomValues(new Uint8Array(32))) | |
| ), | |
| choosePassword: undefined, | |
| }, | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment