@nomicfoundation/hardhat-viem 2.0.6 → 3.0.0-next.1
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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +4 -16
- package/README.md +35 -247
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +10 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/internal/accounts.d.ts +4 -0
- package/dist/src/internal/accounts.d.ts.map +1 -0
- package/dist/src/internal/accounts.js +15 -0
- package/dist/src/internal/accounts.js.map +1 -0
- package/dist/src/internal/chains.d.ts +11 -0
- package/dist/src/internal/chains.d.ts.map +1 -0
- package/dist/src/internal/chains.js +116 -0
- package/dist/src/internal/chains.js.map +1 -0
- package/dist/src/internal/clients.d.ts +10 -0
- package/dist/src/internal/clients.d.ts.map +1 -0
- package/dist/src/internal/clients.js +91 -0
- package/dist/src/internal/clients.js.map +1 -0
- package/dist/src/internal/contracts.d.ts +11 -0
- package/dist/src/internal/contracts.d.ts.map +1 -0
- package/dist/src/internal/contracts.js +141 -0
- package/dist/src/internal/contracts.js.map +1 -0
- package/dist/src/internal/hook-handlers/network.d.ts +4 -0
- package/dist/src/internal/hook-handlers/network.d.ts.map +1 -0
- package/dist/src/internal/hook-handlers/network.js +12 -0
- package/dist/src/internal/hook-handlers/network.js.map +1 -0
- package/dist/src/internal/initialization.d.ts +6 -0
- package/dist/src/internal/initialization.d.ts.map +1 -0
- package/dist/src/internal/initialization.js +14 -0
- package/dist/src/internal/initialization.js.map +1 -0
- package/dist/src/type-extensions.d.ts +8 -0
- package/dist/src/type-extensions.d.ts.map +1 -0
- package/dist/src/type-extensions.js +2 -0
- package/dist/src/type-extensions.js.map +1 -0
- package/dist/src/types.d.ts +166 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +2 -0
- package/dist/src/types.js.map +1 -0
- package/package.json +46 -51
- package/src/index.ts +10 -39
- package/src/internal/accounts.ts +20 -7
- package/src/internal/chains.ts +122 -62
- package/src/internal/clients.ts +135 -141
- package/src/internal/contracts.ts +126 -150
- package/src/internal/hook-handlers/network.ts +27 -0
- package/src/internal/initialization.ts +67 -0
- package/src/type-extensions.ts +10 -0
- package/src/types.ts +237 -72
- package/.eslintrc.js +0 -24
- package/index.d.ts +0 -3
- package/index.d.ts.map +0 -1
- package/index.js +0 -20
- package/index.js.map +0 -1
- package/internal/accounts.d.ts +0 -5
- package/internal/accounts.d.ts.map +0 -1
- package/internal/accounts.js +0 -9
- package/internal/accounts.js.map +0 -1
- package/internal/bytecode.d.ts +0 -13
- package/internal/bytecode.d.ts.map +0 -1
- package/internal/bytecode.js +0 -94
- package/internal/bytecode.js.map +0 -1
- package/internal/chains.d.ts +0 -7
- package/internal/chains.d.ts.map +0 -1
- package/internal/chains.js +0 -80
- package/internal/chains.js.map +0 -1
- package/internal/clients.d.ts +0 -45
- package/internal/clients.d.ts.map +0 -1
- package/internal/clients.js +0 -136
- package/internal/clients.js.map +0 -1
- package/internal/contracts.d.ts +0 -11
- package/internal/contracts.d.ts.map +0 -1
- package/internal/contracts.js +0 -164
- package/internal/contracts.js.map +0 -1
- package/internal/errors.d.ts +0 -36
- package/internal/errors.d.ts.map +0 -1
- package/internal/errors.js +0 -102
- package/internal/errors.js.map +0 -1
- package/internal/tasks.d.ts +0 -2
- package/internal/tasks.d.ts.map +0 -1
- package/internal/tasks.js +0 -240
- package/internal/tasks.js.map +0 -1
- package/internal/type-extensions.d.ts +0 -19
- package/internal/type-extensions.d.ts.map +0 -1
- package/internal/type-extensions.js +0 -5
- package/internal/type-extensions.js.map +0 -1
- package/src/internal/bytecode.ts +0 -138
- package/src/internal/errors.ts +0 -125
- package/src/internal/tasks.ts +0 -341
- package/src/internal/type-extensions.ts +0 -27
- package/src/tsconfig.json +0 -15
- package/types.d.ts +0 -52
- package/types.d.ts.map +0 -1
- package/types.js +0 -3
- package/types.js.map +0 -1
package/src/internal/tasks.ts
DELETED
@@ -1,341 +0,0 @@
|
|
1
|
-
import type { Artifact, Artifacts } from "hardhat/types";
|
2
|
-
import type { ArtifactsEmittedPerFile } from "hardhat/types/builtin-tasks";
|
3
|
-
|
4
|
-
import { join, dirname, relative } from "path";
|
5
|
-
import { mkdir, writeFile, rm } from "fs/promises";
|
6
|
-
|
7
|
-
import { subtask } from "hardhat/config";
|
8
|
-
import {
|
9
|
-
TASK_COMPILE_SOLIDITY_EMIT_ARTIFACTS,
|
10
|
-
TASK_COMPILE_SOLIDITY,
|
11
|
-
TASK_COMPILE_REMOVE_OBSOLETE_ARTIFACTS,
|
12
|
-
} from "hardhat/builtin-tasks/task-names";
|
13
|
-
import {
|
14
|
-
getFullyQualifiedName,
|
15
|
-
parseFullyQualifiedName,
|
16
|
-
} from "hardhat/utils/contract-names";
|
17
|
-
import { getAllFilesMatching } from "hardhat/internal/util/fs-utils";
|
18
|
-
import { replaceBackslashes } from "hardhat/utils/source-names";
|
19
|
-
|
20
|
-
interface EmittedArtifacts {
|
21
|
-
artifactsEmittedPerFile: ArtifactsEmittedPerFile;
|
22
|
-
}
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Override task that generates an `artifacts.d.ts` file with `never`
|
26
|
-
* types for duplicate contract names. This file is used in conjunction with
|
27
|
-
* the `artifacts.d.ts` file inside each contract directory to type
|
28
|
-
* `hre.artifacts`.
|
29
|
-
*/
|
30
|
-
subtask(TASK_COMPILE_SOLIDITY).setAction(
|
31
|
-
async (_, { config, artifacts }, runSuper) => {
|
32
|
-
const superRes = await runSuper();
|
33
|
-
|
34
|
-
const duplicateContractNames = await findDuplicateContractNames(artifacts);
|
35
|
-
|
36
|
-
const duplicateArtifactsDTs = generateDuplicateArtifactsDefinition(
|
37
|
-
duplicateContractNames
|
38
|
-
);
|
39
|
-
|
40
|
-
try {
|
41
|
-
await writeFile(
|
42
|
-
join(config.paths.artifacts, "artifacts.d.ts"),
|
43
|
-
duplicateArtifactsDTs
|
44
|
-
);
|
45
|
-
} catch (error) {
|
46
|
-
console.error("Error writing artifacts definition:", error);
|
47
|
-
}
|
48
|
-
|
49
|
-
return superRes;
|
50
|
-
}
|
51
|
-
);
|
52
|
-
|
53
|
-
/**
|
54
|
-
* Override task to emit TypeScript and definition files for each contract.
|
55
|
-
* Generates a `.d.ts` file per contract, and a `artifacts.d.ts` per solidity
|
56
|
-
* file, which is used in conjunction to the root `artifacts.d.ts`
|
57
|
-
* to type `hre.artifacts`.
|
58
|
-
*/
|
59
|
-
subtask(TASK_COMPILE_SOLIDITY_EMIT_ARTIFACTS).setAction(
|
60
|
-
async (_, { artifacts, config }, runSuper): Promise<EmittedArtifacts> => {
|
61
|
-
const { artifactsEmittedPerFile }: EmittedArtifacts = await runSuper();
|
62
|
-
const duplicateContractNames = await findDuplicateContractNames(artifacts);
|
63
|
-
|
64
|
-
await Promise.all(
|
65
|
-
artifactsEmittedPerFile.map(async ({ file, artifactsEmitted }) => {
|
66
|
-
const srcDir = join(config.paths.artifacts, file.sourceName);
|
67
|
-
await mkdir(srcDir, {
|
68
|
-
recursive: true,
|
69
|
-
});
|
70
|
-
|
71
|
-
const contractTypeData = await Promise.all(
|
72
|
-
artifactsEmitted.map(async (contractName) => {
|
73
|
-
const fqn = getFullyQualifiedName(file.sourceName, contractName);
|
74
|
-
const artifact = await artifacts.readArtifact(fqn);
|
75
|
-
const isDuplicate = duplicateContractNames.has(contractName);
|
76
|
-
const declaration = generateContractDeclaration(
|
77
|
-
artifact,
|
78
|
-
isDuplicate
|
79
|
-
);
|
80
|
-
|
81
|
-
const typeName = `${contractName}$Type`;
|
82
|
-
|
83
|
-
return { contractName, fqn, typeName, declaration };
|
84
|
-
})
|
85
|
-
);
|
86
|
-
|
87
|
-
const fp: Array<Promise<void>> = [];
|
88
|
-
for (const { contractName, declaration } of contractTypeData) {
|
89
|
-
fp.push(writeFile(join(srcDir, `${contractName}.d.ts`), declaration));
|
90
|
-
}
|
91
|
-
|
92
|
-
const dTs = generateArtifactsDefinition(contractTypeData);
|
93
|
-
fp.push(writeFile(join(srcDir, "artifacts.d.ts"), dTs));
|
94
|
-
|
95
|
-
try {
|
96
|
-
await Promise.all(fp);
|
97
|
-
} catch (error) {
|
98
|
-
console.error("Error writing artifacts definition:", error);
|
99
|
-
}
|
100
|
-
})
|
101
|
-
);
|
102
|
-
|
103
|
-
return { artifactsEmittedPerFile };
|
104
|
-
}
|
105
|
-
);
|
106
|
-
|
107
|
-
/**
|
108
|
-
* Override task for cleaning up outdated artifacts.
|
109
|
-
* Deletes directories with stale `artifacts.d.ts` files that no longer have
|
110
|
-
* a matching `.sol` file.
|
111
|
-
*/
|
112
|
-
subtask(TASK_COMPILE_REMOVE_OBSOLETE_ARTIFACTS).setAction(
|
113
|
-
async (_, { config, artifacts }, runSuper) => {
|
114
|
-
const superRes = await runSuper();
|
115
|
-
|
116
|
-
const fqns = await artifacts.getAllFullyQualifiedNames();
|
117
|
-
const existingSourceNames = new Set(
|
118
|
-
fqns.map((fqn) => parseFullyQualifiedName(fqn).sourceName)
|
119
|
-
);
|
120
|
-
const allArtifactsDTs = await getAllFilesMatching(
|
121
|
-
config.paths.artifacts,
|
122
|
-
(f) => f.endsWith("artifacts.d.ts")
|
123
|
-
);
|
124
|
-
|
125
|
-
for (const artifactDTs of allArtifactsDTs) {
|
126
|
-
const dir = dirname(artifactDTs);
|
127
|
-
const sourceName = replaceBackslashes(
|
128
|
-
relative(config.paths.artifacts, dir)
|
129
|
-
);
|
130
|
-
// If sourceName is empty, it means that the artifacts.d.ts file is in the
|
131
|
-
// root of the artifacts directory, and we shouldn't delete it.
|
132
|
-
if (sourceName === "") {
|
133
|
-
continue;
|
134
|
-
}
|
135
|
-
|
136
|
-
if (!existingSourceNames.has(sourceName)) {
|
137
|
-
await rm(dir, { force: true, recursive: true });
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
return superRes;
|
142
|
-
}
|
143
|
-
);
|
144
|
-
|
145
|
-
const AUTOGENERATED_FILE_PREFACE = `// This file was autogenerated by hardhat-viem, do not edit it.
|
146
|
-
// prettier-ignore
|
147
|
-
// tslint:disable
|
148
|
-
// eslint-disable`;
|
149
|
-
|
150
|
-
/**
|
151
|
-
* Generates TypeScript code that extends the `ArtifactsMap` with `never` types
|
152
|
-
* for duplicate contract names.
|
153
|
-
*/
|
154
|
-
function generateDuplicateArtifactsDefinition(
|
155
|
-
duplicateContractNames: Set<string>
|
156
|
-
) {
|
157
|
-
return `${AUTOGENERATED_FILE_PREFACE}
|
158
|
-
|
159
|
-
import "hardhat/types/artifacts";
|
160
|
-
|
161
|
-
declare module "hardhat/types/artifacts" {
|
162
|
-
interface ArtifactsMap {
|
163
|
-
${Array.from(duplicateContractNames)
|
164
|
-
.map((name) => `${name}: never;`)
|
165
|
-
.join("\n ")}
|
166
|
-
}
|
167
|
-
|
168
|
-
interface ContractTypesMap {
|
169
|
-
${Array.from(duplicateContractNames)
|
170
|
-
.map((name) => `${name}: never;`)
|
171
|
-
.join("\n ")}
|
172
|
-
}
|
173
|
-
}
|
174
|
-
`;
|
175
|
-
}
|
176
|
-
|
177
|
-
/**
|
178
|
-
* Generates TypeScript code to declare a contract and its associated
|
179
|
-
* TypeScript types.
|
180
|
-
*/
|
181
|
-
function generateContractDeclaration(artifact: Artifact, isDuplicate: boolean) {
|
182
|
-
const { contractName, sourceName } = artifact;
|
183
|
-
const fqn = getFullyQualifiedName(sourceName, contractName);
|
184
|
-
const validNames = isDuplicate ? [fqn] : [contractName, fqn];
|
185
|
-
const json = JSON.stringify(artifact, undefined, 2);
|
186
|
-
const contractTypeName = `${contractName}$Type`;
|
187
|
-
|
188
|
-
const constructorAbi = artifact.abi.find(
|
189
|
-
({ type }) => type === "constructor"
|
190
|
-
);
|
191
|
-
|
192
|
-
const inputs: Array<{
|
193
|
-
internalType: string;
|
194
|
-
name: string;
|
195
|
-
type: string;
|
196
|
-
}> = constructorAbi !== undefined ? constructorAbi.inputs : [];
|
197
|
-
|
198
|
-
const constructorArgs =
|
199
|
-
inputs.length > 0
|
200
|
-
? `constructorArgs: [${inputs
|
201
|
-
.map(({ name, type }) => getArgType(name, type))
|
202
|
-
.join(", ")}]`
|
203
|
-
: `constructorArgs?: []`;
|
204
|
-
|
205
|
-
return `${AUTOGENERATED_FILE_PREFACE}
|
206
|
-
|
207
|
-
import type { Address } from "viem";
|
208
|
-
${
|
209
|
-
inputs.length > 0
|
210
|
-
? `import type { AbiParameterToPrimitiveType, GetContractReturnType } from "@nomicfoundation/hardhat-viem/types";`
|
211
|
-
: `import type { GetContractReturnType } from "@nomicfoundation/hardhat-viem/types";`
|
212
|
-
}
|
213
|
-
import "@nomicfoundation/hardhat-viem/types";
|
214
|
-
|
215
|
-
export interface ${contractTypeName} ${json}
|
216
|
-
|
217
|
-
declare module "@nomicfoundation/hardhat-viem/types" {
|
218
|
-
${validNames
|
219
|
-
.map(
|
220
|
-
(name) => `export function deployContract(
|
221
|
-
contractName: "${name}",
|
222
|
-
${constructorArgs},
|
223
|
-
config?: DeployContractConfig
|
224
|
-
): Promise<GetContractReturnType<${contractTypeName}["abi"]>>;`
|
225
|
-
)
|
226
|
-
.join("\n ")}
|
227
|
-
|
228
|
-
${validNames
|
229
|
-
.map(
|
230
|
-
(name) => `export function sendDeploymentTransaction(
|
231
|
-
contractName: "${name}",
|
232
|
-
${constructorArgs},
|
233
|
-
config?: SendDeploymentTransactionConfig
|
234
|
-
): Promise<{
|
235
|
-
contract: GetContractReturnType<${contractTypeName}["abi"]>;
|
236
|
-
deploymentTransaction: GetTransactionReturnType;
|
237
|
-
}>;`
|
238
|
-
)
|
239
|
-
.join("\n ")}
|
240
|
-
|
241
|
-
${validNames
|
242
|
-
.map(
|
243
|
-
(name) => `export function getContractAt(
|
244
|
-
contractName: "${name}",
|
245
|
-
address: Address,
|
246
|
-
config?: GetContractAtConfig
|
247
|
-
): Promise<GetContractReturnType<${contractTypeName}["abi"]>>;`
|
248
|
-
)
|
249
|
-
.join("\n ")}
|
250
|
-
}
|
251
|
-
`;
|
252
|
-
}
|
253
|
-
|
254
|
-
/**
|
255
|
-
* Generates TypeScript code to extend the `ArtifactsMap` interface with
|
256
|
-
* contract types.
|
257
|
-
*/
|
258
|
-
function generateArtifactsDefinition(
|
259
|
-
contractTypeData: Array<{
|
260
|
-
contractName: string;
|
261
|
-
fqn: string;
|
262
|
-
typeName: string;
|
263
|
-
declaration: string;
|
264
|
-
}>
|
265
|
-
) {
|
266
|
-
return `${AUTOGENERATED_FILE_PREFACE}
|
267
|
-
|
268
|
-
import "hardhat/types/artifacts";
|
269
|
-
import type { GetContractReturnType } from "@nomicfoundation/hardhat-viem/types";
|
270
|
-
|
271
|
-
${contractTypeData
|
272
|
-
.map((ctd) => `import { ${ctd.typeName} } from "./${ctd.contractName}";`)
|
273
|
-
.join("\n")}
|
274
|
-
|
275
|
-
declare module "hardhat/types/artifacts" {
|
276
|
-
interface ArtifactsMap {
|
277
|
-
${contractTypeData
|
278
|
-
.map((ctd) => `["${ctd.contractName}"]: ${ctd.typeName};`)
|
279
|
-
.join("\n ")}
|
280
|
-
${contractTypeData
|
281
|
-
.map((ctd) => `["${ctd.fqn}"]: ${ctd.typeName};`)
|
282
|
-
.join("\n ")}
|
283
|
-
}
|
284
|
-
|
285
|
-
interface ContractTypesMap {
|
286
|
-
${contractTypeData
|
287
|
-
.map(
|
288
|
-
(ctd) =>
|
289
|
-
`["${ctd.contractName}"]: GetContractReturnType<${ctd.typeName}["abi"]>;`
|
290
|
-
)
|
291
|
-
.join("\n ")}
|
292
|
-
${contractTypeData
|
293
|
-
.map(
|
294
|
-
(ctd) =>
|
295
|
-
`["${ctd.fqn}"]: GetContractReturnType<${ctd.typeName}["abi"]>;`
|
296
|
-
)
|
297
|
-
.join("\n ")}
|
298
|
-
}
|
299
|
-
}
|
300
|
-
`;
|
301
|
-
}
|
302
|
-
|
303
|
-
/**
|
304
|
-
* Returns the type of a function argument in one of the following formats:
|
305
|
-
* - If the 'name' is provided:
|
306
|
-
* "name: AbiParameterToPrimitiveType<{ name: string; type: string; }>"
|
307
|
-
*
|
308
|
-
* - If the 'name' is empty:
|
309
|
-
* "AbiParameterToPrimitiveType<{ name: string; type: string; }>"
|
310
|
-
*/
|
311
|
-
function getArgType(name: string | undefined, type: string) {
|
312
|
-
const argType = `AbiParameterToPrimitiveType<${JSON.stringify({
|
313
|
-
name,
|
314
|
-
type,
|
315
|
-
})}>`;
|
316
|
-
|
317
|
-
return name !== "" && name !== undefined ? `${name}: ${argType}` : argType;
|
318
|
-
}
|
319
|
-
|
320
|
-
/**
|
321
|
-
* Returns a set of duplicate contract names.
|
322
|
-
*/
|
323
|
-
async function findDuplicateContractNames(artifacts: Artifacts) {
|
324
|
-
const fqns = await artifacts.getAllFullyQualifiedNames();
|
325
|
-
const contractNames = fqns.map(
|
326
|
-
(fqn) => parseFullyQualifiedName(fqn).contractName
|
327
|
-
);
|
328
|
-
|
329
|
-
const duplicates = new Set<string>();
|
330
|
-
const existing = new Set<string>();
|
331
|
-
|
332
|
-
for (const name of contractNames) {
|
333
|
-
if (existing.has(name)) {
|
334
|
-
duplicates.add(name);
|
335
|
-
}
|
336
|
-
|
337
|
-
existing.add(name);
|
338
|
-
}
|
339
|
-
|
340
|
-
return duplicates;
|
341
|
-
}
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import type { HardhatViemHelpers } from "../types";
|
2
|
-
import "hardhat/types/runtime";
|
3
|
-
import "hardhat/types/artifacts";
|
4
|
-
|
5
|
-
declare module "hardhat/types/runtime" {
|
6
|
-
interface HardhatRuntimeEnvironment {
|
7
|
-
viem: HardhatViemHelpers;
|
8
|
-
}
|
9
|
-
}
|
10
|
-
|
11
|
-
declare module "hardhat/types/artifacts" {
|
12
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
13
|
-
interface ArtifactsMap {}
|
14
|
-
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
16
|
-
interface ContractTypesMap {}
|
17
|
-
|
18
|
-
interface Artifacts {
|
19
|
-
readArtifact<ArgT extends keyof ArtifactsMap>(
|
20
|
-
contractNameOrFullyQualifiedName: ArgT
|
21
|
-
): Promise<ArtifactsMap[ArgT]>;
|
22
|
-
|
23
|
-
readArtifactSync<ArgT extends keyof ArtifactsMap>(
|
24
|
-
contractNameOrFullyQualifiedName: ArgT
|
25
|
-
): ArtifactsMap[ArgT];
|
26
|
-
}
|
27
|
-
}
|
package/src/tsconfig.json
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"extends": "../../../config/typescript/tsconfig.json",
|
3
|
-
"compilerOptions": {
|
4
|
-
"outDir": "../",
|
5
|
-
"rootDirs": ["."],
|
6
|
-
"composite": true
|
7
|
-
},
|
8
|
-
"include": ["./**/*.ts"],
|
9
|
-
"exclude": [],
|
10
|
-
"references": [
|
11
|
-
{
|
12
|
-
"path": "../../hardhat-core/src"
|
13
|
-
}
|
14
|
-
]
|
15
|
-
}
|
package/types.d.ts
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
import type * as viemT from "viem";
|
2
|
-
import type { ArtifactsMap } from "hardhat/types/artifacts";
|
3
|
-
import type { Libraries } from "./internal/bytecode";
|
4
|
-
export type PublicClient = viemT.PublicClient<viemT.Transport, viemT.Chain>;
|
5
|
-
export type WalletClient = viemT.WalletClient<viemT.Transport, viemT.Chain, viemT.Account>;
|
6
|
-
export type TestClient = viemT.TestClient<TestClientMode, viemT.Transport, viemT.Chain>;
|
7
|
-
export type KeyedClient = {
|
8
|
-
public?: PublicClient;
|
9
|
-
wallet: WalletClient;
|
10
|
-
} | {
|
11
|
-
public: PublicClient;
|
12
|
-
wallet?: WalletClient;
|
13
|
-
};
|
14
|
-
export type TestClientMode = Parameters<typeof viemT.createTestClient>[0]["mode"];
|
15
|
-
export interface SendTransactionConfig {
|
16
|
-
client?: KeyedClient;
|
17
|
-
gas?: bigint;
|
18
|
-
gasPrice?: bigint;
|
19
|
-
maxFeePerGas?: bigint;
|
20
|
-
maxPriorityFeePerGas?: bigint;
|
21
|
-
value?: bigint;
|
22
|
-
}
|
23
|
-
export interface DeployContractConfig extends SendTransactionConfig {
|
24
|
-
confirmations?: number;
|
25
|
-
libraries?: Libraries<viemT.Address>;
|
26
|
-
}
|
27
|
-
export interface SendDeploymentTransactionConfig extends SendTransactionConfig {
|
28
|
-
libraries?: Libraries<viemT.Address>;
|
29
|
-
}
|
30
|
-
export interface GetContractAtConfig {
|
31
|
-
client?: KeyedClient;
|
32
|
-
}
|
33
|
-
export type GetContractReturnType<TAbi extends viemT.Abi | readonly unknown[] = viemT.Abi> = viemT.GetContractReturnType<TAbi, Required<KeyedClient>, viemT.Address>;
|
34
|
-
export type GetTransactionReturnType = viemT.GetTransactionReturnType<viemT.Chain, "latest">;
|
35
|
-
export type ContractName<StringT extends string> = StringT extends keyof ArtifactsMap ? never : StringT;
|
36
|
-
export declare function deployContract<CN extends string>(contractName: ContractName<CN>, constructorArgs?: any[], config?: DeployContractConfig): Promise<GetContractReturnType>;
|
37
|
-
export declare function sendDeploymentTransaction<CN extends string>(contractName: ContractName<CN>, constructorArgs?: any[], config?: SendDeploymentTransactionConfig): Promise<{
|
38
|
-
contract: GetContractReturnType;
|
39
|
-
deploymentTransaction: GetTransactionReturnType;
|
40
|
-
}>;
|
41
|
-
export declare function getContractAt<CN extends string>(contractName: ContractName<CN>, address: viemT.Address, config?: GetContractAtConfig): Promise<GetContractReturnType>;
|
42
|
-
export interface HardhatViemHelpers {
|
43
|
-
getPublicClient(publicClientConfig?: Partial<viemT.PublicClientConfig>): Promise<PublicClient>;
|
44
|
-
getWalletClients(walletClientConfig?: Partial<viemT.WalletClientConfig>): Promise<WalletClient[]>;
|
45
|
-
getWalletClient(address: viemT.Address, walletClientConfig?: Partial<viemT.WalletClientConfig>): Promise<WalletClient>;
|
46
|
-
getTestClient(testClientConfig?: Partial<viemT.TestClientConfig>): Promise<TestClient>;
|
47
|
-
deployContract: typeof deployContract;
|
48
|
-
sendDeploymentTransaction: typeof sendDeploymentTransaction;
|
49
|
-
getContractAt: typeof getContractAt;
|
50
|
-
}
|
51
|
-
export type { AbiParameterToPrimitiveType } from "abitype";
|
52
|
-
//# sourceMappingURL=types.d.ts.map
|
package/types.d.ts.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":"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"}
|
package/types.js
DELETED
package/types.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["src/types.ts"],"names":[],"mappings":""}
|