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

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 {}

                                                                                property name

                                                                                name: string;

                                                                                  property type

                                                                                  type: EvmOutputType;

                                                                                    interface AbiParameter

                                                                                    interface AbiParameter {}

                                                                                      property name

                                                                                      name: string;

                                                                                        property type

                                                                                        type: EvmType;

                                                                                          interface BytecodeLinkReference

                                                                                          interface BytecodeLinkReference {}

                                                                                            property name

                                                                                            name?: string;

                                                                                              property reference

                                                                                              reference: string;

                                                                                                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 {}

                                                                                                                                                        property author

                                                                                                                                                        author?: string;

                                                                                                                                                          property details

                                                                                                                                                          details?: string;

                                                                                                                                                            property methods

                                                                                                                                                            methods?: {
                                                                                                                                                            [methodName: string]: FunctionDocumentation;
                                                                                                                                                            };

                                                                                                                                                              property notice

                                                                                                                                                              notice?: string;

                                                                                                                                                                property title

                                                                                                                                                                title?: string;

                                                                                                                                                                  interface EventArgDeclaration

                                                                                                                                                                  interface EventArgDeclaration {}

                                                                                                                                                                    property isIndexed

                                                                                                                                                                    isIndexed: boolean;

                                                                                                                                                                      property name

                                                                                                                                                                      name?: string | undefined;

                                                                                                                                                                        property type

                                                                                                                                                                        type: EvmType;

                                                                                                                                                                          interface EventDeclaration

                                                                                                                                                                          interface EventDeclaration {}

                                                                                                                                                                            property inputs

                                                                                                                                                                            inputs: EventArgDeclaration[];

                                                                                                                                                                              property isAnonymous

                                                                                                                                                                              isAnonymous: boolean;

                                                                                                                                                                                property name

                                                                                                                                                                                name: string;

                                                                                                                                                                                  interface FileDescription

                                                                                                                                                                                  interface FileDescription {}

                                                                                                                                                                                    property contents

                                                                                                                                                                                    contents: string;

                                                                                                                                                                                      property path

                                                                                                                                                                                      path: string;

                                                                                                                                                                                        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 {}

                                                                                                                                                                                                      property author

                                                                                                                                                                                                      author?: string;

                                                                                                                                                                                                        property details

                                                                                                                                                                                                        details?: string;

                                                                                                                                                                                                          property notice

                                                                                                                                                                                                          notice?: string;

                                                                                                                                                                                                            property params

                                                                                                                                                                                                            params?: {
                                                                                                                                                                                                            [paramName: string]: string;
                                                                                                                                                                                                            };

                                                                                                                                                                                                              property return

                                                                                                                                                                                                              return?: string;

                                                                                                                                                                                                                interface FunctionWithoutInputDeclaration

                                                                                                                                                                                                                interface FunctionWithoutInputDeclaration extends FunctionDeclaration {}

                                                                                                                                                                                                                  property inputs

                                                                                                                                                                                                                  inputs: [];

                                                                                                                                                                                                                    interface FunctionWithoutOutputDeclaration

                                                                                                                                                                                                                    interface FunctionWithoutOutputDeclaration extends FunctionDeclaration {}

                                                                                                                                                                                                                      property outputs

                                                                                                                                                                                                                      outputs: [];

                                                                                                                                                                                                                        interface RawAbiDefinition

                                                                                                                                                                                                                        interface RawAbiDefinition {}

                                                                                                                                                                                                                          property constant

                                                                                                                                                                                                                          constant: boolean;

                                                                                                                                                                                                                            property inputs

                                                                                                                                                                                                                            inputs: RawAbiParameter[];

                                                                                                                                                                                                                              property name

                                                                                                                                                                                                                              name: string;

                                                                                                                                                                                                                                property outputs

                                                                                                                                                                                                                                outputs: RawAbiParameter[];

                                                                                                                                                                                                                                  property payable

                                                                                                                                                                                                                                  payable: boolean;

                                                                                                                                                                                                                                    property stateMutability

                                                                                                                                                                                                                                    stateMutability?: StateMutability;

                                                                                                                                                                                                                                      property type

                                                                                                                                                                                                                                      type: string;

                                                                                                                                                                                                                                        interface RawAbiParameter

                                                                                                                                                                                                                                        interface RawAbiParameter {}

                                                                                                                                                                                                                                          property components

                                                                                                                                                                                                                                          components?: RawAbiParameter[];

                                                                                                                                                                                                                                            property internalType

                                                                                                                                                                                                                                            internalType?: string;

                                                                                                                                                                                                                                              property name

                                                                                                                                                                                                                                              name: string;

                                                                                                                                                                                                                                                property type

                                                                                                                                                                                                                                                type: string;

                                                                                                                                                                                                                                                  interface RawEventAbiDefinition

                                                                                                                                                                                                                                                  interface RawEventAbiDefinition {}

                                                                                                                                                                                                                                                    property anonymous

                                                                                                                                                                                                                                                    anonymous?: boolean;

                                                                                                                                                                                                                                                      property inputs

                                                                                                                                                                                                                                                      inputs: RawEventArgAbiDefinition[];

                                                                                                                                                                                                                                                        property name

                                                                                                                                                                                                                                                        name: string;

                                                                                                                                                                                                                                                          property type

                                                                                                                                                                                                                                                          type: 'event';

                                                                                                                                                                                                                                                            interface RawEventArgAbiDefinition

                                                                                                                                                                                                                                                            interface RawEventArgAbiDefinition {}

                                                                                                                                                                                                                                                              property indexed

                                                                                                                                                                                                                                                              indexed: boolean;

                                                                                                                                                                                                                                                                property name

                                                                                                                                                                                                                                                                name: string;

                                                                                                                                                                                                                                                                  property type

                                                                                                                                                                                                                                                                  type: string;

                                                                                                                                                                                                                                                                    interface Services

                                                                                                                                                                                                                                                                    interface Services {}

                                                                                                                                                                                                                                                                      property fs

                                                                                                                                                                                                                                                                      fs: typeof fs;

                                                                                                                                                                                                                                                                        property mkdirp

                                                                                                                                                                                                                                                                        mkdirp: typeof mkdirp;

                                                                                                                                                                                                                                                                          property prettier

                                                                                                                                                                                                                                                                          prettier: typeof prettier;

                                                                                                                                                                                                                                                                            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)

                                                                                                                                                                                                                                                                                                                Dependencies (10)

                                                                                                                                                                                                                                                                                                                Dev Dependencies (10)

                                                                                                                                                                                                                                                                                                                Peer Dependencies (1)

                                                                                                                                                                                                                                                                                                                Badge

                                                                                                                                                                                                                                                                                                                To add a badge like this onejsDocs.io badgeto 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>