Class SmartContract<TContract>Beta

Custom contract dynamic class with feature detection

Example

import { ThirdwebSDK } from "@thirdweb-dev/sdk";

const sdk = new ThirdwebSDK(provider);
const contract = await sdk.getContract("{{contract_address}}");

// call any function in your contract
await contract.call("myCustomFunction", [param1, param2]);

// if your contract follows the ERC721 standard, contract.nft will be present
const allNFTs = await contract.erc721.query.all()

// if your contract extends IMintableERC721, contract.nft.mint() will be available
const tx = await contract.erc721.mint({
name: "Cool NFT",
image: readFileSync("some_image.png"),
});

Type Parameters

Hierarchy

  • SmartContract

Implements

  • UpdateableNetwork

Constructors

  • Type Parameters

    Parameters

    • network: NetworkInput
    • address: string
    • abi: objectInputType<{
          inputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          name: ZodDefault<ZodString>;
          outputs: ZodDefault<ZodArray<ZodObject<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, "strip", ZodAny, objectOutputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">, objectInputType<{
              components: ZodOptional<ZodArray<ZodObject<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, "strip", ZodAny, objectOutputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">, objectInputType<{
                  name: ZodDefault<ZodString>;
                  type: ZodString;
              }, ZodAny, "strip">>, "many">>;
              name: ZodDefault<ZodString>;
              stateMutability: ZodOptional<ZodString>;
              type: ZodString;
          }, ZodAny, "strip">>, "many">>;
          type: ZodString;
      }, ZodAny, "strip">[]
    • storage: ThirdwebStorage<IpfsUploadBatchOptions>
    • options: undefined | {
          clientId?: string;
          gasSettings?: { maxPriceInGwei?: number | undefined; speed?: "standard" | "fast" | "fastest" | undefined; };
          gasless?: ({ openzeppelin: { relayerUrl: string; relayerForwarderAddress?: string | undefined; useEOAForwarder?: boolean | undefined; domainName?: string | undefined; domainVersion?: string | undefined; }; experimentalChainlessSupport?: boolean | undefined; }) | ({ biconomy: { apiId: string; apiKey: string; deadlineSeconds?: number | undefined; }; });
          gatewayUrls?: string[];
          readonlySettings?: { rpcUrl: string; chainId?: number | undefined; };
          secretKey?: string;
          supportedChains?: ({ rpc: string[]; chainId: number; nativeCurrency: { symbol: string; name: string; decimals: number; }; slug: string; })[];
      } = {}
    • chainId: number
    • contractWrapper: ContractWrapper<TContract> = ...

    Returns SmartContract<TContract>

Properties

_chainId: number
contractWrapper: ContractWrapper<TContract>
encoder: ContractEncoder<TContract>
estimator: GasCostEstimator<TContract>
events: ContractEvents<TContract>
interceptor: ContractInterceptor<TContract>
metadata: ContractMetadata<BaseContract, {
    deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        platform_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        platform_fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        primary_sale_recipient: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
        trusted_forwarders: ZodOptional<ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        merkle?: Record<string, string>;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient?: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        merkle?: Record<string, string>;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient?: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>;
    input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, "strip", ZodAny, objectOutputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">, objectInputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">>;
    output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, "strip", ZodAny, objectOutputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">, objectInputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">>;
}>

