diff --git a/.changeset/little-tomatoes-fetch.md b/.changeset/little-tomatoes-fetch.md new file mode 100644 index 00000000..957ab88e --- /dev/null +++ b/.changeset/little-tomatoes-fetch.md @@ -0,0 +1,7 @@ +--- +"@delvtech/evm-client-ethers": patch +"@delvtech/evm-client-viem": patch +"@delvtech/evm-client": patch +--- + +Modify exports diff --git a/packages/evm-client-ethers/src/index.ts b/packages/evm-client-ethers/src/index.ts index 302ee2f5..db38adfd 100644 --- a/packages/evm-client-ethers/src/index.ts +++ b/packages/evm-client-ethers/src/index.ts @@ -1,25 +1,59 @@ -// Errors -export * from '@delvtech/evm-client/errors'; - // Contract -export { createCachedReadContract } from 'src/contract/createCachedReadContract'; -export { createCachedReadWriteContract } from 'src/contract/createCachedReadWriteContract'; -export { createReadContract } from 'src/contract/createReadContract'; -export { createReadWriteContract } from 'src/contract/createReadWriteContract'; +export { + createCachedReadContract, + type CreateCachedReadContractOptions, +} from 'src/contract/createCachedReadContract'; +export { + createCachedReadWriteContract, + type CreateCachedReadWriteContractOptions, +} from 'src/contract/createCachedReadWriteContract'; +export { + createReadContract, + type CreateReadContractOptions, + type EthersReadContract, +} from 'src/contract/createReadContract'; +export { + createReadWriteContract, + type ReadWriteContractOptions, +} from 'src/contract/createReadWriteContract'; // Network export { createNetwork } from 'src/network/createNetwork'; -// Types -export type { CreateCachedReadContractOptions } from 'src/contract/createCachedReadContract'; -export type { CreateCachedReadWriteContractOptions } from 'src/contract/createCachedReadWriteContract'; +// Re-exports +export * from '@delvtech/evm-client/cache'; + +export { + arrayToFriendly, + friendlyToArray, + getAbiEntry, +} from '@delvtech/evm-client/contract'; export type { - CreateReadContractOptions, - EthersReadContract, -} from 'src/contract/createReadContract'; -export type { ReadWriteContractOptions } from 'src/contract/createReadWriteContract'; + AbiArrayType, + AbiEntry, + AbiEntryName, + AbiFriendlyType, + CachedReadContract, + CachedReadWriteContract, + ContractDecodeFunctionDataArgs, + ContractEncodeFunctionDataArgs, + ContractGetEventsArgs, + ContractGetEventsOptions, + ContractReadArgs, + ContractReadOptions, + ContractWriteArgs, + ContractWriteOptions, + DecodedFunctionData, + Event, + EventArgs, + EventFilter, + EventName, + FunctionArgs, + FunctionName, + FunctionReturn, + ReadContract, + ReadWriteContract, +} from '@delvtech/evm-client/contract'; -// Re-exports -export { createLruSimpleCache } from '@delvtech/evm-client/factories'; -export * from '@delvtech/evm-client/types'; -export * from '@delvtech/evm-client/utils'; +export * from '@delvtech/evm-client/errors'; +export * from '@delvtech/evm-client/network'; diff --git a/packages/evm-client-viem/src/index.ts b/packages/evm-client-viem/src/index.ts index 73a3c12b..266aedd5 100644 --- a/packages/evm-client-viem/src/index.ts +++ b/packages/evm-client-viem/src/index.ts @@ -1,25 +1,59 @@ -// Errors -export * from '@delvtech/evm-client/errors'; - // Contract -export { createCachedReadContract } from 'src/contract/createCachedReadContract'; -export { createCachedReadWriteContract } from 'src/contract/createCachedReadWriteContract'; -export { createReadContract } from 'src/contract/createReadContract'; -export { createReadWriteContract } from 'src/contract/createReadWriteContract'; +export { + createCachedReadContract, + type CreateCachedReadContractOptions, +} from 'src/contract/createCachedReadContract'; +export { + createCachedReadWriteContract, + type CreateCachedReadWriteContractOptions, +} from 'src/contract/createCachedReadWriteContract'; +export { + createReadContract, + type CreateReadContractOptions, + type ViemReadContract, +} from 'src/contract/createReadContract'; +export { + createReadWriteContract, + type ReadWriteContractOptions, +} from 'src/contract/createReadWriteContract'; // Network export { createNetwork } from 'src/network/createNetwork'; -// Types -export type { CreateCachedReadContractOptions } from 'src/contract/createCachedReadContract'; -export type { CreateCachedReadWriteContractOptions } from 'src/contract/createCachedReadWriteContract'; +// Re-exports +export * from '@delvtech/evm-client/cache'; + +export { + arrayToFriendly, + friendlyToArray, + getAbiEntry, +} from '@delvtech/evm-client/contract'; export type { - CreateReadContractOptions, - ViemReadContract, -} from 'src/contract/createReadContract'; -export type { ReadWriteContractOptions } from 'src/contract/createReadWriteContract'; + AbiArrayType, + AbiEntry, + AbiEntryName, + AbiFriendlyType, + CachedReadContract, + CachedReadWriteContract, + ContractDecodeFunctionDataArgs, + ContractEncodeFunctionDataArgs, + ContractGetEventsArgs, + ContractGetEventsOptions, + ContractReadArgs, + ContractReadOptions, + ContractWriteArgs, + ContractWriteOptions, + DecodedFunctionData, + Event, + EventArgs, + EventFilter, + EventName, + FunctionArgs, + FunctionName, + FunctionReturn, + ReadContract, + ReadWriteContract, +} from '@delvtech/evm-client/contract'; -// Re-exports -export { createLruSimpleCache } from '@delvtech/evm-client/factories'; -export * from '@delvtech/evm-client/types'; -export * from '@delvtech/evm-client/utils'; +export * from '@delvtech/evm-client/errors'; +export * from '@delvtech/evm-client/network'; diff --git a/packages/evm-client/package.json b/packages/evm-client/package.json index 864ecde6..be9345ab 100644 --- a/packages/evm-client/package.json +++ b/packages/evm-client/package.json @@ -8,26 +8,26 @@ "types": "./dist/index.d.ts", "default": "./dist/index.js" }, + "./cache": { + "types": "./dist/cache.d.ts", + "default": "./dist/cache.js" + }, + "./contract": { + "types": "./dist/contract.d.ts", + "default": "./dist/contract.js" + }, "./errors": { "types": "./dist/errors.d.ts", "default": "./dist/errors.js" }, - "./factories": { - "types": "./dist/factories.d.ts", - "default": "./dist/factories.js" + "./network": { + "types": "./dist/network.d.ts", + "default": "./dist/network.js" }, "./stubs": { "types": "./dist/stubs.d.ts", "default": "./dist/stubs.js" }, - "./types": { - "types": "./dist/types.d.ts", - "default": "./dist/types.js" - }, - "./utils": { - "types": "./dist/utils.d.ts", - "default": "./dist/utils.js" - }, "./package.json": "./package.json" }, "scripts": { diff --git a/packages/evm-client/src/exports/cache.ts b/packages/evm-client/src/exports/cache.ts new file mode 100644 index 00000000..84a4f392 --- /dev/null +++ b/packages/evm-client/src/exports/cache.ts @@ -0,0 +1,3 @@ +export { createLruSimpleCache } from 'src/cache/factories/createLruSimpleCache'; +export type { SimpleCache, SimpleCacheKey } from 'src/cache/types/SimpleCache'; +export { createSimpleCacheKey } from 'src/cache/utils/createSimpleCacheKey'; diff --git a/packages/evm-client/src/exports/types.ts b/packages/evm-client/src/exports/contract.ts similarity index 53% rename from packages/evm-client/src/exports/types.ts rename to packages/evm-client/src/exports/contract.ts index 5b8f978e..8969eee0 100644 --- a/packages/evm-client/src/exports/types.ts +++ b/packages/evm-client/src/exports/contract.ts @@ -1,9 +1,14 @@ -// Cache -export type { SimpleCache, SimpleCacheKey } from 'src/cache/types/SimpleCache'; +// Factories +export { + createCachedReadContract, + type CreateCachedReadContractOptions, +} from 'src/contract/factories/createCachedReadContract'; +export { + createCachedReadWriteContract, + type CreateCachedReadWriteContractOptions, +} from 'src/contract/factories/createCachedReadWriteContract'; -// Contract -export type { CreateCachedReadContractOptions } from 'src/contract/factories/createCachedReadContract'; -export type { CreateCachedReadWriteContractOptions } from 'src/contract/factories/createCachedReadWriteContract'; +// Types export type { AbiArrayType, AbiEntry, @@ -39,16 +44,7 @@ export type { FunctionReturn, } from 'src/contract/types/Function'; -// Network -export type { Block, BlockTag } from 'src/network/types/Block'; -export type { - Network, - NetworkGetBlockArgs, - NetworkGetBlockOptions, - NetworkGetTransactionArgs, -} from 'src/network/types/Network'; -export type { - MinedTransaction, - Transaction, - TransactionInfo, -} from 'src/network/types/Transaction'; +// Utils +export { arrayToFriendly } from 'src/contract/utils/arrayToFriendly'; +export { friendlyToArray } from 'src/contract/utils/friendlyToArray'; +export { getAbiEntry } from 'src/contract/utils/getAbiEntry'; diff --git a/packages/evm-client/src/exports/factories.ts b/packages/evm-client/src/exports/factories.ts deleted file mode 100644 index fadcb31e..00000000 --- a/packages/evm-client/src/exports/factories.ts +++ /dev/null @@ -1,6 +0,0 @@ -// Cache -export { createLruSimpleCache } from 'src/cache/factories/createLruSimpleCache'; - -// Contract -export { createCachedReadContract } from 'src/contract/factories/createCachedReadContract'; -export { createCachedReadWriteContract } from 'src/contract/factories/createCachedReadWriteContract'; diff --git a/packages/evm-client/src/exports/index.ts b/packages/evm-client/src/exports/index.ts index bcb8bb22..f8902526 100644 --- a/packages/evm-client/src/exports/index.ts +++ b/packages/evm-client/src/exports/index.ts @@ -1,4 +1,4 @@ +export * from 'src/exports/cache'; +export * from 'src/exports/contract'; export * from 'src/exports/errors'; -export * from 'src/exports/factories'; -export * from 'src/exports/types'; -export * from 'src/exports/utils'; +export * from 'src/exports/network'; diff --git a/packages/evm-client/src/exports/network.ts b/packages/evm-client/src/exports/network.ts new file mode 100644 index 00000000..9bd3ad01 --- /dev/null +++ b/packages/evm-client/src/exports/network.ts @@ -0,0 +1,12 @@ +export type { Block, BlockTag } from 'src/network/types/Block'; +export type { + Network, + NetworkGetBlockArgs, + NetworkGetBlockOptions, + NetworkGetTransactionArgs, +} from 'src/network/types/Network'; +export type { + MinedTransaction, + Transaction, + TransactionInfo, +} from 'src/network/types/Transaction'; diff --git a/packages/evm-client/src/exports/utils.ts b/packages/evm-client/src/exports/utils.ts deleted file mode 100644 index 5b2e625d..00000000 --- a/packages/evm-client/src/exports/utils.ts +++ /dev/null @@ -1,7 +0,0 @@ -// Cache -export { createSimpleCacheKey } from 'src/cache/utils/createSimpleCacheKey'; - -// Contract -export { arrayToFriendly } from 'src/contract/utils/arrayToFriendly'; -export { friendlyToArray } from 'src/contract/utils/friendlyToArray'; -export { getAbiEntry } from 'src/contract/utils/getAbiEntry'; diff --git a/packages/evm-client/tsup.config.ts b/packages/evm-client/tsup.config.ts index 21e355a9..3d385445 100644 --- a/packages/evm-client/tsup.config.ts +++ b/packages/evm-client/tsup.config.ts @@ -5,12 +5,12 @@ export default defineConfig({ // easier for wrapper packages to selectively re-export `*` from some entry // points and while augmenting or modifying others. entry: [ + 'src/exports/cache.ts', + 'src/exports/contract.ts', 'src/exports/errors.ts', - 'src/exports/factories.ts', 'src/exports/index.ts', + 'src/exports/network.ts', 'src/exports/stubs.ts', - 'src/exports/types.ts', - 'src/exports/utils.ts', ], format: ['esm'], sourcemap: true,