diff --git a/README.md b/README.md index bc3eb6b9..25bf6759 100644 --- a/README.md +++ b/README.md @@ -43,16 +43,16 @@ yarn add bnc-assist #### Script Tag The library uses [semantic versioning](https://semver.org/spec/v2.0.0.html). -The current version is 0.9.3. +The current version is 0.9.4. There are minified and non-minified versions. Put this script at the top of your `
` ```html - + - + ``` ### Initialize the Library @@ -207,6 +207,10 @@ var config = { handleNotificationEvent: Function // Called on every tx notification event with a transaction event object timeouts: { txStall: Number // The number of milliseconds after a transaction has been sent before showing a stall notification if not confirmed in the blockchain + }, + recommendedWallets: { + desktop: Array, // Array of Objects that define wallets this dapp supports on desktop to users that don't have a wallet + mobile: Array // Array of Objects that define wallets this dapp supports on mobile to users that don't have a wallet } } ``` @@ -471,6 +475,59 @@ By supplying an amount of wei to the `minimumBalance` option of the config, deve Assist will detect transactions which look to be repeated. We notify users of repeat transactions when we see sequential transactions with the same `to` address and the same `value`. +### Recommended Wallets + +If you would like to define which wallets your dapp works with and recommends to users that don't currently have a wallet installed, you can define it in the config for desktop and mobile devices: + +```javascript +{ + recommendedWallets: { + desktop: [ + { + name: 'MetaMask', + link: 'https://metamask.io/', + icon: 'https://metamask.io/img/metamask.png' + } + // other desktop wallets your dapp supports here + ], + mobile: [ + { + name: 'Coinbase', + link: 'https://wallet.coinbase.com/', + icon: 'https://cdn-images-1.medium.com/max/1200/1*7ywNS48PnonfsvvMu1tTsA.png' + } + // other mobile wallets your dapp supports here + ] + } +} +``` + +#### Assist currently only supports the following wallets: + +##### Desktop +- MetaMask + - link: https://metamask.io/img/metamask.png + - icon: https://metamask.io/img/metamask.png +- Opera + - link: https://www.opera.com/ + - icon: https://images-na.ssl-images-amazon.com/images/I/71Y2mhDkBNL.png + +##### Mobile +- Opera Touch + - link: https://www.opera.com/mobile/touch + - icon: https://apps.goodereader.com/wp-content/uploads/icons/1525044654.png +- Coinbase + - link: https://wallet.coinbase.com/ + - icon: https://cdn-images-1.medium.com/max/1200/1*7ywNS48PnonfsvvMu1tTsA.png +- Trust + - link: https://trustwallet.com/ + - icon: https://uploads-ssl.webflow.com/5a88babea6e0f90001b39b0d/5a8cf5a81df25e0001d5c78d_logo_solid_square_blue%20(2).png +- Status + - link: https://dev.status.im/get/ + - icon: https://cdn.investinblockchain.com/wp-content/uploads/2017/12/status-2-300x300.png?x88891 + +NOTE: above links available at time of writing, but may change. + ## API ### `init(config)` diff --git a/package.json b/package.json index d85b1c66..b83d0a40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bnc-assist", - "version": "0.9.3", + "version": "0.9.4", "description": "Blocknative Assist js library for Dapp developers", "main": "lib/assist.min.js", "scripts": { diff --git a/src/__integration-tests__/ui-rendering/__snapshots__/index.test.js.snap b/src/__integration-tests__/ui-rendering/__snapshots__/index.test.js.snap index b57a2d6a..a7d8f1c2 100644 --- a/src/__integration-tests__/ui-rendering/__snapshots__/index.test.js.snap +++ b/src/__integration-tests__/ui-rendering/__snapshots__/index.test.js.snap @@ -3,7 +3,7 @@ exports[`dom-rendering event activeContract-txAwaitingApproval should trigger correct DOM render [Custom state 0] 1`] = ` " -We’ve detected that you need to be on the local network for this application but you have your wallet set to local. Please switch to the correct network.
Connect your wallet to interact with this Dapp
We’ve detected that you need to be on the local network for this application but you have your wallet set to local. Please switch to the correct network.
@@ -398,7 +445,7 @@ export function onboardMain(type, step) { : onboardButton[step][type] const { - config: { style }, + config: { style, recommendedWallets, images }, currentProvider } = state @@ -408,7 +455,6 @@ export function onboardMain(type, step) { const defaultImages = imageSrc[step + variant] || imageSrc[step] const isMetaMask = currentProvider === 'metamask' - const { images } = state.config const stepKey = stepToImageKey(step) const devImages = images && images[stepKey] const onboardImages = { @@ -420,6 +466,8 @@ export function onboardMain(type, step) { ((isMetaMask || stepKey) && defaultImages && defaultImages.srcset) } + const customButtons = recommendedWallets && recommendedWallets.desktop + return ` ${ onboardImages.src @@ -434,6 +482,7 @@ export function onboardMain(type, step) {
${description}