Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add safeheron #1639

Merged
merged 1 commit into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/src/routes/docs/[...4]wallets/injected.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ const injected = injectedModule({
- DeFiWallet - _Desktop & Mobile_
- ApexWallet - _Desktop_
- BifrostWallet - _Desktop & Mobile_
- Safeheron - _Desktop_

## Build Environments

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.4",
"version": "2.8.5-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 @@ -24,5 +24,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
frontier: 'Frontier',
zerion: 'Zerion',
rainbow: 'Rainbow',
defiwallet: 'DeFi Wallet'
defiwallet: 'DeFi Wallet',
safeheron: 'Safeheron'
}
20 changes: 20 additions & 0 deletions packages/injected/src/icons/safeheron.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export default `
<?xml version="1.0" encoding="UTF-8"?>
<svg width="100%" height="100%" viewBox="0 0 38 38" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<polygon id="path-1" points="0 0 38 0 38 38 0 38"></polygon>
</defs>
<g id="page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
<g id="about" transform="translate(-340.000000, -14.000000)">
<g id="group" transform="translate(340.000000, 14.000000)">
<mask id="mask-2" fill="white">
<use xlink:href="#path-1"></use>
</mask>
<g id="Clip-2"></g>
<path d="M19,0 C8.50690038,0 0,8.50690038 0,19 C0,29.4930996 8.50690038,38 19,38 C29.4938531,38 38,29.4930996 38,19 C38,8.50690038 29.4938531,0 19,0 L19,0 Z" id="Fill-1" fill="#109D84" mask="url(#mask-2)"></path>
<path d="M7.58990324,15.7916402 L23.6603347,26.2689166 C23.8087722,26.3789261 23.896177,26.5522287 23.896177,26.7375872 L23.8170606,31.8334391 C23.8170606,32.3797192 23.1570035,32.654743 22.7697097,32.2689562 L7.55750317,18.2502776 C7.34652602,18.0408074 7.22747462,17.7544813 7.22747462,17.4568528 L7.22747462,15.9739848 C7.22747462,15.7878728 7.43995876,15.6801237 7.58990324,15.7916402 Z M16.3205901,5.72727633 L31.6096526,19.8808296 C31.8251507,20.0918068 31.9464626,20.3803934 31.9464626,20.6817893 L31.9464626,22.2211691 C31.9464626,22.4072811 31.7354854,22.5150301 31.5847874,22.4050206 L20.0081694,15.2091926 C19.8634994,15.1044575 19.6608106,15.2069321 19.6608106,15.3855092 L19.6608106,16.1570828 C19.6608106,16.4117624 19.7640387,16.6558931 19.9456298,16.8344702 L23.5247065,20.338198 C23.7628093,20.5710263 23.896177,20.888999 23.896177,21.2227951 L23.896177,24.1998334 C23.896177,24.3716291 23.6919813,24.4605409 23.566902,24.3429965 L17.70023,18.8711532 L15.6658074,16.9512611 C15.4171558,16.7169258 15.2770067,16.3921716 15.2770067,16.0515942 L15.2770067,6.16656091 C15.2770067,5.62329473 15.9317893,5.34676396 16.3205901,5.72727633 Z" id="shape" fill="#FFFFFF" mask="url(#mask-2)"></path>
</g>
</g>
</g>
</svg>
`
10 changes: 7 additions & 3 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export enum ProviderIdentityFlag {
Zerion = 'isZerion',
Rainbow = 'isRainbow',
SafePal = 'isSafePal',
DeFiWallet = 'isDeficonnectProvider'
DeFiWallet = 'isDeficonnectProvider',
Safeheron = 'isSafeheron'
}

export enum ProviderLabel {
Expand Down Expand Up @@ -111,7 +112,8 @@ export enum ProviderLabel {
Zerion = 'Zerion',
Rainbow = 'Rainbow',
SafePal = 'SafePal',
DeFiWallet = 'DeFi Wallet'
DeFiWallet = 'DeFi Wallet',
Safeheron = 'Safeheron'
}

export interface MeetOneProvider extends ExternalProvider {
Expand Down Expand Up @@ -141,7 +143,8 @@ export enum InjectedNameSpace {
OKXWallet = 'okxwallet',
Trust = 'trustwallet',
Frontier = 'frontier',
DeFiConnectProvider = 'deficonnectProvider'
DeFiConnectProvider = 'deficonnectProvider',
Safeheron = 'safeheron'
}

export interface CustomWindow extends Window {
Expand Down Expand Up @@ -176,6 +179,7 @@ export interface CustomWindow extends Window {
okxwallet: InjectedProvider
trustwallet: InjectedProvider
deficonnectProvider: InjectedProvider
safeheron: InjectedProvider
}

export type InjectedProvider = ExternalProvider &
Expand Down
14 changes: 13 additions & 1 deletion packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,17 @@ const defiwallet: InjectedWalletModule = {
platforms: ['all']
}

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

const wallets = [
zeal,
exodus,
Expand Down Expand Up @@ -793,7 +804,8 @@ const wallets = [
rainbow,
safepal,
defiwallet,
infinitywallet
infinitywallet,
safeheron,
]

export default wallets