|
1 | 1 | const { parseEther } = require("ethers/lib/utils"); |
2 | | -const hhHelpers = require("@nomicfoundation/hardhat-network-helpers"); |
3 | | -const { |
4 | | - getKmsAddress, |
5 | | - getKmsSigner, |
6 | | - hasAwsKmsCredentials, |
7 | | -} = require("./signersNoHardhat"); |
8 | | -const { ethereumAddress, privateKey } = require("./regex"); |
| 2 | +const { getKmsSigner } = require("./signersNoHardhat"); |
| 3 | +const { ethereumAddress } = require("./regex"); |
9 | 4 |
|
10 | 5 | const log = require("./logger")("utils:signers"); |
11 | 6 |
|
12 | | -// @oplabs/talos-client ships only in the Talos runner image, not in a plain |
13 | | -// contracts checkout (it's an optional dependency). Load it lazily so hardhat — |
14 | | -// which pulls this module in through tasks/tasks.js — boots without it. The |
15 | | -// require only fires once DATABASE_URL opts into the nonce queue. |
16 | | -let talosClient = null; |
17 | | -function talosClientLib() { |
18 | | - if (!talosClient) talosClient = require("@oplabs/talos-client"); |
19 | | - return talosClient; |
20 | | -} |
21 | | - |
22 | | -let dbInstance = null; |
23 | | -function getNonceDb() { |
24 | | - if (!process.env.DATABASE_URL) return null; |
25 | | - if (!dbInstance) { |
26 | | - const { createPool, createDb } = talosClientLib(); |
27 | | - const pool = createPool({ connectionString: process.env.DATABASE_URL }); |
28 | | - dbInstance = createDb(pool); |
29 | | - } |
30 | | - return dbInstance; |
| 7 | +// These modules are TypeScript and belong to the standalone Talos runtime. |
| 8 | +// Resolve them lazily so importing this legacy CommonJS helper still works in |
| 9 | +// Hardhat environments where the optional Talos dependencies are not installed. |
| 10 | +function getProvider() { |
| 11 | + return require("../tasks/lib/network").getProvider(); |
31 | 12 | } |
32 | 13 |
|
33 | | -// Wrap a raw signer with the nonce-queue Proxy when DATABASE_URL is set. |
34 | | -// Returning the raw signer unchanged in dev / fork flows preserves the |
35 | | -// DATABASE_URL gate invariant: no queue engagement without explicit opt-in. |
36 | | -function maybeWrap(rawSigner) { |
37 | | - const db = getNonceDb(); |
38 | | - if (!db) return rawSigner; |
39 | | - const { wrapSignerWithNonceQueueV5 } = talosClientLib(); |
40 | | - return wrapSignerWithNonceQueueV5(rawSigner, { db }); |
| 14 | +async function getStandaloneSigner() { |
| 15 | + return await require("../tasks/lib/signer").getSigner(); |
41 | 16 | } |
42 | 17 |
|
43 | 18 | /** |
|
0 commit comments