Class ContractRoyalty<TContract, TSchema>

Handle contract royalties

Remarks

Configure royalties for an entire contract or a particular token.

Example

const contract = await sdk.getContract("{{contract_address}}");
const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
await contract.roles.setTokenRoyaltyInfo(tokenId, {
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});

Type Parameters

  • TContract extends IRoyalty

  • TSchema extends IGenericSchemaType

Hierarchy

  • ContractRoyalty

Implements

  • DetectableFeature

Constructors

Properties

contractWrapper: ContractWrapper<IRoyalty>
featureName: "Royalty" = FEATURE_ROYALTY.name
metadata: ContractMetadata<TContract, TSchema>
setDefaultRoyaltyInfo: {
    prepare: ((...args) => Promise<Transaction<TransactionResultWithMetadata<{
        fee_recipient: string;
        seller_fee_basis_points: number;
    }>>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Set the royalty recipient and fee

      Parameters

      • Rest ...args: [royaltyData: {
            fee_recipient?: string;
            seller_fee_basis_points?: number;
        }]

      Returns Promise<TResult>

      Example

      await contract.roles.setDefaultRoyaltyInfo({
      seller_fee_basis_points: 100, // 1% royalty fee
      fee_recipient: "0x...", // the fee recipient
      });

      Twfeature

      Royalty

  • prepare: ((...args) => Promise<Transaction<TransactionResultWithMetadata<{
        fee_recipient: string;
        seller_fee_basis_points: number;
    }>>>)
      • (...args): Promise<Transaction<TransactionResultWithMetadata<{
            fee_recipient: string;
            seller_fee_basis_points: number;
        }>>>
      • Parameters

        • Rest ...args: [royaltyData: {
              fee_recipient?: string;
              seller_fee_basis_points?: number;
          }]

        Returns Promise<Transaction<TransactionResultWithMetadata<{
            fee_recipient: string;
            seller_fee_basis_points: number;
        }>>>

setTokenRoyaltyInfo: {
    prepare: ((...args) => Promise<Transaction<{
        data: (() => Promise<{
            fee_recipient: string;
            seller_fee_basis_points: number;
        }>);
        receipt: TransactionReceipt;
    }>>);
    (...args): Promise<TResult>;
} = ...

Type declaration

    • (...args): Promise<TResult>
    • Set the royalty recipient and fee for a particular token

      Parameters

      • Rest ...args: [tokenId: BigNumberish, royaltyData: {
            fee_recipient?: string;
            seller_fee_basis_points?: number;
        }]

      Returns Promise<TResult>

      Example

      const tokenId = 0;
      await contract.roles.setTokenRoyaltyInfo(tokenId, {
      seller_fee_basis_points: 100, // 1% royalty fee
      fee_recipient: "0x...", // the fee recipient
      });

      Twfeature

      Royalty

  • prepare: ((...args) => Promise<Transaction<{
        data: (() => Promise<{
            fee_recipient: string;
            seller_fee_basis_points: number;
        }>);
        receipt: TransactionReceipt;
    }>>)
      • (...args): Promise<Transaction<{
            data: (() => Promise<{
                fee_recipient: string;
                seller_fee_basis_points: number;
            }>);
            receipt: TransactionReceipt;
        }>>
      • Parameters

        • Rest ...args: [tokenId: BigNumberish, royaltyData: {
              fee_recipient?: string;
              seller_fee_basis_points?: number;
          }]

        Returns Promise<Transaction<{
            data: (() => Promise<{
                fee_recipient: string;
                seller_fee_basis_points: number;
            }>);
            receipt: TransactionReceipt;
        }>>

Methods

  • Get the royalty recipient and fee

    Returns Promise<{
        fee_recipient: string;
        seller_fee_basis_points: number;
    }>

    • The royalty recipient and BPS

    Example

    const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
    console.log(royaltyInfo.fee_recipient);
    console.log(royaltyInfo.seller_fee_basis_points);

    Twfeature

    Royalty

  • Get the royalty recipient and fee of a particular token

    Parameters

    • tokenId: BigNumberish

    Returns Promise<{
        fee_recipient: string;
        seller_fee_basis_points: number;
    }>

    • The royalty recipient and BPS

    Example

    const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
    console.log(royaltyInfo.fee_recipient);
    console.log(royaltyInfo.seller_fee_basis_points);

    Twfeature

    Royalty

Generated using TypeDoc