Skip to content

Commit 96b0396

Browse files
Merge branch 'develop' into release/1.28.0
2 parents aa1f8bb + 610839f commit 96b0396

File tree

8 files changed

+33
-15
lines changed

8 files changed

+33
-15
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.28.0",
3+
"version": "1.28.0-0.1.0",
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",
@@ -43,6 +43,7 @@
4343
"eslint": "^6.8.0",
4444
"eslint-config-prettier": "^8.3.0",
4545
"prettier": "^2.0.5",
46+
"prettier-plugin-svelte": "^2.2.0",
4647
"rimraf": "^3.0.0",
4748
"rollup": "^1.27.5",
4849
"rollup-plugin-svelte": "^6.1.1",
@@ -75,7 +76,6 @@
7576
"ethereumjs-util": "^7.0.3",
7677
"fortmatic": "^2.2.1",
7778
"hdkey": "^2.0.1",
78-
"prettier-plugin-svelte": "^2.2.0",
7979
"regenerator-runtime": "^0.13.7",
8080
"trezor-connect": "^8.1.9",
8181
"walletlink": "^2.1.0",

src/components/Modal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { fade } from 'svelte/transition'
33
import { app } from '../stores'
44
import Branding from '../elements/Branding.svelte'
5-
export let closeModal: () => void
5+
export let closeModal: () => void = () => {}
66
export let closeable: boolean = true
77
88
let closeHovered: boolean

src/elements/Spinner.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<script>
2-
export let description
1+
<script lang="ts">
2+
export let description: string = ''
33
</script>
44

55
<style>

src/interfaces.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export interface StateAndHelpers extends UserState {
8989
BigNumber: any
9090
walletSelect: WalletSelectFunction
9191
wallet: Wallet
92-
exit: (completed?: boolean) => void
92+
exit: (completed?: boolean, state?: Partial<AppState>) => void
9393
stateSyncStatus: {
9494
[key: string]:
9595
| null
@@ -490,6 +490,7 @@ export interface AppState {
490490
accountSelectInProgress: boolean
491491
walletSelectDisplayedUI: boolean
492492
walletCheckDisplayedUI: boolean
493+
switchingWallets: boolean
493494
displayBranding: boolean
494495
agreement: TermsOfServiceAgreementOptions
495496
}

src/modules/check/network.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@ import { networkName } from '../../utilities'
22
import {
33
WalletCheckModal,
44
StateAndHelpers,
5-
WalletCheckCustomOptions
5+
WalletCheckCustomOptions,
6+
AppState
67
} from '../../interfaces'
78
import { networkIcon } from './icons'
89

10+
import { app } from '../../stores'
11+
912
function network(
1013
options: WalletCheckCustomOptions = {}
1114
): (currentState: StateAndHelpers) => Promise<WalletCheckModal | undefined> {
@@ -50,8 +53,15 @@ function network(
5053
eventCode: 'networkFail',
5154
button: button || {
5255
onclick: () => {
53-
exit()
54-
walletSelect()
56+
exit(false, { switchingWallets: true })
57+
58+
walletSelect().then(result => {
59+
app.update((store: AppState) => ({
60+
...store,
61+
switchingWallets: false,
62+
walletCheckCompleted: result
63+
}))
64+
})
5565
},
5666
text: 'Switch Wallet'
5767
},

src/onboard.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,9 +206,11 @@ function init(initialization: Initialization): API {
206206
const {
207207
walletCheckInProgress,
208208
walletCheckCompleted,
209-
walletCheckDisplayedUI
209+
walletCheckDisplayedUI,
210+
switchingWallets
210211
} = store
211-
if (walletCheckInProgress === false) {
212+
213+
if (!switchingWallets && walletCheckInProgress === false) {
212214
appUnsubscribe()
213215
walletCheckDisplayedUI
214216
? setTimeout(() => {

src/stores.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export const app: WritableStore = writable({
2828
walletSelectCompleted: false,
2929
walletCheckInProgress: false,
3030
walletCheckCompleted: false,
31+
switchingWallets: false,
3132
accountSelectInProgress: false,
3233
autoSelectWallet: '',
3334
checkModules: [],

src/views/WalletCheck.svelte

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,16 @@
169169
})
170170
}
171171
172-
function handleExit(completed?: boolean) {
172+
function handleExit(
173+
completed: boolean = false,
174+
{ switchingWallets }: Partial<AppState> = {}
175+
) {
173176
resetState()
174177
app.update((store: AppState) => ({
175178
...store,
179+
switchingWallets,
176180
walletCheckInProgress: false,
177-
walletCheckCompleted: completed ? completed : false,
181+
walletCheckCompleted: completed,
178182
accountSelectInProgress: false
179183
}))
180184
}
@@ -246,7 +250,7 @@
246250
loadingModal = false
247251
completed = true
248252
modal = res
249-
resolve()
253+
resolve(undefined)
250254
})
251255
252256
setTimeout(() => {
@@ -320,7 +324,7 @@
320324

321325
{#if activeModal}
322326
<Modal closeModal={() => handleExit()}>
323-
<ModalHeader icon={activeModal.icon} heading={activeModal.heading} />
327+
<ModalHeader icon={activeModal.icon || ''} heading={activeModal.heading} />
324328
<p class="bn-onboard-custom bn-onboard-prepare-description">
325329
{@html activeModal.description}
326330
</p>

0 commit comments

Comments
 (0)