NftClient

메서드

  • createNFTCollection
  • getMintFeeToken
  • getMintFee

createNFTCollection

새로운 SPG NFT 컬렉션을 생성합니다.

메서드타입
createNFTCollection(request: CreateNFTCollectionRequest) => Promise<CreateNFTCollectionResponse>

Parameters:

  • request.name: 컬렉션의 이름.
  • request.symbol: 컬렉션의 심볼.
  • request.isPublicMinting: true인 경우, 누구나 컬렉션에서 민팅할 수 있습니다. false인 경우, minter 역할을 가진 주소만 민팅할 수 있습니다.
  • request.mintOpen: 컬렉션이 생성 시 민팅을 위해 열려있는지 여부.
  • request.mintFeeRecipient: 민팅 수수료를 받을 주소.
  • request.contractURI: 컬렉션의 계약 URI. ERC-7572 표준을 따릅니다. 참조: here.
  • request.baseURI: [선택사항] 컬렉션의 기본 URI. baseURI가 비어있지 않으면, tokenURI는 baseURI + 토큰 ID (nftMetadataURI가 비어있는 경우) 또는 baseURI + nftMetadataURI가 됩니다.
  • request.maxSupply: [선택사항] 컬렉션의 최대 공급량.
  • request.mintFee: [선택사항] 토큰을 민팅하는 비용.
  • request.mintFeeToken: [선택사항] 민팅할 토큰.
  • request.owner: [선택사항] 컬렉션의 소유자.
  • request.txOptions: [선택사항] 트랜잭션 options.
import { zeroAddress } from "viem";

// Create a new SPG NFT collection
//
// NOTE: Use this code to create a new SPG NFT collection. You can then use the
// `newCollection.spgNftContract` address as the `spgNftContract` argument in
// functions like `mintAndRegisterIpAssetWithPilTerms` in the
// `simpleMintAndRegisterSpg.ts` file.
//
// You will mostly only have to do this once. Once you get your nft contract address,
// you can use it in SPG functions.
//
const newCollection = await client.nftClient.createNFTCollection({
  name: "Test NFT",
  symbol: "TEST",
  isPublicMinting: true,
  mintOpen: true,
  mintFeeRecipient: zeroAddress,
  contractURI: "",
  txOptions: { waitForTransaction: true },
});

console.log(
  `New SPG NFT collection created at transaction hash ${newCollection.txHash}`
);
console.log(`NFT contract address: ${newCollection.spgNftContract}`);

getMintFeeToken

컬렉션의 현재 민팅 토큰을 반환합니다.

메서드타입
getMintFeeToken(spgNftContract: Address) => Promise<Address>

Parameters:

  • spgNftContract: NFT 계약의 주소.
const mintFeeToken = await client.nftClient.getMintFeeToken("0x01");

getMintFee

컬렉션의 현재 민팅 수수료를 반환합니다.

메서드타입
getMintFee(spgNftContract: Address) => Promise<bigint>

Parameters:

  • spgNftContract: NFT 계약의 주소.
const mintFee = await client.nftClient.getMintFee("0x01");