Skip to main content

Royalty

Functionality available for contracts that inherit the Royalty contract.

getDefaultRoyaltyInfo

Gets the royalty recipient and BPS (basis points) of the smart contract.

const royaltyInfo = await contract.royalties.getDefaultRoyaltyInfo();
Configuration

Return Value

Returns an object containing the royalty recipient address and BPS (basis points) of the smart contract.

{
seller_fee_basis_points: number;
fee_recipient: string;
}

getTokenRoyaltyInfo

Gets the royalty recipient and BPS (basis points) of a particular token in the contract.

const royaltyInfo = await contract.royalties.getTokenRoyaltyInfo(
"{{token_id}}",
);
Configuration

tokenId

The token ID to get the royalty info for.

Must be a string, number, or BigNumber.

Return Value

Returns an object containing the royalty recipient address and BPS (basis points) of the token.

{
seller_fee_basis_points: number;
fee_recipient: string;
}

setDefaultRoyaltyInfo

Set the royalty recipient and fee for the smart contract.

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

seller_fee_basis_points

The royalty fee in BPS (basis points). 100 = 1%.

Must be a number.

fee_recipient

The wallet address that will receive the royalty fees.

Must be a string.

setTokenRoyaltyInfo

Set the royalty recipient and fee for a particular token in the contract.

await contract.royalties.setTokenRoyaltyInfo("{{token_id}}", {
seller_fee_basis_points: 100, // 1% royalty fee
fee_recipient: "0x...", // the fee recipient
});
Configuration

tokenId

The token ID to set the royalty info for.

Must be a string, number, or BigNumber.

seller_fee_basis_points

The royalty fee in BPS (basis points). 100 = 1%.

Must be a number.

fee_recipient

The wallet address that will receive the royalty fees.

Must be a string.