import { JsonRpcEngineV2 } from '@metamask/json-rpc-engine/v2';
const engine = new JsonRpcEngineV2({
// Create a stack of middleware and pass it to the engine:
middleware: [
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
<!-- | |
Proof that cross-realm `MessagePort.postMessage()` can throw. | |
--> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Foo</title> | |
</head> | |
<body> |
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
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env | |
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced | |
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start | |
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running. | |
# Add the following to your shell init to set up gpg-agent automatically for every shell | |
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then | |
source ~/.gnupg/.gpg-agent-info | |
export GPG_AGENT_INFO | |
else |
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
export type SerializableValue = string | number | null | undefined; | |
export type EthereumParameterValue = SerializableValue | Record<string, SerializableValue>; | |
export interface RequestArguments { | |
method: string; | |
params?: EthereumParameterValue[]; | |
} | |
export interface ProviderConnectInfo { | |
chainId: string; | |
} | |
export interface ProviderRpcError extends Error { |
New event dispatched on window
: ethereum#initialized
Event name inspired by JSDoc @event
tag: https://jsdoc.app/tags-event.html
if (window.ethereum) {
handleEthereum()
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
// Running on the page, in the browser | |
// This API will go live in early 2020 | |
// It will be the only API available after a 6-week deprecation period | |
if (!ethereum || !ethereum.isMetaMask) { | |
throw new Error('Please install MetaMask.') | |
} | |
/*********************************************************/ |
I hereby claim:
- I am rekmarks on github.
- I am rekmarks (https://keybase.io/rekmarks) on keybase.
- I have a public key ASDEyJB4xCT718_OZ8KfidOElw2-bXfMFramgHVuNGY4ngo
To claim this, I am signing this object: