@aztec/ethereum 0.0.0-test.1 → 0.0.1-commit.1142ef1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/dest/account.d.ts +2 -0
  2. package/dest/account.d.ts.map +1 -0
  3. package/dest/account.js +4 -0
  4. package/dest/chain.d.ts +1 -1
  5. package/dest/client.d.ts +6 -4
  6. package/dest/client.d.ts.map +1 -1
  7. package/dest/client.js +21 -3
  8. package/dest/config.d.ts +74 -16
  9. package/dest/config.d.ts.map +1 -1
  10. package/dest/config.js +144 -22
  11. package/dest/constants.d.ts +1 -1
  12. package/dest/contracts/empire_base.d.ts +25 -8
  13. package/dest/contracts/empire_base.d.ts.map +1 -1
  14. package/dest/contracts/empire_base.js +75 -2
  15. package/dest/contracts/empire_slashing_proposer.d.ts +67 -0
  16. package/dest/contracts/empire_slashing_proposer.d.ts.map +1 -0
  17. package/dest/contracts/empire_slashing_proposer.js +209 -0
  18. package/dest/contracts/errors.d.ts +7 -0
  19. package/dest/contracts/errors.d.ts.map +1 -0
  20. package/dest/contracts/errors.js +12 -0
  21. package/dest/contracts/fee_asset_handler.d.ts +20 -0
  22. package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
  23. package/dest/contracts/fee_asset_handler.js +57 -0
  24. package/dest/contracts/fee_juice.d.ts +6 -7
  25. package/dest/contracts/fee_juice.d.ts.map +1 -1
  26. package/dest/contracts/fee_juice.js +27 -20
  27. package/dest/contracts/governance.d.ts +43 -32
  28. package/dest/contracts/governance.d.ts.map +1 -1
  29. package/dest/contracts/governance.js +87 -84
  30. package/dest/contracts/governance_proposer.d.ts +17 -13
  31. package/dest/contracts/governance_proposer.d.ts.map +1 -1
  32. package/dest/contracts/governance_proposer.js +428 -25
  33. package/dest/contracts/gse.d.ts +32 -0
  34. package/dest/contracts/gse.d.ts.map +1 -0
  35. package/dest/contracts/gse.js +72 -0
  36. package/dest/contracts/inbox.d.ts +30 -0
  37. package/dest/contracts/inbox.d.ts.map +1 -0
  38. package/dest/contracts/inbox.js +49 -0
  39. package/dest/contracts/index.d.ts +10 -3
  40. package/dest/contracts/index.d.ts.map +1 -1
  41. package/dest/contracts/index.js +9 -2
  42. package/dest/contracts/multicall.d.ts +21 -0
  43. package/dest/contracts/multicall.d.ts.map +1 -0
  44. package/dest/contracts/multicall.js +156 -0
  45. package/dest/contracts/outbox.d.ts +41 -0
  46. package/dest/contracts/outbox.d.ts.map +1 -0
  47. package/dest/contracts/outbox.js +86 -0
  48. package/dest/contracts/registry.d.ts +10 -5
  49. package/dest/contracts/registry.d.ts.map +1 -1
  50. package/dest/contracts/registry.js +44 -16
  51. package/dest/contracts/rollup.d.ts +266 -53
  52. package/dest/contracts/rollup.d.ts.map +1 -1
  53. package/dest/contracts/rollup.js +1059 -116
  54. package/dest/contracts/slasher_contract.d.ts +44 -0
  55. package/dest/contracts/slasher_contract.d.ts.map +1 -0
  56. package/dest/contracts/slasher_contract.js +75 -0
  57. package/dest/contracts/tally_slashing_proposer.d.ts +140 -0
  58. package/dest/contracts/tally_slashing_proposer.d.ts.map +1 -0
  59. package/dest/contracts/tally_slashing_proposer.js +313 -0
  60. package/dest/contracts/utils.d.ts +3 -0
  61. package/dest/contracts/utils.d.ts.map +1 -0
  62. package/dest/contracts/utils.js +11 -0
  63. package/dest/deploy_aztec_l1_contracts.d.ts +255 -0
  64. package/dest/deploy_aztec_l1_contracts.d.ts.map +1 -0
  65. package/dest/deploy_aztec_l1_contracts.js +385 -0
  66. package/dest/deploy_l1_contract.d.ts +68 -0
  67. package/dest/deploy_l1_contract.d.ts.map +1 -0
  68. package/dest/deploy_l1_contract.js +312 -0
  69. package/dest/eth-signer/eth-signer.d.ts +21 -0
  70. package/dest/eth-signer/eth-signer.d.ts.map +1 -0
  71. package/dest/eth-signer/eth-signer.js +5 -0
  72. package/dest/eth-signer/index.d.ts +2 -0
  73. package/dest/eth-signer/index.d.ts.map +1 -0
  74. package/dest/eth-signer/index.js +1 -0
  75. package/dest/forwarder_proxy.d.ts +32 -0
  76. package/dest/forwarder_proxy.d.ts.map +1 -0
  77. package/dest/forwarder_proxy.js +93 -0
  78. package/dest/l1_artifacts.d.ts +79812 -0
  79. package/dest/l1_artifacts.d.ts.map +1 -0
  80. package/dest/l1_artifacts.js +166 -0
  81. package/dest/l1_contract_addresses.d.ts +24 -4
  82. package/dest/l1_contract_addresses.d.ts.map +1 -1
  83. package/dest/l1_contract_addresses.js +25 -21
  84. package/dest/l1_reader.d.ts +4 -2
  85. package/dest/l1_reader.d.ts.map +1 -1
  86. package/dest/l1_reader.js +14 -8
  87. package/dest/l1_tx_utils/config.d.ts +59 -0
  88. package/dest/l1_tx_utils/config.d.ts.map +1 -0
  89. package/dest/l1_tx_utils/config.js +96 -0
  90. package/dest/l1_tx_utils/constants.d.ts +12 -0
  91. package/dest/l1_tx_utils/constants.d.ts.map +1 -0
  92. package/dest/l1_tx_utils/constants.js +39 -0
  93. package/dest/l1_tx_utils/factory.d.ts +24 -0
  94. package/dest/l1_tx_utils/factory.d.ts.map +1 -0
  95. package/dest/l1_tx_utils/factory.js +12 -0
  96. package/dest/l1_tx_utils/fee-strategies/index.d.ts +10 -0
  97. package/dest/l1_tx_utils/fee-strategies/index.d.ts.map +1 -0
  98. package/dest/l1_tx_utils/fee-strategies/index.js +12 -0
  99. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts +8 -0
  100. package/dest/l1_tx_utils/fee-strategies/p75_competitive.d.ts.map +1 -0
  101. package/dest/l1_tx_utils/fee-strategies/p75_competitive.js +129 -0
  102. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts +23 -0
  103. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.d.ts.map +1 -0
  104. package/dest/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.js +191 -0
  105. package/dest/l1_tx_utils/fee-strategies/types.d.ts +51 -0
  106. package/dest/l1_tx_utils/fee-strategies/types.d.ts.map +1 -0
  107. package/dest/l1_tx_utils/fee-strategies/types.js +3 -0
  108. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts +41 -0
  109. package/dest/l1_tx_utils/forwarder_l1_tx_utils.d.ts.map +1 -0
  110. package/dest/l1_tx_utils/forwarder_l1_tx_utils.js +48 -0
  111. package/dest/l1_tx_utils/index-blobs.d.ts +3 -0
  112. package/dest/l1_tx_utils/index-blobs.d.ts.map +1 -0
  113. package/dest/l1_tx_utils/index-blobs.js +2 -0
  114. package/dest/l1_tx_utils/index.d.ts +12 -0
  115. package/dest/l1_tx_utils/index.d.ts.map +1 -0
  116. package/dest/l1_tx_utils/index.js +12 -0
  117. package/dest/l1_tx_utils/interfaces.d.ts +76 -0
  118. package/dest/l1_tx_utils/interfaces.d.ts.map +1 -0
  119. package/dest/l1_tx_utils/interfaces.js +4 -0
  120. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts +233 -0
  121. package/dest/l1_tx_utils/l1_fee_analyzer.d.ts.map +1 -0
  122. package/dest/l1_tx_utils/l1_fee_analyzer.js +506 -0
  123. package/dest/l1_tx_utils/l1_tx_utils.d.ts +94 -0
  124. package/dest/l1_tx_utils/l1_tx_utils.d.ts.map +1 -0
  125. package/dest/l1_tx_utils/l1_tx_utils.js +623 -0
  126. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts +26 -0
  127. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.d.ts.map +1 -0
  128. package/dest/l1_tx_utils/l1_tx_utils_with_blobs.js +26 -0
  129. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts +83 -0
  130. package/dest/l1_tx_utils/readonly_l1_tx_utils.d.ts.map +1 -0
  131. package/dest/l1_tx_utils/readonly_l1_tx_utils.js +323 -0
  132. package/dest/l1_tx_utils/signer.d.ts +4 -0
  133. package/dest/l1_tx_utils/signer.d.ts.map +1 -0
  134. package/dest/l1_tx_utils/signer.js +16 -0
  135. package/dest/l1_tx_utils/types.d.ts +67 -0
  136. package/dest/l1_tx_utils/types.d.ts.map +1 -0
  137. package/dest/l1_tx_utils/types.js +26 -0
  138. package/dest/l1_tx_utils/utils.d.ts +4 -0
  139. package/dest/l1_tx_utils/utils.d.ts.map +1 -0
  140. package/dest/l1_tx_utils/utils.js +14 -0
  141. package/dest/l1_types.d.ts +6 -0
  142. package/dest/l1_types.d.ts.map +1 -0
  143. package/dest/l1_types.js +1 -0
  144. package/dest/publisher_manager.d.ts +15 -0
  145. package/dest/publisher_manager.d.ts.map +1 -0
  146. package/dest/publisher_manager.js +88 -0
  147. package/dest/queries.d.ts +4 -2
  148. package/dest/queries.d.ts.map +1 -1
  149. package/dest/queries.js +58 -12
  150. package/dest/test/chain_monitor.d.ts +75 -0
  151. package/dest/test/chain_monitor.d.ts.map +1 -0
  152. package/dest/test/chain_monitor.js +213 -0
  153. package/dest/test/delayed_tx_utils.d.ts +8 -3
  154. package/dest/test/delayed_tx_utils.d.ts.map +1 -1
  155. package/dest/test/delayed_tx_utils.js +13 -6
  156. package/dest/test/eth_cheat_codes.d.ts +217 -0
  157. package/dest/test/eth_cheat_codes.d.ts.map +1 -0
  158. package/dest/test/eth_cheat_codes.js +560 -0
  159. package/dest/test/eth_cheat_codes_with_state.d.ts +2 -2
  160. package/dest/test/eth_cheat_codes_with_state.d.ts.map +1 -1
  161. package/dest/test/eth_cheat_codes_with_state.js +1 -1
  162. package/dest/test/index.d.ts +4 -1
  163. package/dest/test/index.d.ts.map +1 -1
  164. package/dest/test/index.js +3 -0
  165. package/dest/test/rollup_cheat_codes.d.ts +88 -0
  166. package/dest/test/rollup_cheat_codes.d.ts.map +1 -0
  167. package/dest/test/rollup_cheat_codes.js +283 -0
  168. package/dest/test/start_anvil.d.ts +9 -1
  169. package/dest/test/start_anvil.d.ts.map +1 -1
  170. package/dest/test/start_anvil.js +16 -7
  171. package/dest/test/tx_delayer.d.ts +18 -7
  172. package/dest/test/tx_delayer.d.ts.map +1 -1
  173. package/dest/test/tx_delayer.js +97 -20
  174. package/dest/test/upgrade_utils.d.ts +6 -5
  175. package/dest/test/upgrade_utils.d.ts.map +1 -1
  176. package/dest/test/upgrade_utils.js +23 -16
  177. package/dest/types.d.ts +62 -8
  178. package/dest/types.d.ts.map +1 -1
  179. package/dest/types.js +3 -1
  180. package/dest/utils.d.ts +16 -3
  181. package/dest/utils.d.ts.map +1 -1
  182. package/dest/utils.js +61 -88
  183. package/dest/zkPassportVerifierAddress.d.ts +15 -0
  184. package/dest/zkPassportVerifierAddress.d.ts.map +1 -0
  185. package/dest/zkPassportVerifierAddress.js +11 -0
  186. package/package.json +50 -23
  187. package/src/account.ts +5 -0
  188. package/src/client.ts +43 -5
  189. package/src/config.ts +196 -31
  190. package/src/contracts/empire_base.ts +77 -7
  191. package/src/contracts/empire_slashing_proposer.ts +270 -0
  192. package/src/contracts/errors.ts +13 -0
  193. package/src/contracts/fee_asset_handler.ts +64 -0
  194. package/src/contracts/fee_juice.ts +29 -15
  195. package/src/contracts/governance.ts +80 -77
  196. package/src/contracts/governance_proposer.ts +71 -24
  197. package/src/contracts/gse.ts +88 -0
  198. package/src/contracts/inbox.ts +68 -0
  199. package/src/contracts/index.ts +9 -2
  200. package/src/contracts/multicall.ts +155 -0
  201. package/src/contracts/outbox.ts +98 -0
  202. package/src/contracts/registry.ts +51 -26
  203. package/src/contracts/rollup.ts +784 -90
  204. package/src/contracts/slasher_contract.ts +89 -0
  205. package/src/contracts/tally_slashing_proposer.ts +318 -0
  206. package/src/contracts/utils.ts +14 -0
  207. package/src/deploy_aztec_l1_contracts.ts +605 -0
  208. package/src/deploy_l1_contract.ts +362 -0
  209. package/src/eth-signer/eth-signer.ts +25 -0
  210. package/src/eth-signer/index.ts +1 -0
  211. package/src/forwarder_proxy.ts +108 -0
  212. package/src/l1_artifacts.ts +254 -0
  213. package/src/l1_contract_addresses.ts +49 -34
  214. package/src/l1_reader.ts +17 -9
  215. package/src/l1_tx_utils/README.md +177 -0
  216. package/src/l1_tx_utils/config.ts +161 -0
  217. package/src/l1_tx_utils/constants.ts +29 -0
  218. package/src/l1_tx_utils/factory.ts +64 -0
  219. package/src/l1_tx_utils/fee-strategies/index.ts +22 -0
  220. package/src/l1_tx_utils/fee-strategies/p75_competitive.ts +163 -0
  221. package/src/l1_tx_utils/fee-strategies/p75_competitive_blob_txs_only.ts +245 -0
  222. package/src/l1_tx_utils/fee-strategies/types.ts +56 -0
  223. package/src/l1_tx_utils/forwarder_l1_tx_utils.ts +119 -0
  224. package/src/l1_tx_utils/index-blobs.ts +2 -0
  225. package/src/l1_tx_utils/index.ts +14 -0
  226. package/src/l1_tx_utils/interfaces.ts +86 -0
  227. package/src/l1_tx_utils/l1_fee_analyzer.ts +803 -0
  228. package/src/l1_tx_utils/l1_tx_utils.ts +738 -0
  229. package/src/l1_tx_utils/l1_tx_utils_with_blobs.ts +77 -0
  230. package/src/l1_tx_utils/readonly_l1_tx_utils.ts +419 -0
  231. package/src/l1_tx_utils/signer.ts +28 -0
  232. package/src/l1_tx_utils/types.ts +85 -0
  233. package/src/l1_tx_utils/utils.ts +16 -0
  234. package/src/l1_types.ts +6 -0
  235. package/src/publisher_manager.ts +106 -0
  236. package/src/queries.ts +79 -15
  237. package/src/test/chain_monitor.ts +245 -0
  238. package/src/test/delayed_tx_utils.ts +34 -6
  239. package/src/test/eth_cheat_codes.ts +588 -0
  240. package/src/test/eth_cheat_codes_with_state.ts +1 -1
  241. package/src/test/index.ts +3 -0
  242. package/src/test/rollup_cheat_codes.ts +321 -0
  243. package/src/test/start_anvil.ts +24 -5
  244. package/src/test/tx_delayer.ts +130 -27
  245. package/src/test/upgrade_utils.ts +30 -21
  246. package/src/types.ts +71 -7
  247. package/src/utils.ts +79 -91
  248. package/src/zkPassportVerifierAddress.ts +15 -0
  249. package/dest/contracts/forwarder.d.ts +0 -24
  250. package/dest/contracts/forwarder.d.ts.map +0 -1
  251. package/dest/contracts/forwarder.js +0 -101
  252. package/dest/contracts/slashing_proposer.d.ts +0 -21
  253. package/dest/contracts/slashing_proposer.d.ts.map +0 -1
  254. package/dest/contracts/slashing_proposer.js +0 -47
  255. package/dest/deploy_l1_contracts.d.ts +0 -21210
  256. package/dest/deploy_l1_contracts.d.ts.map +0 -1
  257. package/dest/deploy_l1_contracts.js +0 -687
  258. package/dest/eth_cheat_codes.d.ts +0 -147
  259. package/dest/eth_cheat_codes.d.ts.map +0 -1
  260. package/dest/eth_cheat_codes.js +0 -303
  261. package/dest/index.d.ts +0 -14
  262. package/dest/index.d.ts.map +0 -1
  263. package/dest/index.js +0 -13
  264. package/dest/l1_tx_utils.d.ts +0 -192
  265. package/dest/l1_tx_utils.d.ts.map +0 -1
  266. package/dest/l1_tx_utils.js +0 -641
  267. package/dest/l1_tx_utils_with_blobs.d.ts +0 -12
  268. package/dest/l1_tx_utils_with_blobs.d.ts.map +0 -1
  269. package/dest/l1_tx_utils_with_blobs.js +0 -64
  270. package/src/contracts/forwarder.ts +0 -132
  271. package/src/contracts/slashing_proposer.ts +0 -51
  272. package/src/deploy_l1_contracts.ts +0 -948
  273. package/src/eth_cheat_codes.ts +0 -314
  274. package/src/index.ts +0 -13
  275. package/src/l1_tx_utils.ts +0 -847
  276. package/src/l1_tx_utils_with_blobs.ts +0 -86
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zkPassportVerifierAddress.d.ts","sourceRoot":"","sources":["../src/zkPassportVerifierAddress.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAE3D;;;GAGG;AACH,eAAO,MAAM,4BAA4B,YAAsE,CAAC;AAChH;;GAEG;AACH,eAAO,MAAM,kBAAkB,0BAA0B,CAAC;AAC1D;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAe,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { EthAddress } from '@aztec/foundation/eth-address';
2
+ /**
3
+ * The address of the zk passport verifier on sepolia
4
+ * get address from: ROOT/l1-contracts/lib/circuits/src/solidity/deployments/deployment-11155111.json
5
+ */ export const ZK_PASSPORT_VERIFIER_ADDRESS = EthAddress.fromString('0x3101Bad9eA5fACadA5554844a1a88F7Fe48D4DE0');
6
+ /**
7
+ * The default domain of the zk passport site
8
+ */ export const ZK_PASSPORT_DOMAIN = 'testnet.aztec.network';
9
+ /**
10
+ * The default scope of the zk passport proofs
11
+ */ export const ZK_PASSPORT_SCOPE = 'personhood';
package/package.json CHANGED
@@ -1,15 +1,32 @@
1
1
  {
2
2
  "name": "@aztec/ethereum",
3
- "version": "0.0.0-test.1",
3
+ "version": "0.0.1-commit.1142ef1",
4
4
  "type": "module",
5
5
  "exports": {
6
- ".": "./dest/index.js",
7
- "./eth-cheatcodes": "./dest/eth_cheat_codes.js",
8
- "./test": "./dest/test/index.js",
6
+ "./account": "./dest/account.js",
7
+ "./chain": "./dest/chain.js",
8
+ "./client": "./dest/client.js",
9
+ "./config": "./dest/config.js",
10
+ "./constants": "./dest/constants.js",
9
11
  "./contracts": "./dest/contracts/index.js",
10
- "./deploy-l1-contracts": "./dest/deploy_l1_contracts.js",
12
+ "./deploy-aztec-l1-contracts": "./dest/deploy_aztec_l1_contracts.js",
13
+ "./deploy-l1-contract": "./dest/deploy_l1_contract.js",
14
+ "./contracts/registry": "./dest/contracts/registry.js",
15
+ "./contracts/rollup": "./dest/contracts/rollup.js",
16
+ "./eth-signer": "./dest/eth-signer/index.js",
17
+ "./forwarder-proxy": "./dest/forwarder_proxy.js",
18
+ "./l1-artifacts": "./dest/l1_artifacts.js",
11
19
  "./l1-contract-addresses": "./dest/l1_contract_addresses.js",
12
- "./l1-tx-utils-with-blobs": "./dest/l1_tx_utils_with_blobs.js",
20
+ "./l1-fee-analysis": "./dest/l1_tx_utils/l1_fee_analyzer.js",
21
+ "./l1-reader": "./dest/l1_reader.js",
22
+ "./l1-tx-utils": "./dest/l1_tx_utils/index.js",
23
+ "./l1-tx-utils-with-blobs": "./dest/l1_tx_utils/index-blobs.js",
24
+ "./l1-tx-utils/config": "./dest/l1_tx_utils/config.js",
25
+ "./l1-types": "./dest/l1_types.js",
26
+ "./publisher-manager": "./dest/publisher_manager.js",
27
+ "./queries": "./dest/queries.js",
28
+ "./test": "./dest/test/index.js",
29
+ "./types": "./dest/types.js",
13
30
  "./utils": "./dest/utils.js"
14
31
  },
15
32
  "typedocOptions": {
@@ -20,45 +37,51 @@
20
37
  "tsconfig": "./tsconfig.json"
21
38
  },
22
39
  "scripts": {
23
- "build": "yarn clean && tsc -b",
24
- "build:dev": "tsc -b --watch",
40
+ "build": "yarn clean && ../scripts/tsc.sh",
41
+ "build:dev": "../scripts/tsc.sh --watch",
25
42
  "clean": "rm -rf ./dest .tsbuildinfo",
26
- "formatting": "run -T prettier --check ./src && run -T eslint ./src",
27
- "formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
28
- "start:dev": "tsc-watch -p tsconfig.json --onSuccess 'yarn start'",
43
+ "start:dev": "concurrently -k \"tsgo -b -w\" \"nodemon --watch dest --exec yarn start\"",
29
44
  "start": "node ./dest/index.js",
30
- "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
45
+ "test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}",
46
+ "proposer-address": "node ./dest/cli/forwarder_address.js"
31
47
  },
32
48
  "inherits": [
33
49
  "../package.common.json"
34
50
  ],
35
51
  "dependencies": {
36
- "@aztec/blob-lib": "0.0.0-test.1",
37
- "@aztec/foundation": "0.0.0-test.1",
38
- "@aztec/l1-artifacts": "0.0.0-test.1",
52
+ "@aztec/blob-lib": "0.0.1-commit.1142ef1",
53
+ "@aztec/constants": "0.0.1-commit.1142ef1",
54
+ "@aztec/foundation": "0.0.1-commit.1142ef1",
55
+ "@aztec/l1-artifacts": "0.0.1-commit.1142ef1",
39
56
  "@viem/anvil": "^0.0.10",
40
57
  "dotenv": "^16.0.3",
58
+ "lodash.chunk": "^4.2.0",
59
+ "lodash.pickby": "^4.5.0",
41
60
  "tslib": "^2.4.0",
42
- "viem": "2.22.8",
61
+ "viem": "npm:@aztec/viem@2.38.2",
43
62
  "zod": "^3.23.8"
44
63
  },
45
64
  "devDependencies": {
46
- "@jest/globals": "^29.5.0",
47
- "@types/jest": "^29.5.0",
48
- "@types/node": "^18.14.6",
65
+ "@jest/globals": "^30.0.0",
66
+ "@noble/curves": "=1.7.0",
67
+ "@types/jest": "^30.0.0",
68
+ "@types/lodash.pickby": "^4",
69
+ "@types/node": "^22.15.17",
70
+ "@typescript/native-preview": "7.0.0-dev.20251126.1",
49
71
  "@viem/anvil": "^0.0.10",
50
72
  "get-port": "^7.1.0",
51
- "jest": "^29.5.0",
73
+ "jest": "^30.0.0",
74
+ "jest-mock-extended": "^4.0.0",
52
75
  "lodash.omit": "^4.5.0",
53
76
  "ts-node": "^10.9.1",
54
- "typescript": "^5.0.4"
77
+ "typescript": "^5.3.3"
55
78
  },
56
79
  "files": [
57
80
  "dest",
58
81
  "src",
59
82
  "!*.test.*"
60
83
  ],
61
- "types": "./dest/index.d.ts",
84
+ "types": "./dest/types.d.ts",
62
85
  "jest": {
63
86
  "moduleNameMapper": {
64
87
  "^(\\.{1,2}/.*)\\.[cm]?js$": "$1"
@@ -90,9 +113,13 @@
90
113
  "testTimeout": 120000,
91
114
  "setupFiles": [
92
115
  "../../foundation/src/jest/setup.mjs"
116
+ ],
117
+ "testEnvironment": "../../foundation/src/jest/env.mjs",
118
+ "setupFilesAfterEnv": [
119
+ "../../foundation/src/jest/setupAfterEnv.mjs"
93
120
  ]
94
121
  },
95
122
  "engines": {
96
- "node": ">=18"
123
+ "node": ">=20.10"
97
124
  }
98
125
  }
package/src/account.ts ADDED
@@ -0,0 +1,5 @@
1
+ import { privateKeyToAccount } from 'viem/accounts';
2
+
3
+ export function getAddressFromPrivateKey(privateKey: `0x${string}`): `0x${string}` {
4
+ return privateKeyToAccount(privateKey).address;
5
+ }
package/src/client.ts CHANGED
@@ -1,13 +1,25 @@
1
1
  import type { Logger } from '@aztec/foundation/log';
2
2
  import { retryUntil } from '@aztec/foundation/retry';
3
3
 
4
- import { createPublicClient, fallback, http } from 'viem';
4
+ import {
5
+ type Chain,
6
+ type HDAccount,
7
+ type LocalAccount,
8
+ type PrivateKeyAccount,
9
+ createPublicClient,
10
+ createWalletClient,
11
+ fallback,
12
+ http,
13
+ publicActions,
14
+ } from 'viem';
15
+ import { mnemonicToAccount, privateKeyToAccount } from 'viem/accounts';
16
+ import { foundry } from 'viem/chains';
5
17
 
6
18
  import { createEthereumChain } from './chain.js';
7
- import type { ViemPublicClient } from './types.js';
19
+ import type { ExtendedViemWalletClient, ViemPublicClient } from './types.js';
8
20
 
9
21
  type Config = {
10
- /** The RPC Url of the ethereum host. */
22
+ /** List of URLs of Ethereum RPC nodes that services will connect to (comma separated). */
11
23
  l1RpcUrls: string[];
12
24
  /** The chain ID of the ethereum host. */
13
25
  l1ChainId: number;
@@ -15,6 +27,8 @@ type Config = {
15
27
  viemPollingIntervalMS?: number;
16
28
  };
17
29
 
30
+ export type { Config as EthereumClientConfig };
31
+
18
32
  // TODO: Use these methods to abstract the creation of viem clients.
19
33
 
20
34
  /** Returns a viem public client given the L1 config. */
@@ -22,7 +36,7 @@ export function getPublicClient(config: Config): ViemPublicClient {
22
36
  const chain = createEthereumChain(config.l1RpcUrls, config.l1ChainId);
23
37
  return createPublicClient({
24
38
  chain: chain.chainInfo,
25
- transport: fallback(config.l1RpcUrls.map(url => http(url))),
39
+ transport: fallback(config.l1RpcUrls.map(url => http(url, { batch: false }))),
26
40
  pollingInterval: config.viemPollingIntervalMS,
27
41
  });
28
42
  }
@@ -40,7 +54,7 @@ async function waitForRpc(client: ViemPublicClient, config: Config, logger?: Log
40
54
  let chainId = 0;
41
55
  try {
42
56
  chainId = await client.getChainId();
43
- } catch (err) {
57
+ } catch {
44
58
  logger?.warn(`Failed to connect to Ethereum node at ${config.l1RpcUrls.join(', ')}. Retrying...`);
45
59
  }
46
60
  return chainId;
@@ -56,3 +70,27 @@ async function waitForRpc(client: ViemPublicClient, config: Config, logger?: Log
56
70
  );
57
71
  }
58
72
  }
73
+
74
+ export function createExtendedL1Client(
75
+ rpcUrls: string[],
76
+ mnemonicOrPrivateKeyOrHdAccount: string | HDAccount | PrivateKeyAccount | LocalAccount,
77
+ chain: Chain = foundry,
78
+ pollingIntervalMS?: number,
79
+ addressIndex?: number,
80
+ ): ExtendedViemWalletClient {
81
+ const hdAccount =
82
+ typeof mnemonicOrPrivateKeyOrHdAccount === 'string'
83
+ ? mnemonicOrPrivateKeyOrHdAccount.startsWith('0x')
84
+ ? privateKeyToAccount(mnemonicOrPrivateKeyOrHdAccount as `0x${string}`)
85
+ : mnemonicToAccount(mnemonicOrPrivateKeyOrHdAccount, { addressIndex })
86
+ : mnemonicOrPrivateKeyOrHdAccount;
87
+
88
+ const extendedClient = createWalletClient({
89
+ account: hdAccount,
90
+ chain,
91
+ transport: fallback(rpcUrls.map(url => http(url, { batch: false }))),
92
+ pollingInterval: pollingIntervalMS,
93
+ }).extend(publicActions);
94
+
95
+ return extendedClient;
96
+ }
package/src/config.ts CHANGED
@@ -1,11 +1,23 @@
1
1
  import {
2
2
  type ConfigMappingsType,
3
+ // type NetworkNames,
3
4
  bigintConfigHelper,
5
+ booleanConfigHelper,
6
+ enumConfigHelper,
4
7
  getConfigFromMappings,
5
8
  numberConfigHelper,
9
+ optionalNumberConfigHelper,
6
10
  } from '@aztec/foundation/config';
11
+ import { EthAddress } from '@aztec/foundation/eth-address';
7
12
 
8
- import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils.js';
13
+ import { type L1TxUtilsConfig, l1TxUtilsConfigMappings } from './l1_tx_utils/config.js';
14
+
15
+ export type GenesisStateConfig = {
16
+ /** Whether to populate the genesis state with initial fee juice for the test accounts */
17
+ testAccounts: boolean;
18
+ /** Whether to populate the genesis state with initial fee juice for the sponsored FPC */
19
+ sponsoredFPC: boolean;
20
+ };
9
21
 
10
22
  export type L1ContractsConfig = {
11
23
  /** How many seconds an L1 slot lasts. */
@@ -16,31 +28,80 @@ export type L1ContractsConfig = {
16
28
  aztecEpochDuration: number;
17
29
  /** The target validator committee size. */
18
30
  aztecTargetCommitteeSize: number;
19
- /** The number of L2 slots that we can wait for a proof of an epoch to be produced. */
20
- aztecProofSubmissionWindow: number;
31
+ /** The number of epochs to lag behind the current epoch for validator selection. */
32
+ lagInEpochsForValidatorSet: number;
33
+ /** The number of epochs to lag behind the current epoch for randao selection. */
34
+ lagInEpochsForRandao: number;
35
+ /** The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks). */
36
+ inboxLag: number;
37
+ /** The number of epochs after an epoch ends that proofs are still accepted. */
38
+ aztecProofSubmissionEpochs: number;
39
+ /** The deposit amount for a validator */
40
+ activationThreshold: bigint;
21
41
  /** The minimum stake for a validator. */
22
- minimumStake: bigint;
23
- /** The slashing quorum */
24
- slashingQuorum: number;
25
- /** The slashing round size */
26
- slashingRoundSize: number;
27
- /** Governance proposing quorum */
28
- governanceProposerQuorum: number;
42
+ ejectionThreshold: bigint;
43
+ /** The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup */
44
+ localEjectionThreshold: bigint;
45
+ /** The slashing quorum, i.e. how many slots must signal for the same payload in a round for it to be submittable to the Slasher (defaults to slashRoundSize / 2 + 1) */
46
+ slashingQuorum?: number;
47
+ /** The slashing round size, i.e. how many epochs are in a slashing round */
48
+ slashingRoundSizeInEpochs: number;
49
+ /** The slashing lifetime in rounds. I.e., if 1, round N must be submitted before round N + 2 */
50
+ slashingLifetimeInRounds: number;
51
+ /** The slashing execution delay in rounds. I.e., if 1, round N may not be submitted until round N + 2 */
52
+ slashingExecutionDelayInRounds: number;
53
+ /** The slashing vetoer. May blacklist a payload from being submitted. */
54
+ slashingVetoer: EthAddress;
55
+ /** How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset) */
56
+ slashingOffsetInRounds: number;
57
+ /** How long slashing can be disabled for in seconds when vetoer disables it */
58
+ slashingDisableDuration: number;
59
+ /** Type of slasher proposer */
60
+ slasherFlavor: 'empire' | 'tally' | 'none';
61
+ /** Minimum amount that can be slashed in tally slashing */
62
+ slashAmountSmall: bigint;
63
+ /** Medium amount to slash in tally slashing */
64
+ slashAmountMedium: bigint;
65
+ /** Largest amount that can be slashed per round in tally slashing */
66
+ slashAmountLarge: bigint;
67
+ /** Governance proposing quorum (defaults to roundSize/2 + 1) */
68
+ governanceProposerQuorum?: number;
29
69
  /** Governance proposing round size */
30
70
  governanceProposerRoundSize: number;
71
+ /** The mana target for the rollup */
72
+ manaTarget: bigint;
73
+ /** The proving cost per mana */
74
+ provingCostPerMana: bigint;
75
+ /** The number of seconds to wait for an exit */
76
+ exitDelaySeconds: number;
31
77
  } & L1TxUtilsConfig;
32
78
 
33
79
  export const DefaultL1ContractsConfig = {
34
80
  ethereumSlotDuration: 12,
35
- aztecSlotDuration: 24,
36
- aztecEpochDuration: 16,
81
+ aztecSlotDuration: 36,
82
+ aztecEpochDuration: 32,
37
83
  aztecTargetCommitteeSize: 48,
38
- aztecProofSubmissionWindow: 31, // you have a full epoch to submit a proof after the epoch to prove ends
39
- minimumStake: BigInt(100e18),
40
- slashingQuorum: 6,
41
- slashingRoundSize: 10,
42
- governanceProposerQuorum: 6,
43
- governanceProposerRoundSize: 10,
84
+ lagInEpochsForValidatorSet: 2,
85
+ lagInEpochsForRandao: 2, // For PROD, this value should be > lagInEpochsForValidatorSet
86
+ inboxLag: 1, // Default inbox lag to prevent sequencer DOS attacks
87
+ aztecProofSubmissionEpochs: 1, // you have a full epoch to submit a proof after the epoch to prove ends
88
+ activationThreshold: 100n * 10n ** 18n,
89
+ ejectionThreshold: 50n * 10n ** 18n,
90
+ localEjectionThreshold: 98n * 10n ** 18n,
91
+ slashAmountSmall: 10n * 10n ** 18n,
92
+ slashAmountMedium: 20n * 10n ** 18n,
93
+ slashAmountLarge: 50n * 10n ** 18n,
94
+ slashingRoundSizeInEpochs: 4,
95
+ slashingLifetimeInRounds: 5,
96
+ slashingExecutionDelayInRounds: 0, // round N may be submitted in round N + 1
97
+ slashingVetoer: EthAddress.ZERO,
98
+ governanceProposerRoundSize: 300,
99
+ manaTarget: BigInt(100e6),
100
+ provingCostPerMana: BigInt(100),
101
+ exitDelaySeconds: 2 * 24 * 60 * 60,
102
+ slasherFlavor: 'tally' as const,
103
+ slashingOffsetInRounds: 2,
104
+ slashingDisableDuration: 5 * 24 * 60 * 60, // 5 days in seconds
44
105
  } satisfies L1ContractsConfig;
45
106
 
46
107
  export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> = {
@@ -64,40 +125,144 @@ export const l1ContractsConfigMappings: ConfigMappingsType<L1ContractsConfig> =
64
125
  description: 'The target validator committee size.',
65
126
  ...numberConfigHelper(DefaultL1ContractsConfig.aztecTargetCommitteeSize),
66
127
  },
67
- aztecProofSubmissionWindow: {
68
- env: 'AZTEC_PROOF_SUBMISSION_WINDOW',
69
- description:
70
- 'The number of L2 slots that a proof for an epoch can be submitted in, starting from the beginning of the epoch.',
71
- ...numberConfigHelper(DefaultL1ContractsConfig.aztecProofSubmissionWindow),
128
+ lagInEpochsForValidatorSet: {
129
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_VALIDATOR_SET',
130
+ description: 'The number of epochs to lag behind the current epoch for validator selection.',
131
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForValidatorSet),
132
+ },
133
+ lagInEpochsForRandao: {
134
+ env: 'AZTEC_LAG_IN_EPOCHS_FOR_RANDAO',
135
+ description: 'The number of epochs to lag behind the current epoch for randao selection.',
136
+ ...numberConfigHelper(DefaultL1ContractsConfig.lagInEpochsForRandao),
137
+ },
138
+ inboxLag: {
139
+ env: 'AZTEC_INBOX_LAG',
140
+ description: 'The number of checkpoints to lag in the inbox (prevents sequencer DOS attacks).',
141
+ ...numberConfigHelper(DefaultL1ContractsConfig.inboxLag),
142
+ },
143
+ aztecProofSubmissionEpochs: {
144
+ env: 'AZTEC_PROOF_SUBMISSION_EPOCHS',
145
+ description: 'The number of epochs after an epoch ends that proofs are still accepted.',
146
+ ...numberConfigHelper(DefaultL1ContractsConfig.aztecProofSubmissionEpochs),
147
+ },
148
+ activationThreshold: {
149
+ env: 'AZTEC_ACTIVATION_THRESHOLD',
150
+ description: 'The deposit amount for a validator',
151
+ ...bigintConfigHelper(DefaultL1ContractsConfig.activationThreshold),
72
152
  },
73
- minimumStake: {
74
- env: 'AZTEC_MINIMUM_STAKE',
153
+ ejectionThreshold: {
154
+ env: 'AZTEC_EJECTION_THRESHOLD',
75
155
  description: 'The minimum stake for a validator.',
76
- ...bigintConfigHelper(DefaultL1ContractsConfig.minimumStake),
156
+ ...bigintConfigHelper(DefaultL1ContractsConfig.ejectionThreshold),
157
+ },
158
+ localEjectionThreshold: {
159
+ env: 'AZTEC_LOCAL_EJECTION_THRESHOLD',
160
+ description:
161
+ 'The local ejection threshold for a validator. Stricter than ejectionThreshold but local to a specific rollup',
162
+ ...bigintConfigHelper(DefaultL1ContractsConfig.localEjectionThreshold),
163
+ },
164
+ slashingOffsetInRounds: {
165
+ env: 'AZTEC_SLASHING_OFFSET_IN_ROUNDS',
166
+ description:
167
+ 'How many slashing rounds back we slash (ie when slashing in round N, we slash for offenses committed during epochs of round N-offset)',
168
+ ...numberConfigHelper(DefaultL1ContractsConfig.slashingOffsetInRounds),
169
+ },
170
+ slasherFlavor: {
171
+ env: 'AZTEC_SLASHER_FLAVOR',
172
+ description: 'Type of slasher proposer (empire, tally, or none)',
173
+ ...enumConfigHelper(['empire', 'tally', 'none'] as const, DefaultL1ContractsConfig.slasherFlavor),
174
+ },
175
+ slashAmountSmall: {
176
+ env: 'AZTEC_SLASH_AMOUNT_SMALL',
177
+ description: 'Small slashing amount for light offenses',
178
+ ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountSmall),
179
+ },
180
+ slashAmountMedium: {
181
+ env: 'AZTEC_SLASH_AMOUNT_MEDIUM',
182
+ description: 'Medium slashing amount for moderate offenses',
183
+ ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountMedium),
184
+ },
185
+ slashAmountLarge: {
186
+ env: 'AZTEC_SLASH_AMOUNT_LARGE',
187
+ description: 'Large slashing amount for severe offenses',
188
+ ...bigintConfigHelper(DefaultL1ContractsConfig.slashAmountLarge),
77
189
  },
78
190
  slashingQuorum: {
79
191
  env: 'AZTEC_SLASHING_QUORUM',
80
192
  description: 'The slashing quorum',
81
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingQuorum),
193
+ ...optionalNumberConfigHelper(),
82
194
  },
83
- slashingRoundSize: {
84
- env: 'AZTEC_SLASHING_ROUND_SIZE',
195
+ slashingRoundSizeInEpochs: {
196
+ env: 'AZTEC_SLASHING_ROUND_SIZE_IN_EPOCHS',
85
197
  description: 'The slashing round size',
86
- ...numberConfigHelper(DefaultL1ContractsConfig.slashingRoundSize),
198
+ ...numberConfigHelper(DefaultL1ContractsConfig.slashingRoundSizeInEpochs),
199
+ },
200
+ slashingLifetimeInRounds: {
201
+ env: 'AZTEC_SLASHING_LIFETIME_IN_ROUNDS',
202
+ description: 'The slashing lifetime in rounds',
203
+ ...numberConfigHelper(DefaultL1ContractsConfig.slashingLifetimeInRounds),
204
+ },
205
+ slashingExecutionDelayInRounds: {
206
+ env: 'AZTEC_SLASHING_EXECUTION_DELAY_IN_ROUNDS',
207
+ description: 'The slashing execution delay in rounds',
208
+ ...numberConfigHelper(DefaultL1ContractsConfig.slashingExecutionDelayInRounds),
209
+ },
210
+ slashingVetoer: {
211
+ env: 'AZTEC_SLASHING_VETOER',
212
+ description: 'The slashing vetoer',
213
+ parseEnv: (val: string) => EthAddress.fromString(val),
214
+ defaultValue: DefaultL1ContractsConfig.slashingVetoer,
215
+ },
216
+ slashingDisableDuration: {
217
+ env: 'AZTEC_SLASHING_DISABLE_DURATION',
218
+ description: 'How long slashing can be disabled for in seconds when vetoer disables it',
219
+ ...numberConfigHelper(DefaultL1ContractsConfig.slashingDisableDuration),
87
220
  },
88
221
  governanceProposerQuorum: {
89
222
  env: 'AZTEC_GOVERNANCE_PROPOSER_QUORUM',
90
223
  description: 'The governance proposing quorum',
91
- ...numberConfigHelper(DefaultL1ContractsConfig.governanceProposerQuorum),
224
+ ...optionalNumberConfigHelper(),
92
225
  },
93
226
  governanceProposerRoundSize: {
94
227
  env: 'AZTEC_GOVERNANCE_PROPOSER_ROUND_SIZE',
95
228
  description: 'The governance proposing round size',
96
229
  ...numberConfigHelper(DefaultL1ContractsConfig.governanceProposerRoundSize),
97
230
  },
231
+ manaTarget: {
232
+ env: 'AZTEC_MANA_TARGET',
233
+ description: 'The mana target for the rollup',
234
+ ...bigintConfigHelper(DefaultL1ContractsConfig.manaTarget),
235
+ },
236
+ provingCostPerMana: {
237
+ env: 'AZTEC_PROVING_COST_PER_MANA',
238
+ description: 'The proving cost per mana',
239
+ ...bigintConfigHelper(DefaultL1ContractsConfig.provingCostPerMana),
240
+ },
241
+ exitDelaySeconds: {
242
+ env: 'AZTEC_EXIT_DELAY_SECONDS',
243
+ description: 'The delay before a validator can exit the set',
244
+ ...numberConfigHelper(DefaultL1ContractsConfig.exitDelaySeconds),
245
+ },
98
246
  ...l1TxUtilsConfigMappings,
99
247
  };
