Skip to content

Commit

Permalink
Pass project id through a constructor
Browse files Browse the repository at this point in the history
Pass wallet connect project id through ledger live constructor.
  • Loading branch information
michalsmiarowski committed Jul 27, 2023
1 parent e3f46f9 commit 0853ce8
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/web3/connectors/ledgerLive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ interface LedgerLiveConnectorArguments extends AbstractConnectorArguments {
rpc: {
[chainId: number]: string
}
walletConnectProjectId: string
}

export class LedgerLiveConnector extends AbstractConnector {
private rpc: LedgerLiveConnectorArguments["rpc"]
private provider?: EthereumProvider
private connectKitPromise: Promise<LedgerConnectKit>
private walletConnectProjectId: string

constructor(args: Required<LedgerLiveConnectorArguments>) {
super({
Expand All @@ -29,6 +31,7 @@ export class LedgerLiveConnector extends AbstractConnector {
})

this.rpc = args.rpc
this.walletConnectProjectId = args.walletConnectProjectId

this.handleNetworkChanged = this.handleNetworkChanged.bind(this)
this.handleChainChanged = this.handleChainChanged.bind(this)
Expand Down Expand Up @@ -64,7 +67,7 @@ export class LedgerLiveConnector extends AbstractConnector {
const checkSupportResult = connectKit.checkSupport({
chains: [chainId],
walletConnectVersion: 2,
projectId: getEnvVariable(EnvVariable.WALLET_CONNECT_PROJECT_ID),
projectId: this.walletConnectProjectId,
providerType: SupportedProviders.Ethereum,
rpcMap: this.rpc,
})
Expand Down Expand Up @@ -129,6 +132,7 @@ export const ledgerLive = new LedgerLiveConnector({
rpc: {
[Number(supportedChainId)]: rpcUrl as string,
},
walletConnectProjectId: getEnvVariable(EnvVariable.WALLET_CONNECT_PROJECT_ID),
})

class ConnectorNotAcivatedError extends Error {
Expand Down

0 comments on commit 0853ce8

Please sign in to comment.