Skip to content

Commit

Permalink
Merge branch 'main' into use-failover-provider
Browse files Browse the repository at this point in the history
  • Loading branch information
jtourkos committed Oct 14, 2024
2 parents 35bc102 + 6abd0ce commit 46b959f
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 24 deletions.
17 changes: 0 additions & 17 deletions Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"build:contracts": "typechain --target=ethers-v6 --out-dir ./src/generated/contracts ./src/abi/**.json",
"build": "npm run build:contracts && npm run build:graphql && tsc",
"dev": "npx nodemon",
"start": "npm run build && node dist/index.js",
"start": "node dist/index.js",
"check": "tsc --noEmit"
},
"keywords": [],
Expand Down
26 changes: 21 additions & 5 deletions src/common/dripsContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ const chainConfigs: Record<
repoDriverAddress: '0x54372850Db72915Fd9C5EC745683EB607b4a8642',
},
FILECOIN: {
dripsAddress: '0x29252acF5a3dA105CB3aC245B7758F6e50281ba7',
addressDriverAddress: '0xE13A4f3671ee451F81Df3aa1AEb6653e4c33D5e0',
repoDriverAddress: '0x249e35aC49ccC4B1F0688Bc4c0bFA866a1b1E3fE',
dripsAddress: '0xd320F59F109c618b19707ea5C5F068020eA333B3',
addressDriverAddress: '0x04693D13826a37dDdF973Be4275546Ad978cb9EE',
repoDriverAddress: '0xe75f56B26857cAe06b455Bfc9481593Ae0FB4257',
},
};

Expand Down Expand Up @@ -134,7 +134,15 @@ export async function getCrossChainAddressDriverAccountIdByAddress(
address: Address,
): Promise<AddressDriverId> {
// AddressDriver account IDs are the same across all chains.
const { addressDriver } = dripsContracts[queryableChains[0]]!;
const availableChain = queryableChains.find(
(chain) => dripsContracts[chain] && dripsContracts[chain]!.addressDriver,
);

if (!availableChain) {
throw new Error('No available chain with initialized contracts.');
}

const { addressDriver } = dripsContracts[availableChain]!;

const accountId = (await addressDriver.calcAccountId(address)).toString();

Expand All @@ -146,7 +154,15 @@ export async function getCrossChainRepoDriverAccountIdByAddress(
project: string,
): Promise<AccountId> {
// RepoDriver account IDs are the same across all chains.
const { repoDriver } = dripsContracts[queryableChains[0]]!;
const availableChain = queryableChains.find(
(chain) => dripsContracts[chain] && dripsContracts[chain]!.repoDriver,
);

if (!availableChain) {
throw new Error('No available chain with initialized contracts.');
}

const { repoDriver } = dripsContracts[availableChain]!;

const nameAsBytesLike = ethers.toUtf8Bytes(project);

Expand Down
2 changes: 1 addition & 1 deletion src/common/queryableChains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import appSettings from './appSettings';
const queryableChains: SupportedChain[] = [];

Object.keys(SupportedChain).forEach((chain) => {
if (appSettings.rpcConfigs[chain as SupportedChain]) {
if (appSettings.rpcConfigs[chain as SupportedChain]?.url) {
queryableChains.push(chain as SupportedChain);
}
});
Expand Down
4 changes: 4 additions & 0 deletions src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ const startServer = async () => {

app.set('trust proxy', 1);

app.route('/health').get((_, res) => {
res.status(200).send('OK');
});

app.use(
'/',
cors<cors.CorsRequest>(),
Expand Down

0 comments on commit 46b959f

Please sign in to comment.