Skip to content

Commit 623d759

Browse files
vacekjboudra
andauthored
fix: rename arbitrum one to arbitrum for lit js sdk (gitcoinco#2333)
Co-authored-by: Mohamed Boudra <boudra.moha@gmail.com>
1 parent 49719a7 commit 623d759

7 files changed

Lines changed: 34 additions & 28 deletions

File tree

.github/workflows/builder.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424

2525
- uses: actions/setup-node@v3
2626
with:
27-
node-version: '18'
27+
node-version: '16'
2828
cache: 'pnpm'
2929

3030
- name: Install Dependencies

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"// builder script": "====== packages/builder specific ======",
2828
"b-start": "pnpm --filter builder run start",
2929
"b-lint": "turbo run lint:ci --filter=builder",
30-
"b-test": "turbo run test --filter=builder",
30+
"b-test": "pnpm test --filter=builder",
3131
"b-typecheck": "turbo run typecheck --filter=builder"
3232
},
3333
"devDependencies": {

packages/grant-explorer/src/features/api/__tests__/utils.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ describe("fetchFromIPFS", () => {
107107
const res = await fetchFromIPFS(cid);
108108

109109
expect(fetchMock).toHaveBeenCalledWith(
110-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
110+
`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
111111
);
112112
expect(res).toEqual({ name: "My First Metadata" });
113113
});
@@ -122,7 +122,7 @@ describe("fetchFromIPFS", () => {
122122
await expect(fetchFromIPFS(cid)).rejects.toHaveProperty("status", 404);
123123

124124
expect(fetchMock).toHaveBeenCalledWith(
125-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
125+
`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
126126
);
127127
});
128128
});

packages/grant-explorer/src/features/api/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -427,15 +427,15 @@ export const graphql_fetch = async (
427427
* @param cid - the unique content identifier that points to the data
428428
*/
429429
export const fetchFromIPFS = (cid: string) => {
430-
return fetch(
431-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
432-
).then((resp) => {
433-
if (resp.ok) {
434-
return resp.json();
435-
}
430+
return fetch(`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`).then(
431+
(resp) => {
432+
if (resp.ok) {
433+
return resp.json();
434+
}
436435

437-
return Promise.reject(resp);
438-
});
436+
return Promise.reject(resp);
437+
}
438+
);
439439
};
440440

441441
/**

packages/round-manager/src/features/api/__tests__/utils.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe("fetchFromIPFS", () => {
2828
const res = await fetchFromIPFS(cid);
2929

3030
expect(fetchMock).toHaveBeenCalledWith(
31-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
31+
`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
3232
);
3333
expect(res).toEqual({ name: "My First Metadata" });
3434
});
@@ -43,7 +43,7 @@ describe("fetchFromIPFS", () => {
4343
await expect(fetchFromIPFS(cid)).rejects.toHaveProperty("status", 404);
4444

4545
expect(fetchMock).toHaveBeenCalledWith(
46-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
46+
`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
4747
);
4848
});
4949
});
@@ -251,7 +251,7 @@ describe("checkGrantApplicationStatus", () => {
251251
const res = await checkGrantApplicationStatus("1", metadataPointer);
252252

253253
expect(fetchMock).toHaveBeenCalledWith(
254-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${metadataPointer.pointer}`
254+
`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${metadataPointer.pointer}`
255255
);
256256
expect(res).toEqual("FRAUD");
257257
});

packages/round-manager/src/features/api/utils.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -443,15 +443,15 @@ export const getPayoutTokenOptions = (chainId: ChainId): PayoutToken[] => {
443443
* @param cid - the unique content identifier that points to the data
444444
*/
445445
export const fetchFromIPFS = (cid: string) => {
446-
return fetch(
447-
`https://${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`
448-
).then((resp) => {
449-
if (resp.ok) {
450-
return resp.json();
451-
}
446+
return fetch(`${process.env.REACT_APP_PINATA_GATEWAY}/ipfs/${cid}`).then(
447+
(resp) => {
448+
if (resp.ok) {
449+
return resp.json();
450+
}
452451

453-
return Promise.reject(resp);
454-
});
452+
return Promise.reject(resp);
453+
}
454+
);
455455
};
456456

457457
/**

packages/round-manager/src/features/round/ViewApplicationPage.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,18 @@ export default function ViewApplicationPage() {
261261

262262
const response = await fetch(base64EncryptedString);
263263
const encryptedString: Blob = await response.blob();
264-
264+
let fixedChainName = chain.name;
265+
switch (fixedChainName.toLowerCase()) {
266+
case "pgn":
267+
fixedChainName = "publicGoodsNetwork";
268+
break;
269+
270+
case "arbitrum one":
271+
fixedChainName = "arbitrum";
272+
break;
273+
}
265274
const lit = new Lit({
266-
chain:
267-
chain.name.toLowerCase() === "pgn"
268-
? "publicGoodsNetwork"
269-
: chain.name.toLowerCase(),
275+
chain: fixedChainName.toLowerCase(),
270276
contract: utils.getAddress(roundId),
271277
});
272278

0 commit comments

Comments
 (0)