Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor (url: string) {
super()
this.closed = false
this.connected = false
this.subscriptions = false
this.status = 'loading'
this.url = url
this.pollId = uuid()
this.post = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: null
}
setTimeout(() => this.create(), 0)
}
public create (): void {
this._key = await this._generateKey()
const request: IJsonRpcRequest = this._formatRequest({
method: 'wc_sessionRequest',
params: [
{
peerId: this.clientId,
peerMeta: this.clientMeta,
chainId: opts && opts.chainId ? opts.chainId : null
}
]
})
this.handshakeId = request.id
this.handshakeTopic = uuid()
this._sendSessionRequest(
request,
'Session update rejected',
this.handshakeTopic
)
this._eventManager.trigger({
event: 'display_uri',
params: [this.uri]
})
}
get clientId () {
let clientId: string | null = this._clientId
if (!clientId) {
clientId = this._clientId = uuid()
}
return this._clientId
}