Skip to content

Commit 2516764

Browse files
committed
fix: dont error out if contract not deployed
Signed-off-by: Tomás Migone <[email protected]>
1 parent c432ce1 commit 2516764

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed

packages/common-ts/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [2.0.3-testnet] - 2022-11-09
8+
### Changed
9+
- Don't error out if contract is not deployed
10+
711
## [2.0.1-testnet] - 2022-11-09
812
### Changed
913
- Remove reservoir contracts

packages/common-ts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/common-ts",
3-
"version": "2.0.2-testnet",
3+
"version": "2.0.3-testnet",
44
"description": "Common TypeScript library for Graph Protocol components",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

packages/common-ts/src/contracts/index.ts

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,19 +132,25 @@ export const connectContracts = async (
132132
}
133133

134134
if (GraphChain.isL1(chainId)) {
135-
contracts.l1GraphTokenGateway = L1GraphTokenGateway__factory.connect(
136-
deployedContracts.L1GraphTokenGateway.address,
137-
providerOrSigner,
138-
)
139-
contracts.bridgeEscrow = BridgeEscrow__factory.connect(
140-
deployedContracts.BridgeEscrow.address,
141-
providerOrSigner,
142-
)
135+
if (contracts.l1GraphTokenGateway) {
136+
contracts.l1GraphTokenGateway = L1GraphTokenGateway__factory.connect(
137+
deployedContracts.L1GraphTokenGateway.address,
138+
providerOrSigner,
139+
)
140+
}
141+
if (contracts.bridgeEscrow) {
142+
contracts.bridgeEscrow = BridgeEscrow__factory.connect(
143+
deployedContracts.BridgeEscrow.address,
144+
providerOrSigner,
145+
)
146+
}
143147
} else if (GraphChain.isL2(chainId)) {
144-
contracts.l2GraphTokenGateway = L2GraphTokenGateway__factory.connect(
145-
deployedContracts.L2GraphTokenGateway.address,
146-
providerOrSigner,
147-
)
148+
if (contracts.l2GraphTokenGateway) {
149+
contracts.l2GraphTokenGateway = L2GraphTokenGateway__factory.connect(
150+
deployedContracts.L2GraphTokenGateway.address,
151+
providerOrSigner,
152+
)
153+
}
148154
}
149155

150156
return contracts

0 commit comments

Comments
 (0)