Skip to content

Commit

Permalink
fix to wallet filter. Simplified the rules.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Taras authored and Nick Taras committed Sep 26, 2023
1 parent a5163f7 commit f8b0631
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 173 deletions.
322 changes: 161 additions & 161 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,36 @@
window.negotiator = new negotiator.Client({
type: "active",
issuers: [
// {
// onChain: true,
// fungible: true,
// chain: "eth",
// blockchain: "evm",
// collectionID: "socios",
// contract: "0x3506424F91fD33084466F402d5D97f05F8e3b4AF",
// oAuth2options: {
// consumerKey: "YOUR_CONSUMER_KEY",
// partnerTag: "YOUR_PARTNER_TAG",
// endpoints: {
// redirectURI: {
// path: "http://localhost:5000/user-login-callback",
// params: {}
// },
// userBalance: {
// path: 'http://localhost:5000/user-balance',
// params: {}
// },
// userNfts: {
// path: 'http://localhost:5000/user-nfts',
// params: {}
// },
// userLogout: {
// path: 'http://localhost:5000/user-logout',
// params: {}
// },
// },
// },
// },
// {
// onChain: true,
// fungible: true,
// chain: "eth",
// blockchain: "evm",
// collectionID: "socios",
// contract: "0x3506424F91fD33084466F402d5D97f05F8e3b4AF",
// oAuth2options: {
// consumerKey: "YOUR_CONSUMER_KEY",
// partnerTag: "YOUR_PARTNER_TAG",
// endpoints: {
// redirectURI: {
// path: "http://localhost:5000/user-login-callback",
// params: {}
// },
// userBalance: {
// path: 'http://localhost:5000/user-balance',
// params: {}
// },
// userNfts: {
// path: 'http://localhost:5000/user-nfts',
// params: {}
// },
// userLogout: {
// path: 'http://localhost:5000/user-logout',
// params: {}
// },
// },
// },
// },
// {
// hideToggle: true,
// noTokenMsg:
Expand Down Expand Up @@ -166,137 +166,137 @@
// base64attestorPubKey:
// "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ=",
// },
{
hideToggle: false,
noTokenMsg: "<p>If you have a token please:</p><p>1. Open your magic link inside this browser.<br/>2. Refresh this page.</p>",
collectionID: 'devcon',
title: "Devcon",
onChain: false,
tokenOrigin: "http://localhost:3002/",
attestationOrigin: "https://attestation.id/",
unEndPoint: "https://crypto-verify.herokuapp.com/use-devcon-ticket",
image: "https://raw.githubusercontent.com/TokenScript/token-negotiator/main/mock-images/devcon.svg",
base64senderPublicKeys:
{
"AttestationDAO": 'MFYwEAYHKoZIzj0CAQYFK...'
},
base64attestorPubKey: "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ="
},
{
collectionID: "crypto-cowboy-country",
tokenProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
collectionAddress:
"bf0aae3dd0078a9feb975f1e3242ddcb7774d551c7fd2a3f07a89c827ed606b2",
updateAuthority: "CCCUzWanUNegjGby11DjujDvPaNN68jd9Rimwk2MZzqZ",
onChain: true,
symbol: "CCC",
chain: "mainnet",
blockchain: "solana",
},
{
collectionID: "penthouse-panther-club",
collectionAddress: "ff846ef2eed57e5367cf8826e63f4d53fe28d28aa67417accb6e4b48cbd19136",
updateAuthority: "92oYPmrr1BHznizuZmpKZ3MFRadMFYRTCxo9Pf34mZKX",
tokenProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
onChain: true,
symbol: "PPC",
chain: "mainnet",
blockchain: "solana",
},
{
hideToggle: false,
collectionID: "pixel",
collectionAddress: "166424b16c4c7f40eb852f9eb2d0d6869a9ed7ac54a8e6afbd516676bfbbeb19",
onChain: true,
symbol: "PIXEL",
chain: "mainnet",
blockchain: "solana",
},
{
onChain: true,
collectionID: "expansion-punks",
contract: "0x0d0167a823c6619d430b1a96ad85b888bcf97c37",
chain: "eth",
blockchain: "evm",
},
{
onChain: true,
collectionID: "fantom-collection-test",
contract: "0x94e22c14118353651636f9af43cd0a5a08b93da3",
chain: "fantom",
blockchain: "evm",
},
{
hideToggle: true,
noTokenMsg:
"<p>If you have a token please:</p><p>1. Open your magic link inside this browser.<br/>2. Refresh this page.</p>",
onChain: true,
collectionID: "bsc-collection-test",
contract: "0xF5db804101d8600c26598A1Ba465166c33CdAA4b",
chain: "bsc",
blockchain: "evm",
},
{
onChain: true,
collectionID: "tt",
contract: '0x76be3b62873462d2142405439777e971754e8e77',
chain: 'eth',
blockchain: "evm",
},
{ onChain: true, collectionID: "Perion", contract: '0x96af92ae2d822a0f191455ceca4d4e7ee227668e', chain: 'mumbai', blockchain: "evm" },
{ collectionID: 'COOLCATS-#2426-14', onChain: true, contract: '0x3C7e352481F4b2fdEc1e642a3f0018661c77513D', chain: 'eth', openSeaSlug: 'devcon-vi-suit-up-collection' },
{ collectionID: 'Town-Hall', onChain: true, contract: '0x81b30ff521D1fEB67EDE32db726D95714eb00637', chain: 'Optimism' },
{
collectionID: "Blusteak Kangaroo #64",
onChain: true,
contract: "0xa996F7F3BC647EebC98C684aB0A302c9b85d2FA1",
chain: "Avalanche",
},
{
collectionID: "Alone Pirate",
onChain: true,
contract: "0x36535ec384B94342558e37282527b5052587af6A",
chain: "Arbitrum",
},
{
collectionID: "NBA",
onChain: true,
contract: "A.0b2a3299cc857e29.TopShot",
chain: "mainnet",
blockchain: "flow",
},
{
onChain: true,
erc: 20,
fungible: true,
collectionID: "polygon",
contract: '0x52459834ca561cb55411699e9c2143683bcf865f',
chain: 'matic',
blockchain: "evm",
// Add fungible as a boolean
// symbol: 'USX'
},
{
contract: "0x107065a122f92636a1358a70a0efe0f1a080a7e5",
onChain: true,
fungible: true,
collectionID: "USX",
chain: "matic",
},
{
contract: "0x429f49faec3d568ef83ec803e02df78e25d5ee7d",
onChain: true,
fungible: true,
collectionID: "Ella",
chain: "matic",
},
{
contract: "0xaaa5b9e6c589642f98a1cda99b9d024b8407285a",
onChain: true,
fungible: true,
collectionID: "TITAN",
chain: "matic",
},
// {
// hideToggle: false,
// noTokenMsg: "<p>If you have a token please:</p><p>1. Open your magic link inside this browser.<br/>2. Refresh this page.</p>",
// collectionID: 'devcon',
// title: "Devcon",
// onChain: false,
// tokenOrigin: "http://localhost:3002/",
// attestationOrigin: "https://attestation.id/",
// unEndPoint: "https://crypto-verify.herokuapp.com/use-devcon-ticket",
// image: "https://raw.githubusercontent.com/TokenScript/token-negotiator/main/mock-images/devcon.svg",
// base64senderPublicKeys:
// {
// "AttestationDAO": 'MFYwEAYHKoZIzj0CAQYFK...'
// },
// base64attestorPubKey: "MIIBMzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/////////////////////////////////////v///C8wRAQgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHBEEEeb5mfvncu6xVoGKVzocLBwKb/NstzijZWfKBWxb4F5hIOtp3JqPEZV2k+/wOEQio/Re0SKaFVBmcR9CP+xDUuAIhAP////////////////////66rtzmr0igO7/SXozQNkFBAgEBA0IABL+y43T1OJFScEep69/yTqpqnV/jzONz9Sp4TEHyAJ7IPN9+GHweCX1hT4OFxt152sBN3jJc1s0Ymzd8pNGZNoQ="
// },
// {
// collectionID: "crypto-cowboy-country",
// tokenProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
// collectionAddress:
// "bf0aae3dd0078a9feb975f1e3242ddcb7774d551c7fd2a3f07a89c827ed606b2",
// updateAuthority: "CCCUzWanUNegjGby11DjujDvPaNN68jd9Rimwk2MZzqZ",
// onChain: true,
// symbol: "CCC",
// chain: "mainnet",
// blockchain: "solana",
// },
// {
// collectionID: "penthouse-panther-club",
// collectionAddress: "ff846ef2eed57e5367cf8826e63f4d53fe28d28aa67417accb6e4b48cbd19136",
// updateAuthority: "92oYPmrr1BHznizuZmpKZ3MFRadMFYRTCxo9Pf34mZKX",
// tokenProgram: "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA",
// onChain: true,
// symbol: "PPC",
// chain: "mainnet",
// blockchain: "solana",
// },
// {
// hideToggle: false,
// collectionID: "pixel",
// collectionAddress: "166424b16c4c7f40eb852f9eb2d0d6869a9ed7ac54a8e6afbd516676bfbbeb19",
// onChain: true,
// symbol: "PIXEL",
// chain: "mainnet",
// blockchain: "solana",
// },
// {
// onChain: true,
// collectionID: "expansion-punks",
// contract: "0x0d0167a823c6619d430b1a96ad85b888bcf97c37",
// chain: "eth",
// blockchain: "evm",
// },
// {
// onChain: true,
// collectionID: "fantom-collection-test",
// contract: "0x94e22c14118353651636f9af43cd0a5a08b93da3",
// chain: "fantom",
// blockchain: "evm",
// },
// {
// hideToggle: true,
// noTokenMsg:
// "<p>If you have a token please:</p><p>1. Open your magic link inside this browser.<br/>2. Refresh this page.</p>",
// onChain: true,
// collectionID: "bsc-collection-test",
// contract: "0xF5db804101d8600c26598A1Ba465166c33CdAA4b",
// chain: "bsc",
// blockchain: "evm",
// },
// {
// onChain: true,
// collectionID: "tt",
// contract: '0x76be3b62873462d2142405439777e971754e8e77',
// chain: 'eth',
// blockchain: "evm",
// },
// { onChain: true, collectionID: "Perion", contract: '0x96af92ae2d822a0f191455ceca4d4e7ee227668e', chain: 'mumbai', blockchain: "evm" },
// { collectionID: 'COOLCATS-#2426-14', onChain: true, contract: '0x3C7e352481F4b2fdEc1e642a3f0018661c77513D', chain: 'eth', openSeaSlug: 'devcon-vi-suit-up-collection' },
// { collectionID: 'Town-Hall', onChain: true, contract: '0x81b30ff521D1fEB67EDE32db726D95714eb00637', chain: 'Optimism' },
// {
// collectionID: "Blusteak Kangaroo #64",
// onChain: true,
// contract: "0xa996F7F3BC647EebC98C684aB0A302c9b85d2FA1",
// chain: "Avalanche",
// },
// {
// collectionID: "Alone Pirate",
// onChain: true,
// contract: "0x36535ec384B94342558e37282527b5052587af6A",
// chain: "Arbitrum",
// },
// {
// collectionID: "NBA",
// onChain: true,
// contract: "A.0b2a3299cc857e29.TopShot",
// chain: "mainnet",
// blockchain: "flow",
// },
// {
// onChain: true,
// erc: 20,
// fungible: true,
// collectionID: "polygon",
// contract: '0x52459834ca561cb55411699e9c2143683bcf865f',
// chain: 'matic',
// blockchain: "evm",
// // Add fungible as a boolean
// // symbol: 'USX'
// },
// {
// contract: "0x107065a122f92636a1358a70a0efe0f1a080a7e5",
// onChain: true,
// fungible: true,
// collectionID: "USX",
// chain: "matic",
// },
// {
// contract: "0x429f49faec3d568ef83ec803e02df78e25d5ee7d",
// onChain: true,
// fungible: true,
// collectionID: "Ella",
// chain: "matic",
// },
// {
// contract: "0xaaa5b9e6c589642f98a1cda99b9d024b8407285a",
// onChain: true,
// fungible: true,
// collectionID: "TITAN",
// chain: "matic",
// },
],
uiOptions: {
openingHeading:
Expand Down
20 changes: 8 additions & 12 deletions src/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,20 +292,16 @@ export class Client {

// TODO: Move to token store OR select-wallet view - this method is very similar to getCurrentBlockchains()
public hasIssuerForBlockchain(blockchain: 'evm' | 'solana' | 'flow' | 'ultra', useOauth = false) {
const _blockchain = blockchain.toLocaleLowerCase()
return (
this.config.issuers.filter((issuer: OnChainTokenConfig) => {
const oAuthIssuer = useOauth && issuer.oAuth2options
if (blockchain === 'evm' && !issuer.onChain) {
return true
}
if (blockchain === 'solana' && typeof window.solana === 'undefined') {
return false
}
if (blockchain === 'ultra' && typeof window.ultra === 'undefined') {
return false
}
const blockChainNameMatch = issuer.blockchain ? issuer.blockchain.toLowerCase() : 'evm' === blockchain
return blockChainNameMatch && (oAuthIssuer || !issuer.oAuth2options)
const issuerBlockChain = issuer.blockchain?.toLocaleLowerCase()
const blockChainUsed = issuerBlockChain === blockchain
const solanaEnabled = blockChainUsed && _blockchain === 'solana' && typeof window.solana !== 'undefined'
const ultraEnabled = blockChainUsed && _blockchain === 'ultra' && typeof window.ultra !== 'undefined'
const evmEnabled = blockChainUsed && _blockchain === 'evm' && !issuer.oAuth2options && !useOauth
const sociosEnabled = blockChainUsed && _blockchain === 'evm' && issuer.oAuth2options && useOauth
return solanaEnabled || ultraEnabled || evmEnabled || sociosEnabled
}).length > 0
)
}
Expand Down

0 comments on commit f8b0631

Please sign in to comment.