100
248
 
249
+ export const genesisStateConfigMappings: ConfigMappingsType<GenesisStateConfig> = {
250
+ testAccounts: {
251
+ env: 'TEST_ACCOUNTS',
252
+ description: 'Whether to populate the genesis state with initial fee juice for the test accounts.',
253
+ ...booleanConfigHelper(false),
254
+ },
255
+ sponsoredFPC: {
256
+ env: 'SPONSORED_FPC',
257
+ description: 'Whether to populate the genesis state with initial fee juice for the sponsored FPC.',
258
+ ...booleanConfigHelper(false),
259
+ },
260
+ };
261
+
101
262
  export function getL1ContractsConfigEnvVars(): L1ContractsConfig {
102
263
  return getConfigFromMappings(l1ContractsConfigMappings);
103
264
  }
265
+
266
+ export function getGenesisStateConfigEnvVars(): GenesisStateConfig {
267
+ return getConfigFromMappings(genesisStateConfigMappings);
268
+ }
@@ -1,19 +1,89 @@
1
+ import type { SlotNumber } from '@aztec/foundation/branded-types';
2
+ import type { EthAddress } from '@aztec/foundation/eth-address';
3
+ import { Signature } from '@aztec/foundation/eth-signature';
1
4
  import { EmpireBaseAbi } from '@aztec/l1-artifacts/EmpireBaseAbi';
