Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@wagmi/cli

Package Overview
Dependencies
Maintainers
2
Versions
153
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@wagmi/cli - npm Package Compare versions

Comparing version 0.0.0-canary-20240709180659 to 0.0.0-canary-20240916160500

4

dist/esm/exports/plugins.js

@@ -6,6 +6,6 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module

export { fetch } from '../plugins/fetch.js';
export { foundry } from '../plugins/foundry.js';
export { hardhat } from '../plugins/hardhat.js';
export { foundry, foundryDefaultExcludes, } from '../plugins/foundry.js';
export { hardhat, hardhatDefaultExcludes, } from '../plugins/hardhat.js';
export { react } from '../plugins/react.js';
export { sourcify } from '../plugins/sourcify.js';
//# sourceMappingURL=plugins.js.map

@@ -9,3 +9,3 @@ import dedent from 'dedent';

import * as logger from '../logger.js';
const defaultExcludes = [
export const foundryDefaultExcludes = [
'Base.sol/**',

@@ -47,3 +47,3 @@ 'Common.sol/**',

export function foundry(config = {}) {
const { artifacts, deployments = {}, exclude = defaultExcludes, forge: { clean = false, build = true, path: forgeExecutable = 'forge', rebuild = true, } = {}, include = ['*.json'], namePrefix = '', } = config;
const { artifacts, deployments = {}, exclude = foundryDefaultExcludes, forge: { clean = false, build = true, path: forgeExecutable = 'forge', rebuild = true, } = {}, include = ['*.json'], namePrefix = '', } = config;
function getContractName(artifactPath, usePrefix = true) {

@@ -50,0 +50,0 @@ const filename = basename(artifactPath);

@@ -8,6 +8,6 @@ import { execa } from 'execa';

import { getIsPackageInstalled, getPackageManager } from '../utils/packages.js';
const defaultExcludes = ['build-info/**', '*.dbg.json'];
export const hardhatDefaultExcludes = ['build-info/**', '*.dbg.json'];
/** Resolves ABIs from [Hardhat](https://github.com/NomicFoundation/hardhat) project. */
export function hardhat(config) {
const { artifacts = 'artifacts', deployments = {}, exclude = defaultExcludes, commands = {}, include = ['*.json'], namePrefix = '', sources = 'contracts', } = config;
const { artifacts = 'artifacts', deployments = {}, exclude = hardhatDefaultExcludes, commands = {}, include = ['*.json'], namePrefix = '', sources = 'contracts', } = config;
function getContractName(artifact) {

@@ -14,0 +14,0 @@ return `${namePrefix}${artifact.contractName}`;

@@ -8,7 +8,17 @@ import { promises as fs } from 'node:fs';

const packageManager = await getPackageManager();
const command = packageManager === 'yarn' ? ['why', packageName] : ['ls', packageName];
const command = (() => {
switch (packageManager) {
case 'yarn':
return ['why', packageName];
case 'bun':
return ['pm', 'ls', '--all'];
default:
return ['ls', packageName];
}
})();
const { stdout } = await execa(packageManager, command, { cwd });
if (stdout !== '')
return true;
return false;
// For Bun, we need to check if the package name is in the output
if (packageManager === 'bun')
return stdout.includes(packageName);
return stdout !== '';
}

@@ -29,2 +39,4 @@ catch (_error) {

return executable ? 'npx' : 'npm';
if (userAgent.includes('bun'))
return executable ? 'bunx' : 'bun';
}

@@ -31,0 +43,0 @@ const packageManager = await detect();

@@ -1,2 +0,2 @@

export const version = '0.0.0-canary-20240709180659';
export const version = '0.0.0-canary-20240916160500';
//# sourceMappingURL=version.js.map
import type { Abi } from 'abitype';
import type { Address } from 'viem';
import type { Evaluate, MaybeArray, MaybePromise } from './types.js';
import type { Compute, MaybeArray, MaybePromise } from './types.js';
export type ContractConfig<chainId extends number = number, requiredChainId extends number | undefined = undefined> = {

@@ -29,3 +29,3 @@ /**

};
export type Contract = Evaluate<ContractConfig & {
export type Contract = Compute<ContractConfig & {
/** Generated string content */

@@ -32,0 +32,0 @@ content: string;

@@ -5,6 +5,6 @@ export { actions, type ActionsConfig } from '../plugins/actions.js';

export { fetch, type FetchConfig } from '../plugins/fetch.js';
export { foundry, type FoundryConfig } from '../plugins/foundry.js';
export { hardhat, type HardhatConfig } from '../plugins/hardhat.js';
export { foundry, foundryDefaultExcludes, type FoundryConfig, } from '../plugins/foundry.js';
export { hardhat, hardhatDefaultExcludes, type HardhatConfig, } from '../plugins/hardhat.js';
export { react, type ReactConfig } from '../plugins/react.js';
export { sourcify, type SourcifyConfig } from '../plugins/sourcify.js';
//# sourceMappingURL=plugins.d.ts.map
import type { Plugin } from '../config.js';
import type { Evaluate, RequiredBy } from '../types.js';
import type { Compute, RequiredBy } from '../types.js';
export type ActionsConfig = {

@@ -11,5 +11,5 @@ getActionName?: 'legacy' | ((options: {

};
type ActionsResult = Evaluate<RequiredBy<Plugin, 'run'>>;
type ActionsResult = Compute<RequiredBy<Plugin, 'run'>>;
export declare function actions(config?: ActionsConfig): ActionsResult;
export {};
//# sourceMappingURL=actions.d.ts.map
import type { Address } from 'viem';
import type { ContractConfig } from '../config.js';
import type { Evaluate } from '../types.js';
import type { Compute } from '../types.js';
export type BlockExplorerConfig = {

@@ -22,3 +22,3 @@ /**

*/
contracts: Evaluate<Omit<ContractConfig, 'abi'>>[];
contracts: Compute<Omit<ContractConfig, 'abi'>>[];
/**

@@ -25,0 +25,0 @@ * Function to get address from contract config.

import type { ContractConfig } from '../config.js';
import type { Evaluate } from '../types.js';
import type { Compute } from '../types.js';
declare const apiUrls: {

@@ -69,3 +69,3 @@ 1: string;

*/
contracts: Evaluate<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[];
contracts: Compute<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[];
};

@@ -72,0 +72,0 @@ /**

import type { ContractConfig, Plugin } from '../config.js';
import type { Evaluate, RequiredBy } from '../types.js';
import type { Compute, RequiredBy } from '../types.js';
export type FetchConfig = {

@@ -13,3 +13,3 @@ /**

*/
contracts: Evaluate<Omit<ContractConfig, 'abi'>>[];
contracts: Compute<Omit<ContractConfig, 'abi'>>[];
/**

@@ -19,3 +19,3 @@ * Function for creating a cache key for contract.

getCacheKey?: ((config: {
contract: Evaluate<Omit<ContractConfig, 'abi'>>;
contract: Compute<Omit<ContractConfig, 'abi'>>;
}) => string) | undefined;

@@ -53,3 +53,3 @@ /**

};
type FetchResult = Evaluate<RequiredBy<Plugin, 'contracts'>>;
type FetchResult = Compute<RequiredBy<Plugin, 'contracts'>>;
/** Fetches and parses contract ABIs from network resource with `fetch`. */

@@ -56,0 +56,0 @@ export declare function fetch(config: FetchConfig): FetchResult;

import type { ContractConfig, Plugin } from '../config.js';
import type { Evaluate, RequiredBy } from '../types.js';
import type { Compute, RequiredBy } from '../types.js';
export declare const foundryDefaultExcludes: string[];
export type FoundryConfig = {

@@ -52,3 +53,3 @@ /**

};
type FoundryResult = Evaluate<RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>>;
type FoundryResult = Compute<RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>>;
/** Resolves ABIs from [Foundry](https://github.com/foundry-rs/foundry) project. */

@@ -55,0 +56,0 @@ export declare function foundry(config?: FoundryConfig): FoundryResult;

import type { ContractConfig, Plugin } from '../config.js';
import type { Evaluate, RequiredBy } from '../types.js';
import type { Compute, RequiredBy } from '../types.js';
export declare const hardhatDefaultExcludes: string[];
export type HardhatConfig = {

@@ -54,3 +55,3 @@ /**

};
type HardhatResult = Evaluate<RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>>;
type HardhatResult = Compute<RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>>;
/** Resolves ABIs from [Hardhat](https://github.com/NomicFoundation/hardhat) project. */

@@ -57,0 +58,0 @@ export declare function hardhat(config: HardhatConfig): HardhatResult;

import type { Plugin } from '../config.js';
import type { Evaluate, RequiredBy } from '../types.js';
import type { Compute, RequiredBy } from '../types.js';
export type ReactConfig = {

@@ -10,5 +10,5 @@ getHookName?: 'legacy' | ((options: {

};
type ReactResult = Evaluate<RequiredBy<Plugin, 'run'>>;
type ReactResult = Compute<RequiredBy<Plugin, 'run'>>;
export declare function react(config?: ReactConfig): ReactResult;
export {};
//# sourceMappingURL=react.d.ts.map
import type * as chain from 'viem/chains';
import type { ContractConfig } from '../config.js';
import type { Evaluate } from '../types.js';
import type { Compute } from '../types.js';
export type SourcifyConfig<chainId extends number> = {

@@ -22,3 +22,3 @@ /**

*/
contracts: Evaluate<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[];
contracts: Compute<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[];
};

@@ -25,0 +25,0 @@ /** Fetches contract ABIs from Sourcify. */

@@ -1,2 +0,2 @@

export type Evaluate<type> = {
export type Compute<type> = {
[key in keyof type]: type[key];

@@ -3,0 +3,0 @@ } & unknown;

@@ -5,5 +5,5 @@ export declare function getIsPackageInstalled(parameters: {

}): Promise<boolean>;
export declare function getPackageManager(executable?: boolean | undefined): Promise<"npx" | PackageManager>;
export declare function getPackageManager(executable?: boolean | undefined): Promise<"npx" | "bunx" | PackageManager>;
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun';
export {};
//# sourceMappingURL=packages.d.ts.map

@@ -1,2 +0,2 @@

export declare const version = "0.0.0-canary-20240709180659";
export declare const version = "0.0.0-canary-20240916160500";
//# sourceMappingURL=version.d.ts.map
{
"name": "@wagmi/cli",
"description": "Manage and generate code from Ethereum ABIs",
"version": "0.0.0-canary-20240709180659",
"version": "0.0.0-canary-20240916160500",
"license": "MIT",

@@ -6,0 +6,0 @@ "repository": {

import type { Abi } from 'abitype'
import type { Address } from 'viem'
import type { Evaluate, MaybeArray, MaybePromise } from './types.js'
import type { Compute, MaybeArray, MaybePromise } from './types.js'

@@ -40,3 +40,3 @@ export type ContractConfig<

export type Contract = Evaluate<
export type Contract = Compute<
ContractConfig & {

@@ -43,0 +43,0 @@ /** Generated string content */

@@ -13,5 +13,13 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module

export { foundry, type FoundryConfig } from '../plugins/foundry.js'
export {
foundry,
foundryDefaultExcludes,
type FoundryConfig,
} from '../plugins/foundry.js'
export { hardhat, type HardhatConfig } from '../plugins/hardhat.js'
export {
hardhat,
hardhatDefaultExcludes,
type HardhatConfig,
} from '../plugins/hardhat.js'

@@ -18,0 +26,0 @@ export { react, type ReactConfig } from '../plugins/react.js'

import { pascalCase } from 'change-case'
import type { Contract, Plugin } from '../config.js'
import type { Evaluate, RequiredBy } from '../types.js'
import type { Compute, RequiredBy } from '../types.js'
import { getAddressDocString } from '../utils/getAddressDocString.js'

@@ -19,3 +19,3 @@ import { getIsPackageInstalled } from '../utils/packages.js'

type ActionsResult = Evaluate<RequiredBy<Plugin, 'run'>>
type ActionsResult = Compute<RequiredBy<Plugin, 'run'>>

@@ -22,0 +22,0 @@ export function actions(config: ActionsConfig = {}): ActionsResult {

@@ -7,3 +7,3 @@ import { camelCase } from 'change-case'

import { fromZodError } from '../errors.js'
import type { Evaluate } from '../types.js'
import type { Compute } from '../types.js'
import { fetch } from './fetch.js'

@@ -29,3 +29,3 @@

*/
contracts: Evaluate<Omit<ContractConfig, 'abi'>>[]
contracts: Compute<Omit<ContractConfig, 'abi'>>[]
/**

@@ -32,0 +32,0 @@ * Function to get address from contract config.

import type { ContractConfig } from '../config.js'
import type { Evaluate } from '../types.js'
import type { Compute } from '../types.js'
import { blockExplorer } from './blockExplorer.js'

@@ -85,3 +85,3 @@

*/
contracts: Evaluate<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[]
contracts: Compute<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[]
}

@@ -88,0 +88,0 @@

@@ -7,3 +7,3 @@ import { homedir } from 'node:os'

import type { ContractConfig, Plugin } from '../config.js'
import type { Evaluate, RequiredBy } from '../types.js'
import type { Compute, RequiredBy } from '../types.js'

@@ -20,3 +20,3 @@ export type FetchConfig = {

*/
contracts: Evaluate<Omit<ContractConfig, 'abi'>>[]
contracts: Compute<Omit<ContractConfig, 'abi'>>[]
/**

@@ -26,3 +26,3 @@ * Function for creating a cache key for contract.

getCacheKey?:
| ((config: { contract: Evaluate<Omit<ContractConfig, 'abi'>> }) => string)
| ((config: { contract: Compute<Omit<ContractConfig, 'abi'>> }) => string)
| undefined

@@ -59,3 +59,3 @@ /**

type FetchResult = Evaluate<RequiredBy<Plugin, 'contracts'>>
type FetchResult = Compute<RequiredBy<Plugin, 'contracts'>>

@@ -62,0 +62,0 @@ /** Fetches and parses contract ABIs from network resource with `fetch`. */

@@ -12,5 +12,5 @@ import dedent from 'dedent'

import * as logger from '../logger.js'
import type { Evaluate, RequiredBy } from '../types.js'
import type { Compute, RequiredBy } from '../types.js'
const defaultExcludes = [
export const foundryDefaultExcludes = [
'Base.sol/**',

@@ -97,3 +97,3 @@ 'Common.sol/**',

type FoundryResult = Evaluate<
type FoundryResult = Compute<
RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>

@@ -112,3 +112,3 @@ >

deployments = {},
exclude = defaultExcludes,
exclude = foundryDefaultExcludes,
forge: {

@@ -115,0 +115,0 @@ clean = false,

@@ -9,6 +9,6 @@ import { execa } from 'execa'

import * as logger from '../logger.js'
import type { Evaluate, RequiredBy } from '../types.js'
import type { Compute, RequiredBy } from '../types.js'
import { getIsPackageInstalled, getPackageManager } from '../utils/packages.js'
const defaultExcludes = ['build-info/**', '*.dbg.json']
export const hardhatDefaultExcludes = ['build-info/**', '*.dbg.json']

@@ -67,3 +67,3 @@ export type HardhatConfig = {

type HardhatResult = Evaluate<
type HardhatResult = Compute<
RequiredBy<Plugin, 'contracts' | 'validate' | 'watch'>

@@ -77,3 +77,3 @@ >

deployments = {},
exclude = defaultExcludes,
exclude = hardhatDefaultExcludes,
commands = {},

@@ -80,0 +80,0 @@ include = ['*.json'],

import { pascalCase } from 'change-case'
import type { Contract, Plugin } from '../config.js'
import type { Evaluate, RequiredBy } from '../types.js'
import type { Compute, RequiredBy } from '../types.js'
import { getAddressDocString } from '../utils/getAddressDocString.js'

@@ -17,3 +17,3 @@

type ReactResult = Evaluate<RequiredBy<Plugin, 'run'>>
type ReactResult = Compute<RequiredBy<Plugin, 'run'>>

@@ -20,0 +20,0 @@ export function react(config: ReactConfig = {}): ReactResult {

@@ -8,3 +8,3 @@ import { Abi as AbiSchema } from 'abitype/zod'

import { fromZodError } from '../errors.js'
import type { Evaluate } from '../types.js'
import type { Compute } from '../types.js'
import { fetch } from './fetch.js'

@@ -30,3 +30,3 @@

*/
contracts: Evaluate<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[]
contracts: Compute<Omit<ContractConfig<ChainId, chainId>, 'abi'>>[]
}

@@ -33,0 +33,0 @@

@@ -1,2 +0,2 @@

export type Evaluate<type> = { [key in keyof type]: type[key] } & unknown
export type Compute<type> = { [key in keyof type]: type[key] } & unknown

@@ -3,0 +3,0 @@ export type MaybeArray<T> = T | T[]

@@ -12,7 +12,19 @@ import { promises as fs } from 'node:fs'

const packageManager = await getPackageManager()
const command =
packageManager === 'yarn' ? ['why', packageName] : ['ls', packageName]
const command = (() => {
switch (packageManager) {
case 'yarn':
return ['why', packageName]
case 'bun':
return ['pm', 'ls', '--all']
default:
return ['ls', packageName]
}
})()
const { stdout } = await execa(packageManager, command, { cwd })
if (stdout !== '') return true
return false
// For Bun, we need to check if the package name is in the output
if (packageManager === 'bun') return stdout.includes(packageName)
return stdout !== ''
} catch (_error) {

@@ -30,2 +42,3 @@ return false

if (userAgent.includes('npm')) return executable ? 'npx' : 'npm'
if (userAgent.includes('bun')) return executable ? 'bunx' : 'bun'
}

@@ -32,0 +45,0 @@

@@ -1,1 +0,1 @@

export const version = '0.0.0-canary-20240709180659'
export const version = '0.0.0-canary-20240916160500'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc