Skip to content

Commit

Permalink
Remove @dev comments. Tweak some functions comments
Browse files Browse the repository at this point in the history
  • Loading branch information
carletex committed Nov 27, 2023
1 parent 1014476 commit 07d1a04
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { AbiFunction, AbiParameter } from "abitype";
import { BaseError as BaseViemError } from "viem";

/**
* @dev utility function to generate key corresponding to function metaData
* Generates a key based on function metadata
* @param {AbiFunction} functionName
* @param {utils.ParamType} input - object containing function name and input type corresponding to index
* @param {AbiParameter} input - object containing function name and input type corresponding to index
* @param {number} inputIndex
* @returns {string} key
*/
Expand All @@ -14,7 +14,7 @@ const getFunctionInputKey = (functionName: string, input: AbiParameter, inputInd
};

/**
* @dev utility function to parse error
* Parses an error to get a displayable string
* @param e - error object
* @returns {string} parsed error string
*/
Expand All @@ -38,8 +38,9 @@ const getParsedError = (e: any | BaseViemError): string => {

// This regex is used to identify array types in the form of `type[size]`
const ARRAY_TYPE_REGEX = /\[.*\]$/;

/**
* @dev Parse form input with array support
* Parses form input with array support
* @param {Record<string,any>} form - form object containing key value pairs
* @returns parsed error string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
} from "~~/utils/scaffold-eth/contract";

/**
* @dev wrapper for wagmi's useContractRead hook which loads in deployed contract contract abi, address automatically
* Wrapper for wagmi's useContractRead hook which automatically loads (by name)
* the contract ABI and address from the deployed contracts
* @param config - The config settings, including extra wagmi configuration
* @param config.contractName - deployed contract name
* @param config.functionName - name of the function to be called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { ContractAbi, ContractName, UseScaffoldWriteConfig } from "~~/utils/scaf
type UpdatedArgs = Parameters<ReturnType<typeof useContractWrite<Abi, string, undefined>>["writeAsync"]>[0];

/**
* @dev wrapper for wagmi's useContractWrite hook(with config prepared by usePrepareContractWrite hook) which loads in deployed contract abi and address automatically
* Wrapper for wagmi's useContractWrite hook (with config prepared by usePrepareContractWrite hook)
* which automatically loads (by name) the contract ABI and address from the deployed contracts
* @param config - The config settings, including extra wagmi configuration
* @param config.contractName - deployed contract name
* @param config.functionName - name of the function to be called
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
} from "~~/utils/scaffold-eth/contract";

/**
* @dev reads events from a deployed contract
* Reads events from a deployed contract
* @param config - The config settings
* @param config.contractName - deployed contract name
* @param config.eventName - name of the event to listen for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import { getTargetNetwork } from "~~/utils/scaffold-eth";
import { ContractAbi, ContractName, UseScaffoldEventConfig } from "~~/utils/scaffold-eth/contract";

/**
* @dev wrapper for wagmi's useContractEvent
* Wrapper for wagmi's useContractEvent which automatically loads (by name)
* the contract ABI and address from the deployed contracts.
* @param config - The config settings
* @param config.contractName - deployed contract name
* @param config.eventName - name of the event to listen for
Expand Down
6 changes: 3 additions & 3 deletions packages/nextjs/utils/scaffold-eth/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const NETWORKS_EXTRA_DATA: Record<string, ChainAttributes> = {

/**
* Gives the block explorer transaction URL.
* @dev returns empty string if the network is localChain
* Returns empty string if the network is a local chain
*/
export function getBlockExplorerTxLink(chainId: number, txnHash: string) {
const chainNames = Object.keys(chains);
Expand All @@ -84,8 +84,8 @@ export function getBlockExplorerTxLink(chainId: number, txnHash: string) {
}

/**
* Gives the block explorer Address URL.
* @returns block explorer address URL and etherscan URL if block explorer URL is not present for wagmi network
* Gives the block explorer URL for a given address.
* Defaults to Etherscan if no (wagmi) block explorer is configured for the network.
*/
export function getBlockExplorerAddressLink(network: chains.Chain, address: string) {
const blockExplorerBaseURL = network.blockExplorers?.default?.url;
Expand Down

0 comments on commit 07d1a04

Please sign in to comment.