Skip to content

Commit 8e4964f

Browse files
authored
1.20.0-0.0.1: [enhancement] - Install Wallet Copy (#514)
* Start implementing * Fix svelte formatting * Remove mobileDevice flag * Add ismobile to common wallet interface * Change button copy * Update mobile copy * Add isMobile to all wallet modules * Conditionally render message * Increment version
1 parent 106e091 commit 8e4964f

File tree

8 files changed

+24
-17
lines changed

8 files changed

+24
-17
lines changed

.prettierrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ module.exports = {
44
singleQuote: true,
55
printWidth: 80,
66
tabWidth: 2,
7-
arrowParens: 'avoid'
7+
arrowParens: 'avoid',
8+
svelteSortOrder: 'scripts-styles-markup'
89
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.20.0",
3+
"version": "1.20.0-0.0.1",
44
"description": "Onboard users to web3 by allowing them to select a wallet, get that wallet ready to transact and have access to synced wallet state.",
55
"keywords": [
66
"ethereum",

src/components/SelectedWallet.svelte

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
iconSrc={selectedWalletModule.iconSrc}
3030
iconSrcSet={selectedWalletModule.iconSrcSet}
3131
svg={selectedWalletModule.svg}
32-
text={selectedWalletModule.name} />
32+
text={selectedWalletModule.name}
33+
/>
3334

3435
{#if installMessage}
3536
{@html installMessage}
@@ -39,8 +40,9 @@
3940
<a
4041
href={selectedWalletModule.link}
4142
rel="noreferrer noopener"
42-
target="_blank">
43-
<Button>Install {selectedWalletModule.name}</Button>
43+
target="_blank"
44+
>
45+
<Button>Open {selectedWalletModule.name}</Button>
4446
</a>
4547
<Button onclick={onBack}>Back</Button>
4648
</footer>

src/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ export interface CommonWalletOptions {
171171
label?: string
172172
iconSrc?: string
173173
svg?: string
174+
isMobile: boolean
174175
}
175176

176177
export interface SdkWalletOptions extends CommonWalletOptions {

src/modules/select/content.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const mobileWalletInstallMessage = (helpers: {
5353

5454
return `
5555
<p style="font-size: 0.889rem;">
56-
You'll need to install <b>${selectedWallet}</b> to continue. Click below to install and then load this Dapp with <b>${selectedWallet}</b>.
56+
Tap the button below to <b>Open ${selectedWallet}</b>. Please access this site on ${selectedWallet}'s in-app browser for a seamless experience.
5757
</p>
5858
`
5959
}

src/modules/select/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function select(
3838

3939
try {
4040
return getModule(walletName).then((m: any) =>
41-
m.default({ ...initParams, networkId })
41+
m.default({ ...initParams, networkId, isMobile })
4242
)
4343
} catch (error) {
4444
if (error.name === 'DeprecatedWalletError') {

src/modules/select/wallets/metamask.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { extensionInstallMessage } from '../content'
1+
import { extensionInstallMessage, mobileWalletInstallMessage } from '../content'
22
import { WalletModule, Helpers, CommonWalletOptions } from '../../../interfaces'
33

44
import metamaskIcon from '../wallet-icons/icon-metamask.png'
55
import metamaskIcon2x from '../wallet-icons/icon-metamask@2x.png'
66

77
function metamask(options: CommonWalletOptions): WalletModule {
8-
const { preferred, label, iconSrc, svg } = options
8+
const { preferred, label, iconSrc, svg, isMobile } = options
99

1010
return {
1111
name: label || 'MetaMask',
@@ -35,7 +35,9 @@ function metamask(options: CommonWalletOptions): WalletModule {
3535
},
3636
type: 'injected',
3737
link: `https://metamask.app.link/dapp/${window.location.host}`,
38-
installMessage: extensionInstallMessage,
38+
installMessage: isMobile
39+
? mobileWalletInstallMessage
40+
: extensionInstallMessage,
3941
desktop: true,
4042
mobile: true,
4143
preferred

src/views/WalletSelect.svelte

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import Wallets from '../components/Wallets.svelte'
1212
import SelectedWallet from '../components/SelectedWallet.svelte'
1313
import Button from '../elements/Button.svelte'
14-
import IconButton from '../elements/IconButton.svelte'
1514
import walletIcon from '../elements/walletIcon'
1615
1716
import {
@@ -21,13 +20,11 @@
2120
getAddress,
2221
getBalance,
2322
getNetwork,
24-
isPromise,
2523
networkName
2624
} from '../utilities'
2725
2826
import {
2927
WalletSelectModalData,
30-
AppState,
3128
WalletModule,
3229
WalletSelectModule,
3330
WalletInterface
@@ -253,11 +250,13 @@
253250
{handleWalletSelect}
254251
{loadingWallet}
255252
{showingAllWalletModules}
256-
{showAllWallets} />
253+
{showAllWallets}
254+
/>
257255
<div class="bn-onboard-custom bn-onboard-select-info-container">
258256
<span
259257
class="bn-onboard-custom bn-onboard-select-wallet-info"
260-
on:click={() => (showWalletDefinition = !showWalletDefinition)}>
258+
on:click={() => (showWalletDefinition = !showWalletDefinition)}
259+
>
261260
What is a wallet?
262261
</span>
263262
{#if mobileDevice}
@@ -267,7 +266,8 @@
267266
{#if showWalletDefinition}
268267
<p
269268
in:fade
270-
class="bn-onboard-custom bn-onboard-select-wallet-definition">
269+
class="bn-onboard-custom bn-onboard-select-wallet-definition"
270+
>
271271
{@html modalData.explanation}
272272
</p>
273273
{/if}
@@ -278,7 +278,8 @@
278278
selectedWalletModule = null
279279
walletAlreadyInstalled = null
280280
}}
281-
{installMessage} />
281+
{installMessage}
282+
/>
282283
{/if}
283284
</Modal>
284285
{/if}

0 commit comments

Comments
 (0)