Skip to content

Commit 911a537

Browse files
committed
Rename ContractArtifact to Artifact
1 parent 0134b62 commit 911a537

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/compilerWrapper.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { ChildProcess, exec, execSync } from 'child_process';
22
import { existsSync, mkdirSync, readFileSync, renameSync, unlinkSync, writeFileSync } from 'fs';
33
import { basename, dirname, join } from 'path';
44
import {
5-
buildTypeResolver, ContractArtifact, CURRENT_CONTRACT_ARTIFACT_VERSION, findCompiler, hash160, md5, path2uri, resolveConstValue, TypeResolver
5+
buildTypeResolver, Artifact, CURRENT_CONTRACT_ARTIFACT_VERSION, findCompiler, hash160, md5, path2uri, resolveConstValue, TypeResolver
66
} from './internal';
77
import rimraf = require('rimraf');
88
import JSONbig = require('json-bigint');
@@ -110,9 +110,9 @@ export class CompileResult {
110110
sourceMapFile?: string;
111111
dbgFile?: string;
112112

113-
toArtifact(): ContractArtifact {
113+
toArtifact(): Artifact {
114114

115-
const artifact: ContractArtifact = {
115+
const artifact: Artifact = {
116116
version: CURRENT_CONTRACT_ARTIFACT_VERSION,
117117
compilerVersion: this.compilerVersion || '0.0.0',
118118
contract: this.contract || '',
@@ -1098,7 +1098,7 @@ function doClean(settings: CompilingSettings, outputFiles: Record<string, string
10981098
// console.log('compile time spent: ', Date.now() - st)
10991099
}
11001100

1101-
export function loadSourceMapfromArtifact(artifact: ContractArtifact): Array<{
1101+
export function loadSourceMapfromArtifact(artifact: Artifact): Array<{
11021102
pos: Pos | undefined,
11031103
opcode: string
11041104
}> {

src/contract.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export interface VerifyResult {
4141
export const CURRENT_CONTRACT_ARTIFACT_VERSION = 9;
4242

4343
export const SUPPORTED_MINIMUM_VERSION = 8;
44-
export interface ContractArtifact {
44+
export interface Artifact {
4545
/** version of artifact file */
4646
version: number;
4747
/** version of compiler used to produce this file */
@@ -82,7 +82,7 @@ export type StepIndex = number;
8282

8383
export class AbstractContract {
8484

85-
public static artifact: ContractArtifact;
85+
public static artifact: Artifact;
8686
public static opcodes?: OpCode[];
8787
public static hex: string;
8888
public static abi: ABIEntity[];
@@ -129,27 +129,27 @@ export class AbstractContract {
129129
}
130130

131131
get sourceMapFile(): string {
132-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
132+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
133133
return artifact.sourceMapFile;
134134
}
135135

136136
get file(): string {
137-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
137+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
138138
return artifact.file;
139139
}
140140

141141
get contractName(): string {
142-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
142+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
143143
return artifact.contract;
144144
}
145145

146146
get stateProps(): ParamEntity[] {
147-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
147+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
148148
return artifact.stateProps || [];
149149
}
150150

151151
get version(): number {
152-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
152+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
153153
return artifact.version || 0;
154154
}
155155

@@ -338,7 +338,7 @@ export class AbstractContract {
338338
}
339339
} else if (this.version <= 8) {
340340

341-
const artifact = Object.getPrototypeOf(this).constructor.artifact as ContractArtifact;
341+
const artifact = Object.getPrototypeOf(this).constructor.artifact as Artifact;
342342

343343
const sourceMap = loadSourceMapfromArtifact(artifact);
344344

@@ -811,7 +811,7 @@ const invalidMethodName = ['arguments',
811811

812812

813813

814-
export function buildContractClass(artifact: ContractArtifact | CompileResult): typeof AbstractContract {
814+
export function buildContractClass(artifact: Artifact | CompileResult): typeof AbstractContract {
815815

816816

817817
if (artifact instanceof CompileResult) {
@@ -918,7 +918,7 @@ export function buildContractClass(artifact: ContractArtifact | CompileResult):
918918

919919

920920

921-
export function buildTypeResolverFromArtifact(artifact: ContractArtifact): TypeResolver {
921+
export function buildTypeResolverFromArtifact(artifact: Artifact): TypeResolver {
922922
const alias: AliasEntity[] = artifact.alias || [];
923923
const library: LibraryEntity[] = artifact.library || [];
924924
const structs: StructEntity[] = artifact.structs || [];

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export {
2222
OpCodeType, SupportedParamType, PubKeyHash, TxContext, ContractClass, Contract, SortedItem, HashedMap, HashedSet,
2323
StructObject, TypeResolver, PrimitiveTypes, AsmVarValues, Flavor,
2424
Arguments, Argument, StructEntity, LibraryEntity, ABIEntity, ABIEntityType, ABI, ParamEntity,
25-
BuildType, RelatedInformation, ContractArtifact, VerifyResult, VerifyError, AbstractContract,
25+
BuildType, RelatedInformation, Artifact, VerifyResult, VerifyError, AbstractContract,
2626
DebugInfo, DebugModeTag, ContractEntity, TypeInfo, SymbolType, DEFAULT_FLAGS, ScryptType, DEFAULT_SIGHASH_TYPE, CallData
2727
} from './internal';
2828

0 commit comments

Comments
 (0)