Skip to content

Commit

Permalink
feat: add Talisman injected wallet (#1717)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xKheops committed May 16, 2023
1 parent 0c876df commit c6ef997
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 7 deletions.
1 change: 1 addition & 0 deletions docs/src/routes/docs/[...4]wallets/[...9]injected/+page.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ const injected = injectedModule({
- ApexWallet - _Desktop_
- BifrostWallet - _Desktop & Mobile_
- Safeheron - _Desktop_
- Talisman - _Desktop_

## Build Environments

Expand Down
2 changes: 1 addition & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"@web3-onboard/keystone": "^2.3.7-alpha.1",
"@web3-onboard/ledger": "^2.4.5",
"@web3-onboard/infinity-wallet": "^2.0.3",
"@web3-onboard/injected-wallets": "^2.8.5",
"@web3-onboard/injected-wallets": "^2.9.0-alpha.1",
"@web3-onboard/magic": "^2.1.6",
"@web3-onboard/phantom": "^2.0.1",
"@web3-onboard/portis": "^2.1.6",
Expand Down
2 changes: 2 additions & 0 deletions packages/injected/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const connectedWallets = await onboard.connectWallet()

console.log(connectedWallets)
```

### Injected Wallets Supported Natively

- Metamask - _Desktop & Mobile_
Expand Down Expand Up @@ -82,6 +83,7 @@ console.log(connectedWallets)
- ApexWallet - _Desktop_
- BifrostWallet - _Desktop & Mobile_
- Safeheron - _Desktop_
- Talisman - _Desktop_

## Filtering Wallets

Expand Down
2 changes: 1 addition & 1 deletion packages/injected/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/injected-wallets",
"version": "2.8.7-alpha.1",
"version": "2.9.0-alpha.1",
"description": "Injected wallet module for connecting browser extension and mobile wallets to Web3-Onboard. Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardised spec compliant web3 providers for all supported wallets, framework agnostic modern javascript UI with code splitting, CSS customization, multi-chain and multi-account support, reactive wallet state subscriptions and real-time transaction state change notifications.",
"keywords": [
"Ethereum",
Expand Down
3 changes: 2 additions & 1 deletion packages/injected/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
zerion: 'Zerion',
rainbow: 'Rainbow',
defiwallet: 'DeFi Wallet',
safeheron: 'Safeheron'
safeheron: 'Safeheron',
talismanEth: 'Talisman'
}
13 changes: 13 additions & 0 deletions packages/injected/src/icons/talisman.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export default `
<svg width="100%" height="100%" viewBox="0 0 82 82" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="82" height="82" rx="12" fill="#d5ff5c"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M59.117 44.663c.608 1.325 2.398 1.792 3.428.762l1.89-1.89a5 5 0 0 1 7.072 7.071L56.234 65.879C52.565 70.233 47.07 73 40.932 73c-6.403 0-12.102-3.008-15.763-7.689L10.464 50.607a5 5 0 0 1 7.071-7.071l1.861 1.86c1.008 1.009 2.759.555 3.354-.74a1.94 1.94 0 0 0 .182-.813V21a5 5 0 0 1 10 0v11.557c0 .994 1.018 1.669 1.966 1.37.6-.19 1.034-.737 1.034-1.366V14a5 5 0 0 1 10 0v18.561c0 .63.433 1.176 1.033 1.365.948.3 1.966-.375 1.966-1.37V21a5 5 0 1 1 10 0v22.835c0 .287.066.567.186.828z" fill="#fd4848"/>
<path d="M56.933 55s-7.164 10-16 10c-8.837 0-16-10-16-10s7.163-10 16-10c8.836 0 16 10 16 10z" fill="#d5ff5c"/>
<path d="M48.43 55a7.499 7.499 0 1 1-14.996 0 7.499 7.499 0 0 1 14.997 0z" stroke="#fd4848" stroke-width="1.003"/>
<path d="M45.43 55a4.499 4.499 0 1 1-8.997 0 4.499 4.499 0 0 1 8.998 0z" stroke="#fd4848" stroke-width="1.003"/>
<path d="M51.431 55c0 5.798-4.7 10.498-10.498 10.498-5.799 0-10.5-4.7-10.5-10.498 0-5.798 4.701-10.499 10.5-10.499 5.798 0 10.498 4.7 10.498 10.499z" stroke="#fd4848" stroke-width="1.003"/>
<path d="M54.43 55c0 7.455-6.043 13.498-13.498 13.498-7.455 0-13.498-6.043-13.498-13.498 0-7.456 6.043-13.499 13.498-13.499 7.455 0 13.499 6.044 13.499 13.499z" stroke="#fd4848" stroke-width="1.003"/>
<path d="M42.431 55a1.499 1.499 0 1 1-2.997 0 1.499 1.499 0 0 1 2.997 0z" fill="#fd4848" stroke="#fd4848" stroke-width="1.003"/>
<path d="M25.653 55.121A26.748 26.748 0 0 1 25.56 55l.094-.122a33.186 33.186 0 0 1 4.293-4.499c2.866-2.473 6.75-4.878 10.987-4.878 4.236 0 8.12 2.405 10.986 4.878a33.196 33.196 0 0 1 4.293 4.5l.094.12a28.888 28.888 0 0 1-1.01 1.235 33.186 33.186 0 0 1-3.377 3.386c-2.865 2.474-6.75 4.878-10.986 4.878-4.237 0-8.121-2.404-10.986-4.878a33.196 33.196 0 0 1-4.294-4.499z" stroke="#d5ff5c" stroke-width="1.003"/>
</svg>
`
10 changes: 7 additions & 3 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export enum ProviderIdentityFlag {
Rainbow = 'isRainbow',
SafePal = 'isSafePal',
DeFiWallet = 'isDeficonnectProvider',
Safeheron = 'isSafeheron'
Safeheron = 'isSafeheron',
Talisman = 'isTalisman'
}

export enum ProviderLabel {
Expand Down Expand Up @@ -113,7 +114,8 @@ export enum ProviderLabel {
Rainbow = 'Rainbow',
SafePal = 'SafePal',
DeFiWallet = 'DeFi Wallet',
Safeheron = 'Safeheron'
Safeheron = 'Safeheron',
Talisman = 'Talisman'
}

export interface MeetOneProvider extends ExternalProvider {
Expand Down Expand Up @@ -144,7 +146,8 @@ export enum InjectedNameSpace {
Trust = 'trustwallet',
Frontier = 'frontier',
DeFiConnectProvider = 'deficonnectProvider',
Safeheron = 'safeheron'
Safeheron = 'safeheron',
Talisman = 'talismanEth'
}

export interface CustomWindow extends Window {
Expand Down Expand Up @@ -180,6 +183,7 @@ export interface CustomWindow extends Window {
trustwallet: InjectedProvider
deficonnectProvider: InjectedProvider
safeheron: InjectedProvider
talismanEth: InjectedProvider
}

export type InjectedProvider = ExternalProvider &
Expand Down
15 changes: 14 additions & 1 deletion packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,18 @@ const safeheron: InjectedWalletModule = {
platforms: ['desktop', 'Chrome', 'Chromium', 'Microsoft Edge']
}

const talisman: InjectedWalletModule = {
label: ProviderLabel.Talisman,
injectedNamespace: InjectedNameSpace.Talisman,
checkProviderIdentity: ({ provider }) =>
!!provider && !!provider[ProviderIdentityFlag.Talisman],
getIcon: async () => (await import('./icons/talisman.js')).default,
getInterface: async () => ({
provider: createEIP1193Provider(window.talismanEth)
}),
platforms: ['desktop']
}

const wallets = [
zeal,
exodus,
Expand Down Expand Up @@ -812,7 +824,8 @@ const wallets = [
safepal,
defiwallet,
infinitywallet,
safeheron
safeheron,
talisman
]

export default wallets

0 comments on commit c6ef997

Please sign in to comment.