Skip to content

Commit c8321db

Browse files
authored
Merge pull request #311 from blocknative/enhancement/wallet-connect-options
Enhancement: WalletConnect Options. Closes #309
2 parents 484e6c5 + 4722ba1 commit c8321db

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

src/interfaces.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ export interface SdkWalletOptions {
168168

169169
export interface WalletConnectOptions {
170170
infuraKey: string
171+
rpc: {
172+
[key: string]: string
173+
}
174+
bridge: string
171175
}
172176

173177
export interface TrezorOptions {

src/modules/select/wallets/wallet-connect.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import walletConnectIcon from '../wallet-icons/icon-wallet-connect'
1010
function walletConnect(
1111
options: WalletConnectOptions & CommonWalletOptions
1212
): WalletModule {
13-
const { infuraKey, preferred, label, iconSrc, svg } = options
13+
const { infuraKey, rpc, bridge, preferred, label, iconSrc, svg } = options
1414

1515
return {
1616
name: label || 'WalletConnect',
@@ -24,7 +24,9 @@ function walletConnect(
2424
)
2525

2626
const provider = new WalletConnectProvider({
27-
infuraId: infuraKey
27+
infuraId: infuraKey,
28+
rpc,
29+
bridge
2830
})
2931

3032
provider.autoRefreshOnNetworkChange = false

src/validation.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,8 @@ export function validateWalletInit(
542542
apiKey,
543543
networkId,
544544
infuraKey,
545+
rpc,
546+
bridge,
545547
preferred,
546548
label,
547549
iconSrc,
@@ -567,6 +569,8 @@ export function validateWalletInit(
567569
'apiKey',
568570
'networkId',
569571
'infuraKey',
572+
'rpc',
573+
'bridge',
570574
'preferred',
571575
'label',
572576
'iconSrc',
@@ -612,6 +616,20 @@ export function validateWalletInit(
612616
optional: true
613617
})
614618

619+
validateType({
620+
name: 'walletInit.rpc',
621+
value: rpc,
622+
type: 'object',
623+
optional: true
624+
})
625+
626+
validateType({
627+
name: 'walletInit.bridge',
628+
value: bridge,
629+
type: 'string',
630+
optional: true
631+
})
632+
615633
validateType({
616634
name: 'walletInit.preferred',
617635
value: preferred,

0 commit comments

Comments
 (0)