Last active
March 30, 2023 04:41
-
-
Save jeftarmascarenhas/a16fcded79494099115e43738e6a9bb1 to your computer and use it in GitHub Desktop.
Connector to Binance on Wagmi - Small Example
This file contains 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 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