Skip to content

Commit

Permalink
feat: Integrate ZKSync Wallet for ChainTechnicalStack-Specific Transa…
Browse files Browse the repository at this point in the history
…ction Signing (#4914)

### Description

This PR integrates the zksync-ethers wallet implementation for the
ZKSync signer strategy. Key changes include:
- Added zksync-ethers dependency (v5.10.0)
- Updated ZKSyncSignerStrategy to use ZKSyncWallet instead of standard
ethers Wallet
- Removed outdated TODO comment about ZKSync signer implementation

### Drive-by changes

None

### Related issues

N/A

### Backward compatibility

Yes

### Testing

Manual testing

---------

Co-authored-by: Morteza Shojaei <[email protected]>
Co-authored-by: ljankovic-txfusion <[email protected]>
Co-authored-by: ljankovic-txfusion <[email protected]>
  • Loading branch information
4 people authored Dec 16, 2024
1 parent a2b5efb commit 8dadd52
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/ten-spiders-trade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/cli': patch
---

Added ZKSync signer support using zksync-ethers package
3 changes: 2 additions & 1 deletion typescript/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
"eslint-plugin-import": "^2.31.0",
"mocha": "^10.2.0",
"prettier": "^2.8.8",
"typescript": "5.3.3"
"typescript": "5.3.3",
"zksync-ethers": "^5.10.0"
},
"scripts": {
"hyperlane": "node ./dist/cli.js",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { password } from '@inquirer/prompts';
import { Signer, Wallet } from 'ethers';
import { Wallet as ZKSyncWallet } from 'zksync-ethers';

import {
ChainName,
Expand Down Expand Up @@ -57,7 +58,6 @@ class EthereumSignerStrategy extends BaseMultiProtocolSigner {
}

// 99% overlap with EthereumSignerStrategy for the sake of keeping MultiProtocolSignerFactory clean
// TODO: import ZKSync signer
class ZKSyncSignerStrategy extends BaseMultiProtocolSigner {
async getSignerConfig(chain: ChainName): Promise<SignerConfig> {
const submitter = this.config[chain]?.submitter as {
Expand All @@ -74,6 +74,6 @@ class ZKSyncSignerStrategy extends BaseMultiProtocolSigner {
}

getSigner(config: SignerConfig): Signer {
return new Wallet(config.privateKey);
return new ZKSyncWallet(config.privateKey);
}
}
14 changes: 13 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7351,6 +7351,7 @@ __metadata:
typescript: "npm:5.3.3"
yaml: "npm:2.4.5"
yargs: "npm:^17.7.2"
zksync-ethers: "npm:^5.10.0"
zod: "npm:^3.21.2"
zod-validation-error: "npm:^3.3.0"
zx: "npm:^8.1.4"
Expand Down Expand Up @@ -22645,7 +22646,7 @@ __metadata:
languageName: node
linkType: hard

"ethers@npm:^5.1.0, ethers@npm:^5.3.1, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2":
"ethers@npm:^5.1.0, ethers@npm:^5.3.1, ethers@npm:^5.7.0, ethers@npm:^5.7.1, ethers@npm:^5.7.2, ethers@npm:~5.7.0":
version: 5.7.2
resolution: "ethers@npm:5.7.2"
dependencies:
Expand Down Expand Up @@ -37893,6 +37894,17 @@ __metadata:
languageName: node
linkType: hard

"zksync-ethers@npm:^5.10.0":
version: 5.10.0
resolution: "zksync-ethers@npm:5.10.0"
dependencies:
ethers: "npm:~5.7.0"
peerDependencies:
ethers: ~5.7.0
checksum: 10/826719e2e40731e1104cf8a0c16c758526de6ca9e907d0483eb5bd80b635f02e3cce012115b75d68976a8dd746d63d4f83d576cc3bddc18a02a49d2bc023347f
languageName: node
linkType: hard

"zksync-web3@npm:^0.14.3":
version: 0.14.4
resolution: "zksync-web3@npm:0.14.4"
Expand Down

0 comments on commit 8dadd52

Please sign in to comment.