Skip to content

Commit 177e66a

Browse files
1.37.3-0.0.1 : [feat] -Add DID wallet (#773)
* add did wallet * update package.json version field * fix lint error Co-authored-by: Adam Carpenter <adamcarpenter86@gmail.com>
1 parent 2165eb8 commit 177e66a

File tree

5 files changed

+43
-1
lines changed

5 files changed

+43
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "bnc-onboard",
3-
"version": "1.37.3",
3+
"version": "1.37.3-0.0.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",
Loading
Loading
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { mobileWalletInstallMessage } from '../content'
2+
import { WalletModule, Helpers, CommonWalletOptions } from '../../../interfaces'
3+
4+
import didWalletIcon from '../wallet-icons/icon-didwallet.png'
5+
import didWalletIcon2x from '../wallet-icons/icon-didwallet@2x.png'
6+
7+
function didwallet(options: CommonWalletOptions): WalletModule {
8+
const { preferred, label, iconSrc, svg } = options
9+
10+
return {
11+
name: label || 'DID Wallet',
12+
iconSrc: iconSrc || didWalletIcon,
13+
iconSrcSet: iconSrc || didWalletIcon2x,
14+
svg,
15+
wallet: async (helpers: Helpers) => {
16+
const { getProviderName, createLegacyProviderInterface } = helpers
17+
const provider =
18+
(window as any).web3 && (window as any).web3.currentProvider
19+
20+
return {
21+
provider,
22+
interface:
23+
provider && getProviderName(provider) === 'DIDWallet'
24+
? createLegacyProviderInterface(provider)
25+
: null
26+
}
27+
},
28+
type: 'injected',
29+
link: `abt://abtwallet.io/i?action=requestOpenUrl&url=${encodeURIComponent(
30+
window.location.href
31+
)}`,
32+
installMessage: mobileWalletInstallMessage,
33+
mobile: true,
34+
preferred
35+
}
36+
}
37+
38+
export default didwallet

src/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,10 @@ export function getProviderName(provider: any): string | undefined {
257257
return 'MathWallet'
258258
}
259259

260+
if (provider.isDIDWallet) {
261+
return 'DIDWallet'
262+
}
263+
260264
if (provider.isWalletIO) {
261265
return 'wallet.io'
262266
}

0 commit comments

Comments
 (0)