@enscribe/hardhat-enscribe 0.1.4 → 0.1.5
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.
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import "@nomicfoundation/hardhat-viem";
|
|
2
2
|
import { normalize } from "viem/ens";
|
|
3
|
-
import { nameContract
|
|
3
|
+
import { nameContract } from "@enscribe/enscribe";
|
|
4
4
|
const taskName = async (args, hre) => {
|
|
5
5
|
if (args.contract == null) {
|
|
6
6
|
console.log("need to pass a contract address");
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
const
|
|
10
|
-
const networkInfo = getNetworkInfo(chainName);
|
|
11
|
-
// Initialize contracts based on network
|
|
12
|
-
const contracts = getContractAddresses(networkInfo.networkName);
|
|
13
|
-
const networkConnection = await hre.network.connect(networkInfo.networkName);
|
|
9
|
+
const networkConnection = await hre.network.connect();
|
|
14
10
|
const [walletClient] = await networkConnection.viem.getWalletClients();
|
|
15
11
|
const nameNormalized = normalize(args.name);
|
|
16
12
|
console.log(`normalized name is ${nameNormalized}`);
|
|
17
13
|
// Use the library API
|
|
18
14
|
try {
|
|
19
|
-
console.log(`\Setting name for contract ${args.contract} on chain ${
|
|
15
|
+
console.log(`\Setting name for contract ${args.contract} on chain ${networkConnection.networkName} ...`);
|
|
20
16
|
const result = await nameContract({
|
|
21
17
|
name: nameNormalized,
|
|
22
18
|
contractAddress: args.contract,
|
|
23
19
|
walletClient: walletClient,
|
|
24
|
-
chainName,
|
|
20
|
+
chainName: networkConnection.networkName,
|
|
25
21
|
opType: "hh-enscribe-nameexisting",
|
|
26
22
|
enableMetrics: true, // Enable metrics logging for plugin usage
|
|
27
23
|
});
|
|
@@ -38,17 +38,14 @@ describe("name task integration", () => {
|
|
|
38
38
|
const mockArgs = {
|
|
39
39
|
name: "test.example.eth",
|
|
40
40
|
contract: "0x1234567890123456789012345678901234567890",
|
|
41
|
-
chain: "sepolia",
|
|
42
41
|
};
|
|
43
42
|
expect(mockArgs.name).toBe("test.example.eth");
|
|
44
43
|
expect(mockArgs.contract).toBe("0x1234567890123456789012345678901234567890");
|
|
45
|
-
expect(mockArgs.chain).toBe("sepolia");
|
|
46
44
|
});
|
|
47
45
|
it("should handle missing contract address gracefully", () => {
|
|
48
46
|
const mockArgs = {
|
|
49
47
|
name: "test.example.eth",
|
|
50
48
|
contract: null,
|
|
51
|
-
chain: "sepolia",
|
|
52
49
|
};
|
|
53
50
|
expect(mockArgs.contract).toBeNull();
|
|
54
51
|
});
|