Skip to content

Commit b59fd93

Browse files
authored
Merge pull request #610 from blocknative/release/1.30.0
Release 1.30.0
2 parents 634e39b + b6578b1 commit b59fd93

File tree

11 files changed

+66
-28
lines changed

11 files changed

+66
-28
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.29.0",
3+
"version": "1.29.0-0.3.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",
@@ -67,7 +67,7 @@
6767
"@walletconnect/web3-provider": "^1.4.1",
6868
"authereum": "^0.1.12",
6969
"bignumber.js": "^9.0.0",
70-
"bnc-sdk": "^3.3.4",
70+
"bnc-sdk": "^3.4.1",
7171
"bowser": "^2.10.0",
7272
"eth-lattice-keyring": "^0.2.7",
7373
"eth-provider": "^0.6.1",

src/components/SelectedWallet.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@
3737
{/if}
3838

3939
<footer class="bn-onboard-custom bn-onboard-modal-selected-wallet-footer">
40+
<Button cta={false} onclick={onBack}>Back</Button>
4041
<a
4142
href={selectedWalletModule.link}
4243
rel="noreferrer noopener"
4344
target="_blank"
4445
>
4546
<Button>Open {selectedWalletModule.name}</Button>
4647
</a>
47-
<Button onclick={onBack}>Back</Button>
4848
</footer>
4949
</section>

src/elements/Button.svelte

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,16 @@
33
export let onclick: () => void = () => {}
44
export let position: string = ''
55
export let disabled: boolean = false
6+
// If this is a CTA Button then we want to emphasize it
7+
export let cta: boolean = true
68
</script>
79

