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

[FIX] - Particle icon imports #2156

Merged
merged 14 commits into from
Apr 12, 2024
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
2 changes: 1 addition & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"@web3-onboard/web3auth": "^2.2.3",
"@web3-onboard/xdefi": "^2.0.4",
"@web3-onboard/zeal": "^2.0.4",
"@web3-onboard/particle-network": "^2.0.1-alpha.1",
"@web3-onboard/particle-network": "^2.0.1-alpha.3",
"animejs": "^3.2.1",
"bnc-sdk": "^4.6.6",
"ethers": "^5.7.0",
Expand Down
14 changes: 7 additions & 7 deletions docs/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5908,9 +5908,9 @@
joi "17.9.1"

"@web3-onboard/core@^2.21.6-alpha.1":
version "2.21.5"
resolved "https://registry.yarnpkg.com/@web3-onboard/core/-/core-2.21.5.tgz#aaddc12fc29e134f3ec44a84f863e0c2c490a249"
integrity sha512-e23bmWj0+dC9sbu/TvzPJm0mUikUB/0yAL+Gqh2mmWOpr2GKBpROnRNhevne3IyeDf16mdkUo8wVEO6eGsiANg==
version "2.21.6-alpha.1"
resolved "https://registry.yarnpkg.com/@web3-onboard/core/-/core-2.21.6-alpha.1.tgz#43070f4c187c39199b77f4ae6d5893fb366afc74"
integrity sha512-AB5M3Fc3RisZFNwXmH9CbGRmieaHnCsLMNNvrb6cpTpmmx1UFXj6vDwdQJwX0rrvUNAurdavbDK0DkzvnINofg==
dependencies:
"@web3-onboard/common" "^2.3.4"
bignumber.js "^9.0.0"
Expand Down Expand Up @@ -6074,10 +6074,10 @@
"@web3-onboard/common" "^2.3.3"
lodash.uniqby "^4.7.0"

"@web3-onboard/particle-network@^2.0.0":
version "2.0.0"
resolved "https://registry.yarnpkg.com/@web3-onboard/particle-network/-/particle-network-2.0.0.tgz#3120c507c0486b6c0f3e4b7a93967d0d97d83c69"
integrity sha512-2uiXMuKcRKe9lYnbxAa/jmfdtUmQruAyVuQ8QtPj0UQi5nBWHcrK/grmimUHzboxe/UCbn9+Qe8FrrGF1HA9Hw==
"@web3-onboard/particle-network@^2.0.1-alpha.2":
version "2.0.1-alpha.2"
resolved "https://registry.yarnpkg.com/@web3-onboard/particle-network/-/particle-network-2.0.1-alpha.2.tgz#45e60de7033904c1d2304759dff3caf9f8d5db81"
integrity sha512-jc3YdIwQWS2aSV7aGt2Z965e9ulN7Kz6hBew2BVlIu1FLDOFsbca402Btk8SWc/tsURcNgVnfNpwPqLM2rnCEw==
dependencies:
"@particle-network/auth" "^1.2.1"
"@particle-network/provider" "^1.2.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/particle-network/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@web3-onboard/particle-network",
"version": "2.0.1-alpha.2",
"version": "2.0.1-alpha.3",
"description": "Particle Network SDK wallet module for connecting 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
32 changes: 30 additions & 2 deletions packages/particle-network/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,36 @@ const particleAuth = (options: ParticleAuthModuleOptions): WalletInit => {
return () => ({
label: displayLabel,
getIcon: async () => {
const iconName = authType && setAsDisplay ? authType : 'icon'
return (await import(`./${iconName}.js`)).default
const icons = await Promise.all([
import('./email.js'),
import('./phone.js'),
import('./google.js'),
import('./apple.js'),
import('./twitter.js'),
import('./facebook.js'),
import('./microsoft.js'),
import('./linkedin.js'),
import('./github.js'),
import('./twitch.js'),
import('./discord.js')
])

const iconMap = {
email: icons[0].default,
phone: icons[1].default,
google: icons[2].default,
apple: icons[3].default,
twitter: icons[4].default,
facebook: icons[5].default,
microsoft: icons[6].default,
linkedin: icons[7].default,
github: icons[8].default,
twitch: icons[9].default,
discord: icons[10].default
}
const iconName =
authType && setAsDisplay ? authType : ('icon' as AuthTypes)
return iconMap[iconName]
},
getInterface: async ({ chains }) => {
const { createEIP1193Provider } = await import('@web3-onboard/common')
Expand Down
Loading