Skip to content

Commit

Permalink
feat: Fetch cell deps from CDN
Browse files Browse the repository at this point in the history
  • Loading branch information
duanyytop committed May 28, 2024
1 parent 2730f59 commit 1310d40
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ckb/src/utils/cell-dep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,14 @@ interface CellDepsObject {
const GITHUB_CELL_DEPS_JSON_URL =
'https://raw.githubusercontent.com/ckb-cell/typeid-contract-cell-deps/main/deployment/cell-deps.json';

const CDN_GITHUB_CELL_DEPS_JSON_URL =
'https://cdn.jsdelivr.net/gh/ckb-cell/typeid-contract-cell-deps@main/deployment/cell-deps.json';

const request = (url: string) => axios.get(url, { timeout: 2000 });

const fetchCellDepsJson = async () => {
try {
const response = await axios.get(GITHUB_CELL_DEPS_JSON_URL);
const response = await Promise.any([request(GITHUB_CELL_DEPS_JSON_URL), request(CDN_GITHUB_CELL_DEPS_JSON_URL)]);
return response.data as CellDepsObject;
} catch (error) {
// console.error('Error fetching cell deps:', error);
Expand Down

0 comments on commit 1310d40

Please sign in to comment.