mirror of
https://github.com/lil-org/wallet.git
synced 2024-12-29 15:32:31 +03:00
announce provider
This commit is contained in:
parent
68a0c77f4f
commit
eab109e9ff
File diff suppressed because one or more lines are too long
@ -19,11 +19,27 @@ window.tokenary.disconnect = (provider) => {
|
|||||||
|
|
||||||
// - MARK: Ethereum
|
// - MARK: Ethereum
|
||||||
|
|
||||||
window.ethereum = new TokenaryEthereum();
|
let provider = new TokenaryEthereum();
|
||||||
window.web3 = {currentProvider: window.ethereum};
|
window.ethereum = provider;
|
||||||
window.metamask = window.ethereum;
|
window.web3 = {currentProvider: provider};
|
||||||
|
window.metamask = provider;
|
||||||
window.dispatchEvent(new Event('ethereum#initialized'));
|
window.dispatchEvent(new Event('ethereum#initialized'));
|
||||||
|
|
||||||
|
// MARK: EIP-6963
|
||||||
|
|
||||||
|
function announceProvider() {
|
||||||
|
const info = {
|
||||||
|
uuid: "f9058af0-b501-43c4-bd7d-b43f83244681",
|
||||||
|
name: "tokenary",
|
||||||
|
icon: 'data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiBmaWxsPSJ3aGl0ZSIvPgo8Y2lyY2xlIGN4PSI2NCIgY3k9IjY0IiByPSI0MC44NzUiIGZpbGw9IiMyQzdDRjUiLz4KPC9zdmc+Cg==',
|
||||||
|
rdns: "io.tokenary"
|
||||||
|
};
|
||||||
|
window.dispatchEvent(new CustomEvent("eip6963:announceProvider", { detail: Object.freeze({ info, provider }), }));
|
||||||
|
}
|
||||||
|
|
||||||
|
window.addEventListener("eip6963:requestProvider", function(event) { announceProvider(); });
|
||||||
|
announceProvider();
|
||||||
|
|
||||||
// - MARK: Process content script messages
|
// - MARK: Process content script messages
|
||||||
|
|
||||||
window.addEventListener("message", function(event) {
|
window.addEventListener("message", function(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user