marlowe-ts-sdk
marlowe-ts-sdk copied to clipboard
`getInstalledWalletExtensions` string returns
Discussed in https://github.com/input-output-hk/marlowe-ts-sdk/discussions/140
Originally posted by nstanford5 December 19, 2023
Calling getInstalledWalletExtensions
returns the name of any installed wallet extensions in a browser window. Currently it returns as follows..
- lace =
"lace"
- eternl =
"eternl"
- nami =
"Nami"
The issue I had was parsing the return to check for each of these extensions -- I assumed they would return to conform to the SupportedWalletName
Type, but the return for nami uses a capital N
.
Checking these returns against a set of constants like this..
const constants = {
NAMI: 'nami',
ETERNL: 'eternl',
LACE: 'lace',
}
const installedWalletExtensions = wallet.getInstalledWalletExtensions();
installedWalletExtensions.forEach((i) => names.push(i.name));
if(names.includes(constants.NAMI)){ setNami(true); }
if(names.includes(constants.LACE)){ setLace(true); }
if(names.includes(constants.ETERNL)){ setEternl(true); }
incorrectly denotes that Nami is not installed. The issue would persist when checking the array of names is a SupportedWalletName
as well, because the Type denotes below..
SupportedWalletName: "nami" | "eternl" | "lace"
Fix: Have getInstalledWalletExtensions
return "nami"
with a lowercase n