Skip to content

Commit ab47062

Browse files
authored
Merge pull request #297 from blocknative/develop
Release 1.7.3
2 parents 4435f43 + d66fb1f commit ab47062

File tree

4 files changed

+119
-392
lines changed

4 files changed

+119
-392
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.7.2",
3+
"version": "1.7.3",
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",
@@ -44,7 +44,7 @@
4444
"@portis/web3": "^2.0.0-beta.42",
4545
"@toruslabs/torus-embed": "^1.2.4",
4646
"@unilogin/provider": "^0.5.21",
47-
"@walletconnect/web3-provider": "^1.0.0-beta.45",
47+
"@walletconnect/web3-provider": "^1.0.0-beta.75",
4848
"authereum": "^0.0.4-beta.131",
4949
"bignumber.js": "^9.0.0",
5050
"bnc-sdk": "2.0.0",

src/elements/Spinner.svelte

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
1+
<script>
2+
export let description
3+
</script>
4+
15
<style>
6+
.bn-onboard-loading-container {
7+
display: flex;
8+
flex-direction: column;
9+
align-items: center;
10+
justify-content: center;
11+
font-family: inherit;
12+
font-size: inherit;
13+
color: inherit;
14+
}
15+
16+
span {
17+
font-family: inherit;
18+
font-size: 0.889em;
19+
margin-top: 1rem;
20+
}
21+
222
:global(.bn-onboard-loading) {
323
display: inline-block;
424
position: relative;
@@ -36,8 +56,13 @@
3656
}
3757
</style>
3858

39-
<div class="bn-onboard-custom bn-onboard-loading">
40-
<div class="bn-onboard-loading-first" />
41-
<div class="bn-onboard-loading-second" />
42-
<div class="bn-onboard-loading-third" />
59+
<div class="bn-onboard-loading-container">
60+
<div class="bn-onboard-custom bn-onboard-loading">
61+
<div class="bn-onboard-loading-first" />
62+
<div class="bn-onboard-loading-second" />
63+
<div class="bn-onboard-loading-third" />
64+
</div>
65+
{#if description}
66+
<span>{description}</span>
67+
{/if}
4368
</div>

src/views/WalletCheck.svelte

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,6 @@
186186
}
187187
188188
function runModules(modules: WalletCheckModule[]) {
189-
loadingModal = true
190189
return new Promise(
191190
async (
192191
resolve: (result: {
@@ -198,12 +197,10 @@
198197
const result = await invalidState(module, currentState)
199198
200199
if (result) {
201-
loadingModal = false
202200
return resolve(result)
203201
}
204202
}
205203
206-
loadingModal = false
207204
return resolve({ modal: undefined, module: undefined })
208205
}
209206
)
@@ -238,7 +235,25 @@
238235
}
239236
} else {
240237
// module returned a promise, so await it for val
241-
const modal = await result
238+
// show loading spinner if promise doesn't resolve within 150ms
239+
let modal
240+
await new Promise(resolve => {
241+
let completed: boolean = false
242+
243+
result.then(res => {
244+
loadingModal = false
245+
completed = true
246+
modal = res
247+
resolve()
248+
})
249+
250+
setTimeout(() => {
251+
if (!completed) {
252+
loadingModal = true
253+
}
254+
}, 150)
255+
})
256+
242257
if (modal) {
243258
validateModal(modal)
244259
return {
@@ -294,7 +309,7 @@
294309

295310
{#if loadingModal}
296311
<Modal closeable={false}>
297-
<Spinner />
312+
<Spinner description="Checking wallet" />
298313
</Modal>
299314
{/if}
300315

0 commit comments

Comments
 (0)