Skip to content

Commit

Permalink
Update version walletConnect custom option
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiendekaco committed May 16, 2024
1 parent cf20656 commit 38e5f96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
8 changes: 3 additions & 5 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ function init(options: InitOptions): OnboardAPI {
disableFontDownload,
unstoppableResolution,
chainsPolkadot,
projectId
wcConfigOption
} = options


Expand All @@ -128,11 +128,9 @@ function init(options: InitOptions): OnboardAPI {
initI18N(i18n)
addChains(chainIdToHex(chains).concat(chainsPolkadot))

if(projectId){
if(wcConfigOption?.projectId){
const modalWC = new WalletConnectModal(
{
projectId
});
{...wcConfigOption});

qrModalConnect$.next({
isOpen: false,
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import type { TransactionPreviewAPI } from '@subwallet-connect/transaction-previ
import type en from './i18n/en.json'
import type { EthereumTransactionData, Network } from 'bnc-sdk'
import type { Signer } from '@polkadot/types/types';
import type { WalletConnectModalConfig } from '@walletconnect/modal/dist/_types/src/client';

export interface InitOptions {
/**
Expand Down Expand Up @@ -87,8 +88,7 @@ export interface InitOptions {
*/
unstoppableResolution?: typeof unstoppableResolution,

projectId?: string,

wcConfigOption ?: WalletConnectModalConfig

chainsPolkadot: Chain[]

Expand Down
8 changes: 7 additions & 1 deletion packages/demo/src/web3-onboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const walletConnect = walletConnectModule({
projectId: '59b5826141a56b204e9e0a3f7e46641d',
dappUrl: 'https://w3o-demo.subwallet.app/'
})
const subwalletWCIds = '9ce87712b99b3eb57396cc8621db8900ac983c712236f48fb70ad28760be3f6a';
const coinbaseWCIds = 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa';
const metamaskWCIds = 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96'

export default init({
theme: "dark",
Expand All @@ -72,7 +75,10 @@ export default init({
enabled: false
}
},
projectId : '59b5826141a56b204e9e0a3f7e46641d',
wcConfigOption: {
projectId: '59b5826141a56b204e9e0a3f7e46641d',
explorerRecommendedWalletIds: [subwalletWCIds, coinbaseWCIds, metamaskWCIds]
},

// An array of wallet modules that you would like to be presented to the user to select from when connecting a wallet.
wallets: [
Expand Down

0 comments on commit 38e5f96

Please sign in to comment.