Skip to content

Commit 1bb2094

Browse files
committed
fix: fix contracts.getAllByProtocolAndChain
1 parent 84a7530 commit 1bb2094

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@sablier/deployments",
33
"description": "Keeping track of Sablier deployments",
4-
"version": "1.0.0-alpha.35",
4+
"version": "1.0.0-alpha.36",
55
"author": {
66
"name": "Sablier Labs Ltd",
77
"url": "https://sablier.com"

src/releases/queries.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,15 @@ export const contracts = {
3434
* Get all contracts for a protocol and chain
3535
*/
3636
getAllByProtocolAndChain: (protocol: Sablier.Protocol, chainId: number): Sablier.Contract[] | undefined => {
37-
const release = releasesByProtocol[protocol].find((release) =>
38-
release.deployments.find((deployment) => deployment.chainId === chainId),
37+
const releases = releasesByProtocol[protocol];
38+
const matchingDeployments = _.flatMap(releases, (release) =>
39+
release.deployments.filter((deployment) => deployment.chainId === chainId),
3940
);
40-
if (!release) {
41+
42+
if (_.isEmpty(matchingDeployments)) {
4143
return undefined;
4244
}
43-
return release.deployments.flatMap((deployment) => deployment.contracts);
45+
return _.flatMap(matchingDeployments, (deployment) => deployment.contracts);
4446
},
4547

4648
/**

0 commit comments

Comments
 (0)