810
<style>
911
button {
12+
border: none;
1013
background: inherit;
1114
font-size: 0.889em;
1215
font-family: inherit;
13-
border: 1px solid #4a90e2;
14-
border-radius: 40px;
1516
padding: 0.55em 1.4em;
1617
cursor: pointer;
1718
color: #4a90e2;
@@ -25,9 +26,6 @@
2526
button:focus {
2627
outline: none;
2728
}
28-
button:hover {
29-
background: #ecf3fc;
30-
}
3129
3230
.bn-onboard-prepare-button-right {
3331
position: absolute;
@@ -44,12 +42,21 @@
4442
pointer-events: none;
4543
opacity: 0.4;
4644
}
45+
.cta {
46+
border: 1px solid #4a90e2;
47+
border-radius: 40px;
48+
}
49+
50+
.cta:hover {
51+
background: #ecf3fc;
52+
}
4753
</style>
4854

4955
<button
5056
on:click={onclick}
5157
{disabled}
5258
class:disabled
59+
class:cta
5360
class="bn-onboard-custom bn-onboard-prepare-button"
5461
class:bn-onboard-prepare-button-right={position === 'right'}
5562
class:bn-onboard-prepare-button-left={position === 'left'}

src/modules/select/wallets/keepkey/entryModal.ts

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const pinButtons = `
5656
const delButtonIcon = `<svg class="del-button-icon" viewBox="0 0 24 24" focusable="false" class="chakra-icon css-onkibi" aria-hidden="true"><path fill="currentColor" d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"></path></svg>`
5757

5858
const pinPhraseInput = (modalType: ModalType) => `
59-
<form class="pin-phrase-input-container">
59+
<form id="pin-phrase-form" class="pin-phrase-input-container">
6060
<input
6161
id="pin-phrase-input"
6262
placeholder="${modalType === ModalType.Pin ? 'PIN' : ''}"
@@ -254,6 +254,20 @@ export const renderModal = (wallet: KeepKeyHDWallet, modalType: ModalType) => {
254254
}
255255
} as SvelteComponentDev['new'])
256256

257+
// Submits the pin or passphrase to the Keepkey device
258+
const submit = async () => {
259+
const value = getInput().value
260+
modalType === ModalType.Pin
261+
? await wallet.sendPin(value)
262+
: await wallet.sendPassphrase(value)
263+
pinModal.$destroy()
264+
}
265+
266+
document.getElementById('pin-phrase-form')?.addEventListener('submit', e => {
267+
e.preventDefault()
268+
submit()
269+
})
270+
257271
// Creates a new Button component used to trigger sending the pin to Keepkey
258272
const entryEl = document.getElementById('entry')
259273
if (entryEl) {
@@ -264,13 +278,7 @@ export const renderModal = (wallet: KeepKeyHDWallet, modalType: ModalType) => {
264278
target: entryEl,
265279
props: {
266280
onclick: async () => {
267-
const value = getInput().value
268-
269-
modalType === ModalType.Pin
270-
? await wallet.sendPin(value)
271-
: await wallet.sendPassphrase(value)
272-
273-
pinModal.$destroy()
281+
submit()
274282
deleteWindowProperties()
275283
},
276284
$$slots: createSlot(span),

src/modules/select/wallets/keepkey/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ interface KeepProviderOptions {
4141
function keepkey(
4242
options: CommonWalletOptions & { rpcUrl: string; networkId: number }
4343
): WalletModule {
44-
const { label, iconSrc, rpcUrl, networkId } = options
44+
const { label, iconSrc, rpcUrl, networkId, preferred } = options
4545

4646
// Used to signal if the keep key could not be paired or if the keep key is already paired with another app
4747
let installMessage: string
@@ -90,7 +90,8 @@ function keepkey(
9090
: '',
9191
type: 'hardware',
9292
mobile: false,
93-
desktop: true
93+
desktop: true,
94+
preferred
9495
}
9596
}
9697

src/onboard.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
} from './interfaces'
3333

3434
import initializeModules from './modules'
35+
import { closeSocketConnection } from './services'
3536

3637
let onboard: any
3738

@@ -57,6 +58,14 @@ function init(initialization: Initialization): API {
5758
console.warn(
5859
'Initializing Onboard and destroying previously initialized instance.'
5960
)
61+
62+
// close WebSocket connection
63+
closeSocketConnection()
64+
65+
// reset the wallet state
66+
resetWalletState()
67+
68+
// destroy svelte instance and remove from DOM
6069
onboard.$destroy()
6170
}
6271

src/services.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ export function getBlocknative(): any {
2828
}
2929
return blocknative
3030
}
31+
32+
export function closeSocketConnection(): void {
33+
blocknative?.destroy()
34+
}

src/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,8 @@ export function networkName(id: number): string {
325325
return 'kovan'
326326
case 100:
327327
return 'xdai'
328+
case 56:
329+
return 'bsc'
328330
default:
329331
const { networkId, networkName } = get(app)
330332
return (networkId === id && networkName) || 'unknown'
@@ -345,6 +347,8 @@ export function networkToId(network: string): number {
345347
return 42
346348
case 'xdai':
347349
return 100
350+
case 'bsc':
351+
return 56
348352
default:
349353
return 0
350354
}

src/views/WalletCheck.svelte

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,15 @@
349349

350350
<div class="bn-onboard-custom bn-onboard-prepare-button-container">
351351
{#if activeModal.button}
352-
<Button position="left" onclick={activeModal.button.onclick}>
352+
<Button position="right" onclick={activeModal.button.onclick}>
353353
{activeModal.button.text}
354354
</Button>
355355
{/if}
356356
{#if errorMsg}
357-
<Button position={!activeModal.button ? 'left' : ''} onclick={doAction}>
357+
<Button
358+
position={!activeModal.button ? 'right' : ''}
359+
onclick={doAction}
360+
>
358361
Try Again
359362
</Button>
360363
{:else}
@@ -363,9 +366,9 @@
363366
{#if loading}
364367
<Spinner />
365368
{/if}
366-
<Button position="right" onclick={() => handleExit(false)}>
367-
Dismiss
368-
</Button>
369+
<Button position="left" onclick={() => handleExit(false)} cta={false}
370+
>Dismiss</Button
371+
>
369372
</div>
370373
</Modal>
371374
{/if}

src/views/WalletSelect.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,9 @@
328328
What is a wallet?
329329
</span>
330330
{#if mobileDevice}
331-
<Button onclick={() => finish({ completed: false })}>Dismiss</Button>
331+
<Button cta={false} onclick={() => finish({ completed: false })}
332+
>Dismiss</Button
333+
>
332334
{/if}
333335
</div>
334336
{#if showWalletDefinition}

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,10 +2372,10 @@ bnb-javascript-sdk-nobroadcast@^2.16.14:
23722372
uuid "^3.3.2"
23732373
websocket-stream "^5.5.0"
23742374

2375-
bnc-sdk@^3.3.4:
2376-
version "3.4.0"
2377-
resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-3.4.0.tgz#402874a4a794ccf5dd8ba8fba6925e24b38f772e"
2378-
integrity sha512-JVDDyIYucFQyq+ZfHSBVZG+R2Ophhdi+HIK5zj1gE2MYSCK/Ax8Budqys9/LyZkGdewWHZ5EWi2TUehxAbx0Rw==
2375+
bnc-sdk@^3.4.1:
2376+
version "3.4.1"
2377+
resolved "https://registry.yarnpkg.com/bnc-sdk/-/bnc-sdk-3.4.1.tgz#fca070656a6efbfc489889ed0404e1b6289c17ff"
2378+
integrity sha512-GrZzN3zyqVOmtk++tvq/X1zchO+Bt9TIzw39xv7UkMLEUcs43pwj6XWphLRbqkrrILNSrLwOI0S8opyjffDFAA==
23792379
dependencies:
23802380
crypto-es "^1.2.2"
23812381
rxjs "^6.6.3"

0 commit comments

Comments
 (0)