Skip to content

Commit 1b6df15

Browse files
leightktAdamj1232ByteZhang1024sanyu1225finessevanes
authored
Release 2.24.2 (#1793)
* update Google Analytics Script (#1770) * feat: add OneKey wallet (#1739) * feat: Support OneKey wallet * fix: OneKey docs * Update injected package.json version * Update demo package.json --------- Co-authored-by: Adam Carpenter <[email protected]> * Fix: Connect view on safari mobile & Remove unnecessary validation check for autoSelect (#1773) * working as expected * Bump versions * Remove testing css * Remove testing code from demo * feat: add blocto wallet (#1699) * Release 2.24.1 (develop) (#1776) * Release 2.24.1 (docs) (#1778) * Update +page.md (#1775) * Feature- update appMetadata (#1779) * update versions * Upgrade wallet connect v2 packages (#1788) --------- Co-authored-by: Adam Carpenter <[email protected]> Co-authored-by: ByteZhang <[email protected]> Co-authored-by: jimmy.pan <[email protected]> Co-authored-by: vanes <[email protected]>
1 parent c8ab47f commit 1b6df15

29 files changed

+235
-84
lines changed

docs/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"@web3-onboard/blocto": "^2.0.0-alpha.1",
5353
"@web3-onboard/cede-store": "^2.0.2",
5454
"@web3-onboard/coinbase": "^2.2.4",
55-
"@web3-onboard/core": "^2.20.2-alpha.1",
55+
"@web3-onboard/core": "^2.20.3-alpha.1",
5656
"@web3-onboard/dcent": "^2.2.7",
5757
"@web3-onboard/enkrypt": "^2.0.4",
5858
"@web3-onboard/fortmatic": "^2.0.19",
@@ -61,7 +61,7 @@
6161
"@web3-onboard/gas": "^2.1.8",
6262
"@web3-onboard/gnosis": "^2.1.10",
6363
"@web3-onboard/infinity-wallet": "^2.0.4",
64-
"@web3-onboard/injected-wallets": "^2.10.1-alpha.1",
64+
"@web3-onboard/injected-wallets": "^2.10.1",
6565
"@web3-onboard/keepkey": "^2.3.7",
6666
"@web3-onboard/keystone": "^2.3.7",
6767
"@web3-onboard/ledger": "^2.4.6",

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,18 @@ type RecommendedInjectedWallets = {
223223
}
224224
```
225225
226+
**`updateAppMetadata`**
227+
228+
If you need to update your Application Metadata after initialization, you can call the `updateAppMetadata` function with the new configuration
229+
230+
```typescript
231+
onboard.state.actions.updateAppMetadata({
232+
logo: `<svg width="100%" height="100%" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0L0.0100002 6L4 10L0.0100002 14.01L0 20H12V14L8 10L12 6.01V0H0ZM10 14.5V18H2V14.5L6 10.5L10 14.5Z" fill="#929BED"/>
233+
</svg>`,
234+
description: 'Updated Description!'
235+
})
236+
```
237+
226238
---
227239
228240
#### connect

docs/src/routes/docs/[...4]wallets/[...24]walletconnect/+page.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Walletconnect
2+
title: WalletConnect
33
---
44

55
# {$frontmatter.title}
@@ -116,7 +116,16 @@ const onboard = Onboard({
116116
wallets: [
117117
walletConnect
118118
//... other wallets
119-
]
119+
],
120+
chains: [ // chains that are passed as optional chains to WC wallet after cleaning and parsing as number[]
121+
{
122+
id: '0x89',
123+
token: 'MATIC',
124+
label: 'Polygon',
125+
rpcUrl: 'https://matic-mainnet.chainstacklabs.com'
126+
}
127+
// ...
128+
]
120129
})
121130

122131
const connectedWallets = await onboard.connectWallet()

packages/core/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,20 @@ type RecommendedInjectedWallets = {
193193
}
194194
```
195195
196+
**`updateAppMetadata`**
197+
198+
If you need to update your Application Metadata after initialization, you can call the `updateAppMetadata` function with the new configuration
199+
200+
```typescript
201+
onboard.state.actions.updateAppMetadata({
202+
logo: `<svg width="100%" height="100%" viewBox="0 0 12 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 0L0.0100002 6L4 10L0.0100002 14.01L0 20H12V14L8 10L12 6.01V0H0ZM10 14.5V18H2V14.5L6 10.5L10 14.5Z" fill="#929BED"/>
203+
</svg>`,
204+
description: 'Updated Description!'
205+
})
206+
```
207+
208+
---
209+
196210
**`connect`**
197211
An object that allows for customization of the Connect Modal and accepts the type ConnectModalOptions.
198212

packages/core/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/core",
3-
"version": "2.20.2",
3+
"version": "2.20.3",
44
"description": "Web3-Onboard makes it simple to connect Ethereum hardware and software wallets to your dapp. Features standardized 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/core/src/configuration.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { getDevice } from './utils.js'
33

44
export let configuration: Configuration = {
55
svelteInstance: null,
6-
appMetadata: null,
76
apiKey: null,
87
device: getDevice(),
98
initialWalletInit: [],

packages/core/src/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ export const APP_INITIAL_STATE: AppState = {
2626
connect: {
2727
showSidebar: true,
2828
disableClose: false
29-
}
29+
},
30+
appMetadata: null,
3031
}
3132

3233
export const STORAGE_KEYS = {

packages/core/src/index.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ import {
3232
setPrimaryWallet,
3333
setWalletModules,
3434
updateConnectModal,
35-
updateTheme
35+
updateTheme,
36+
updateAppMetadata
3637
} from './store/actions.js'
3738
import type { PatchedEIP1193Provider } from '@web3-onboard/transaction-preview'
3839
import { getBlocknativeSdk } from './services.js'
@@ -53,7 +54,8 @@ const API = {
5354
updateBalances,
5455
updateAccountCenter,
5556
setPrimaryWallet,
56-
updateTheme
57+
updateTheme,
58+
updateAppMetadata
5759
}
5860
}
5961
}
@@ -92,7 +94,7 @@ function init(options: InitOptions): OnboardAPI {
9294
const {
9395
wallets,
9496
chains,
95-
appMetadata = null,
97+
appMetadata,
9698
i18n,
9799
accountCenter,
98100
apiKey,
@@ -208,7 +210,6 @@ function init(options: InitOptions): OnboardAPI {
208210
const app = svelteInstance || mountApp(theme, disableFontDownload)
209211

210212
updateConfiguration({
211-
appMetadata,
212213
svelteInstance: app,
213214
apiKey,
214215
initialWalletInit: wallets,
@@ -217,6 +218,8 @@ function init(options: InitOptions): OnboardAPI {
217218
unstoppableResolution
218219
})
219220

221+
appMetadata && updateAppMetadata(appMetadata)
222+
220223
if (apiKey && transactionPreview) {
221224
const getBnSDK = async () => {
222225
transactionPreview.init({

packages/core/src/store/actions.ts

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { Chain, WalletInit, WalletModule } from '@web3-onboard/common'
1+
import type { AppMetadata, Chain, WalletInit, WalletModule } from '@web3-onboard/common'
22
import { nanoid } from 'nanoid'
33
import { dispatch } from './index.js'
44
import { configuration } from '../configuration.js'
@@ -29,7 +29,8 @@ import type {
2929
ConnectModalOptions,
3030
UpdateConnectModalAction,
3131
Theme,
32-
UpdateChainsAction
32+
UpdateChainsAction,
33+
UpdateAppMetadataAction
3334
} from '../types.js'
3435

3536
import {
@@ -45,7 +46,8 @@ import {
4546
validateNotify,
4647
validateConnectModalUpdate,
4748
validateUpdateTheme,
48-
validateSetChainOptions
49+
validateSetChainOptions,
50+
validateAppMetadataUpdate
4951
} from '../validation.js'
5052

5153
import {
@@ -63,7 +65,8 @@ import {
6365
REMOVE_NOTIFICATION,
6466
UPDATE_ALL_WALLETS,
6567
UPDATE_CONNECT_MODAL,
66-
UPDATE_CHAINS
68+
UPDATE_CHAINS,
69+
UPDATE_APP_METADATA
6770
} from './constants.js'
6871

6972
export function addChains(chains: Chain[]): void {
@@ -438,3 +441,20 @@ export function updateTheme(theme: Theme): void {
438441
const themingObj = returnTheme(theme)
439442
themingObj && handleThemeChange(themingObj)
440443
}
444+
445+
export function updateAppMetadata(
446+
update: AppMetadata| Partial<AppMetadata>
447+
): void {
448+
const error = validateAppMetadataUpdate(update)
449+
450+
if (error) {
451+
throw error
452+
}
453+
454+
const action = {
455+
type: UPDATE_APP_METADATA,
456+
payload: update
457+
}
458+
459+
dispatch(action as UpdateAppMetadataAction)
460+
}

packages/core/src/store/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ export const UPDATE_NOTIFY = 'update_notify'
1313
export const ADD_NOTIFICATION = 'add_notification'
1414
export const REMOVE_NOTIFICATION = 'remove_notification'
1515
export const UPDATE_ALL_WALLETS = 'update_balance'
16+
export const UPDATE_APP_METADATA = 'update_app_metadata'

0 commit comments

Comments
 (0)