Skip to main content

Contract Settings

You can change the settings of your contract using the SDK, including:

  • Contract Metadata
  • Royalty Fees
  • Platform Fees

Contract Metadata

You can directly read, write, and update the metadata of a smart contract using the SDK, such as the:

  • Image
  • Name
  • Description

Read

const metadata = await contract.metadata.get();
View in Javascript SDK Documentation

Write (Overwrite)

warning

This will overwrite the existing metadata.

await contract.metadata.set({
name: "My Contract",
description: "My contract description"
})
View in Javascript SDK Documentation

Update

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

Royalty Fees

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
});
View in Javascript SDK Documentation

Platform Fees

const contract = await sdk.getContract("{{contract_address}}");
const feeInfo = await contract.platformFee.get();
await contract.platformFee.set({
platform_fee_basis_points: 100, // 1% fee
platform_fee_recipient: "0x..." // the fee recipient
})
View in Javascript SDK Documentation