Skip to content

Commit a8de78d

Browse files
authored
Fix getStandaloneSigner is not defined (#2952)
1 parent 20468b7 commit a8de78d

1 file changed

Lines changed: 9 additions & 34 deletions

File tree

contracts/utils/signers.js

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,18 @@
11
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");
94

105
const log = require("./logger")("utils:signers");
116

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();
3112
}
3213

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();
4116
}
4217

4318
/**

0 commit comments

Comments
 (0)