Skip to content
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
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 @@ -334,6 +334,7 @@ const injected = injectedModule({
- BifrostWallet - _Desktop & Mobile_
- Safeheron - _Desktop_
- Talisman - _Desktop_
- OneKey - _Desktop & Mobile_

## 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 @@ -35,7 +35,7 @@
"@web3-onboard/gas": "^2.1.7",
"@web3-onboard/gnosis": "^2.1.9",
"@web3-onboard/infinity-wallet": "^2.0.3",
"@web3-onboard/injected-wallets": "^2.10.0",
"@web3-onboard/injected-wallets": "^2.10.1-alpha.1",
"@web3-onboard/keepkey": "^2.3.7",
"@web3-onboard/keystone": "^2.3.7",
"@web3-onboard/ledger": "^2.4.5",
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.10.0",
"version": "2.10.1-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 @@ -26,5 +26,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
rainbow: 'Rainbow',
defiwallet: 'DeFi Wallet',
safeheron: 'Safeheron',
talismanEth: 'Talisman'
talismanEth: 'Talisman',
onekey: 'OneKey'
}
6 changes: 6 additions & 0 deletions packages/injected/src/icons/onekey.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="450" height="450" viewBox="0 0 450 450" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M448.628 224.314C448.628 379.171 379.171 448.628 224.314 448.628C69.4575 448.628 0 379.171 0 224.314C0 69.4575 69.4575 0 224.314 0C379.171 0 448.628 69.4575 448.628 224.314Z" fill="#3BD23D"/>
<path d="M244.583 95.1172L182.18 95.1172L171.232 128.221H205.892V197.951H244.583V95.1172Z" fill="black"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M295.485 282.343C295.485 321.648 263.622 353.511 224.317 353.511C185.012 353.511 153.149 321.648 153.149 282.343C153.149 243.039 185.012 211.176 224.317 211.176C263.622 211.176 295.485 243.039 295.485 282.343ZM263.175 282.343C263.175 303.804 245.778 321.202 224.317 321.202C202.856 321.202 185.459 303.804 185.459 282.343C185.459 260.882 202.856 243.485 224.317 243.485C245.778 243.485 263.175 260.882 263.175 282.343Z" fill="black"/>
</svg>`
13 changes: 10 additions & 3 deletions packages/injected/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ export enum ProviderIdentityFlag {
SafePal = 'isSafePal',
DeFiWallet = 'isDeficonnectProvider',
Safeheron = 'isSafeheron',
Talisman = 'isTalisman'
Talisman = 'isTalisman',
OneKey = 'isOneKey'
}


Expand All @@ -82,6 +83,7 @@ export enum ProviderExternalUrl {
Phantom = 'https://phantom.app/download',
Talisman = 'https://www.talisman.xyz/',
Trust = 'https://trustwallet.com/download/',
OneKey = 'https://onekey.so/download/',
}

export enum ProviderLabel {
Expand Down Expand Up @@ -134,7 +136,8 @@ export enum ProviderLabel {
SafePal = 'SafePal',
DeFiWallet = 'DeFi Wallet',
Safeheron = 'Safeheron',
Talisman = 'Talisman'
Talisman = 'Talisman',
OneKey = 'OneKey'
}

export interface MeetOneProvider extends ExternalProvider {
Expand Down Expand Up @@ -166,7 +169,8 @@ export enum InjectedNameSpace {
Frontier = 'frontier',
DeFiConnectProvider = 'deficonnectProvider',
Safeheron = 'safeheron',
Talisman = 'talismanEth'
Talisman = 'talismanEth',
OneKey = '$onekey'
}

export interface CustomWindow extends Window {
Expand Down Expand Up @@ -203,6 +207,9 @@ export interface CustomWindow extends Window {
deficonnectProvider: InjectedProvider
safeheron: InjectedProvider
talismanEth: InjectedProvider
$onekey: {
ethereum: InjectedProvider
}
}

export type InjectedProvider = ExternalProvider &
Expand Down
18 changes: 17 additions & 1 deletion packages/injected/src/wallets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -785,6 +785,21 @@ const talisman: InjectedWalletModule = {
externalUrl: ProviderExternalUrl.Talisman
}

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

const wallets = [
zeal,
exodus,
Expand Down Expand Up @@ -833,7 +848,8 @@ const wallets = [
defiwallet,
infinitywallet,
safeheron,
talisman
talisman,
onekey
]

export default wallets