Skip to content

Commit

Permalink
docs: Improve loader docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
shazow committed Dec 2, 2024
1 parent cf95d31 commit 4d7cbed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/auto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export type AutoloadConfig = {


/**
* Load full contract metadata result, include it in {@link AutoloadResult.ContractResult} if successful.
* Load full contract metadata result, include it in {@link AutoloadResult.contractResult} if successful.
*
* This changes the behaviour of autoload to use {@link ABILoader.getContract} instead of {@link ABILoader.loadABI},
* which returns a larger superset result including all of the available verified contract metadata.
Expand Down
16 changes: 11 additions & 5 deletions src/loaders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface ABILoader {
getContract(address: string): Promise<ContractResult>
}

// Load ABIs from multiple providers until a result is found.
/** Load ABIs from multiple providers until a result is found. */
export class MultiABILoader implements ABILoader {
readonly name: string = "MultiABILoader";

Expand Down Expand Up @@ -158,6 +158,7 @@ export class MultiABILoader implements ABILoader {
export class MultiABILoaderError extends errors.LoaderError { };


/** Etherscan v1 API loader */
export class EtherscanABILoader implements ABILoader {
readonly name: string = "EtherscanABILoader";

Expand Down Expand Up @@ -295,6 +296,8 @@ export type EtherscanContractResult = {
SwarmSource: string;
}


/** Etherscan v2 API loader */
export class EtherscanV2ABILoader extends EtherscanABILoader {
readonly name: string = "EtherscanV2ABILoader";
constructor(config: { apiKey: string, chainId?: number }) {
Expand Down Expand Up @@ -451,6 +454,7 @@ export interface SourcifyContractMetadata {
version: number;
}

/** Blockscout API loader: https://docs.blockscout.com/ */
export class BlockscoutABILoader implements ABILoader {
readonly name = "BlockscoutABILoader";

Expand Down Expand Up @@ -636,7 +640,7 @@ function isAnyABINotFound(error: any): boolean {
);
}

// https://anyabi.xyz/
/** https://anyabi.xyz/ */
export class AnyABILoader implements ABILoader {
readonly name = "AnyABILoader";

Expand Down Expand Up @@ -723,7 +727,7 @@ export class MultiSignatureLookup implements SignatureLookup {
}
}

// https://www.4byte.directory/
/** https://www.4byte.directory/ */
export class FourByteSignatureLookup implements SignatureLookup {
async load(url: string): Promise<string[]> {
try {
Expand All @@ -750,8 +754,10 @@ export class FourByteSignatureLookup implements SignatureLookup {

export class FourByteSignatureLookupError extends errors.LoaderError { };

// openchain.xyz
// Formerly: https://sig.eth.samczsun.com/
/**
* https://openchain.xyz/
* Formerly: https://sig.eth.samczsun.com/
*/
export class OpenChainSignatureLookup implements SignatureLookup {
async load(url: string): Promise<any> {
try {
Expand Down

0 comments on commit 4d7cbed

Please sign in to comment.