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 FoxWallet to injected wallets #1997

Merged
merged 2 commits into from
Nov 28, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions 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.10.9",
"version": "2.10.10-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 Expand Up @@ -34,7 +34,8 @@
"Phantom",
"DeFi Wallet",
"Fordefi",
"Coin98 Wallet"
"Coin98 Wallet",
"FoxWallet"
],
"repository": {
"type": "git",
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 @@ -32,5 +32,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
roninWallet: 'Ronin Wallet',
coin98wallet: 'Coin98 Wallet',
SubWallet: 'SubWallet',
kayros: 'Kayros'
kayros: 'Kayros',
foxwallet: "FoxWallet"
}
14 changes: 14 additions & 0 deletions packages/injected/src/icons/foxwallet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
export default `
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" viewBox="0 0 28 28" fill="none">
<path fill="#fff" d="M0 0h28v28H0z"/>
<path fill="#fff" fill-rule="evenodd" d="M11.784 15.84a.792.792 0 0 0 .162.036s-.229.085-.702-.075c0 0-.353-.144-.619-.12-.308.028-.52.429-.52.429a.862.862 0 0 1 .192-.076c.21-.043.138-.007.138-.007s-.404.169-.431.32c-.007.037.106-.07.405-.06.366.012.684.224.815.26.269.071.653.087 1.006-.19 0 0 .326-.204.427-.581.026-.105.041-.212.046-.32a1.191 1.191 0 0 0-.029-.282s-.19.441-.89.667Z" clip-rule="evenodd"/>
<path fill="url(#a)" fill-rule="evenodd" d="M18.715 19.983a5.031 5.031 0 0 0 0-6.274l4.554-.501s.473 1.298.598 1.992c.016.089.044.268.044.268s-.706 1.715-1.79 2.657c-1.458 1.267-3.406 1.858-3.406 1.858ZM7.93 19.921l-1.746.323a9.247 9.247 0 0 1 .957-8.599l.112-.16 1.929 5.43-1.252 3.006Z" clip-rule="evenodd"/>
<path fill="url(#b)" fill-rule="evenodd" d="m14.245 8.781.016-.018c.047-.05 1.13-1.215-.161-3.188-.954-1.454-3.382-1.413-4.374-2.17.074.583.645 1.108.583 1.907a4.18 4.18 0 0 1-.147.778c-.118.456-.227.889-.063 1.739.127.662.43 1.146.898 1.437.536.332 1.278.405 2.04.198.51-.139.962-.395 1.208-.683Z" clip-rule="evenodd"/>
<path fill="url(#c)" fill-rule="evenodd" d="M15.861 7.93c.279-.48.332-1.04.16-1.662-.238-.868-.693-1.438-1.06-1.896-.114-.145-.223-.28-.31-.407a2.54 2.54 0 0 1-.422-1.746c-.443.318-1.294.919-1.839 1.559.787.377 1.4.788 1.887 1.529.828 1.262.815 2.282.657 2.915-.044.175.29.33.228.464a2.52 2.52 0 0 0 .7-.755Z" clip-rule="evenodd"/>
<path fill="url(#d)" fill-rule="evenodd" d="M21.894 13.175c-.925-.088-2.799-.316-2.799-.316-4.213-.235-6.604 1.03-8.41 2.684-1.393 1.384-2.634 4.972-2.634 4.972l-1.51-.082S7.024 19 7.579 17.96c.637-1.194.78-1.097.636-1.296-.674-.925-.99-1.653-1.26-3.209 0 0 .317.249.556.097 0 0-.544-.945-.628-1.964-.149-1.806.697-4.272.717-4.329-.008.026-.053.238.443.555.036-.15.073-.296.113-.438.175-.853.642-2.713 1.575-3.974 0 0 .522 1.823 1.834 2.65 2.553 1.61 4.151 1.62 4.151 1.62 3.607.403 5.147 2.172 5.147 2.172 2.588 2.792 4.94 2.766 4.94 2.766-.845.808-3.908.565-3.908.565ZM7.599 7.259v-.002.002Z" clip-rule="evenodd"/>
<path fill="url(#e)" fill-rule="evenodd" d="M25.845 12.61s-.367 2.032-2.291 2.268c0 0-6.978-.045-7.486 6.294l-.119 1.78-8.37-2.439s.79-2.691 2.514-4.852c0 0 2.93-4.14 11.28-3.049 0 0 .975.197 2.343.325 1.156.108 2.13-.327 2.13-.327Z" clip-rule="evenodd"/>
<path fill="#722B00" fill-rule="evenodd" d="M21.098 11.643s-1.813-.942-4.067-.853c0 0 1.226-.959 2.883-.724l1.184 1.577Z" clip-rule="evenodd"/>
<path fill="url(#f)" fill-rule="evenodd" d="M16.515 20.303s.59.407 1.526.19c0 0-1.513.878-4.7-.325 0 0-3.288-1.47-5.6-1.135-1.487.216-2.802 1.397-3.598 2.295-.961 1.087-.842.579 1.574.28.58-.072.246.093.246.093s-3.227 1.352-3.445 2.554c-.054.3.85-.547 3.235-.472 2.928.092 5.475 1.793 6.522 2.073 2.145.574 5.22.705 8.042-1.508 0 0 2.603-1.633 3.408-4.652.21-.837.333-1.694.368-2.556.043-1.124-.299-2.307-.299-2.307s-1.902 4.214-7.279 5.47Z" clip-rule="evenodd"/>
<defs><linearGradient id="a" x1="14.361" x2="14.725" y1="11.206" y2="20.244" gradientUnits="userSpaceOnUse"><stop stop-color="#DADB48"/><stop offset=".656" stop-color="#637621"/></linearGradient><linearGradient id="b" x1="14.731" x2="10.303" y1="6.996" y2="6.996" gradientUnits="userSpaceOnUse"><stop stop-color="#EC6F01"/><stop offset="1" stop-color="#F4B23D"/></linearGradient><linearGradient id="c" x1="15.102" x2="14.84" y1="7.192" y2="2.917" gradientUnits="userSpaceOnUse"><stop stop-color="#F4B33E"/><stop offset="1" stop-color="#FB6F1B"/></linearGradient><linearGradient id="d" x1="8.035" x2="23.609" y1="7.215" y2="13.366" gradientUnits="userSpaceOnUse"><stop stop-color="#FB6D1A"/><stop offset="1" stop-color="#F3B23E"/></linearGradient><linearGradient id="e" x1="9.671" x2="24.46" y1="19.648" y2="13.148" gradientUnits="userSpaceOnUse"><stop stop-color="#F3B63F"/><stop offset="1" stop-color="#FB701C"/></linearGradient><linearGradient id="f" x1="9.147" x2="21.951" y1="26.213" y2="18.23" gradientUnits="userSpaceOnUse"><stop stop-color="#EC6F00"/><stop offset="1" stop-color="#F4B33E"/></linearGradient></defs>
</svg>
`
13 changes: 9 additions & 4 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ export enum ProviderIdentityFlag {
Fordefi = 'isFordefi',
Coin98Wallet = 'isCoin98',
SubWallet = 'isSubWallet',
Kayros = 'isKayros'
Kayros = 'isKayros',
FoxWallet = 'isFoxWallet'
}

