Skip to content

Instantly share code, notes, and snippets.

@jeftarmascarenhas
Last active March 30, 2023 04:41
Show Gist options
  • Save jeftarmascarenhas/a16fcded79494099115e43738e6a9bb1 to your computer and use it in GitHub Desktop.
Save jeftarmascarenhas/a16fcded79494099115e43738e6a9bb1 to your computer and use it in GitHub Desktop.
Connector to Binance on Wagmi - Small Example
export class BinanceSmallConnector extends InjectedConnector {
constructor({ chains }: { chains: Chain[] | undefined }) {
const options = {
name: "Binance",
shimDisconnect: true,
shimChainChangedDisconnect: false,
};
super({
chains,
options,
});
}
async getProvider() {
return typeof window !== "undefined" ? window.BinanceChain : undefined;
}
}
/**
Usage example:
const client = createClient({
autoConnect: true,
connectors: [
new MetaMaskConnector({
chains,
options: {
UNSTABLE_shimOnConnectSelectAccount: true,
},
}),
new BinanceSmallConnector({ chains })
],
provider,
webSocketProvider,
});
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment