diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts index 4355d96..a0e7c12 100644 --- a/docs/.vitepress/config.mts +++ b/docs/.vitepress/config.mts @@ -196,10 +196,6 @@ export default defineConfig({ text: "createERC721Data", link: "", }, - { - text: "createERC721DataID", - link: "", - }, ], }, { @@ -245,10 +241,6 @@ export default defineConfig({ text: "getERC721Data", link: "", }, - { - text: "getERC721DataID", - link: "", - }, ], }, { diff --git a/packages/core/src/erc1155/index.ts b/packages/core/src/erc1155/index.ts index 899fbf7..8efebb8 100644 --- a/packages/core/src/erc1155/index.ts +++ b/packages/core/src/erc1155/index.ts @@ -1,4 +1,5 @@ export type { + BaseERC1155, ERC1155, ERC1155Data, } from "./types.js"; diff --git a/packages/core/src/erc1155/publicActions/getERC1155.ts b/packages/core/src/erc1155/publicActions/getERC1155.ts index 1dfdcbf..1044488 100644 --- a/packages/core/src/erc1155/publicActions/getERC1155.ts +++ b/packages/core/src/erc1155/publicActions/getERC1155.ts @@ -2,18 +2,18 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { readContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC1155 } from "../types.js"; +import type { BaseERC1155 } from "../types.js"; import { createERC1155 } from "../utils.js"; export type GetERC1155Parameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" > & { - erc1155: Pick & - Partial>; + erc1155: Pick & + Partial>; }; -export type GetERC1155ReturnType = ERC1155; +export type GetERC1155ReturnType = BaseERC1155; export const getERC1155 = < TChain extends Chain | undefined, diff --git a/packages/core/src/erc1155/publicActions/getERC1155BalanceOf.ts b/packages/core/src/erc1155/publicActions/getERC1155BalanceOf.ts index aef8698..31a9afa 100644 --- a/packages/core/src/erc1155/publicActions/getERC1155BalanceOf.ts +++ b/packages/core/src/erc1155/publicActions/getERC1155BalanceOf.ts @@ -8,20 +8,20 @@ import type { import { readContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC1155, ERC1155Data } from "../types.js"; +import type { BaseERC1155, ERC1155Data } from "../types.js"; import { createERC1155Data } from "../utils.js"; -export type GetERC1155BalanceOfParameters = Omit< +export type GetERC1155BalanceOfParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" > & { erc1155: TERC1155; address: Address }; -export type GetERC1155BalanceOfReturnType = +export type GetERC1155BalanceOfReturnType = ERC1155Data; export const getERC1155BalanceOf = < TChain extends Chain | undefined, - TERC1155 extends ERC1155, + TERC1155 extends BaseERC1155, T extends "select" | undefined, >( client: Client, diff --git a/packages/core/src/erc1155/publicActions/getERC1155IsApprovedForAll.ts b/packages/core/src/erc1155/publicActions/getERC1155IsApprovedForAll.ts index 5bed0d9..9f06db2 100644 --- a/packages/core/src/erc1155/publicActions/getERC1155IsApprovedForAll.ts +++ b/packages/core/src/erc1155/publicActions/getERC1155IsApprovedForAll.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC1155 } from "../types.js"; +import type { BaseERC1155 } from "../types.js"; export type GetERC1155IsApprovedForAllParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc1155: Pick; owner: Address; spender: Address }; +> & { erc1155: Pick; owner: Address; spender: Address }; export type GetERC1155IsApprovedForAllReturnType = boolean; diff --git a/packages/core/src/erc1155/publicActions/getERC1155URI.ts b/packages/core/src/erc1155/publicActions/getERC1155URI.ts index 8a36ae7..e4bab89 100644 --- a/packages/core/src/erc1155/publicActions/getERC1155URI.ts +++ b/packages/core/src/erc1155/publicActions/getERC1155URI.ts @@ -2,12 +2,12 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { readContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC1155 } from "../types.js"; +import type { BaseERC1155 } from "../types.js"; export type GetERC1155URIParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc1155: Pick }; +> & { erc1155: Pick }; export type GetERC1155URIReturnType = string; diff --git a/packages/core/src/erc1155/types.ts b/packages/core/src/erc1155/types.ts index 4480e08..f587206 100644 --- a/packages/core/src/erc1155/types.ts +++ b/packages/core/src/erc1155/types.ts @@ -2,14 +2,16 @@ import type { Address } from "viem"; import type { Amount } from "../amount/types.js"; import type { Token } from "../types/token.js"; -export type ERC1155 = Token<"erc1155"> & { +export type BaseERC1155 = Token & { address: Address; id: bigint; uri: string; blockCreated: bigint; }; -export type ERC1155Data = Amount< +export type ERC1155 = BaseERC1155<"erc1155">; + +export type ERC1155Data = Amount< TERC1155, `${TERC1155["type"]}Data` >; diff --git a/packages/core/src/erc1155/utils.ts b/packages/core/src/erc1155/utils.ts index 883843d..fc43aee 100644 --- a/packages/core/src/erc1155/utils.ts +++ b/packages/core/src/erc1155/utils.ts @@ -1,5 +1,5 @@ import { type Address, getAddress } from "viem"; -import type { ERC1155, ERC1155Data } from "./types.js"; +import type { BaseERC1155, ERC1155, ERC1155Data } from "./types.js"; /** * Creates an {@link ERC1155} @@ -22,7 +22,7 @@ export const createERC1155 = ( /** * Creates an {@link ERC1155Data} */ -export const createERC1155Data = ( +export const createERC1155Data = ( erc1155: TERC1155, amount: bigint, ): ERC1155Data => ({ diff --git a/packages/core/src/erc1155/walletActions/simulateERC1155SetApprovalForAll.ts b/packages/core/src/erc1155/walletActions/simulateERC1155SetApprovalForAll.ts index e61f602..433f5c4 100644 --- a/packages/core/src/erc1155/walletActions/simulateERC1155SetApprovalForAll.ts +++ b/packages/core/src/erc1155/walletActions/simulateERC1155SetApprovalForAll.ts @@ -8,10 +8,10 @@ import type { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155 } from "../../generated.js"; -import type { ERC1155 } from "../types.js"; +import type { BaseERC1155 } from "../types.js"; export type ERC1155SetApprovalForAllParameters = { - erc1155: Pick; + erc1155: Pick; spender: Address; approved: boolean; }; diff --git a/packages/core/src/erc1155/walletActions/simulateERC1155Transfer.ts b/packages/core/src/erc1155/walletActions/simulateERC1155Transfer.ts index 49824d2..dfa6262 100644 --- a/packages/core/src/erc1155/walletActions/simulateERC1155Transfer.ts +++ b/packages/core/src/erc1155/walletActions/simulateERC1155Transfer.ts @@ -9,10 +9,10 @@ import type { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155 } from "../../generated.js"; -import type { ERC1155, ERC1155Data } from "../types.js"; +import type { BaseERC1155, ERC1155Data } from "../types.js"; export type ERC1155TransferParameters = { - erc1155Data: ERC1155Data; + erc1155Data: ERC1155Data; from?: Address; to: Address; data?: Hex; diff --git a/packages/core/src/erc1155/walletActions/simulateERC1155TransferBatch.ts b/packages/core/src/erc1155/walletActions/simulateERC1155TransferBatch.ts index ce442a8..557f514 100644 --- a/packages/core/src/erc1155/walletActions/simulateERC1155TransferBatch.ts +++ b/packages/core/src/erc1155/walletActions/simulateERC1155TransferBatch.ts @@ -10,10 +10,10 @@ import { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc1155ABI as solmateERC1155 } from "../../generated.js"; -import type { ERC1155, ERC1155Data } from "../types.js"; +import type { BaseERC1155, ERC1155Data } from "../types.js"; export type ERC1155TransferBatchParameters = { - erc1155Data: ERC1155Data[]; + erc1155Data: ERC1155Data[]; from?: Address; to: Address; data?: Hex; diff --git a/packages/core/src/erc721/index.ts b/packages/core/src/erc721/index.ts index 66cd6cd..8211afb 100644 --- a/packages/core/src/erc721/index.ts +++ b/packages/core/src/erc721/index.ts @@ -1,4 +1,5 @@ export type { + BaseERC721, ERC721, ERC721Data, } from "./types.js"; diff --git a/packages/core/src/erc721/publicActions/getERC721.ts b/packages/core/src/erc721/publicActions/getERC721.ts index 7c4d27b..abd77dc 100644 --- a/packages/core/src/erc721/publicActions/getERC721.ts +++ b/packages/core/src/erc721/publicActions/getERC721.ts @@ -1,7 +1,7 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; import { createERC721 } from "../utils.js"; import { getERC721Name } from "./getERC721Name.js"; import { getERC721Symbol } from "./getERC721Symbol.js"; @@ -10,11 +10,11 @@ export type GetERC721Parameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" > & { - erc721: Pick & - Partial>; + erc721: Pick & + Partial>; }; -export type GetERC721ReturnType = ERC721; +export type GetERC721ReturnType = BaseERC721; export const getERC721 = < TChain extends Chain | undefined, diff --git a/packages/core/src/erc721/publicActions/getERC721Approved.ts b/packages/core/src/erc721/publicActions/getERC721Approved.ts index 8ef832e..0eac762 100644 --- a/packages/core/src/erc721/publicActions/getERC721Approved.ts +++ b/packages/core/src/erc721/publicActions/getERC721Approved.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721ApprovedParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; id: bigint }; +> & { erc721: Pick; id: bigint }; export type GetERC721ApprovedReturnType = Address; diff --git a/packages/core/src/erc721/publicActions/getERC721BalanceOf.ts b/packages/core/src/erc721/publicActions/getERC721BalanceOf.ts index 00e05c2..69260b0 100644 --- a/packages/core/src/erc721/publicActions/getERC721BalanceOf.ts +++ b/packages/core/src/erc721/publicActions/getERC721BalanceOf.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721BalanceOfParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; address: Address }; +> & { erc721: Pick; address: Address }; export type GetERC721BalanceOfReturnType = bigint; diff --git a/packages/core/src/erc721/publicActions/getERC721Data.ts b/packages/core/src/erc721/publicActions/getERC721Data.ts index 455d8c7..9505ea7 100644 --- a/packages/core/src/erc721/publicActions/getERC721Data.ts +++ b/packages/core/src/erc721/publicActions/getERC721Data.ts @@ -7,21 +7,21 @@ import type { } from "viem"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721, ERC721Data } from "../types.js"; +import type { BaseERC721, ERC721Data } from "../types.js"; import { createERC721Data } from "../utils.js"; import { getERC721BalanceOf } from "./getERC721BalanceOf.js"; -export type GetERC721DataParameters = Omit< +export type GetERC721DataParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" > & { erc721: TERC721; address: Address }; -export type GetERC721DataReturnType = +export type GetERC721DataReturnType = ERC721Data; export const getERC721Data = < TChain extends Chain | undefined, - TERC721 extends ERC721, + TERC721 extends BaseERC721, T extends "select" | undefined, >( client: Client, diff --git a/packages/core/src/erc721/publicActions/getERC721IsApprovedForAll.ts b/packages/core/src/erc721/publicActions/getERC721IsApprovedForAll.ts index 420df7a..41e66c5 100644 --- a/packages/core/src/erc721/publicActions/getERC721IsApprovedForAll.ts +++ b/packages/core/src/erc721/publicActions/getERC721IsApprovedForAll.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721IsApprovedForAllParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; owner: Address; spender: Address }; +> & { erc721: Pick; owner: Address; spender: Address }; export type GetERC721IsApprovedForAllReturnType = boolean; diff --git a/packages/core/src/erc721/publicActions/getERC721Name.ts b/packages/core/src/erc721/publicActions/getERC721Name.ts index 6494551..c66a84b 100644 --- a/packages/core/src/erc721/publicActions/getERC721Name.ts +++ b/packages/core/src/erc721/publicActions/getERC721Name.ts @@ -2,12 +2,12 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721NameParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick }; +> & { erc721: Pick }; export type GetERC721NameReturnType = string; diff --git a/packages/core/src/erc721/publicActions/getERC721OwnerOf.ts b/packages/core/src/erc721/publicActions/getERC721OwnerOf.ts index 5e70660..87aa835 100644 --- a/packages/core/src/erc721/publicActions/getERC721OwnerOf.ts +++ b/packages/core/src/erc721/publicActions/getERC721OwnerOf.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721OwnerOfParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; id: bigint }; +> & { erc721: Pick; id: bigint }; export type GetERC721OwnerOfReturnType = Address; diff --git a/packages/core/src/erc721/publicActions/getERC721SupportsInterface.ts b/packages/core/src/erc721/publicActions/getERC721SupportsInterface.ts index 3ba0392..1f71914 100644 --- a/packages/core/src/erc721/publicActions/getERC721SupportsInterface.ts +++ b/packages/core/src/erc721/publicActions/getERC721SupportsInterface.ts @@ -8,12 +8,12 @@ import type { import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721SupportsInterfaceParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; interfaceID: Hex }; +> & { erc721: Pick; interfaceID: Hex }; export type GetERC721SupportsInterfaceReturnType = boolean; diff --git a/packages/core/src/erc721/publicActions/getERC721Symbol.ts b/packages/core/src/erc721/publicActions/getERC721Symbol.ts index 41b4aff..48ccd1b 100644 --- a/packages/core/src/erc721/publicActions/getERC721Symbol.ts +++ b/packages/core/src/erc721/publicActions/getERC721Symbol.ts @@ -2,12 +2,12 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721SymbolParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick }; +> & { erc721: Pick }; export type GetERC721SymbolReturnType = string; diff --git a/packages/core/src/erc721/publicActions/getERC721TokenURI.ts b/packages/core/src/erc721/publicActions/getERC721TokenURI.ts index 50f3b83..c94cf1c 100644 --- a/packages/core/src/erc721/publicActions/getERC721TokenURI.ts +++ b/packages/core/src/erc721/publicActions/getERC721TokenURI.ts @@ -2,12 +2,12 @@ import type { Chain, Client, ReadContractParameters, Transport } from "viem"; import { readContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721ABI } from "../../generated.js"; import type { ReverseMirage } from "../../types/rm.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type GetERC721TokenURIParameters = Omit< ReadContractParameters, "address" | "abi" | "functionName" | "args" -> & { erc721: Pick; id: bigint }; +> & { erc721: Pick; id: bigint }; export type GetERC721TokenURIReturnType = string; diff --git a/packages/core/src/erc721/types.ts b/packages/core/src/erc721/types.ts index 099106b..3d48a67 100644 --- a/packages/core/src/erc721/types.ts +++ b/packages/core/src/erc721/types.ts @@ -2,15 +2,17 @@ import type { Address } from "viem"; import type { Token, TokenData } from "../types/token.js"; import type { Tuple } from "../types/tuple.js"; -export type ERC721 = Token<"erc721"> & { +export type BaseERC721 = Token & { address: Address; name: string; symbol: string; blockCreated: bigint; }; +export type ERC721 = BaseERC721<"erc721">; + export type ERC721Data< - TERC721 extends ERC721, + TERC721 extends BaseERC721, TBalance extends number = number, > = TokenData< TERC721, diff --git a/packages/core/src/erc721/utils.ts b/packages/core/src/erc721/utils.ts index f9bb7ff..e6f78bd 100644 --- a/packages/core/src/erc721/utils.ts +++ b/packages/core/src/erc721/utils.ts @@ -1,6 +1,6 @@ import { type Address, getAddress } from "viem"; import type { Tuple } from "../types/tuple.js"; -import type { ERC721, ERC721Data } from "./types.js"; +import type { BaseERC721, ERC721, ERC721Data } from "./types.js"; /** * Creates an {@link ERC721} @@ -24,7 +24,7 @@ export const createERC721 = ( * Creates an {@link ERC721Data} */ export const createERC721Data = < - TERC721 extends ERC721, + TERC721 extends BaseERC721, TBalance extends number, >( erc721: TERC721, diff --git a/packages/core/src/erc721/walletActions/simulateERC721Approve.ts b/packages/core/src/erc721/walletActions/simulateERC721Approve.ts index e1e9e7a..9fde2ff 100644 --- a/packages/core/src/erc721/walletActions/simulateERC721Approve.ts +++ b/packages/core/src/erc721/walletActions/simulateERC721Approve.ts @@ -8,10 +8,10 @@ import type { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721 } from "../../generated.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type ERC721ApproveParameters = { - erc721: Pick; + erc721: Pick; id: bigint; spender: Address; }; diff --git a/packages/core/src/erc721/walletActions/simulateERC721SetApprovalForAll.ts b/packages/core/src/erc721/walletActions/simulateERC721SetApprovalForAll.ts index d268f5b..065da18 100644 --- a/packages/core/src/erc721/walletActions/simulateERC721SetApprovalForAll.ts +++ b/packages/core/src/erc721/walletActions/simulateERC721SetApprovalForAll.ts @@ -8,10 +8,10 @@ import type { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721 } from "../../generated.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type ERC721SetApprovalForAllParameters = { - erc721: Pick; + erc721: Pick; spender: Address; approved: boolean; }; diff --git a/packages/core/src/erc721/walletActions/simulateERC721Transfer.ts b/packages/core/src/erc721/walletActions/simulateERC721Transfer.ts index f659314..4198ffe 100644 --- a/packages/core/src/erc721/walletActions/simulateERC721Transfer.ts +++ b/packages/core/src/erc721/walletActions/simulateERC721Transfer.ts @@ -9,10 +9,10 @@ import type { } from "viem"; import { simulateContract } from "viem/contract"; import { solmateErc721ABI as solmateERC721 } from "../../generated.js"; -import type { ERC721 } from "../types.js"; +import type { BaseERC721 } from "../types.js"; export type ERC721TransferParameters = { - erc721: Pick; + erc721: Pick; id: bigint; from?: Address; to: Address; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 95eb46f..ddee3dc 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -64,6 +64,7 @@ export { } from "./erc20/index.js"; export { + type BaseERC721, type ERC721, type ERC721Data, createERC721, @@ -85,6 +86,7 @@ export { } from "./erc721/index.js"; export { + type BaseERC1155, type ERC1155, type ERC1155Data, createERC1155,