Skip to content

Commit

Permalink
Fix provider value for EIP6963 integration
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienGllmt committed Jan 12, 2024
1 parent 2716a51 commit 8f5b284
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/milkomeda-wsc-provider/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<EIP6963ProviderDetail>("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
Expand All @@ -57,15 +57,15 @@ 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;
};

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;
};
Expand Down

0 comments on commit 8f5b284

Please sign in to comment.