Class ContractMetadata<TContract, TSchema>

Handles metadata for a Contract

Remarks

Read and update metadata for this contract

Example

const contract = await sdk.getContract("{{contract_address}}");
const metadata = await contract.metadata.get();
await contract.metadata.set({
name: "My Contract",
description: "My contract description"
})

Type Parameters

  • TContract extends BaseContract

  • TSchema extends IGenericSchemaType

Hierarchy

  • ContractMetadata

Implements

  • DetectableFeature

Constructors

Properties

contractWrapper: ContractWrapper<TContract>
featureName: "ContractMetadata" = FEATURE_METADATA.name
schema: TSchema
set: {
    prepare: ((...args) => Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Set the metadata of this contract

      Parameters

      • Rest ...args: [metadata: input<TSchema["input"]>]

      Returns Promise<TResult>

      Remarks

      OVERWRITE the metadata of a contract

      Example

      await contract.metadata.set({
      name: "My Contract",
      description: "My contract description"
      })

      Twfeature

      ContractMetadata

  • prepare: ((...args) => Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>)
      • (...args): Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>
      • Parameters

        • Rest ...args: [metadata: input<TSchema["input"]>]

        Returns Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>

storage: ThirdwebStorage<IpfsUploadBatchOptions>
update: {
    prepare: ((...args) => Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Update the metadata of a contract

      Parameters

      • Rest ...args: [metadata: Partial<input<TSchema["input"]>>]

      Returns Promise<TResult>

      Remarks

      Update the metadata of a contract

      Example

      await contract.metadata.update({
      description: "My new contract description"
      })

      Twfeature

      ContractMetadata

  • prepare: ((...args) => Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>)
      • (...args): Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>
      • Parameters

        • Rest ...args: [metadata: Partial<input<TSchema["input"]>>]

        Returns Promise<Transaction<If<Equals<output<TSchema["output"]>, never>, Omit<TransactionResultWithMetadata<unknown>, "data">, TransactionResultWithMetadata<output<TSchema["output"]>>>>>

Methods

  • Get the metadata of this contract

    Returns Promise<output<TSchema["output"]>>

    the metadata of the given contract

    Remarks

    Get the metadata of a contract

    Example

    const metadata = await contract.metadata.get();
    console.log(metadata);

    Twfeature

    ContractMetadata

Generated using TypeDoc