typechain
- Version 8.3.2
- Published
- 120 kB
- 10 dependencies
- MIT license
Install
npm i typechain
yarn add typechain
pnpm add typechain
Overview
🔌 TypeScript bindings for Ethereum smartcontracts
Index
Variables
Functions
- createBarrelFiles()
- detectInputsRoot()
- ensure0xPrefix()
- ensureAbsPath()
- extractAbi()
- extractBytecode()
- extractDocumentation()
- getArgumentForSignature()
- getFileExtension()
- getFilename()
- getFullSignatureAsSymbolForEvent()
- getFullSignatureForEvent()
- getFunctionDocumentation()
- getIndexedSignatureForEvent()
- getSignatureForFn()
- glob()
- isConstant()
- isConstantFn()
- lowestCommonPath()
- normalizeName()
- normalizeSlashes()
- parse()
- parseContractPath()
- parseEvent()
- parseEvmType()
- runTypeChain()
- shortenFullJsonFilePath()
Classes
Interfaces
Type Aliases
Variables
variable DEFAULT_FLAGS
const DEFAULT_FLAGS: CodegenConfig;
Functions
function createBarrelFiles
createBarrelFiles: ( paths: string[], { typeOnly, postfix, moduleSuffix, }: { typeOnly: boolean; postfix?: string; moduleSuffix?: string }) => FileDescription[];
returns barrel files with reexports for all given paths
See Also
https://github.com/basarat/typescript-book/blob/master/docs/tips/barrel.md
function detectInputsRoot
detectInputsRoot: (allFiles: string[]) => string;
function ensure0xPrefix
ensure0xPrefix: (hexString: string) => string;
function ensureAbsPath
ensureAbsPath: (path: string) => string;
function extractAbi
extractAbi: (rawJson: string) => RawAbiDefinition[];
function extractBytecode
extractBytecode: (rawContents: string) => BytecodeWithLinkReferences | undefined;
function extractDocumentation
extractDocumentation: (rawContents: string) => DocumentationResult | undefined;
function getArgumentForSignature
getArgumentForSignature: ( argument: EventArgDeclaration | AbiParameter) => string;
function getFileExtension
getFileExtension: (path: string) => string;
function getFilename
getFilename: (path: string) => string;
function getFullSignatureAsSymbolForEvent
getFullSignatureAsSymbolForEvent: (event: EventDeclaration) => string;
function getFullSignatureForEvent
getFullSignatureForEvent: (event: EventDeclaration) => string;
function getFunctionDocumentation
getFunctionDocumentation: ( abiPiece: RawAbiDefinition, documentation?: DocumentationResult) => FunctionDocumentation | undefined;
function getIndexedSignatureForEvent
getIndexedSignatureForEvent: (event: EventDeclaration) => string;
function getSignatureForFn
getSignatureForFn: (fn: FunctionDeclaration) => string;
function glob
glob: ( cwd: string, patternsOrFiles: string[], ignoreNodeModules?: boolean) => string[];
function isConstant
isConstant: (fn: FunctionDeclaration) => boolean;
function isConstantFn
isConstantFn: (fn: FunctionDeclaration) => boolean;
function lowestCommonPath
lowestCommonPath: (paths: string[]) => string;
function normalizeName
normalizeName: (rawName: string) => string;
Converts valid file names to valid javascript symbols and does best effort to make them readable. Example: ds-token.test becomes DsTokenTest
function normalizeSlashes
normalizeSlashes: (path: string) => string;
function parse
parse: ( abi: RawAbiDefinition[], path: string, documentation?: DocumentationResult) => Contract;
function parseContractPath
parseContractPath: (path: string) => { name: string; rawName: string; path: string[];};
function parseEvent
parseEvent: ( abiPiece: RawEventAbiDefinition, registerStruct: (struct: StructType) => void) => EventDeclaration;
function parseEvmType
parseEvmType: ( rawType: string, components?: EvmSymbol[], internalType?: string) => EvmType;
function runTypeChain
runTypeChain: ( publicConfig: MarkOptional<Config, 'flags' | 'inputDir'>) => Promise<Result>;
function shortenFullJsonFilePath
shortenFullJsonFilePath: (path: string, allPaths: string[]) => string;
Transforms all paths matching
ContractName(\.sol)?/ContractName.ext
Classes
class StructName
class StructName {}
constructor
constructor(_identifier: string, _namespace?: string);
property identifier
readonly identifier: string;
property namespace
readonly namespace?: string;
method merge
merge: (other: Partial<StructName>) => StructName;
method toString
toString: () => string;
class TypeChainTarget
abstract class TypeChainTarget {}
constructor
constructor(cfg: Config);
property cfg
readonly cfg: Config;
property name
abstract readonly name: string;
method afterRun
afterRun: () => Output | Promise<Output>;
method beforeRun
beforeRun: () => Output | Promise<Output>;
method transformFile
abstract transformFile: (file: FileDescription) => Output | Promise<Output>;
Interfaces
interface AbiOutputParameter
interface AbiOutputParameter {}
interface AbiParameter
interface AbiParameter {}
interface BytecodeLinkReference
interface BytecodeLinkReference {}
interface BytecodeWithLinkReferences
interface BytecodeWithLinkReferences {}
property bytecode
bytecode: string;
property linkReferences
linkReferences?: BytecodeLinkReference[];
interface CodegenConfig
interface CodegenConfig {}
property alwaysGenerateOverloads
alwaysGenerateOverloads: boolean;
property discriminateTypes
discriminateTypes: boolean;
property environment
environment: 'hardhat' | undefined;
property node16Modules
node16Modules?: boolean;
property tsNocheck
tsNocheck?: boolean;
interface Config
interface Config {}
property allFiles
allFiles: string[];
property cwd
cwd: string;
property filesToProcess
filesToProcess: string[];
property flags
flags: CodegenConfig;
property inputDir
inputDir: string;
Optional path to directory with ABI files. If not specified, inferred to be lowest common path of all input files.
property outDir
outDir?: string | undefined;
property prettier
prettier?: object | undefined;
property target
target: string;
interface Contract
interface Contract {}
property constructor
constructor: FunctionWithoutOutputDeclaration[];
property documentation
documentation?: | { author?: string; details?: string; notice?: string; } | undefined;
property events
events: Dictionary<EventDeclaration[]>;
property fallback
fallback?: FunctionWithoutInputDeclaration | undefined;
property functions
functions: Dictionary<FunctionDeclaration[]>;
property name
name: string;
property path
path: string[];
property rawName
rawName: string;
property structs
structs: Dictionary<StructType[]>;
interface DocumentationResult
interface DocumentationResult {}
interface EventArgDeclaration
interface EventArgDeclaration {}
interface EventDeclaration
interface EventDeclaration {}
property inputs
inputs: EventArgDeclaration[];
property isAnonymous
isAnonymous: boolean;
property name
name: string;
interface FileDescription
interface FileDescription {}
interface FunctionDeclaration
interface FunctionDeclaration {}
property documentation
documentation?: FunctionDocumentation | undefined;
property inputs
inputs: AbiParameter[];
property name
name: string;
property outputs
outputs: AbiOutputParameter[];
property stateMutability
stateMutability: StateMutability;
interface FunctionDocumentation
interface FunctionDocumentation {}
interface FunctionWithoutInputDeclaration
interface FunctionWithoutInputDeclaration extends FunctionDeclaration {}
property inputs
inputs: [];
interface FunctionWithoutOutputDeclaration
interface FunctionWithoutOutputDeclaration extends FunctionDeclaration {}
property outputs
outputs: [];
interface RawAbiDefinition
interface RawAbiDefinition {}
interface RawAbiParameter
interface RawAbiParameter {}
property components
components?: RawAbiParameter[];
property internalType
internalType?: string;
property name
name: string;
property type
type: string;
interface RawEventAbiDefinition
interface RawEventAbiDefinition {}
interface RawEventArgAbiDefinition
interface RawEventArgAbiDefinition {}
Type Aliases
type AddressType
type AddressType = { type: 'address'; originalType: string;};
type ArrayType
type ArrayType = { type: 'array'; itemType: EvmType; size?: number; originalType: string; structName?: StructName;};
type BooleanType
type BooleanType = { type: 'boolean'; originalType: string;};
type BytesType
type BytesType = { type: 'bytes'; size: number; originalType: string;};
type DynamicBytesType
type DynamicBytesType = { type: 'dynamic-bytes'; originalType: string;};
type EvmOutputType
type EvmOutputType = EvmType | VoidType;
Like EvmType but with void
type EvmSymbol
type EvmSymbol = { type: EvmType; name: string;};
type EvmType
type EvmType = | BooleanType | IntegerType | UnsignedIntegerType | StringType | BytesType | DynamicBytesType | AddressType | ArrayType | TupleType | UnknownType;
type IntegerType
type IntegerType = { type: 'integer'; bits: number; originalType: string;};
type Named
type Named<T> = { name: string; values: T;};
type Output
type Output = void | FileDescription | FileDescription[];
type PublicConfig
type PublicConfig = MarkOptional<Config, 'flags' | 'inputDir'>;
type StateMutability
type StateMutability = 'pure' | 'view' | 'nonpayable' | 'payable';
type StringType
type StringType = { type: 'string'; originalType: string;};
type StructType
type StructType = ArrayType | TupleType;
type TupleType
type TupleType = { type: 'tuple'; components: EvmSymbol[]; originalType: string; structName?: StructName;};
type UnknownType
type UnknownType = { type: 'unknown'; originalType: string;};
type UnsignedIntegerType
type UnsignedIntegerType = { type: 'uinteger'; bits: number; originalType: string;};
type VoidType
type VoidType = { type: 'void';};
Package Files (16)
- dist/codegen/createBarrelFiles.d.ts
- dist/index.d.ts
- dist/parser/abiParser.d.ts
- dist/parser/normalizeName.d.ts
- dist/parser/parseEvmType.d.ts
- dist/typechain/runTypeChain.d.ts
- dist/typechain/types.d.ts
- dist/utils/files/detectInputsRoot.d.ts
- dist/utils/files/ensureAbsPath.d.ts
- dist/utils/files/getFileExtension.d.ts
- dist/utils/files/getFilename.d.ts
- dist/utils/files/lowestCommonPath.d.ts
- dist/utils/files/normalizeSlashes.d.ts
- dist/utils/files/shortenFullJsonFilePath.d.ts
- dist/utils/glob.d.ts
- dist/utils/signatures.d.ts
Dependencies (10)
Dev Dependencies (10)
Peer Dependencies (1)
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/typechain
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/typechain)
- HTML<a href="https://www.jsdocs.io/package/typechain"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4506 ms. - Missing or incorrect documentation? Open an issue for this package.