From 36d99921f450512dcac85e9083ad3984130dfea8 Mon Sep 17 00:00:00 2001 From: Sophia Date: Fri, 9 Jun 2023 16:45:53 -0400 Subject: [PATCH] Update memberlist pure proxy and refactor IPFS hashes (#1440) * Update dev pure proxy * Remove addtional /ipfs from ipfs uri * Add catalyst proxy * Update onboarding APIs pure proxy * Update pinning api to handle new uri structure * Remove quotes * Remove second set of quotes --- centrifuge-app/.env-config/.env.catalyst | 2 +- centrifuge-app/.env-config/.env.development | 2 +- centrifuge-js/src/modules/metadata.ts | 4 ++-- onboarding-api/env-vars/catalyst.env | 2 +- onboarding-api/env-vars/development.env | 2 +- pinning-api/src/controllers/pinFile.ts | 2 +- pinning-api/src/controllers/pinJson.ts | 2 +- pinning-api/src/utils/api.ts | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/centrifuge-app/.env-config/.env.catalyst b/centrifuge-app/.env-config/.env.catalyst index 0b201cc88c..6a05dd8ba7 100644 --- a/centrifuge-app/.env-config/.env.catalyst +++ b/centrifuge-app/.env-config/.env.catalyst @@ -14,4 +14,4 @@ REACT_APP_SUBSCAN_URL= REACT_APP_TINLAKE_NETWORK=goerli REACT_APP_INFURA_KEY=bf808e7d3d924fbeb74672d9341d0550 REACT_APP_WHITELISTED_ACCOUNTS= -REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpSf3aMw19 \ No newline at end of file +REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=4bo2vNkwZtr2PuqppWwqya6dPC8MzxqZ4kgnAoTZyKo9Kxq8 \ No newline at end of file diff --git a/centrifuge-app/.env-config/.env.development b/centrifuge-app/.env-config/.env.development index e5abef8063..babbf7ac45 100644 --- a/centrifuge-app/.env-config/.env.development +++ b/centrifuge-app/.env-config/.env.development @@ -14,4 +14,4 @@ REACT_APP_SUBSCAN_URL= REACT_APP_TINLAKE_NETWORK=goerli REACT_APP_INFURA_KEY=bf808e7d3d924fbeb74672d9341d0550 REACT_APP_WHITELISTED_ACCOUNTS= -REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpSf3aMw19 \ No newline at end of file +REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALwmJutBq95s41U9fWnoApCUgvPqPGTh1GSmFnQh5f9fWo93 \ No newline at end of file diff --git a/centrifuge-js/src/modules/metadata.ts b/centrifuge-js/src/modules/metadata.ts index 9f28e99415..4e87e1b5ec 100644 --- a/centrifuge-js/src/modules/metadata.ts +++ b/centrifuge-js/src/modules/metadata.ts @@ -39,7 +39,7 @@ export function getMetadataModule(inst: Centrifuge) { // string without protocol is assumed to be an IPFS hash newUrl = new URL(`ipfs/${url.replace(/\/?(ipfs\/)/, '')}`, inst.config.metadataHost) } else if (url.startsWith('ipfs://')) { - newUrl = new URL(url.substr(7), inst.config.metadataHost) + newUrl = new URL(`ipfs/${url.substr(7)}`, inst.config.metadataHost) } else { newUrl = new URL(url) } @@ -63,7 +63,7 @@ export function getMetadataModule(inst: Centrifuge) { .join() return { uri, ipfsHash: hash } } else if (!uri.includes('/') && uri.length === IPFS_HASH_LENGTH) { - return { uri: `ipfs://ipfs/${uri}`, ipfsHash: uri } + return { uri: `ipfs://${uri}`, ipfsHash: uri } } return { uri, ipfsHash: '' } } diff --git a/onboarding-api/env-vars/catalyst.env b/onboarding-api/env-vars/catalyst.env index 6a28036d28..d2748693fd 100644 --- a/onboarding-api/env-vars/catalyst.env +++ b/onboarding-api/env-vars/catalyst.env @@ -1,5 +1,5 @@ REDIRECT_URL=https://app-catalyst.k-f.dev -MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpSf3aMw19 +MEMBERLIST_ADMIN_PURE_PROXY=4bo2vNkwZtr2PuqppWwqya6dPC8MzxqZ4kgnAoTZyKo9Kxq8 COLLATOR_WSS_URL=wss://fullnode.catalyst.cntrfg.com RELAY_WSS_URL=wss://rococo-rpc.polkadot.io INFURA_KEY=bf808e7d3d924fbeb74672d9341d0550 diff --git a/onboarding-api/env-vars/development.env b/onboarding-api/env-vars/development.env index b799327872..72d91c51b3 100644 --- a/onboarding-api/env-vars/development.env +++ b/onboarding-api/env-vars/development.env @@ -1,5 +1,5 @@ REDIRECT_URL=https://app-dev.k-f.dev -MEMBERLIST_ADMIN_PURE_PROXY=kALJqPUHFzDR2VkoQYWefPQyzjGzKznNny2smXGQpSf3aMw19 +MEMBERLIST_ADMIN_PURE_PROXY=kALwmJutBq95s41U9fWnoApCUgvPqPGTh1GSmFnQh5f9fWo93 COLLATOR_WSS_URL=wss://fullnode.development.cntrfg.com RELAY_WSS_URL=wss://fullnode-relay.development.cntrfg.com INFURA_KEY=bf808e7d3d924fbeb74672d9341d0550 diff --git a/pinning-api/src/controllers/pinFile.ts b/pinning-api/src/controllers/pinFile.ts index 2c09f1b879..54bba557f8 100644 --- a/pinning-api/src/controllers/pinFile.ts +++ b/pinning-api/src/controllers/pinFile.ts @@ -22,7 +22,7 @@ const dataUriToReadStream = (uri: string) => { return fs.createReadStream(tempFilePath) } -const ipfsHashToURI = (hash: string) => `ipfs://ipfs/${hash}` +const ipfsHashToURI = (hash: string) => `ipfs://${hash}` export default async (req: Request, res: Response) => { try { diff --git a/pinning-api/src/controllers/pinJson.ts b/pinning-api/src/controllers/pinJson.ts index a0eebd6d94..dc97650264 100644 --- a/pinning-api/src/controllers/pinJson.ts +++ b/pinning-api/src/controllers/pinJson.ts @@ -1,7 +1,7 @@ import { Request, Response } from 'express' import { pinJson } from '../utils/api' -const ipfsHashToURI = (hash: string) => `ipfs://ipfs/${hash}` +const ipfsHashToURI = (hash: string) => `ipfs://${hash}` export default async (req: Request, res: Response) => { try { diff --git a/pinning-api/src/utils/api.ts b/pinning-api/src/utils/api.ts index 6e8b06e86c..4fe0c73c02 100644 --- a/pinning-api/src/utils/api.ts +++ b/pinning-api/src/utils/api.ts @@ -37,4 +37,4 @@ export const pinFile = async (fileReadStream: any) => { }) as Promise<{ data: { IpfsHash: string } }> } -export const ipfsHashToURI = (hash: string) => `ipfs://ipfs/${hash}` +export const ipfsHashToURI = (hash: string) => `ipfs://${hash}`