Skip to content

Commit

Permalink
Merge pull request #2199 from torusresearch/fix/custom-network-persis…
Browse files Browse the repository at this point in the history
…tence

fix custom network peristence and currency updates
  • Loading branch information
chaitanyapotti authored Dec 23, 2022
2 parents 8ae1720 + e80e94d commit 93a0762
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/handlers/Auth/OpenLoginHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class OpenLoginHandler {
try {
const { sessionId } = this.openLoginInstance.state.store.getStore()
const { sessionNamespace } = this.openLoginInstance.state
const finalSessionNamespace = sessionNamespace || config.namespace
const finalSessionNamespace = sessionNamespace || config.namespace || ''
const finalSessionId = sessionId || config.sessionId
if (finalSessionId) {
log.info('found session id')
Expand Down Expand Up @@ -105,7 +105,7 @@ class OpenLoginHandler {
try {
const { sessionId } = this.openLoginInstance.state.store.getStore()
const { sessionNamespace } = this.openLoginInstance.state
const finalSessionNamespace = sessionNamespace || config.namespace
const finalSessionNamespace = sessionNamespace || config.namespace || ''
const finalSessionId = sessionId || config.sessionId
if (finalSessionId) {
const privKey = Buffer.from(finalSessionId.padStart(64, '0'), 'hex')
Expand All @@ -125,7 +125,7 @@ class OpenLoginHandler {
try {
const { sessionId } = this.openLoginInstance.state.store.getStore()
const { sessionNamespace } = this.openLoginInstance.state
const finalSessionNamespace = sessionNamespace || config.namespace
const finalSessionNamespace = sessionNamespace || config.namespace || ''

if (sessionId) {
const privKey = Buffer.from(sessionId.padStart(64, '0'), 'hex')
Expand All @@ -145,7 +145,7 @@ class OpenLoginHandler {
try {
const { sessionId } = this.openLoginInstance.state.store.getStore()
const { sessionNamespace } = this.openLoginInstance.state
const finalSessionNamespace = sessionNamespace || config.namespace
const finalSessionNamespace = sessionNamespace || config.namespace || ''
if (sessionId) {
const privKey = Buffer.from(sessionId.padStart(64, '0'), 'hex')
const publicKeyHex = getPublic(privKey).toString('hex')
Expand Down
2 changes: 1 addition & 1 deletion src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export default {
networkType = { ...getters.supportedNetworks[networkType.host], ...networkType }
isSupportedNetwork = true
}

const currentTicker = networkType.ticker || 'ETH'
if ((payload.type && payload.type === RPC) || !isSupportedNetwork) {
const networkId = await torusController.setCustomRpc(networkType.host, networkType.chainId || 1, currentTicker, networkType.networkName || '', {
Expand All @@ -379,7 +380,6 @@ export default {
networkType.id = networkId
}
commit('setNetworkType', networkType)
return null
}
commit('setNetworkType', networkType)
await networkController.setProviderType(networkType.host, networkType.rpcUrl || networkType.host, networkType.ticker, networkType.networkName)
Expand Down

0 comments on commit 93a0762

Please sign in to comment.