Skip to content

Commit

Permalink
added logic to disconnect socios wallet.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Taras authored and Nick Taras committed Sep 6, 2023
1 parent 3e39bcd commit 333f4de
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 28 deletions.
8 changes: 0 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
path: "http://localhost:5000/user-login-callback",
params: {}
},
userLogout: {
path: "http://localhost:5000/user-logout",
params: {}
},
userSignature: {
path: 'http://localhost:5000/user-signature',
params: {}
},
userBalance: {
path: 'http://localhost:5000/user-balance',
params: {}
Expand Down
5 changes: 0 additions & 5 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,6 @@ export class Client {
// this.registerOutletProofEventListener()
}

async testSig() {
let res = await fetch('http://localhost:5000/user-signature?message=hola', {})
console.log(res)
}

handleRecievedRedirectMessages() {
const issuer = this.getDataFromQuery('issuer')
const error = this.getDataFromQuery('error')
Expand Down
8 changes: 4 additions & 4 deletions src/client/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ export interface Oauth2IssuerConfig {
path: string
params?: object
}
userAccessToken: {
userBalance?: {
path: string
params?: object
params: object
}
userLogout: {
userNfts?: {
path: string
params?: object
params: object
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/utils/token/fungibleTokenProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ export const getFungibleTokenBalances = async (issuer: OnChainIssuer, owner: str
if (ipfsBaseUrl) query += `&ipfsBaseUrl=${ipfsBaseUrl}`
if (issuer.oAuth2options) {
query = issuer.oAuth2options.endpoints.userBalance.path;
// TODO when a user clicks load
// if(isCookieExpired(`tn-oauth2-expiry-${issuer.collectionID}`)) {
// ui.updateUI('wallet', { viewName: 'wallet' }, { viewTransition: 'slide-in-left' })
// }
}
return tokenRequest(query, true)
}
Expand Down
11 changes: 4 additions & 7 deletions src/wallet/Web3WalletProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ export class Web3WalletProvider {
if (state) {
for (let item in state) {
let provider = state[item].providerType
switch (provider) {
case 'WalletConnectV2':
switch (provider.toLowerCase()) {
case 'walletconnectV2':
{
let walletConnect2Provider = await import('./WalletConnectV2Provider')

Expand All @@ -125,8 +125,7 @@ export class Web3WalletProvider {
}
break
case 'socios':
console.log('remove socios wallet from local storage')
// deleteCookieByName(provider.expiryCookieName);
deleteCookieByName(`tn-oauth2-expiry-socios`)
break
}
}
Expand Down Expand Up @@ -496,19 +495,17 @@ export class Web3WalletProvider {
let client_id
let redirect_uri
let partner_tag
let collectionID
for (const issuer of this.client.config.issuers) {
const oauthIssuer = issuer as Oauth2IssuerConfig
if (oauthIssuer.oAuth2options.consumerKey) {
client_id = oauthIssuer.oAuth2options.consumerKey
redirect_uri = oauthIssuer.oAuth2options.endpoints.redirectURI.path
partner_tag = oauthIssuer.oAuth2options.partnerTag
collectionID = oauthIssuer.collectionID
break
}
}

if (isCookieMaxAgeExpired(`tn-oauth2-expiry-${collectionID}`)) {
if (isCookieMaxAgeExpired(`tn-oauth2-expiry-socios`)) {
// @ts-ignore
this.client.ui.showLoaderDelayed(['<h4>Connecting to Socios...</h4>'], 600, true)
window.location.href = `https://partner.socios.com/oauth2/authorize?response_type=code&client_id=${client_id}&redirect_uri=${redirect_uri}&partner_tag=${partner_tag}`
Expand Down

0 comments on commit 333f4de

Please sign in to comment.