2
5
 
3
- import { type Hex, encodeFunctionData } from 'viem';
6
+ import { type Hex, type TypedDataDefinition, encodeFunctionData } from 'viem';
4
7
 
5
- import type { L1TxRequest } from '../l1_tx_utils.js';
8
+ import type { L1TxRequest } from '../l1_tx_utils/index.js';
6
9
 
7
10
  export interface IEmpireBase {
8
- getRoundInfo(rollupAddress: Hex, round: bigint): Promise<{ lastVote: bigint; leader: Hex; executed: boolean }>;
9
- computeRound(slot: bigint): Promise<bigint>;
10
- createVoteRequest(payload: Hex): L1TxRequest;
11
+ get address(): EthAddress;
12
+ getRoundInfo(
13
+ rollupAddress: Hex,
14
+ round: bigint,
15
+ ): Promise<{ lastSignalSlot: SlotNumber; payloadWithMostSignals: Hex; quorumReached: boolean; executed: boolean }>;
16
+ computeRound(slot: SlotNumber): Promise<bigint>;
17
+ createSignalRequest(payload: Hex): L1TxRequest;
18
+ createSignalRequestWithSignature(
19
+ payload: Hex,
20
+ slot: SlotNumber,
21
+ chainId: number,
22
+ signerAddress: Hex,
23
+ signer: (msg: TypedDataDefinition) => Promise<Hex>,
24
+ ): Promise<L1TxRequest>;
11
25
  }
