Skip to content

Instantly share code, notes, and snippets.

Avatar
🐐

Erik Marks rekmarks

🐐
View GitHub Profile
@rekmarks
rekmarks / mm-inpage-provider.d.ts
Created Aug 16, 2020
@metamask/inpage-provider draft types
View mm-inpage-provider.d.ts
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 {
@rekmarks
rekmarks / ethereum-dom-event.md
Last active May 7, 2020
Ethereum Provider Initialization Event
View ethereum-dom-event.md

New event dispatched on window: ethereum#initialized

Event name inspired by JSDoc @event tag: https://jsdoc.app/tags-event.html

if (window.ethereum) {

  handleEthereum()
@rekmarks
rekmarks / newProvider.js
Last active Apr 18, 2021
Using the New MetaMask Inpage Provider
View newProvider.js
// 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.')
}
/*********************************************************/
View keybase.md

Keybase proof

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: