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 BitKeep #1177

Merged
merged 3 commits into from Jul 28, 2022
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
2 changes: 1 addition & 1 deletion packages/injected/package.json
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/injected-wallets",
"version": "2.0.15-alpha.2",
"version": "2.0.15-alpha.3",
"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
Expand Up @@ -11,5 +11,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
metamask: 'MetaMask',
detected: 'Detected Wallet',
meetone: 'MeetOne',
frame: 'Frame'
frame: 'Frame',
bitkeep: 'BitKeep',
}
5 changes: 5 additions & 0 deletions packages/injected/src/icons/bitkeep.ts
@@ -0,0 +1,5 @@
export default `<svg width="36" height="36" viewBox="0 0 36 36" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M18 0C27.942 0 36 8.05967 36 18C36 27.942 27.942 36 18 36C8.05967 36 0 27.9413 0 18C0 8.05967 8.05967 0 18 0Z" fill="#7524F9"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M28 13.1817V14.2863C28.0002 14.3931 27.9714 14.4981 27.9165 14.5907C27.8616 14.6833 27.7826 14.7601 27.6875 14.8135L24.0242 16.8686L27.2969 18.6995C27.5108 18.8196 27.6884 18.9924 27.8118 19.2005C27.9353 19.4085 28.0002 19.6445 28 19.8847V22.8302C28.0003 23.0705 27.9355 23.3066 27.812 23.5148C27.6886 23.723 27.5109 23.8959 27.2969 24.0161L18.6898 28.8168C18.4761 28.9368 18.2336 29 17.9867 29C17.7399 29 17.4974 28.9368 17.2836 28.8168L14.4672 27.235C14.4196 27.2084 14.3802 27.17 14.3527 27.1238C14.3253 27.0776 14.3108 27.0252 14.3108 26.9718C14.3108 26.9184 14.3253 26.866 14.3527 26.8198C14.3802 26.7736 14.4196 26.7352 14.4672 26.7086L23.7641 21.5052C23.7877 21.4918 23.8074 21.4727 23.8211 21.4496C23.8347 21.4265 23.8419 21.4004 23.8419 21.3738C23.8419 21.3472 23.8347 21.321 23.8211 21.2979C23.8074 21.2749 23.7877 21.2557 23.7641 21.2423L20.3125 19.3035C20.2175 19.2502 20.1097 19.2221 20 19.2221C19.8903 19.2221 19.7825 19.2502 19.6875 19.3035L10.2445 24.5927C10.1733 24.6327 10.0924 24.6538 10.0102 24.6538C9.92788 24.6538 9.84704 24.6327 9.77578 24.5927L8.70625 23.9979C8.4913 23.8779 8.31277 23.7048 8.18875 23.4961C8.06472 23.2875 7.99961 23.0507 8 22.8096V21.6055C7.99995 21.5254 8.02158 21.4468 8.06273 21.3774C8.10387 21.3081 8.16307 21.2505 8.23438 21.2104L21.7734 13.6443C21.7971 13.631 21.8168 13.6118 21.8304 13.5887C21.8441 13.5657 21.8513 13.5395 21.8513 13.5129C21.8513 13.4863 21.8441 13.4601 21.8304 13.4371C21.8168 13.414 21.7971 13.3948 21.7734 13.3815L18.3164 11.4358C18.2214 11.3825 18.1136 11.3544 18.0039 11.3544C17.8942 11.3544 17.7864 11.3825 17.6914 11.4358L8.46875 16.5936C8.42127 16.6202 8.36741 16.6343 8.31258 16.6343C8.25775 16.6343 8.20389 16.6203 8.15639 16.5937C8.10889 16.567 8.06944 16.5287 8.04199 16.4826C8.01454 16.4364 8.00006 16.384 8 16.3307V13.1672C7.99971 12.9269 8.06454 12.6907 8.18798 12.4825C8.31142 12.2743 8.4891 12.1015 8.70313 11.9813L17.3086 7.18212C17.5219 7.0628 17.7637 7 18.0098 7C18.2558 7 18.4976 7.0628 18.7109 7.18212L27.2969 11.998C27.5106 12.118 27.688 12.2905 27.8114 12.4983C27.9349 12.706 27.9999 12.9417 28 13.1817Z" fill="white"/>
</svg>
`
14 changes: 10 additions & 4 deletions packages/injected/src/types.ts
Expand Up @@ -43,7 +43,8 @@ export enum ProviderIdentityFlag {
BraveWallet = 'isBraveWallet',
Rabby = 'isRabby',
MathWallet = 'isMathWallet',
GameStop = 'isGamestop'
GameStop = 'isGamestop',
BitKeep = 'isBitKeep'
}

export enum ProviderLabel {
Expand Down Expand Up @@ -78,7 +79,8 @@ export enum ProviderLabel {
Tally = 'Tally Wallet',
Rabby = 'Rabby',
MathWallet = 'MathWallet',
GameStop = 'GameStop Wallet'
GameStop = 'GameStop Wallet',
BitKeep = 'BitKeep'
}

export interface MeetOneProvider extends ExternalProvider {
Expand All @@ -98,7 +100,8 @@ export enum InjectedNameSpace {
Web3 = 'web3',
Arbitrum = 'arbitrum',
XFI = 'xfi',
GameStop = 'gamestop'
GameStop = 'gamestop',
BitKeep = 'bitkeep'
}

export interface CustomWindow extends Window {
Expand All @@ -110,7 +113,10 @@ export interface CustomWindow extends Window {
xfi: {
ethereum: InjectedProvider
}
gamestop: InjectedProvider
gamestop: InjectedProvider,
bitkeep: {
ethereum: InjectedProvider
}
}

export type InjectedProvider = ExternalProvider &
Expand Down
15 changes: 14 additions & 1 deletion packages/injected/src/wallets.ts
Expand Up @@ -508,6 +508,18 @@ const gamestop: InjectedWalletModule = {
platforms: ['desktop']
}

const bitkeep: InjectedWalletModule = {
label: ProviderLabel.BitKeep,
injectedNamespace: InjectedNameSpace.BitKeep,
checkProviderIdentity: ({ provider }) =>
!!provider && !!provider["ethereum"][ProviderIdentityFlag.BitKeep],
getIcon: async () => (await import('./icons/bitkeep.js')).default,
getInterface: async () => ({
provider: window.bitkeep && window.bitkeep.ethereum,
}),
platforms: ['all']
}

const wallets = [
exodus,
metamask,
Expand Down Expand Up @@ -538,7 +550,8 @@ const wallets = [
tally,
rabby,
mathwallet,
gamestop
gamestop,
bitkeep
]

export default wallets