Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/sour-crabs-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"abitype": minor
---

Deprecated human-readable ABI utilities in favor of Ox's `Abi`, `AbiItem`, `AbiParameter`, and `AbiParameters` modules.
6 changes: 6 additions & 0 deletions packages/abitype/src/human-readable/formatAbi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { type FormatAbiItem, formatAbiItem } from './formatAbiItem.js'
*
* @param abi - ABI
* @returns Human-readable ABI
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `Abi.format.ReturnType` instead: `import { Abi } from 'ox'`.
*/
export type FormatAbi<abi extends Abi | readonly unknown[]> = Abi extends abi
? readonly string[]
Expand All @@ -22,6 +25,9 @@ export type FormatAbi<abi extends Abi | readonly unknown[]> = Abi extends abi
*
* @param abi - ABI
* @returns Human-readable ABI
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `Abi.format` instead: `import { Abi } from 'ox'`.
*/
export function formatAbi<const abi extends Abi | readonly unknown[]>(
abi: abi,
Expand Down
6 changes: 6 additions & 0 deletions packages/abitype/src/human-readable/formatAbiItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import type { AssertName } from './types/signatures.js'
*
* @param abiItem - ABI item
* @returns Human-readable ABI item
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiItem.format.ReturnType` instead: `import { AbiItem } from 'ox'`.
*/
export type FormatAbiItem<abiItem extends Abi[number]> =
Abi[number] extends abiItem
Expand Down Expand Up @@ -94,6 +97,9 @@ type FormatAbiParameters<
*
* @param abiItem - ABI item
* @returns Human-readable ABI item
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiItem.format` instead: `import { AbiItem } from 'ox'`.
*/
export function formatAbiItem<const abiItem extends Abi[number]>(
abiItem: abiItem,
Expand Down
7 changes: 7 additions & 0 deletions packages/abitype/src/human-readable/formatAbiParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import type { AssertName } from './types/signatures.js'
* @param abiParameter - ABI parameter
* @returns Human-readable ABI parameter
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameter.format.ReturnType` instead: `import { AbiParameter } from
* 'ox'`.
*
* @example
* type Result = FormatAbiParameter<{ type: 'address'; name: 'from'; }>
* // ^? type Result = 'address from'
Expand Down Expand Up @@ -60,6 +64,9 @@ const tupleRegex = /^tuple(?<array>(\[(\d*)\])*)$/
* @param abiParameter - ABI parameter
* @returns Human-readable ABI parameter
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameter.format` instead: `import { AbiParameter } from 'ox'`.
*
* @example
* const result = formatAbiParameter({ type: 'address', name: 'from' })
* // ^? const result: 'address from'
Expand Down
7 changes: 7 additions & 0 deletions packages/abitype/src/human-readable/formatAbiParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import {
* @param abiParameters - ABI parameters
* @returns Human-readable ABI parameters
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameters.format.ReturnType` instead: `import { AbiParameters } from
* 'ox'`.
*
* @example
* type Result = FormatAbiParameters<[
* // ^? type Result = 'address from, uint256 tokenId'
Expand All @@ -36,6 +40,9 @@ export type FormatAbiParameters<
* @param abiParameters - ABI parameters
* @returns Human-readable ABI parameters
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameters.format` instead: `import { AbiParameters } from 'ox'`.
*
* @example
* const result = formatAbiParameters([
* // ^? const result: 'address from, uint256 tokenId'
Expand Down
6 changes: 6 additions & 0 deletions packages/abitype/src/human-readable/parseAbi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ import type { ParseSignature } from './types/utils.js'
* @param signatures - Human-readable ABI
* @returns Parsed {@link Abi}
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `Abi.from.ReturnType` instead: `import { Abi } from 'ox'`.
*
* @example
* type Result = ParseAbi<
* // ^? type Result = readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
Expand Down Expand Up @@ -49,6 +52,9 @@ export type ParseAbi<signatures extends readonly string[]> =
* @param signatures - Human-Readable ABI
* @returns Parsed {@link Abi}
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `Abi.from` instead: `import { Abi } from 'ox'`.
*
* @example
* const abi = parseAbi([
* // ^? const abi: readonly [{ name: "balanceOf"; type: "function"; stateMutability:...
Expand Down
6 changes: 6 additions & 0 deletions packages/abitype/src/human-readable/parseAbiItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ import type { ParseSignature } from './types/utils.js'
* @param signature - Human-readable ABI item
* @returns Parsed {@link Abi} item
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiItem.from.ReturnType` instead: `import { AbiItem } from 'ox'`.
*
* @example
* type Result = ParseAbiItem<'function balanceOf(address owner) view returns (uint256)'>
* // ^? type Result = { name: "balanceOf"; type: "function"; stateMutability: "view";...
Expand Down Expand Up @@ -63,6 +66,9 @@ export type ParseAbiItem<
* @param signature - Human-readable ABI item
* @returns Parsed {@link Abi} item
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiItem.from` instead: `import { AbiItem } from 'ox'`.
*
* @example
* const abiItem = parseAbiItem('function balanceOf(address owner) view returns (uint256)')
* // ^? const abiItem: { name: "balanceOf"; type: "function"; stateMutability: "view";...
Expand Down
7 changes: 7 additions & 0 deletions packages/abitype/src/human-readable/parseAbiParameter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import type { ParseAbiParameter as ParseAbiParameter_ } from './types/utils.js'
* @param param - Human-readable ABI parameter
* @returns Parsed {@link AbiParameter}
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameter.from.ReturnType` instead: `import { AbiParameter } from
* 'ox'`.
*
* @example
* type Result = ParseAbiParameter<'address from'>
* // ^? type Result = { type: "address"; name: "from"; }
Expand Down Expand Up @@ -64,6 +68,9 @@ export type ParseAbiParameter<
* @param param - Human-readable ABI parameter
* @returns Parsed {@link AbiParameter}
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameter.from` instead: `import { AbiParameter } from 'ox'`.
*
* @example
* const abiParameter = parseAbiParameter('address from')
* // ^? const abiParameter: { type: "address"; name: "from"; }
Expand Down
7 changes: 7 additions & 0 deletions packages/abitype/src/human-readable/parseAbiParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import type { ParseAbiParameters as ParseAbiParameters_ } from './types/utils.js
* @param params - Human-readable ABI parameters
* @returns Parsed {@link AbiParameter}s
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameters.from.ReturnType` instead: `import { AbiParameters } from
* 'ox'`.
*
* @example
* type Result = ParseAbiParameters('address from, address to, uint256 amount')
* // ^? type Result: [{ type: "address"; name: "from"; }, { type: "address";...
Expand Down Expand Up @@ -88,6 +92,9 @@ type DeepFlatten<
* @param params - Human-readable ABI parameters
* @returns Parsed {@link AbiParameter}s
*
* @deprecated Human-readable ABI utilities are moving to Ox. Install `ox` and
* use `AbiParameters.from` instead: `import { AbiParameters } from 'ox'`.
*
* @example
* const abiParameters = parseAbiParameters('address from, address to, uint256 amount')
* // ^? const abiParameters: [{ type: "address"; name: "from"; }, { type: "address";...
Expand Down
Loading