diff --git a/.ci/index.ts b/.ci/index.ts index daf2de76..aada6159 100644 --- a/.ci/index.ts +++ b/.ci/index.ts @@ -134,11 +134,6 @@ export = async function main() { name: 'WAREHOUSE_TOKEN', value: config.requireSecret('WAREHOUSE_TOKEN'), }, - { - name: 'TPW_MANAGER_ADDRESSES', - value: - '0x1D9aa2025b67f0F21d1603ce521bda7869098f8a,0xeDaE96F7739aF8A7fB16E2a888C1E578E1328299,0xeC6E6c0841a2bA474E92Bf42BaF76bFe80e8657C,0x24e5F44999c151f08609F8e27b2238c773C4D020', - }, { name: 'THIRD_PARTY_GRAPH_URL', value: diff --git a/.env.example b/.env.example index c42c5bce..4b600304 100644 --- a/.env.example +++ b/.env.example @@ -34,5 +34,3 @@ MATIC_RPC_URL= WAREHOUSE_URL= WAREHOUSE_TOKEN= WAREHOUSE_CONTEXT_PREFIX= - -TPW_MANAGER_ADDRESSES: 0xc6d2000a7a1ddca92941f4e2b41360fe4ee2abd9 diff --git a/.github/workflows/node.yml b/.github/workflows/node.yml index 7147e185..2e3634ec 100644 --- a/.github/workflows/node.yml +++ b/.github/workflows/node.yml @@ -30,7 +30,6 @@ jobs: ANALYTICS_CONNECTION_STRING: ANALYTICS_CONNECTION_STRING PEER_URL: https://peer.decentraland.zone ETHEREUM_NETWORK: ropsten - TPW_MANAGER_ADDRESSES: '0x25349e40543494430ae6d06ca2b31bb844439d09' THIRD_PARTY_GRAPH_URL: 'http://thid-party-url' - name: Report Coverage uses: coverallsapp/github-action@master diff --git a/src/Collection/Collection.service.spec.ts b/src/Collection/Collection.service.spec.ts index b8ff05ea..a33ce8e9 100644 --- a/src/Collection/Collection.service.spec.ts +++ b/src/Collection/Collection.service.spec.ts @@ -1,4 +1,3 @@ -import { env } from 'decentraland-commons' import { collectionAttributesMock } from '../../spec/mocks/collections' import { wallet } from '../../spec/mocks/wallet' import { thirdPartyAPI } from '../ethereum/api/thirdParty' @@ -57,58 +56,37 @@ describe('Collection service', () => { describe('when checking if an address is a TPW manager', () => { const service = new CollectionService() + let urn: string + let manager: string + + beforeEach(() => { + urn = 'some:valid:urn' + manager = '0x123123' + }) afterAll(() => { jest.restoreAllMocks() }) - describe('when an address belongs to the TPW_MANAGER_ADDRESSES env var', () => { - let manager: string + describe('when thegraph has a urn with the address as manager', () => { beforeEach(() => { - manager = '0x123123' - jest - .spyOn(env, 'get') - .mockReturnValueOnce(`0x555,${manager},0x444,0x333`) + ;(thirdPartyAPI.isManager as jest.Mock).mockReturnValueOnce(true) }) it('should return true', async () => { - expect(await service.isTPWManager('', manager)).toBe(true) - expect(env.get).toHaveBeenCalledWith('TPW_MANAGER_ADDRESSES', '') + expect(await service.isTPWManager(urn, manager)).toBe(true) + expect(thirdPartyAPI.isManager).toHaveBeenCalledWith(urn, manager) }) }) - describe('when an address does not belong to the TPW_MANAGER_ADDRESSES env var', () => { - let urn: string - let manager: string - + describe('when thegraph does not have a urn with the address as manager', () => { beforeEach(() => { - urn = 'some:valid:urn' - manager = '0x123123' - jest.spyOn(env, 'get').mockReturnValueOnce(`0x555,0x444,0x333`) + ;(thirdPartyAPI.isManager as jest.Mock).mockReturnValueOnce(false) }) - describe('when thegraph has a urn with the address as manager', () => { - beforeEach(() => { - ;(thirdPartyAPI.isManager as jest.Mock).mockReturnValueOnce(true) - }) - - it('should return true', async () => { - expect(await service.isTPWManager(urn, manager)).toBe(true) - expect(thirdPartyAPI.isManager).toHaveBeenCalledWith(urn, manager) - expect(env.get).toHaveBeenCalledWith('TPW_MANAGER_ADDRESSES', '') - }) - }) - - describe('when thegraph does not has a urn with the address as manager', () => { - beforeEach(() => { - ;(thirdPartyAPI.isManager as jest.Mock).mockReturnValueOnce(false) - }) - - it('should return true', async () => { - expect(await service.isTPWManager(urn, manager)).toBe(false) - expect(thirdPartyAPI.isManager).toHaveBeenCalledWith(urn, manager) - expect(env.get).toHaveBeenCalledWith('TPW_MANAGER_ADDRESSES', '') - }) + it('should return false', async () => { + expect(await service.isTPWManager(urn, manager)).toBe(false) + expect(thirdPartyAPI.isManager).toHaveBeenCalledWith(urn, manager) }) }) }) diff --git a/src/Collection/Collection.service.ts b/src/Collection/Collection.service.ts index d5078284..b310e72d 100644 --- a/src/Collection/Collection.service.ts +++ b/src/Collection/Collection.service.ts @@ -1,4 +1,3 @@ -import { env } from 'decentraland-commons' import { collectionAPI } from '../ethereum/api/collection' import { thirdPartyAPI } from '../ethereum/api/thirdParty' import { isPublished } from '../utils/eth' @@ -255,17 +254,6 @@ export class CollectionService { * @param address - The address to check if it manages the collection. */ public async isTPWManager(urn: string, address: string): Promise { - const isEnvManager = - !env.isProduction() && - env - .get('TPW_MANAGER_ADDRESSES', '') - .toLowerCase() - .search(address.toLowerCase()) > -1 - - if (isEnvManager) { - return true - } - return thirdPartyAPI.isManager(urn, address) }