Type declaration

  • deploy: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        platform_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        platform_fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        primary_sale_recipient: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
        trusted_forwarders: ZodOptional<ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>>;
    }, "strip", ZodTypeAny, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        merkle?: Record<string, string>;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient?: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }, {
        app_uri?: string;
        description?: string;
        external_link?: string;
        fee_recipient?: string;
        image?: any;
        merkle?: Record<string, string>;
        name: string;
        platform_fee_basis_points?: number;
        platform_fee_recipient?: string;
        primary_sale_recipient?: string;
        seller_fee_basis_points?: number;
        social_urls?: Record<string, string>;
        symbol?: string;
        trusted_forwarders?: string[];
    }>
  • input: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, "strip", ZodAny, objectOutputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">, objectInputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
            data: ZodUnion<[ZodTypeAny, ZodString]>;
            name: ZodString;
        }, "strip", ZodTypeAny, {
            data?: any;
            name: string;
        }, {
            data?: any;
            name: string;
        }>]>, ZodString]>>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">>
  • output: ZodObject<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, "strip", ZodAny, objectOutputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">, objectInputType<{
        app_uri: ZodOptional<ZodString>;
        description: ZodOptional<ZodString>;
        external_link: ZodOptional<ZodString>;
        fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
        image: ZodOptional<ZodString>;
        merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
        name: ZodString;
        seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
        social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
        symbol: ZodOptional<ZodDefault<ZodString>>;
    }, ZodAny, "strip">>
publishedMetadata: ContractPublishedMetadata<TContract>
storage: ThirdwebStorage<IpfsUploadBatchOptions>

