Skip to content

Commit 7ed2079

Browse files
1.31.0-0.0.3: add tp wallet (#576)
* add tp wallet * change IsTp to isTp * Version bump Co-authored-by: Taylor Dawson <taylorjdawson@gmail.com>
1 parent ddca1cf commit 7ed2079

File tree

6 files changed

+47
-2
lines changed

6 files changed

+47
-2
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.31.0-0.0.2",
3+
"version": "1.31.0-0.0.3",
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",

src/modules/select/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ const mobileDefaultWalletNames = [
3434
'alphawallet',
3535
'ownbit',
3636
'bitpie',
37-
'authereum'
37+
'authereum',
38+
'tp'
3839
]
3940

4041
const injectedWalletDetected = () =>
@@ -179,6 +180,8 @@ function getModule(name: string): Promise<{
179180
return import('./wallets/gnosis')
180181
case 'detectedwallet':
181182
return import('./wallets/detectedwallet')
183+
case 'tp':
184+
return import('./wallets/tp')
182185
default:
183186
throw new Error(`${name} is not a valid walletName.`)
184187
}
2.02 KB
Loading
4.15 KB
Loading

src/modules/select/wallets/tp.ts

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 tpIcon from '../wallet-icons/icon-tp.png'
5+
import tpIcon2x from '../wallet-icons/icon-tp@2x.png'
6+
7+
function tp(options: CommonWalletOptions): WalletModule {
8+
const { preferred, label, iconSrc, svg } = options
9+
10+
return {
11+
name: label || 'tp',
12+
iconSrc: iconSrc || tpIcon,
13+
iconSrcSet: iconSrc || tpIcon2x,
14+
svg,
15+
wallet: async (helpers: Helpers) => {
16+
const { getProviderName, createModernProviderInterface } = helpers
17+
18+
const provider =
19+
(window as any).ethereum ||
20+
((window as any).web3 && (window as any).web3.currentProvider)
21+
22+
return {
23+
provider,
24+
interface:
25+
(getProviderName(provider) === 'tp' &&
26+
createModernProviderInterface(provider)) ||
27+
null
28+
}
29+
},
30+
type: 'injected',
31+
link: 'https://tokenpocket.jp',
32+
installMessage: mobileWalletInstallMessage,
33+
mobile: true,
34+
preferred
35+
}
36+
}
37+
38+
export default tp

src/utilities.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,10 @@ export function getProviderName(provider: any): string | undefined {
306306
return 'Bitpie'
307307
}
308308

309+
if (provider.isTp) {
310+
return 'tp'
311+
}
312+
309313
// =====================================
310314
// When adding new wallet place above this metamask check as some providers
311315
// have an isMetaMask property in addition to the wallet's own `is[WalletName]`

0 commit comments

Comments
 (0)