Skip to content

Commit

Permalink
Update memberlist pure proxy and refactor IPFS hashes (#1440)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sophialittlejohn authored Jun 9, 2023
1 parent 5d99791 commit 36d9992
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion centrifuge-app/.env-config/.env.catalyst
Original file line number Diff line number Diff line change
Expand Up @@ -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
REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=4bo2vNkwZtr2PuqppWwqya6dPC8MzxqZ4kgnAoTZyKo9Kxq8
2 changes: 1 addition & 1 deletion centrifuge-app/.env-config/.env.development
Original file line number Diff line number Diff line change
Expand Up @@ -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
REACT_APP_MEMBERLIST_ADMIN_PURE_PROXY=kALwmJutBq95s41U9fWnoApCUgvPqPGTh1GSmFnQh5f9fWo93
4 changes: 2 additions & 2 deletions centrifuge-js/src/modules/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand All @@ -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: '' }
}
Expand Down
2 changes: 1 addition & 1 deletion onboarding-api/env-vars/catalyst.env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion onboarding-api/env-vars/development.env
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion pinning-api/src/controllers/pinFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pinning-api/src/controllers/pinJson.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion pinning-api/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`

0 comments on commit 36d9992

Please sign in to comment.