/**
Expand All @@ -92,7 +93,8 @@ export enum ProviderExternalUrl {
Coin98Wallet = 'https://coin98.com/wallet/',
SubWallet = 'https://www.subwallet.app/',
Kayros = 'https://www.kayros.games/wallet/',
XDEFI = 'https://xdefi.io/'
XDEFI = 'https://xdefi.io/',
FoxWallet = 'https://foxwallet.com/download'
}

export enum ProviderLabel {
Expand Down Expand Up @@ -151,7 +153,8 @@ export enum ProviderLabel {
RoninWallet = 'Ronin Wallet',
Coin98Wallet = 'Coin98 Wallet',
SubWallet = 'SubWallet',
Kayros = 'Kayros'
Kayros = 'Kayros',
FoxWallet = 'FoxWallet'
}

export interface MeetOneProvider extends ExternalProvider {
Expand Down Expand Up @@ -188,7 +191,8 @@ export enum InjectedNameSpace {
RoninWallet = 'ronin',
Coin98Wallet = 'coin98',
SubWallet = 'SubWallet',
Kayros = 'kayros'
Kayros = 'kayros',
FoxWallet = 'foxwallet'
}

export interface CustomWindow extends Window {
Expand Down Expand Up @@ -238,6 +242,7 @@ export interface CustomWindow extends Window {
provider: InjectedProvider
}
kayros: InjectedProvider
foxwallet: 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 @@ -880,6 +880,18 @@ const kayros: InjectedWalletModule = {
platforms: ['desktop']
}

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

const wallets = [
zeal,
exodus,
Expand Down Expand Up @@ -934,7 +946,8 @@ const wallets = [
ronin,
coin98wallet,
subwallet,
kayros
kayros,
foxwallet
]

export default wallets
Loading