@layerzerolabs/verify-contract 1.1.1 → 1.1.3

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/dist/index.d.mts CHANGED
@@ -1,24 +1,94 @@
1
1
  import { Logger } from 'winston';
2
2
 
3
- type NetworkName = string;
3
+ declare enum LicenseType {
4
+ None = 1,
5
+ Unlicense = 2,
6
+ MIT = 3,
7
+ "GNU-GPLv2" = 4,
8
+ "GNU-GPLv3" = 5,
9
+ "GNU-LGPLv2.1" = 6,
10
+ "GNU-LGPLv3" = 7,
11
+ "BSD-2-Clause" = 8,
12
+ "BSD-3-Clause" = 9,
13
+ "MPL-2.0" = 10,
14
+ "OSL-3.0" = 11,
15
+ "Apache-2.0" = 12,
16
+ "GNU-AGPLv3" = 13,
17
+ "BUSL-1.1" = 14
18
+ }
4
19
 
5
- interface VerifyHardhatDeployPathsConfig {
6
- deployments: string;
20
+ interface SubmitForVerificationProps {
21
+ apiKey?: string;
22
+ apiUrl: string;
23
+ address: string;
24
+ contractName: string;
25
+ compilerVersion: string;
26
+ optimizerRuns?: number;
27
+ licenseType?: LicenseType;
28
+ sourceCode: string;
29
+ constructorArguments?: string;
30
+ evmVersion?: string;
31
+ }
32
+ interface VerificationResponse {
33
+ alreadyVerified: boolean;
7
34
  }
8
- interface VerifyHardhatDeploysNetworkConfig {
35
+
36
+ type NetworkName = string;
37
+ interface NetworkConfig {
9
38
  apiUrl: string;
10
39
  apiKey?: string;
11
40
  browserUrl?: string;
12
41
  }
13
- type VerifyHardhatDeployFilterConfig = boolean | string | string[] | RegExp | VerifyHardhatDeployFilterConfigFunction;
14
- type VerifyHardhatDeployFilterConfigFunction = (name: string, path: string, networkName: NetworkName) => boolean;
15
- interface VerifyHardhatDeploysConfig {
16
- paths?: Partial<VerifyHardhatDeployPathsConfig>;
17
- networks?: Record<NetworkName, Partial<VerifyHardhatDeploysNetworkConfig>>;
18
- verify?: VerifyHardhatDeployFilterConfig;
42
+
43
+ interface VerifyHardhatPathsConfig {
44
+ deployments: string;
45
+ }
46
+ type VerifyHardhatFilterConfig = boolean | string | string[] | RegExp | VerifyHardhatFilterFunction;
47
+ type VerifyHardhatFilterFunction = (name: string, path: string, networkName: NetworkName) => boolean;
48
+ interface VerifyHardhatBaseConfig {
49
+ paths?: Partial<VerifyHardhatPathsConfig>;
50
+ networks?: Record<NetworkName, Partial<NetworkConfig>>;
19
51
  dryRun?: boolean;
20
52
  }
53
+ interface VerifyHardhatTargetConfig extends VerifyHardhatBaseConfig {
54
+ filter?: VerifyHardhatFilterConfig;
55
+ }
56
+ interface VerifyHardhatContractConfig {
57
+ network: NetworkName;
58
+ address: string;
59
+ deployment: string;
60
+ contractName: string;
61
+ constructorArguments?: unknown[];
62
+ }
63
+ interface VerifyHardhatNonTargetConfig extends VerifyHardhatBaseConfig {
64
+ contracts: VerifyHardhatContractConfig[];
65
+ }
66
+ interface VerificationArtifact {
67
+ networkName: string;
68
+ networkConfig: NetworkConfig;
69
+ submitProps: SubmitForVerificationProps;
70
+ }
71
+ interface VerificationResult {
72
+ artifact: VerificationArtifact;
73
+ response?: VerificationResponse;
74
+ error?: unknown;
75
+ }
21
76
 
22
- declare const _default: (config: VerifyHardhatDeploysConfig, logger: Logger) => Promise<void>;
77
+ /**
78
+ * verifyNonTarget is useful when verifying a contract that does not have its own
79
+ * deployment file (i.e. is not a target of any hardhat deployment, hence the name).
80
+ *
81
+ * This happens when a contract is deployed dynamically from another contract,
82
+ * either using minimal proxy pattern or by new keyword
83
+ *
84
+ * In this case the construtor arguments must be provided manually for every contract/network combination
85
+ *
86
+ * @param config VerifyHardhatNonTargetConfig
87
+ * @param logger Logger
88
+ *
89
+ * @returns Promise<VerificationResult[]>
90
+ */
91
+ declare const verifyNonTarget: (config: VerifyHardhatNonTargetConfig, logger: Logger) => Promise<VerificationResult[]>;
92
+ declare const verifyTarget: (config: VerifyHardhatTargetConfig, logger: Logger) => Promise<VerificationResult[]>;
23
93
 
24
- export { _default as verifyHardhatDeploy };
94
+ export { verifyNonTarget as verifyHardhatDeployNonTarget, verifyTarget as verifyHardhatDeployTarget };
package/dist/index.d.ts CHANGED
@@ -1,24 +1,94 @@
1
1
  import { Logger } from 'winston';
2
2
 
3
- type NetworkName = string;
3
+ declare enum LicenseType {
4
+ None = 1,
5
+ Unlicense = 2,
6
+ MIT = 3,
7
+ "GNU-GPLv2" = 4,
8
+ "GNU-GPLv3" = 5,
9
+ "GNU-LGPLv2.1" = 6,
10
+ "GNU-LGPLv3" = 7,
11
+ "BSD-2-Clause" = 8,
12
+ "BSD-3-Clause" = 9,
13
+ "MPL-2.0" = 10,
14
+ "OSL-3.0" = 11,
15
+ "Apache-2.0" = 12,
16
+ "GNU-AGPLv3" = 13,
17
+ "BUSL-1.1" = 14
18
+ }
4
19
 
5
- interface VerifyHardhatDeployPathsConfig {
6
- deployments: string;
20
+ interface SubmitForVerificationProps {
21
+ apiKey?: string;
22
+ apiUrl: string;
23
+ address: string;
24
+ contractName: string;
25
+ compilerVersion: string;
26
+ optimizerRuns?: number;
27
+ licenseType?: LicenseType;
28
+ sourceCode: string;
29
+ constructorArguments?: string;
30
+ evmVersion?: string;
31
+ }
32
+ interface VerificationResponse {
33
+ alreadyVerified: boolean;
7
34
  }
8
- interface VerifyHardhatDeploysNetworkConfig {
35
+
36
+ type NetworkName = string;
37
+ interface NetworkConfig {
9
38
  apiUrl: string;
10
39
  apiKey?: string;
11
40
  browserUrl?: string;
12
41
  }
13
- type VerifyHardhatDeployFilterConfig = boolean | string | string[] | RegExp | VerifyHardhatDeployFilterConfigFunction;
14
- type VerifyHardhatDeployFilterConfigFunction = (name: string, path: string, networkName: NetworkName) => boolean;
15
- interface VerifyHardhatDeploysConfig {
16
- paths?: Partial<VerifyHardhatDeployPathsConfig>;
17
- networks?: Record<NetworkName, Partial<VerifyHardhatDeploysNetworkConfig>>;
18
- verify?: VerifyHardhatDeployFilterConfig;
42
+
43
+ interface VerifyHardhatPathsConfig {
44
+ deployments: string;
45
+ }
46
+ type VerifyHardhatFilterConfig = boolean | string | string[] | RegExp | VerifyHardhatFilterFunction;
47
+ type VerifyHardhatFilterFunction = (name: string, path: string, networkName: NetworkName) => boolean;
48
+ interface VerifyHardhatBaseConfig {
49
+ paths?: Partial<VerifyHardhatPathsConfig>;
50
+ networks?: Record<NetworkName, Partial<NetworkConfig>>;
19
51
  dryRun?: boolean;
20
52
  }
53
+ interface VerifyHardhatTargetConfig extends VerifyHardhatBaseConfig {
54
+ filter?: VerifyHardhatFilterConfig;
55
+ }
56
+ interface VerifyHardhatContractConfig {
57
+ network: NetworkName;
58
+ address: string;
59
+ deployment: string;
60
+ contractName: string;
61
+ constructorArguments?: unknown[];
62
+ }
63
+ interface VerifyHardhatNonTargetConfig extends VerifyHardhatBaseConfig {
64
+ contracts: VerifyHardhatContractConfig[];
65
+ }
66
+ interface VerificationArtifact {
67
+ networkName: string;
68
+ networkConfig: NetworkConfig;
69
+ submitProps: SubmitForVerificationProps;
70
+ }
71
+ interface VerificationResult {
72
+ artifact: VerificationArtifact;
73
+ response?: VerificationResponse;
74
+ error?: unknown;
75
+ }
21
76
 
22
- declare const _default: (config: VerifyHardhatDeploysConfig, logger: Logger) => Promise<void>;
77
+ /**
78
+ * verifyNonTarget is useful when verifying a contract that does not have its own
79
+ * deployment file (i.e. is not a target of any hardhat deployment, hence the name).
80
+ *
81
+ * This happens when a contract is deployed dynamically from another contract,
82
+ * either using minimal proxy pattern or by new keyword
83
+ *
84
+ * In this case the construtor arguments must be provided manually for every contract/network combination
85
+ *
86
+ * @param config VerifyHardhatNonTargetConfig
87
+ * @param logger Logger
88
+ *
89
+ * @returns Promise<VerificationResult[]>
90
+ */
91
+ declare const verifyNonTarget: (config: VerifyHardhatNonTargetConfig, logger: Logger) => Promise<VerificationResult[]>;
92
+ declare const verifyTarget: (config: VerifyHardhatTargetConfig, logger: Logger) => Promise<VerificationResult[]>;
23
93
 
24
- export { _default as verifyHardhatDeploy };
94
+ export { verifyNonTarget as verifyHardhatDeployNonTarget, verifyTarget as verifyHardhatDeployTarget };