Accessors

  • get abi(): objectOutputType<{
        inputs: ZodDefault<ZodArray<ZodObject<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        outputs: ZodDefault<ZodArray<ZodObject<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        type: ZodString;
    }, ZodAny, "strip">[]
  • Returns objectOutputType<{
        inputs: ZodDefault<ZodArray<ZodObject<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        name: ZodDefault<ZodString>;
        outputs: ZodDefault<ZodArray<ZodObject<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, "strip", ZodAny, objectOutputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">, objectInputType<{
            components: ZodOptional<ZodArray<ZodObject<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, "strip", ZodAny, objectOutputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">, objectInputType<{
                name: ZodDefault<ZodString>;
                type: ZodString;
            }, ZodAny, "strip">>, "many">>;
            name: ZodDefault<ZodString>;
            stateMutability: ZodOptional<ZodString>;
            type: ZodString;
        }, ZodAny, "strip">>, "many">>;
        type: ZodString;
    }, ZodAny, "strip">[]

  • get accountFactory(): AccountFactory<IAccountFactory>
  • Account Factory

    Returns AccountFactory<IAccountFactory>

    Remarks

    Create accounts and fetch data about them.

    Example


    // Predict the address of the account that will be created for an admin.
    const deterministicAddress = await contract.accountFactory.predictAccountAddress(admin, extraData);

    // Create accounts
    const tx = await contract.accountFactory.createAccount(admin, extraData);
    // the same as `deterministicAddress`
    const accountAddress = tx.address;

    // Get all accounts created by the factory
    const allAccounts = await contract.accountFactory.getAllAccounts();

    // Get all accounts on which a signer has been given authority.
    const associatedAccounts = await contract.accountFactory.getAssociatedAccounts(signer);

    // Get all signers who have been given authority on a account.
    const associatedSigners = await contract.accountFactory.getAssociatedSigners(accountAddress);

    // Check whether a account has already been created for a given admin.
    const isAccountDeployed = await contract.accountFactory.isAccountDeployed(admin, extraData);
  • get directListings(): MarketplaceV3DirectListings<DirectListingsLogic>
  • Direct listings

    Returns MarketplaceV3DirectListings<DirectListingsLogic>

    Remarks

    Create and manage direct listings in your marketplace.

    // Data of the listing you want to create
    const listing = {
    // address of the contract the asset you want to list is on
    assetContractAddress: "0x...",
    // token ID of the asset you want to list
    tokenId: "0",
    // how many of the asset you want to list
    quantity: 1,
    // address of the currency contract that will be used to pay for the listing
    currencyContractAddress: NATIVE_TOKEN_ADDRESS,
    // The price to pay per unit of NFTs listed.
    pricePerToken: 1.5,
    // when should the listing open up for offers
    startTimestamp: new Date(Date.now()),
    // how long the listing will be open for
    endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
    // Whether the listing is reserved for a specific set of buyers.
    isReservedListing: false
    }

    const tx = await contract.directListings.createListing(listing);
    const receipt = tx.receipt; // the transaction receipt
    const id = tx.id; // the id of the newly created listing

    // And on the buyers side:
    // The ID of the listing you want to buy from
    const listingId = 0;
    // Quantity of the asset you want to buy
    const quantityDesired = 1;

    await contract.directListings.buyFromListing(listingId, quantityDesired);
  • get englishAuctions(): MarketplaceV3EnglishAuctions<EnglishAuctionsLogic>
  • Auctions

    Returns MarketplaceV3EnglishAuctions<EnglishAuctionsLogic>

    Remarks

    Create and manage auctions in your marketplace.

    Example

    // Data of the auction you want to create
    const auction = {
    // address of the contract of the asset you want to auction
    assetContractAddress: "0x...",
    // token ID of the asset you want to auction
    tokenId: "0",
    // how many of the asset you want to auction
    quantity: 1,
    // address of the currency contract that will be used to pay for the auctioned tokens
    currencyContractAddress: NATIVE_TOKEN_ADDRESS,
    // the minimum bid that will be accepted for the token
    minimumBidAmount: "1.5",
    // how much people would have to bid to instantly buy the asset
    buyoutBidAmount: "10",
    // If a bid is made less than these many seconds before expiration, the expiration time is increased by this.
    timeBufferInSeconds: "1000",
    // A bid must be at least this much bps greater than the current winning bid
    bidBufferBps: "100", // 100 bps stands for 1%
    // when should the auction open up for bidding
    startTimestamp: new Date(Date.now()),
    // end time of auction
    endTimestamp: new Date(Date.now() + 5 * 24 * 60 * 60 * 1000),
    }

    const tx = await contract.englishAuctions.createAuction(auction);
    const receipt = tx.receipt; // the transaction receipt
    const id = tx.id; // the id of the newly created auction

    // And on the buyers side:
    // The auction ID of the asset you want to bid on
    const auctionId = 0;
    // The total amount you are willing to bid for auctioned tokens
    const bidAmount = 1;

    await contract.englishAuctions.makeBid(auctionId, bidAmount);
  • get offers(): MarketplaceV3Offers<OffersLogic>
  • Offers

    Returns MarketplaceV3Offers<OffersLogic>

    Remarks

    Make and manage offers.

    Example

    // Data of the offer you want to make
    const offer = {
    // address of the contract the asset you want to make an offer for
    assetContractAddress: "0x...",
    // token ID of the asset you want to buy
    tokenId: "0",
    // how many of the asset you want to buy
    quantity: 1,
    // address of the currency contract that you offer to pay in
    currencyContractAddress: NATIVE_TOKEN_ADDRESS,
    // Total price you offer to pay for the mentioned token(s)
    totalPrice: "1.5",
    // Offer valid until
    endTimestamp: new Date(),
    }

    const tx = await contract.offers.makeOffer(offer);
    const receipt = tx.receipt; // the transaction receipt
    const id = tx.id; // the id of the newly created offer

    // And on the seller's side:
    // The ID of the offer you want to accept
    const offerId = 0;
    await contract.offers.acceptOffer(offerId);

