Skip to content

Commit 7715ce2

Browse files
committed
fix: ensure transaction logging wrapping is disabled with boolean flag
Signed-off-by: Tomás Migone <[email protected]>
1 parent b8a0c14 commit 7715ce2

File tree

9 files changed

+62
-12
lines changed

9 files changed

+62
-12
lines changed

packages/hardhat-graph-protocol/CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
# hardhat-graph-protocol
22

3+
## 0.1.15
4+
5+
### Patch Changes
6+
7+
- Updated dependencies
8+
- @graphprotocol/toolshed@0.4.2
9+
10+
## 0.1.14
11+
12+
### Patch Changes
13+
14+
- Updated dependencies
15+
- @graphprotocol/toolshed@0.4.1
16+
317
## 0.1.13
418

519
### Patch Changes

packages/hardhat-graph-protocol/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ An example log output:
145145
[2025-04-10T20:32:40.946Z] ✔ Transaction succeeded!
146146
```
147147
148+
__Note__ Transaction logging requires using js Proxy which strips down some type definitions from contract methods. This means that when transaction logging is enabled `contract.functionName.estimateGas` for example will not be available.
149+
148150
**Transaction auto-awaiting**
149151
150152
Any transactions made using the `contracts` object will be automatically awaited:

packages/hardhat-graph-protocol/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hardhat-graph-protocol",
3-
"version": "0.1.13",
3+
"version": "0.1.15",
44
"publishConfig": {
55
"access": "public"
66
},

packages/horizon/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"hardhat": "^2.22.18",
5656
"hardhat-contract-sizer": "^2.10.0",
5757
"hardhat-gas-reporter": "^1.0.8",
58-
"hardhat-graph-protocol": "workspace:^0.1.13",
58+
"hardhat-graph-protocol": "workspace:^0.1.15",
5959
"hardhat-secure-accounts": "^1.0.5",
6060
"lint-staged": "^15.2.2",
6161
"prettier": "^3.2.5",

packages/subgraph-service/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
"hardhat": "^2.22.18",
5757
"hardhat-contract-sizer": "^2.10.0",
5858
"hardhat-gas-reporter": "^1.0.8",
59-
"hardhat-graph-protocol": "workspace:^0.1.13",
59+
"hardhat-graph-protocol": "workspace:^0.1.15",
6060
"hardhat-secure-accounts": "^1.0.5",
6161
"json5": "^2.2.3",
6262
"lint-staged": "^15.2.2",

packages/toolshed/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# @graphprotocol/toolshed
22

3+
## 0.4.2
4+
5+
### Patch Changes
6+
7+
- Ensure all contracts are not wrapped when using connect shortcuts
8+
- @graphprotocol/horizon@0.3.2
9+
- @graphprotocol/subgraph-service@0.3.4
10+
11+
## 0.4.1
12+
13+
### Patch Changes
14+
15+
- Build before publishing
16+
- @graphprotocol/horizon@0.3.2
17+
- @graphprotocol/subgraph-service@0.3.4
18+
319
## 0.4.0
420

521
### Minor Changes

packages/toolshed/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@graphprotocol/toolshed",
3-
"version": "0.4.0",
3+
"version": "0.4.2",
44
"publishConfig": {
55
"access": "public"
66
},
@@ -29,6 +29,7 @@
2929
},
3030
"scripts": {
3131
"build": "tsc",
32+
"prepublishOnly": "tsc",
3233
"lint": "eslint '**/*.{js,ts}' --fix",
3334
"clean": "rm -rf dist"
3435
},

packages/toolshed/src/deployments/horizon/address-book.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,9 @@ export class GraphHorizonAddressBook extends AddressBook<number, GraphHorizonCon
4141
),
4242
signerOrProvider,
4343
)
44-
contracts.HorizonStaking = wrapTransactionCalls(stakingOverride, 'HorizonStaking')
44+
contracts.HorizonStaking = enableTxLogging
45+
? wrapTransactionCalls(stakingOverride, 'HorizonStaking')
46+
: stakingOverride
4547
}
4648

4749
this._assertGraphHorizonContracts(contracts)
@@ -52,11 +54,16 @@ export class GraphHorizonAddressBook extends AddressBook<number, GraphHorizonCon
5254
contracts.Curation = contracts.L2Curation
5355
if (contracts.HorizonStaking) {
5456
// add LegacyStaking alias using old IL2Staking abi
55-
contracts.LegacyStaking = wrapTransactionCalls(new Contract(
57+
const contract = new Contract(
5658
contracts.HorizonStaking.target,
5759
loadArtifact('IL2Staking', GraphHorizonArtifactsMap.LegacyStaking).abi,
5860
signerOrProvider,
59-
), 'LegacyStaking') as unknown as LegacyStaking
61+
)
62+
contracts.LegacyStaking = (
63+
enableTxLogging
64+
? wrapTransactionCalls(contract, 'LegacyStaking')
65+
: contract
66+
) as unknown as LegacyStaking
6067
}
6168

6269
return contracts

packages/toolshed/src/deployments/subgraph-service/address-book.ts

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Contract } from 'ethers'
77
import { loadArtifact } from '../artifact'
88
import { wrapTransactionCalls } from '../tx-logging'
99

10+
import type { LegacyDisputeManager, LegacyServiceRegistry } from './types'
1011
import type { SubgraphServiceContractName, SubgraphServiceContracts } from './contracts'
11-
import { LegacyDisputeManager, LegacyServiceRegistry } from './types'
1212

1313
export class SubgraphServiceAddressBook extends AddressBook<number, SubgraphServiceContractName> {
1414
isContractName(name: unknown): name is SubgraphServiceContractName {
@@ -44,21 +44,31 @@ export class SubgraphServiceAddressBook extends AddressBook<number, SubgraphServ
4444
// Load LegacyDisputeManager manually
4545
if (this.entryExists('LegacyDisputeManager')) {
4646
const entry = this.getEntry('LegacyDisputeManager')
47-
contractsWithAliases.LegacyDisputeManager = wrapTransactionCalls(new Contract(
47+
const contract = new Contract(
4848
entry.address,
4949
loadArtifact('IDisputeManager', SubgraphServiceArtifactsMap.LegacyDisputeManager).abi,
5050
signerOrProvider,
51-
), 'LegacyDisputeManager') as unknown as LegacyDisputeManager
51+
)
52+
contractsWithAliases.LegacyDisputeManager = (
53+
enableTxLogging
54+
? wrapTransactionCalls(contract, 'LegacyDisputeManager')
55+
: contract
56+
) as unknown as LegacyDisputeManager
5257
}
5358

5459
// Load ServiceRegistry manually
5560
if (this.entryExists('LegacyServiceRegistry')) {
5661
const entry = this.getEntry('LegacyServiceRegistry')
57-
contractsWithAliases.LegacyServiceRegistry = wrapTransactionCalls(new Contract(
62+
const contract = new Contract(
5863
entry.address,
5964
loadArtifact('IServiceRegistry', SubgraphServiceArtifactsMap.LegacyServiceRegistry).abi,
6065
signerOrProvider,
61-
), 'LegacyServiceRegistry') as unknown as LegacyServiceRegistry
66+
)
67+
contractsWithAliases.LegacyServiceRegistry = (
68+
enableTxLogging
69+
? wrapTransactionCalls(contract, 'LegacyServiceRegistry')
70+
: contract
71+
) as unknown as LegacyServiceRegistry
6272
}
6373

6474
this._assertSubgraphServiceContracts(contractsWithAliases)

0 commit comments

Comments
 (0)