Skip to content

Commit 7c87d64

Browse files
committed
Remove txn notification support as it relied on legacy BN systems that have been deprecated - cutsom notifications are still available. Update docs
1 parent 7f5430a commit 7c87d64

File tree

26 files changed

+39
-913
lines changed

26 files changed

+39
-913
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- **Multiple Wallets and Accounts Connection**: Allow your users to connect multiple wallets and multiple accounts within each wallet at the same time to your app.
99
- **Multiple Chain Support**: Allow users to switch between chains/networks with ease.
1010
- **Account Center**: A persistent interface to manage wallet connections and networks, with a minimal version for mobile
11-
- **Notify**: Real-time transaction notifications for the connected wallet addresses for all transaction states
1211
- **Wallet Provider Standardization**: All wallet modules expose a provider that is patched to be compliant with the [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193), [EIP-1102](https://eips.ethereum.org/EIPS/eip-1102), [EIP-3085](https://eips.ethereum.org/EIPS/eip-3085) and [EIP-3326](https://ethereum-magicians.org/t/eip-3326-wallet-switchethereumchain/5471) specifications.
1312
- **Dynamic Imports**: Supporting multiple wallets in your app requires a lot of dependencies. Onboard dynamically imports a wallet and its dependencies only when the user selects it, so that minimal bandwidth is used.
1413

docs/src/lib/components/FeaturesSection.svelte

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import FeatureCard from './FeatureCard.svelte'
88
99
import FrameworksGraphic from './svg/frameworks-group.svelte'
10-
import NotifyGraphic from './svg/notify-group.svelte'
1110
import NetworksGraphic from './svg/networks-graphic.svg'
1211
import AccountCenterGraphic from './svg/account-center-graphic.svg'
1312
import WalletsGraphic from './svg/wallet-row.svg'
@@ -89,52 +88,6 @@
8988
style="margin: 0 auto; max-width: none;"
9089
/>
9190
</ScrollContainer>
92-
<Container>
93-
<div class="flexbox">
94-
<div>
95-
<img
96-
src={TransactionPreviewGraphic}
97-
alt="Transaction Preview"
98-
style="margin: 0 auto; max-width: none;"
99-
/>
100-
</div>
101-
<div>
102-
<TextBlock
103-
title={'Transaction Preview'}
104-
subtitle={'Preview transactions to see net-balance changes and gas spent'}
105-
text={'Reduce transaction anxiety by allowing users to easily preview expected net-balance changes for their connected wallets before authorizing transactions.'}
106-
>
107-
<Flexbox --wrap="wrap">
108-
<Button href="/docs/modules/transaction-preview" buttonStyle={'link'}
109-
>{'Learn More'}</Button
110-
>
111-
<Button
112-
href="/docs/modules/transaction-preview#try-transaction-preview"
113-
buttonStyle={'link'}>{'View Demo'}</Button
114-
>
115-
</Flexbox>
116-
<div class="prose">
117-
<slot name="installTp" />
118-
</div>
119-
</TextBlock>
120-
</div>
121-
</div>
122-
</Container>
123-
<Container>
124-
<div class="flexbox">
125-
<TextBlock
126-
title={'Real-time transaction notifications'}
127-
subtitle={''}
128-
text={'Real-time transaction notifications for all connected wallet addresses and all transaction states.'}
129-
>
130-
<Flexbox --wrap="wrap">
131-
<Button href="/docs" buttonStyle={'link'}>{'Learn More'}</Button>
132-
<Button href="/examples/connect-wallet" buttonStyle={'link'}>{'View Demo'}</Button>
133-
</Flexbox>
134-
</TextBlock>
135-
<div><NotifyGraphic /></div>
136-
</div>
137-
</Container>
13891
<Container>
13992
<div class="flexbox">
14093
<div><img src={AccountCenterGraphic} alt="" /></div>

docs/src/routes/docs/[...1]overview/[...1]introduction/+page.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ Web3 Onboard is the quickest and easiest way to add multi-wallet and multi-chain
3030

3131
- **Framework Agnostic:** Avoid framework lock in -- Web3 Onboard works with any framework and includes helper packages for vue & react.
3232

33-
- **Notify:** Real-time transaction notifications for all transaction states for the connected wallet address(es). In-notification speedups & cancels for hardware wallet connections.
34-
3533
### Natively Supported EVM Chains
3634

3735
Web3 Onboard supports all EVM networks. Supporting a new network is simply a matter of adding its details in the Chains section upon initialization. For more information see [initialization options](../../modules/core.md#initialization).

docs/src/routes/docs/[...1]overview/[...3]onboard.js-migration-guide/+page.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ This change allows us to support many web3 wallets without affecting the overall
3030

3131
### Expansive Initialization Options
3232

33-
We’ve made initialization simpler while introducing more powerful options like [Account Center](https://www.blocknative.com/blog/multichain-and-multiwallet-account-management-on-your-dapp-with-account-center) and Notify in Web3 Onboard.
33+
We’ve made initialization simpler while introducing more powerful options like [Account Center](https://www.blocknative.com/blog/multichain-and-multiwallet-account-management-on-your-dapp-with-account-center) in Web3 Onboard.
3434
Web3 Onboard now requires two compulsory initial setup options: `wallets` (Wallet modules, as shown above, to be initialized and added to wallet selection modal) and `chains` (EVM networks your app should work with). You can also pass multiple wallets and chains.
3535

3636
```

docs/src/routes/docs/[...3]modules/[...1]core/+page.md

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -534,22 +534,17 @@ type ContainerElements = {
534534
535535
#### notify
536536
537-
Notify is a feature that provides transaction notifications for all connected wallets on the current blockchain. This document will provide you with an overview of Notify and guide you through the process of integrating it into your decentralized application (dapp).
537+
Notify is a feature that provides DApps with the ability to send custom messages to the client. This document will provide you with an overview of Notify and guide you through the process of integrating it into your decentralized application (dapp). Check out the [customNotifications API docs for examples and code snippets](#customnotification).
538538
539539
<img src="{notifyImg}" alt="Transaction notifications image"/>
540540
541-
To enable transaction notifications and updates simply add your Blocknative `apiKey`([sign up for free](https://explorer.blocknative.com/account)) to the web3-onboard configurations as the value to the `apiKey` prop and thats it!
542-
Transaction notifications will be shown for all transactions occurring on supported chains for all of the users connected wallets.
543-
When switching chains, the previous chain listeners remain active for 60 seconds to allow the capture and report of any remaining transactions that may be in flight.
544-
545541
Notifications are by default positioned in the same location as the Account Center (if enabled) or can be positioned separately using the `position` property.
546542
547543
##### **Notify Configuration**
548544
549545
| Property | Type | Description |
550546
| -------------------- | --------------- | ------------------------------------------------------------- |
551547
| `enabled` | boolean | Indicates whether transaction notifications will be displayed |
552-
| `transactionHandler` | function | Optional callback for customizations of notifications |
553548
| `position` | CommonPositions | Position of the notification on the screen |
554549
555550
##### **Position Options**
@@ -561,10 +556,6 @@ Notifications are by default positioned in the same location as the Account Cent
561556
562557
Both `desktop` and `mobile` configurations are of type `Notify`.
563558
564-
###### **Transaction Handler**
565-
566-
The `transactionHandler` is a callback that receives an object of type `EthereumTransactionData`. Based on the data received, the handler can return a custom `Notification` object or a boolean value (false to disable the notification for the current event or undefined for a default notification).
567-
568559
##### **Customizing Notification**
569560
570561
| Property | Type | Description |
@@ -580,24 +571,6 @@ The `transactionHandler` is a callback that receives an object of type `Ethereum
580571
581572
Notify automatically will match the [`theme`](#theme) defined in the web3-onboard configuration. It can also be styled using the [exposed css variables provided below](#custom-styling). These variables allow for maximum customization with base styling variables setting the global theme (e.g., `--onboard-grey-600`) and more precise component-level styling variables available (`--notify-onboard-grey-600`). The latter takes precedence if defined.
582573
583-
##### **Handling Notifications**
584-
585-
If notifications are enabled, they can be fielded and handled through the onboard app state as seen in the example below - although this is not required for notifications to display:
586-
587-
```javascript
588-
const wallets = onboard.state.select('notifications')
589-
const { unsubscribe } = wallets.subscribe((update) =>
590-
console.log('transaction notifications: ', update)
591-
)
592-
593-
// unsubscribe when updates are no longer needed
594-
unsubscribe()
595-
```
596-
597-
##### **Notifications as Toast Messages**
598-
599-
The Notifications messages can also be used to send fully customized dapp toast messages and updated. Check out the [customNotifications API docs for examples and code snippets](#customnotification)
600-
601574
```ts
602575
type NotifyOptions = {
603576
desktop: Notify
@@ -1210,74 +1183,6 @@ The `customNotification` method also returns a `dismiss` method that is called w
12101183

12111184
---
12121185

1213-
#### **preflightNotifications**
1214-
1215-
Notify can be used to deliver standard notifications along with preflight updates by passing a `PreflightNotificationsOptions` object to the `preflightNotifications` API action.
1216-
1217-
<img src="{notifyPreflightImg}" alt="Preflight notifications image"/>
1218-
1219-
Preflight event types include:
1220-
1221-
- `txRequest` : Alert user that there is a transaction request awaiting confirmation by their wallet
1222-
- `txAwaitingApproval` : A previous transaction is awaiting confirmation
1223-
- `txConfirmReminder` : Reminder to confirm a transaction to continue - configurable with the `txApproveReminderTimeout` property; defaults to 15 seconds
1224-
- `nsfFail` : The user has insufficient funds for transaction (requires `gasPrice`, `estimateGas`, `balance`, `txDetails.value`)
1225-
- `txError` : General transaction error (requires `sendTransaction`)
1226-
- `txSendFail` : The user rejected the transaction (requires `sendTransaction`)
1227-
- `txUnderpriced` : The gas price for the transaction is too low (requires `sendTransaction`)
1228-
1229-
This API call will return a promise that resolves to the transaction hash (if `sendTransaction` resolves the transaction hash and is successful), the internal notification id (if no `sendTransaction` function is provided) or return nothing if an error occurs or `sendTransaction` is not provided or doesn't resolve to a string.
1230-
1231-
Example:
1232-
1233-
```typescript copy
1234-
const balanceValue = Object.values(balance)[0]
1235-
// if using ethers v6 this is:
1236-
// ethersProvider = new ethers.BrowserProvider(wallet.provider, 'any')
1237-
const ethersProvider = new ethers.providers.Web3Provider(provider, 'any')
1238-
1239-
const signer = ethersProvider.getSigner()
1240-
const txDetails = {
1241-
to: toAddress,
1242-
value: 100000000000000
1243-
}
1244-
1245-
const sendTransaction = () => {
1246-
return signer.sendTransaction(txDetails).then((tx) => tx.hash)
1247-
}
1248-
1249-
const gasPrice = () => ethersProvider.getGasPrice().then((res) => res.toString())
1250-
1251-
const estimateGas = () => {
1252-
return ethersProvider.estimateGas(txDetails).then((res) => res.toString())
1253-
}
1254-
const transactionHash = await onboard.state.actions.preflightNotifications({
1255-
sendTransaction,
1256-
gasPrice,
1257-
estimateGas,
1258-
balance: balanceValue,
1259-
txDetails: txDetails
1260-
})
1261-
console.log(transactionHash)
1262-
```
1263-
1264-
```typescript
1265-
interface PreflightNotificationsOptions {
1266-
sendTransaction?: () => Promise<string | void>
1267-
estimateGas?: () => Promise<string>
1268-
gasPrice?: () => Promise<string>
1269-
balance?: string | number
1270-
txDetails?: {
1271-
value: string | number
1272-
to?: string
1273-
from?: string
1274-
}
1275-
txApproveReminderTimeout?: number // defaults to 15 seconds if not specified
1276-
}
1277-
```
1278-
1279-
---
1280-
12811186
#### **updateAccountCenter**
12821187

12831188
If you need to update your Account Center configuration after initialization, you can call the `updateAccountCenter` function with the new configuration

docs/src/routes/docs/[...3]modules/[...3]react/+page.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ async function signMessage(chainId) {
303303
## useNotifications
304304

305305
This hook allows the dev to access all notifications if enabled, send custom notifications, and update notify <enable/disable & update transactionHandler function>
306-
**note** This requires an API key be added to the initialization, enabled by default if an API key exists
307306
For full Notification documentation please see [Notify section within the `@web3-onboard/core` docs](../../modules/core.md#initialization)
308307

309308
```typescript
@@ -314,7 +313,6 @@ type UseNotifications = (): [
314313
update: UpdateNotification
315314
},
316315
(update: Partial<Notify>) => void,
317-
(options: PreflightNotificationsOptions) => Promise<void | string>
318316
]
319317

320318
type Notification = {
@@ -368,20 +366,6 @@ type Notify = {
368366
*/
369367
position?: NotificationPosition
370368
}
371-
372-
type PreflightNotificationsOptions = {
373-
sendTransaction?: () => Promise<string | void>
374-
estimateGas?: () => Promise<string>
375-
gasPrice?: () => Promise<string>
376-
balance?: string | number
377-
txDetails?: TxDetails
378-
txApproveReminderTimeout?: number
379-
}
380-
type TxDetails = {
381-
value: string | number
382-
to?: string
383-
from?: string
384-
}
385369
```
386370
387371
```typescript

0 commit comments

Comments
 (0)