Skip to content

Commit

Permalink
Merge pull request #427 from blocknative/develop
Browse files Browse the repository at this point in the history
Release 1.13.0
  • Loading branch information
lnbc1QWFyb24 authored Aug 28, 2020
2 parents 83875fa + f7df5a1 commit 31351a0
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-onboard",
"version": "1.12.0",
"version": "1.13.0",
"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.",
"keywords": [
"ethereum",
Expand Down
3 changes: 3 additions & 0 deletions src/modules/select/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const defaultWalletNames = [
'opera',
'operaTouch',
'status',
'hyperpay',
'unilogin'
]

Expand Down Expand Up @@ -96,6 +97,8 @@ function getModule(name: string): Promise<any> | undefined {
return import('./wallets/mykey')
case 'huobiwallet':
return import('./wallets/huobiwallet')
case 'hyperpay':
return import('./wallets/hyperpay')
default:
return
}
Expand Down
Binary file added src/modules/select/wallet-icons/icon-hyperpay.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions src/modules/select/wallets/hyperpay.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { mobileWalletInstallMessage } from '../content'
import { WalletModule, Helpers, CommonWalletOptions } from '../../../interfaces'

import hyerpayIcon from '../wallet-icons/icon-hyperpay.png'
import hyerpayIcon2x from '../wallet-icons/[email protected]'

function hyperpay(options: CommonWalletOptions): WalletModule {
const { preferred, label, iconSrc, svg } = options

return {
name: label || 'HyperPay',
iconSrc: iconSrc || hyerpayIcon,
iconSrcSet: iconSrc || hyerpayIcon2x,
svg,
wallet: async (helpers: Helpers) => {
const { getProviderName, createModernProviderInterface } = helpers

const provider =
(window as any).ethereum ||
((window as any).web3 && (window as any).web3.currentProvider)

return {
provider,
interface:
provider && getProviderName(provider) === 'HyperPay'
? createModernProviderInterface(provider)
: null
}
},
type: 'injected',
link: 'https://www.hyperpay.me/',
installMessage: mobileWalletInstallMessage,
mobile: true,
preferred
}
}

export default hyperpay
3 changes: 3 additions & 0 deletions src/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ export function getProviderName(provider: any): string | undefined {
return 'huobiwallet'
}

if (provider.isHyperPay) {
return 'HyperPay'
}

if (provider.host && provider.host.indexOf('localhost') !== -1) {
return 'localhost'
Expand Down

0 comments on commit 31351a0

Please sign in to comment.