Skip to content

Commit a6e5273

Browse files
authored
Merge pull request #314 from blocknative/develop
Release 1.7.6
2 parents a8398dc + 80f9f79 commit a6e5273

File tree

9 files changed

+616
-650
lines changed

9 files changed

+616
-650
lines changed

.circleci/config.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ jobs:
4040
- run: sudo npm i -g add npm-cli-login
4141
- run: NPM_USER=$NPM_USERNAME NPM_EMAIL=$NPM_EMAIL NPM_PASS=$NPM_PASSWORD npm-cli-login
4242
- run: npm publish
43+
deploy_demo:
44+
docker:
45+
- image: circleci/node:8.15-browsers
46+
user: root
47+
steps:
48+
- checkout
49+
- run: sh ./trigger-demo-build.sh $CIRCLE_TOKEN
50+
4351
workflows:
4452
version: 2
4553
test_build:
@@ -59,3 +67,8 @@ workflows:
5967
branches:
6068
only:
6169
- master
70+
- deploy_demo:
71+
filters:
72+
branches:
73+
only:
74+
- develop

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.7.5",
3+
"version": "1.7.6",
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",
@@ -42,7 +42,7 @@
4242
"@ledgerhq/hw-app-eth": "^5.7.0",
4343
"@ledgerhq/hw-transport-u2f": "^5.7.0",
4444
"@portis/web3": "^2.0.0-beta.42",
45-
"@toruslabs/torus-embed": "^1.2.4",
45+
"@toruslabs/torus-embed": "^1.3.0",
4646
"@unilogin/provider": "^0.5.21",
4747
"@walletconnect/web3-provider": "^1.0.0-beta.75",
4848
"authereum": "^0.0.4-beta.131",
@@ -61,6 +61,7 @@
6161
},
6262
"scripts": {
6363
"build": "rimraf dist && rollup -c && babel dist/cjs --out-dir dist/cjs && babel dist/esm --out-dir dist/esm",
64-
"test": "echo \"TBD\" && exit 0"
64+
"test": "echo \"TBD\" && exit 0",
65+
"prepare": "npm run build"
6566
}
6667
}

src/interfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ export interface SdkWalletOptions {
168168

169169
export interface WalletConnectOptions {
170170
infuraKey: string
171+
rpc: {
172+
[key: string]: string
173+
}
174+
bridge: string
171175
}
172176

173177
export interface TrezorOptions {

src/modules/check/connect.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ function connect(
2121
if (address === null) {
2222
// wait for address sync if is still on initial value
2323
if (stateSyncStatus.address) {
24-
try {
25-
await stateSyncStatus.address
26-
} catch (error) {}
24+
await new Promise(resolve => {
25+
stateSyncStatus.address && stateSyncStatus.address.then(resolve)
26+
27+
setTimeout(() => {
28+
if (address === null) {
29+
// if prom isn't resolving after 500ms, then stop waiting
30+
resolve()
31+
}
32+
}, 500)
33+
})
2734
}
2835
}
2936

src/modules/check/network.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@ function network(
2424
if (network === null) {
2525
// wait for network sync if is still on initial value
2626
if (stateSyncStatus.network) {
27-
try {
28-
await stateSyncStatus.network
29-
} catch (error) {}
27+
await new Promise(resolve => {
28+
stateSyncStatus.network && stateSyncStatus.network.then(resolve)
29+
30+
setTimeout(() => {
31+
if (network === null) {
32+
// if prom isn't resolving after 500ms, then stop waiting
33+
resolve()
34+
}
35+
}, 500)
36+
})
3037
}
3138
}
3239

src/modules/select/wallets/wallet-connect.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import walletConnectIcon from '../wallet-icons/icon-wallet-connect'
1010
function walletConnect(
1111
options: WalletConnectOptions & CommonWalletOptions
1212
): WalletModule {
13-
const { infuraKey, preferred, label, iconSrc, svg } = options
13+
const { infuraKey, rpc, bridge, preferred, label, iconSrc, svg } = options
1414

1515
return {
1616
name: label || 'WalletConnect',
@@ -24,7 +24,9 @@ function walletConnect(
2424
)
2525

2626
const provider = new WalletConnectProvider({
27-
infuraId: infuraKey
27+
infuraId: infuraKey,
28+
rpc,
29+
bridge
2830
})
2931

3032
provider.autoRefreshOnNetworkChange = false

src/validation.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ export function validateWalletInit(
542542
apiKey,
543543
networkId,
544544
infuraKey,
545+
rpc,
546+
bridge,
545547
preferred,
546548
label,
547549
iconSrc,
@@ -567,6 +569,8 @@ export function validateWalletInit(
567569
'apiKey',
568570
'networkId',
569571
'infuraKey',
572+
'rpc',
573+
'bridge',
570574
'preferred',
571575
'label',
572576
'iconSrc',
@@ -612,6 +616,20 @@ export function validateWalletInit(
612616
optional: true
613617
})
614618

619+
validateType({
620+
name: 'walletInit.rpc',
621+
value: rpc,
622+
type: 'object',
623+
optional: true
624+
})
625+
626+
validateType({
627+
name: 'walletInit.bridge',
628+
value: bridge,
629+
type: 'string',
630+
optional: true
631+
})
632+
615633
validateType({
616634
name: 'walletInit.preferred',
617635
value: preferred,

trigger-demo-build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
curl -X POST --header "Content-Type: application/json" -d '{"build_parameters": {"CIRCLE_JOB": "deploy_stage"}}' https://circleci.com/api/v1/project/blocknative/react-demo/tree/develop?circle-token=$1

0 commit comments

Comments
 (0)