diff --git a/docs/src/routes/docs/[...4]wallets/[...9]injected/+page.md b/docs/src/routes/docs/[...4]wallets/[...9]injected/+page.md index 23cc2b3f3..240372226 100644 --- a/docs/src/routes/docs/[...4]wallets/[...9]injected/+page.md +++ b/docs/src/routes/docs/[...4]wallets/[...9]injected/+page.md @@ -153,7 +153,12 @@ const equal = { provider: window.ethereum }), // A list of platforms that this wallet supports - platforms: ['desktop'] + platforms: ['desktop'], + /** + * A Url to link users to a download page for the wallet + * to be shown if not installed or available on the browser + */ + externalUrl: 'http://www.CoolEqualWalletDownload.com' } const injected = injectedModule({ @@ -172,17 +177,22 @@ You may want to display injected wallets that are not currently available to the ```javascript const injected = injectedModule({ - displayUnavailable: true + // display all unavailable injected wallets + displayUnavailable: true, + || + // display specific unavailable wallets + displayUnavailable: [ProviderLabel.MetaMask, ProviderLabel.Trust] }) ``` -This will render every injected wallet as regardless of whether it has been detected in the window, happy days. -Then the issue of the order of wallets displayed becomes apparent when you have 21 injected wallets at the top of the wallets list. To solve this, all injected wallets are sorted alphabetically by default and there is an additional `sort` parameter which receives the final list of wallets and then returns the list to be rendered. This allows for example setting MetaMask and Coinbase first and then just the rest alphabetically: +This can be set to an array top specify which unavailable injected wallets to show or set to true to display all unavailable injected wallets regardless of whether it has been detected in the window, happy days. +Then the issue of the order of wallets displayed becomes apparent when you have 21 injected wallets at the top of the wallets list. To solve this, all injected wallets are sorted **alphabetically** by default and there is an additional `sort` parameter which receives the final list of wallets and then returns the list to be rendered. This allows for example setting MetaMask and Coinbase first and then just the rest alphabetically: ```javascript const injected = injectedModule({ - // display all wallets even if they are unavailable - displayUnavailable: true, + // display specific injected wallets even if they are unavailable + // can also be set to `true` to display all unavailable injected wallets + displayUnavailable: [ProviderLabel.MetaMask, ProviderLabel.Trust], // do a manual sort of injected wallets so that MetaMask and Coinbase are ordered first sort: (wallets) => { const metaMask = wallets.find(({ label }) => label === ProviderLabel.MetaMask) @@ -203,11 +213,12 @@ const injected = injectedModule({ }) ``` -You may want to display all wallets, but filter out specific wallets based on their availability. For example I may want to display all unavailable wallets except when Binance and Bitski wallet is unavailable, then don't show them, but if they are available, then do show them. To do this, the filters value has been extended to have a new value: `'unavailable'`, as in; remove this wallet if it is unavailable, even though `displayUnavailable` wallets is set: +You may want to display all unavailable injected wallets, but filter out specific wallets based on their availability. For example I may want to display all unavailable wallets except when Binance and Bitski wallet is unavailable, then don't show them, but if they are available, then do show them. To do this, the filters value has been extended to have a new value: `'unavailable'`, as in; remove this wallet if it is unavailable, even though `displayUnavailable` wallets is set: ```javascript const injected = injectedModule({ - // display all wallets even if they are unavailable + // display specific injected wallets even if they are unavailable + // can also be set to `true` to display all unavailable injected wallets displayUnavailable: true, // but only show Binance and Bitski wallet if they are available filter: { @@ -234,15 +245,16 @@ const injected = injectedModule({ }) ``` -If a wallet is selected, but is not available the default error message is: `Please install or enable ${walletName} to continue`. You may want to customise that message, so there is the `walletUnavailableMessage` parameter which is a function that takes the wallet object that is unavailable and returns a string which is the message to display: +If a wallet is selected, but is not available the default error message is: `Oops ${wallet.label} is unavailable! Please install` if a download link is available for that wallet. If there isn't a download link for that wallet the default is: `Please install or enable ${walletName} to continue`. You may want to customize that message, so there is the `walletUnavailableMessage` parameter which is a function that takes the wallet object that is unavailable and returns a string which is the message to display: ```javascript const injected = injectedModule({ custom: [ // include custom (not natively supported) injected wallet modules here ], - // display all wallets even if they are unavailable - displayUnavailable: true, + // display specific injected wallets even if they are unavailable + // can also be set to `true` to display all unavailable injected wallets + displayUnavailable: [ProviderLabel.MetaMask, ProviderLabel.Trust], // but only show Binance and Bitski wallet if they are available filter: { [ProviderLabel.Binance]: 'unavailable', @@ -265,7 +277,10 @@ const injected = injectedModule({ .filter((wallet) => wallet) ) }, - walletUnavailableMessage: (wallet) => `Oops ${wallet.label} is unavailable!` + walletUnavailableMessage: (wallet) => + wallet.externalUrl + ? `Oops ${wallet.label} is unavailable! Please install` + : `Oops ${wallet.label} is unavailable!` }) ``` diff --git a/packages/core/package.json b/packages/core/package.json index c55e7e1d8..998685a0a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,6 +1,6 @@ { "name": "@web3-onboard/core", - "version": "2.20.0", + "version": "2.20.1-alpha.1", "description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.", "keywords": [ "Ethereum", diff --git a/packages/core/src/views/account-center/AcctCenterTriggerLarge.svelte b/packages/core/src/views/account-center/AcctCenterTriggerLarge.svelte index 895402226..f085a27e0 100644 --- a/packages/core/src/views/account-center/AcctCenterTriggerLarge.svelte +++ b/packages/core/src/views/account-center/AcctCenterTriggerLarge.svelte @@ -143,7 +143,7 @@
{#if firstAddressBalance} -
+
{firstAddressBalance.length > 7 ? firstAddressBalance.slice(0, 7) : firstAddressBalance} diff --git a/packages/core/src/views/account-center/SecondaryTokenTable.svelte b/packages/core/src/views/account-center/SecondaryTokenTable.svelte index 15b86f62e..e954fd3fa 100644 --- a/packages/core/src/views/account-center/SecondaryTokenTable.svelte +++ b/packages/core/src/views/account-center/SecondaryTokenTable.svelte @@ -72,7 +72,7 @@
{#if token.icon} {#await token.icon then iconLoaded} -
+
{#if isSVG(iconLoaded)} {@html iconLoaded} diff --git a/packages/core/src/views/account-center/WalletRow.svelte b/packages/core/src/views/account-center/WalletRow.svelte index 1e02aa089..734b6b58f 100644 --- a/packages/core/src/views/account-center/WalletRow.svelte +++ b/packages/core/src/views/account-center/WalletRow.svelte @@ -237,7 +237,7 @@ {#if balance} -
+
{formatBalance(balance)}
{/if} @@ -256,7 +256,7 @@
{#if showMenu === address} -