From 8f5b2844937b66dabc8eb488c87a2d4e17b4e63b Mon Sep 17 00:00:00 2001 From: Sebastien Guillemot Date: Sat, 13 Jan 2024 01:37:51 +0900 Subject: [PATCH] Fix provider value for EIP6963 integration --- packages/milkomeda-wsc-provider/src/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/milkomeda-wsc-provider/src/index.ts b/packages/milkomeda-wsc-provider/src/index.ts index 82a67c4..5b220b1 100644 --- a/packages/milkomeda-wsc-provider/src/index.ts +++ b/packages/milkomeda-wsc-provider/src/index.ts @@ -41,9 +41,9 @@ const algorandWscEip6963Info: EIP6963ProviderInfo = { rdns: "com.milkomeda.a1.wsc", } as const; -function addEip6963Listener(provider: EIP6963ProviderInfo) { +function addEip6963Listener(info: EIP6963ProviderInfo, provider: Provider) { const announceEvent = new CustomEvent("eip6963:announceProvider", { - detail: Object.freeze({ info: cardanoWscEip6963Info, provider }), + detail: Object.freeze({ info, provider }), }) as EIP6963AnnounceProviderEvent; // send an event for any dApp that was already listening to let them know about the WSC provider @@ -57,7 +57,7 @@ function addEip6963Listener(provider: EIP6963ProviderInfo) { export const injectCardano = (oracleUrl: string, jsonRpcProviderUrl: string) => { const provider = new Provider(oracleUrl, jsonRpcProviderUrl, PROVIDER_TYPES.CARDANO); window.ethereum = provider; // note: other wallets may override this or block this from even being set - addEip6963Listener(cardanoWscEip6963Info); + addEip6963Listener(cardanoWscEip6963Info, provider); return provider; }; @@ -65,7 +65,7 @@ export const injectCardano = (oracleUrl: string, jsonRpcProviderUrl: string) => export const injectAlgorand = (oracleUrl: string, jsonRpcProviderUrl: string) => { const provider = new Provider(oracleUrl, jsonRpcProviderUrl, PROVIDER_TYPES.ALGORAND); window.ethereum = provider; // note: other wallets may override this or block this from even being set - addEip6963Listener(algorandWscEip6963Info); + addEip6963Listener(algorandWscEip6963Info, provider); return provider; };