Skip to content

Commit dba164e

Browse files
authored
[injected-v2.2.2-alpha.1] : Feature - Add core wallet support, fix scroll issue (#1259)
* Add core wallet support, fix scroll issue * Commit core icon
1 parent 7a2fcb4 commit dba164e

File tree

8 files changed

+32
-9
lines changed

8 files changed

+32
-9
lines changed

packages/core/src/views/connect/Index.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
}
116116
117117
connectingErrorMessage = ''
118-
118+
scrollToTop()
119119
// change step on next event loop
120120
setTimeout(() => setStep('connectingWallet'), 1)
121121
} catch (error) {
@@ -196,8 +196,10 @@
196196
trackWallet(provider, label)
197197
updateSelectedWallet(update)
198198
setStep('connectedWallet')
199+
scrollToTop()
199200
} catch (error) {
200201
const { code } = error as { code: number; message: string }
202+
scrollToTop()
201203
202204
// user rejected account access
203205
if (code === ProviderRpcErrorCode.ACCOUNT_ACCESS_REJECTED) {

packages/demo/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"@web3-onboard/fortmatic": "^2.0.13",
2929
"@web3-onboard/gas": "^2.1.2",
3030
"@web3-onboard/gnosis": "^2.1.2",
31-
"@web3-onboard/injected-wallets": "^2.2.1",
31+
"@web3-onboard/injected-wallets": "^2.2.2-alpha.1",
3232
"@web3-onboard/keepkey": "^2.3.0",
3333
"@web3-onboard/keystone": "^2.3.0",
3434
"@web3-onboard/ledger": "^2.3.0",

packages/demo/src/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@
106106
107107
const onboard = Onboard({
108108
wallets: [
109+
injected,
109110
web3auth,
110111
ledger,
111112
trezor,
112113
walletConnect,
113114
keepkey,
114115
keystone,
115116
coinbaseWallet,
116-
injected,
117117
magic,
118118
fortmatic,
119119
portis,

packages/injected/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@web3-onboard/injected-wallets",
3-
"version": "2.2.1",
3+
"version": "2.2.2-alpha.1",
44
"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.",
55
"keywords": [
66
"Ethereum",

packages/injected/src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ export const WALLET_NAMES: { [key: string]: string } = {
1313
meetone: 'MeetOne',
1414
frame: 'Frame',
1515
bitkeep: 'BitKeep',
16-
sequence: 'Sequence'
16+
sequence: 'Sequence',
17+
core: 'Core'
1718
}

packages/injected/src/icons/core.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default `<svg width="256" height="256" viewBox="0 0 256 256" fill="none" xmlns="http://www.w3.org/2000/svg">
2+
<rect width="256" height="256" rx="128" fill="black"/>
3+
<path fill-rule="evenodd" clip-rule="evenodd" d="M87.6477 203.403C66.6922 203.403 47.0213 198.931 30 191.095L99.2514 127.885C89.6861 120.038 83.5836 108.126 83.5836 94.7884C83.5836 81.2079 89.9104 69.1052 99.7773 61.2668V52.0015H126.08C126.177 52.0008 126.274 52.0005 126.372 52.0005C137.068 52.0005 146.848 55.9254 154.349 62.4136C161.85 55.926 171.629 52.0015 182.325 52.0015H182.389L182.39 52L182.392 52.0015H208.919V61.2679C218.786 69.1062 225.113 81.209 225.113 94.7894C225.113 111.867 215.108 126.608 200.64 133.47C195.467 148.743 185.737 162.479 172.714 173.652V193.398H139.977C124.227 199.801 106.455 203.403 87.6477 203.403ZM126.371 127.703C134.16 127.703 141.317 124.998 146.954 120.475L154.282 136.976L161.645 120.397C167.296 124.967 174.491 127.703 182.325 127.703C200.502 127.703 215.238 112.967 215.238 94.7895C215.238 76.6117 200.502 61.8757 182.325 61.8757C170.513 61.8757 160.155 68.0975 154.348 77.4425C148.541 68.0975 138.183 61.8757 126.371 61.8757C108.193 61.8757 93.4575 76.6117 93.4575 94.7895C93.4575 112.967 108.193 127.703 126.371 127.703ZM126.371 117.829C139.096 117.829 149.411 107.514 149.411 94.7893C149.411 82.0648 139.096 71.7496 126.371 71.7496C113.647 71.7496 103.331 82.0648 103.331 94.7893C103.331 107.514 113.647 117.829 126.371 117.829ZM126.371 107.955C133.642 107.955 139.537 102.06 139.537 94.7893C139.537 87.5182 133.642 81.6238 126.371 81.6238C119.1 81.6238 113.206 87.5182 113.206 94.7893C113.206 102.06 119.1 107.955 126.371 107.955ZM205.364 94.7893C205.364 107.514 195.049 117.829 182.324 117.829C169.6 117.829 159.285 107.514 159.285 94.7893C159.285 82.0648 169.6 71.7496 182.324 71.7496C195.049 71.7496 205.364 82.0648 205.364 94.7893ZM195.49 94.7893C195.49 102.06 189.596 107.955 182.324 107.955C175.053 107.955 169.159 102.06 169.159 94.7893C169.159 87.5182 175.053 81.6238 182.324 81.6238C189.596 81.6238 195.49 87.5182 195.49 94.7893Z" fill="white"/>
4+
</svg>`

packages/injected/src/types.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ export enum ProviderIdentityFlag {
4545
MathWallet = 'isMathWallet',
4646
GameStop = 'isGamestop',
4747
BitKeep = 'isBitKeep',
48-
Sequence = 'isSequence'
48+
Sequence = 'isSequence',
49+
Core = 'isAvalanche'
4950
}
5051

5152
export enum ProviderLabel {
@@ -82,7 +83,8 @@ export enum ProviderLabel {
8283
MathWallet = 'MathWallet',
8384
GameStop = 'GameStop Wallet',
8485
BitKeep = 'BitKeep',
85-
Sequence = 'Sequence'
86+
Sequence = 'Sequence',
87+
Core = 'Core'
8688
}
8789

8890
export interface MeetOneProvider extends ExternalProvider {
@@ -103,7 +105,8 @@ export enum InjectedNameSpace {
103105
Arbitrum = 'arbitrum',
104106
XFI = 'xfi',
105107
GameStop = 'gamestop',
106-
BitKeep = 'bitkeep'
108+
BitKeep = 'bitkeep',
109+
Avalanche = 'avalanche'
107110
}
108111

109112
export interface CustomWindow extends Window {
@@ -119,6 +122,7 @@ export interface CustomWindow extends Window {
119122
bitkeep: {
120123
ethereum: InjectedProvider
121124
}
125+
avalanche: InjectedProvider
122126
}
123127

124128
export type InjectedProvider = ExternalProvider &

packages/injected/src/wallets.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,17 @@ const sequence: InjectedWalletModule = {
532532
platforms: ['all']
533533
}
534534

535+
const core: InjectedWalletModule = {
536+
label: ProviderLabel.Core,
537+
injectedNamespace: InjectedNameSpace.Avalanche,
538+
checkProviderIdentity: ({ provider }) =>
539+
!!provider && !!provider[ProviderIdentityFlag.Core],
540+
getIcon: async () => (await import('./icons/core.js')).default,
541+
getInterface: getInjectedInterface(ProviderIdentityFlag.Core),
542+
// Core wallet is only tested in chrome or chromium browser
543+
platforms: ['desktop', 'Chrome', 'Chromium', 'Microsoft Edge']
544+
}
545+
535546
const wallets = [
536547
exodus,
537548
metamask,
@@ -564,7 +575,8 @@ const wallets = [
564575
mathwallet,
565576
gamestop,
566577
bitkeep,
567-
sequence
578+
sequence,
579+
core
568580
]
569581

570582
export default wallets

0 commit comments

Comments
 (0)