12
26
 
13
- export function encodeVote(payload: Hex): Hex {
27
+ export function encodeSignal(payload: Hex): Hex {
14
28
  return encodeFunctionData({
15
29
  abi: EmpireBaseAbi,
16
- functionName: 'vote',
30
+ functionName: 'signal',
17
31
  args: [payload],
18
32
  });
19
33
  }
34
+
35
+ export function encodeSignalWithSignature(payload: Hex, signature: Signature) {
36
+ return encodeFunctionData({
37
+ abi: EmpireBaseAbi,
38
+ functionName: 'signalWithSig',
39
+ args: [payload, signature.toViemSignature()],
40
+ });
41
+ }
42
+
43
+ /**
44
+ * Signs a signal proposal using EIP-712 typed data for use with signalWithSig
45
+ * @param walletClient - The viem wallet client to sign with
46
+ * @param payload - The payload address to signal
47
+ * @param verifyingContract - The address of the EmpireBase contract
48
+ * @param chainId - The chain ID where the contract is deployed
49
+ * @param account - The account to sign with (optional if hoisted on wallet client)
50
+ * @returns The EIP-712 signature
51
+ */
52
+ export async function signSignalWithSig(
53
+ signer: (msg: TypedDataDefinition) => Promise<Hex>,
54
+ payload: Hex,
55
+ slot: SlotNumber,
56
+ instance: Hex,
57
+ verifyingContract: Hex,
58
+ chainId: number,
59
+ ): Promise<Signature> {
60
+ const domain = {
61
+ name: 'EmpireBase',
62
+ version: '1',
63
+ chainId,
64
+ verifyingContract,
65
+ };
66
+
67
+ const types = {
68
+ EIP712Domain: [
69
+ { name: 'name', type: 'string' },
70
+ { name: 'version', type: 'string' },
71
+ { name: 'chainId', type: 'uint256' },
72
+ { name: 'verifyingContract', type: 'address' },
73
+ ],
74
+ Signal: [
75
+ { name: 'payload', type: 'address' },
76
+ { name: 'slot', type: 'uint256' },
77
+ { name: 'instance', type: 'address' },
78
+ ],
79
+ };
80
+
81
+ const message = {
82
+ payload,
83
+ slot: BigInt(slot),
84
+ instance,
85
+ };
86
+
87
+ const typedData = { domain, types, primaryType: 'Signal', message };
88
+ return Signature.fromString(await signer(typedData));
89
+ }