Methods

  • Call any function on this contract

    Type Parameters

    • TMethod extends string | number | symbol = keyof TContract["functions"]

    Parameters

    • functionName: string & TMethod

      the name of the function to call

    • Optional args: Parameters<TContract["functions"][TMethod]>

      the arguments of the function

    • Optional overrides: CallOverrides

    Returns Promise<ReturnType<TContract["functions"][TMethod]>>

    Example

    // read functions will return the data from the contract
    const myValue = await contract.call("myReadFunction");
    console.log(myValue);

    // write functions will return the transaction receipt
    const tx = await contract.call("myWriteFunction", [arg1, arg2]);
    const receipt = tx.receipt;

    // Optionally override transaction options
    await contract.call("myWriteFunction", [arg1, arg2], {
    gasLimit: 1000000, // override default gas limit
    value: ethers.utils.parseEther("0.1"), // send 0.1 ether with the contract call
    };

  • FEATURE DETECTION


    Returns undefined | ContractRoyalty<TContract & IRoyalty, {
        deploy: ZodObject<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
                data: ZodUnion<[ZodTypeAny, ZodString]>;
                name: ZodString;
            }, "strip", ZodTypeAny, {
                data?: any;
                name: string;
            }, {
                data?: any;
                name: string;
            }>]>, ZodString]>>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            platform_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            platform_fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            primary_sale_recipient: ZodOptional<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
            trusted_forwarders: ZodOptional<ZodDefault<ZodArray<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>, "many">>>;
        }, "strip", ZodTypeAny, {
            app_uri?: string;
            description?: string;
            external_link?: string;
            fee_recipient?: string;
            image?: any;
            merkle?: Record<string, string>;
            name: string;
            platform_fee_basis_points?: number;
            platform_fee_recipient?: string;
            primary_sale_recipient?: string;
            seller_fee_basis_points?: number;
            social_urls?: Record<string, string>;
            symbol?: string;
            trusted_forwarders?: string[];
        }, {
            app_uri?: string;
            description?: string;
            external_link?: string;
            fee_recipient?: string;
            image?: any;
            merkle?: Record<string, string>;
            name: string;
            platform_fee_basis_points?: number;
            platform_fee_recipient?: string;
            primary_sale_recipient?: string;
            seller_fee_basis_points?: number;
            social_urls?: Record<string, string>;
            symbol?: string;
            trusted_forwarders?: string[];
        }>;
        input: ZodObject<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
                data: ZodUnion<[ZodTypeAny, ZodString]>;
                name: ZodString;
            }, "strip", ZodTypeAny, {
                data?: any;
                name: string;
            }, {
                data?: any;
                name: string;
            }>]>, ZodString]>>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, "strip", ZodAny, objectOutputType<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
                data: ZodUnion<[ZodTypeAny, ZodString]>;
                name: ZodString;
            }, "strip", ZodTypeAny, {
                data?: any;
                name: string;
            }, {
                data?: any;
                name: string;
            }>]>, ZodString]>>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, ZodAny, "strip">, objectInputType<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodUnion<[ZodUnion<[ZodTypeAny, ZodObject<{
                data: ZodUnion<[ZodTypeAny, ZodString]>;
                name: ZodString;
            }, "strip", ZodTypeAny, {
                data?: any;
                name: string;
            }, {
                data?: any;
                name: string;
            }>]>, ZodString]>>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, ZodAny, "strip">>;
        output: ZodObject<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodString>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, "strip", ZodAny, objectOutputType<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodString>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, ZodAny, "strip">, objectInputType<{
            app_uri: ZodOptional<ZodString>;
            description: ZodOptional<ZodString>;
            external_link: ZodOptional<ZodString>;
            fee_recipient: ZodOptional<ZodDefault<ZodUnion<[ZodType<string, ZodTypeDef, string>, ZodType<`0x${string}`, ZodTypeDef, `${string}.eth` | `${string}.cb.id`>]>>>;
            image: ZodOptional<ZodString>;
            merkle: ZodOptional<ZodDefault<ZodRecord<ZodString, ZodString>>>;
            name: ZodString;
            seller_fee_basis_points: ZodOptional<ZodDefault<ZodNumber>>;
            social_urls: ZodOptional<ZodRecord<ZodString, ZodString>>;
            symbol: ZodOptional<ZodDefault<ZodString>>;
        }, ZodAny, "strip">>;
    }>

  • Prepare a transaction for sending

    Type Parameters

    • TMethod extends string | number | symbol = keyof TContract["functions"]

    Parameters

    • method: string & TMethod
    • args: any[] & Parameters<TContract["functions"][TMethod]>
    • Optional overrides: CallOverrides

    Returns Transaction<Omit<TransactionResultWithMetadata<unknown>, "data">>

Generated using TypeDoc