Skip to content

Commit 3f67ce2

Browse files
MarkNerdiAdamj1232
andauthored
feat: add bloom wallet (#2209)
* add bloom package * fix indentation * add icon + fixes * add bloom to example app * add bloom documentation * fix typescript issue * fix bloom dependencies * Prettier * add download prompt --------- Co-authored-by: Adam Carpenter <adamcarpenter86@gmail.com>
1 parent 079a31d commit 3f67ce2

File tree

12 files changed

+943
-0
lines changed

12 files changed

+943
-0
lines changed
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: Bloom
3+
---
4+
5+
# {$frontmatter.title}
6+
7+
Wallet module for connecting Bloom to web3-onboard.
8+
9+
## Install
10+
11+
<Tabs values={['yarn', 'npm']}>
12+
<TabPanel value="yarn">
13+
14+
```sh copy
15+
yarn add @web3-onboard/bloom
16+
```
17+
18+
</TabPanel>
19+
<TabPanel value="npm">
20+
21+
```sh copy
22+
npm install @web3-onboard/bloom
23+
```
24+
25+
</TabPanel>
26+
</Tabs>
27+
28+
29+
```typescript
30+
type WalletConnectOptions = {
31+
/**
32+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
33+
*/
34+
projectId: string
35+
/**
36+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
37+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
38+
* To connect with walletconnect
39+
*/
40+
dappUrl?: string
41+
/**
42+
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
43+
* Defaults to [1] - Ethereum
44+
*/
45+
requiredChains?: number[] | undefined
46+
/**
47+
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
48+
* Defaults to the chains provided within the web3-onboard init chain property
49+
*/
50+
optionalChains?: number[] | undefined
51+
/**
52+
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
53+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
54+
*/
55+
additionalRequiredMethods?: string[] | undefined
56+
/**
57+
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
58+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
59+
*/
60+
additionalOptionalMethods?: string[] | undefined
61+
)
62+
```
63+
64+
## Usage
65+
66+
```typescript
67+
import Onboard from '@web3-onboard/core'
68+
import bloomModule from '@web3-onboard/bloom'
69+
70+
const wcInitOptions = {
71+
/**
72+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
73+
*/
74+
projectId: 'abc123...',
75+
/**
76+
* Chains required to be supported by all wallets connecting to your DApp
77+
*/
78+
requiredChains: [1],
79+
/**
80+
* Chains required to be supported by all wallets connecting to your DApp
81+
*/
82+
optionalChains: [42161, 8453, 10, 137, 56],
83+
/**
84+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
85+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
86+
* To connect with WalletConnect
87+
*/
88+
dappUrl: 'http://YourAwesomeDapp.com'
89+
}
90+
91+
// initialize the module with options
92+
const bloom = bloomModule(wcInitOptions)
93+
94+
// can also initialize with no options...
95+
96+
const onboard = Onboard({
97+
// ... other Onboard options
98+
wallets: [
99+
bloom
100+
//... other wallets
101+
]
102+
})
103+
104+
const connectedWallets = await onboard.connectWallet()
105+
106+
// Assuming only wallet connect is connected, index 0
107+
// `instance` will give insight into the WalletConnect info
108+
// such as namespaces, methods, chains, etc per wallet connected
109+
const { instance } = connectedWallets[0]
110+
111+
console.log(connectedWallets)
112+
```
113+
114+
## Build Environments
115+
116+
For build env configurations and setups please see the Build Env section [here](/docs/modules/core#build-environments)

packages/bloom/README.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# @web3-onboard/bloom
2+
3+
## Wallet module for connecting Bloom to web3-onboard
4+
5+
### Install
6+
7+
`npm i @web3-onboard/core @web3-onboard/bloom`
8+
9+
## Options
10+
11+
```typescript
12+
type WalletConnectOptions = {
13+
/**
14+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
15+
*/
16+
projectId: string
17+
/**
18+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
19+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
20+
* To connect with walletconnect
21+
*/
22+
dappUrl?: string
23+
/**
24+
* List of Required Chain(s) ID for wallets to support in number format (integer or hex)
25+
* Defaults to [1] - Ethereum
26+
*/
27+
requiredChains?: number[] | undefined
28+
/**
29+
* List of Optional Chain(s) ID for wallets to support in number format (integer or hex)
30+
* Defaults to the chains provided within the web3-onboard init chain property
31+
*/
32+
optionalChains?: number[] | undefined
33+
/**
34+
* Additional required methods to be added to the default list of ['eth_sendTransaction', 'personal_sign']
35+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/advanced/providers/ethereum#required-and-optional-methods
36+
*/
37+
additionalRequiredMethods?: string[] | undefined
38+
/**
39+
* Additional methods to be added to the default list of ['eth_sendTransaction', 'eth_signTransaction', 'personal_sign', 'eth_sign', 'eth_signTypedData', 'eth_signTypedData_v4']
40+
* Passed methods to be included along with the defaults methods - see https://docs.walletconnect.com/2.0/web/walletConnectModal/options
41+
*/
42+
additionalOptionalMethods?: string[] | undefined
43+
}
44+
```
45+
46+
## Usage
47+
48+
```typescript
49+
import Onboard from '@web3-onboard/core'
50+
import walletConnectModule from '@web3-onboard/walletconnect'
51+
52+
const wcInitOptions = {
53+
/**
54+
* Project ID associated with [WalletConnect account](https://cloud.walletconnect.com)
55+
*/
56+
projectId: 'abc123...',
57+
/**
58+
* Chains required to be supported by all wallets connecting to your DApp
59+
*/
60+
requiredChains: [1],
61+
/**
62+
* Chains required to be supported by all wallets connecting to your DApp
63+
*/
64+
optionalChains: [42161, 8453, 10, 137, 56],
65+
/**
66+
* Defaults to `appMetadata.explore` that is supplied to the web3-onboard init
67+
* Strongly recommended to provide atleast one URL as it is required by some wallets (i.e. MetaMask)
68+
* To connect with WalletConnect
69+
*/
70+
dappUrl: 'http://YourAwesomeDapp.com'
71+
}
72+
73+
// initialize the module with options
74+
const bloom = initBloom(wcInitOptions)
75+
76+
// can also initialize with no options...
77+
78+
const onboard = Onboard({
79+
// ... other Onboard options
80+
wallets: [
81+
bloom
82+
//... other wallets
83+
]
84+
})
85+
86+
const connectedWallets = await onboard.connectWallet()
87+
88+
// Assuming only wallet connect is connected, index 0
89+
// `instance` will give insight into the WalletConnect info
90+
// such as namespaces, methods, chains, etc per wallet connected
91+
const { instance } = connectedWallets[0]
92+
93+
console.log(connectedWallets)
94+
```

packages/bloom/package.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "@web3-onboard/bloom",
3+
"version": "2.0.0-alpha.1",
4+
"description": "Unstoppable Domains 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.",
5+
"keywords": [
6+
"Bloom",
7+
"Iota",
8+
"Shimmer",
9+
"Ethereum",
10+
"Web3",
11+
"EVM",
12+
"dapp",
13+
"Multichain",
14+
"Wallet",
15+
"Transaction",
16+
"Provider",
17+
"Hardware Wallet",
18+
"Notifications",
19+
"React",
20+
"Svelte",
21+
"Vue",
22+
"Next",
23+
"Nuxt",
24+
"MetaMask",
25+
"Coinbase",
26+
"WalletConnect",
27+
"Ledger",
28+
"Trezor",
29+
"Connect Wallet",
30+
"Ethereum Hooks",
31+
"Blocknative",
32+
"Mempool",
33+
"pending",
34+
"confirmed",
35+
"Injected Wallet",
36+
"Crypto",
37+
"Crypto Wallet",
38+
"Domain Name",
39+
"Unstoppable Domains",
40+
"Unstoppable"
41+
],
42+
"repository": {
43+
"type": "git",
44+
"url": "https://github.com/blocknative/web3-onboard.git",
45+
"directory": "packages/bloom"
46+
},
47+
"homepage": "https://onboard.blocknative.com",
48+
"bugs": "https://github.com/blocknative/web3-onboard/issues",
49+
"module": "dist/index.js",
50+
"browser": "dist/index.js",
51+
"main": "dist/index.js",
52+
"type": "module",
53+
"typings": "dist/index.d.ts",
54+
"files": [
55+
"dist"
56+
],
57+
"scripts": {
58+
"build": "tsc",
59+
"dev": "tsc -w",
60+
"type-check": "tsc --noEmit"
61+
},
62+
"license": "MIT",
63+
"devDependencies": {
64+
"typescript": "^5.4.5",
65+
"@walletconnect/types": "^2.13.0"
66+
},
67+
"dependencies": {
68+
"@walletconnect/ethereum-provider": "^2.13.0",
69+
"@web3-onboard/common": "^2.4.1",
70+
"joi": "17.9.1",
71+
"rxjs": "^7.5.2"
72+
}
73+
}

packages/bloom/src/icon.ts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
export default `
2+
<svg
3+
{...props}
4+
width="128"
5+
height="128"
6+
viewBox="0 0 128 128"
7+
fill="none"
8+
xmlns="http://www.w3.org/2000/svg"
9+
>
10+
<g filter="url(#filter0_b_159_287)">
11+
<rect width="128" height="128" fill="url(#paint0_linear_159_287)" rx="24" />
12+
</g>
13+
<path d="M64.0095 66.9176C62.8967 68.9345 63.3836 72.4815 73.6768 85.0003C91.1335 106.073 101.009 90.8424 96.6974 82.7747C106.156 99.536 88.8384 113.724 75.485 107.812C67.9042 104.404 61.7144 93.9026 59.2802 83.8876C55.3855 67.6827 62.549 66.4308 64.0095 66.9176Z" fill="url(#paint1_linear_159_287)" />
14+
<path d="M64.01 66.9182C65.6096 68.5874 69.087 69.2829 84.1791 63.3017C109.634 53.2171 98.1584 39.0988 89.1866 40.6984C108.034 36.8732 116.241 57.7378 106.435 68.6569C100.871 74.8467 88.978 77.4896 78.6848 76.655C62.0626 75.3336 63.1059 68.1005 64.01 66.9182Z" fill="url(#paint2_linear_159_287)" />
15+
<path d="M64.0101 66.9177C66.0965 65.944 67.8352 62.8143 66.792 46.6095C65.0533 19.3464 48.0834 25.8145 46.8315 34.8558C49.0571 15.7299 71.3822 14.4085 78.7544 27.0663C82.9273 34.2994 81.745 46.4008 77.7807 55.9289C71.3822 71.3687 64.8447 68.1 64.0101 66.9177Z" fill="url(#paint3_linear_159_287)" />
16+
<path d="M66.7918 46.6096C65.0531 19.3465 48.0137 25.8146 46.8314 34.856C46.4836 37.6379 46.6227 40.5589 47.1095 43.4799C50.9347 45.2882 54.6208 47.6528 57.8201 50.3652C68.1133 59.1283 66.7223 64.275 65.0531 66.0832C66.5832 64.4141 67.6264 60.0325 66.7918 46.6096Z" fill="url(#paint4_linear_159_287)" />
17+
<path d="M64.0095 66.9178C63.7313 64.6227 61.2971 62.0494 45.5791 58.0156C19.0811 51.1998 20.0548 69.3521 28.2615 73.3859C10.8048 65.3878 16.4383 43.6885 30.6957 40.6284C38.8329 38.8897 49.9607 43.7582 57.8197 50.4348C70.4776 61.2149 65.4005 66.431 64.0095 66.9178Z" fill="url(#paint5_linear_159_287)" />
18+
<path d="M64.0093 66.918C61.7142 66.5007 58.515 68.0309 49.8214 81.7319C35.1467 104.822 52.7425 109.551 59.0714 102.944C46.0658 117.063 27.1485 105.031 28.6786 90.4951C29.5132 82.2188 37.6504 73.1078 46.4135 67.7526C60.6014 58.9895 64.0093 65.4575 64.0093 66.918Z" fill="url(#paint6_linear_159_287)" />
19+
<path d="M84.1786 63.3016C109.633 53.2171 98.1579 39.0292 89.1861 40.6983C86.4737 41.1852 83.6918 42.2979 81.0489 43.6193C80.4925 47.7922 79.3797 52.1042 77.7801 55.9294C72.6335 68.4482 67.3478 68.6569 65.0527 67.6832C67.1392 68.6569 71.6599 68.2396 84.1786 63.3016Z" fill="url(#paint7_linear_159_287)" />
20+
<path d="M73.6766 85.0007C91.1333 106.074 101.079 90.7732 96.6972 82.7751C95.3757 80.3409 93.4979 78.0458 91.4115 75.9593C87.2385 76.7244 82.857 77.0026 78.6841 76.6548C65.1916 75.6116 63.3834 70.6737 63.592 68.1699C63.3138 70.465 65.1221 74.6379 73.6766 85.0007Z" fill="url(#paint8_linear_159_287)" />
21+
<path d="M49.8218 81.7319C35.1471 104.822 52.8124 109.621 59.0718 102.944C60.9496 100.927 62.6188 98.4235 63.9402 95.7807C61.9233 92.0946 60.3237 87.9218 59.35 83.8879C56.1508 70.7432 60.3237 67.4744 62.7579 66.918C60.3932 67.4048 56.9853 70.3954 49.8218 81.7319Z" fill="url(#paint9_linear_159_287)" />
22+
<path d="M45.5101 58.0156C19.0121 51.1999 19.9162 69.4912 28.1925 73.386C30.6963 74.5683 33.5478 75.3333 36.5384 75.7506C39.4594 72.6904 42.8673 69.9086 46.4143 67.683C57.9593 60.589 62.3409 63.51 63.5928 65.666C62.4105 63.6491 58.5157 61.354 45.5101 58.0156Z" fill="url(#paint10_linear_159_287)" />
23+
<defs>
24+
<filter id="filter0_b_159_287" x="-1.35914" y="-1.35914" width="130.718" height="130.718" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
25+
<feFlood flood-opacity="0" result="BackgroundImageFix" />
26+
<feGaussianBlur in="BackgroundImageFix" stdDeviation="0.67957" />
27+
<feComposite in2="SourceAlpha" operator="in" result="effect1_backgroundBlur_159_287" />
28+
<feBlend mode="normal" in="SourceGraphic" in2="effect1_backgroundBlur_159_287" result="shape" />
29+
</filter>
30+
<linearGradient id="paint0_linear_159_287" x1="19.6779" y1="-83.848" x2="81.6722" y2="122.802" gradientUnits="userSpaceOnUse">
31+
<stop stop-color="#B882FF" />
32+
<stop offset="1" stop-color="#2F00A6" />
33+
</linearGradient>
34+
<linearGradient id="paint1_linear_159_287" x1="59.4545" y1="69.2649" x2="93.9982" y2="104.05" gradientUnits="userSpaceOnUse">
35+
<stop stop-color="white" stop-opacity="0.1" />
36+
<stop offset="0.25" stop-color="white" />
37+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
38+
</linearGradient>
39+
<linearGradient id="paint2_linear_159_287" x1="64.7702" y1="72.027" x2="108.53" y2="49.9246" gradientUnits="userSpaceOnUse">
40+
<stop stop-color="white" stop-opacity="0.1" />
41+
<stop offset="0.25" stop-color="white" />
42+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
43+
</linearGradient>
44+
<linearGradient id="paint3_linear_159_287" x1="69.0506" y1="67.6901" x2="61.5513" y2="19.2442" gradientUnits="userSpaceOnUse">
45+
<stop stop-color="white" stop-opacity="0.1" />
46+
<stop offset="0.25" stop-color="white" />
47+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
48+
</linearGradient>
49+
<linearGradient id="paint4_linear_159_287" x1="59.85" y1="27.6087" x2="55.6723" y2="55.3608" gradientUnits="userSpaceOnUse">
50+
<stop stop-color="white" stop-opacity="0.9" />
51+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
52+
</linearGradient>
53+
<linearGradient id="paint5_linear_159_287" x1="66.3303" y1="62.3729" x2="17.936" y2="54.5358" gradientUnits="userSpaceOnUse">
54+
<stop stop-color="white" stop-opacity="0.1" />
55+
<stop offset="0.25" stop-color="white" />
56+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
57+
</linearGradient>
58+
<linearGradient id="paint6_linear_159_287" x1="60.3117" y1="63.3084" x2="37.9021" y2="106.909" gradientUnits="userSpaceOnUse">
59+
<stop stop-color="white" stop-opacity="0.1" />
60+
<stop offset="0.25" stop-color="white" />
61+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
62+
</linearGradient>
63+
<linearGradient id="paint7_linear_159_287" x1="100.047" y1="50.8934" x2="72.3612" y2="55.4953" gradientUnits="userSpaceOnUse">
64+
<stop stop-color="white" stop-opacity="0.9" />
65+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
66+
</linearGradient>
67+
<linearGradient id="paint8_linear_159_287" x1="90.4573" y1="96.2819" x2="77.5244" y2="71.3748" gradientUnits="userSpaceOnUse">
68+
<stop stop-color="white" stop-opacity="0.9" />
69+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
70+
</linearGradient>
71+
<linearGradient id="paint9_linear_159_287" x1="44.197" y1="101.142" x2="63.8895" y2="81.1463" gradientUnits="userSpaceOnUse">
72+
<stop stop-color="white" stop-opacity="0.9" />
73+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
74+
</linearGradient>
75+
<linearGradient id="paint10_linear_159_287" x1="25.3691" y1="58.7338" x2="50.4734" y2="71.2827" gradientUnits="userSpaceOnUse">
76+
<stop stop-color="white" stop-opacity="0.9" />
77+
<stop offset="1" stop-color="white" stop-opacity="0.1" />
78+
</linearGradient>
79+
</defs>
80+
</svg>
81+
`

0 commit comments

Comments
 (0)