LicenseClient

메소드

  • attachLicenseTerms
  • mintLicenseTokens
  • registerPILTerms
  • registerNonComSocialRemixingPIL
  • registerCommercialUsePIL
  • registerCommercialRemixPIL
  • getLicenseTerms

attachLicenseTerms

IP에 라이선스 조건을 첨부합니다.

메소드타입
attachLicenseTerms(request: AttachLicenseTermsRequest) => AttachLicenseTermsResponse

Parameters:

  • request.ipId: 라이선스 조건이 첨부될 IP의 주소.
  • request.licenseTemplate: 라이선스 템플릿의 주소.
  • request.licenseTermsId: 라이선스 조건의 ID.
  • request.txOptions: [선택사항] 트랜잭션 options.
const response = await client.license.attachLicenseTerms({
  licenseTermsId: "1",
  ipId: "0x4c1f8c1035a8cE379dd4ed666758Fb29696CF721",
  txOptions: { waitForTransaction: true },
});

if (response.success) {
  console.log(
    `Attached License Terms to IPA at transaction hash ${response.txHash}.`
  );
} else {
  console.log(`License Terms already attached to this IPA.`);
}

mintLicenseTokens

IP 자산을 License Terms에 기반하여 사용할 수 있는 권한을 부여하는 License Tokens를 발행합니다. 라이선스 토큰은 receiver에게 발행됩니다.

라이선스 토큰은 licenseTermsId가 이미 IP 자산에 첨부되어 있어 공개적으로 사용 가능한 라이선스인 경우에만 발행될 수 있습니다. 그러나 IP 소유자는 private license를 IP 자산에 첨부되지 않은 licenseTermsId로 라이선스 토큰을 발행하여 만들 수 있습니다.

라이선스 조건이나 IP 소유자의 설정에 따라 호출자가 발행 수수료를 지불해야 할 수 있습니다. 발행 수수료는 라이선스 조건에 명시되거나 IP 소유자가 설정한 발행 수수료 토큰으로 지불됩니다. IP 소유자는 자신의 IP에 대한 발행 수수료를 설정하거나 발행 수수료 모듈을 구성하여 발행 수수료를 결정할 수 있습니다.

메소드타입
mintLicenseTokens(request: MintLicenseTokensRequest) => Promise<MintLicenseTokensResponse>

Parameters:

  • request.licensorIpId: 라이선스 제공자 IP ID.
  • request.licenseTermsId: 라이선스 템플릿 내의 라이선스 조건 ID.
  • request.maxMintingFee: 라이선스 발행 시 지불할 최대 발행 수수료.
  • request.maxRevenueShare: 라이선스 발행 시 지불할 최대 수익 공유 비율.
  • request.amount: [선택사항] 발행할 라이선스 토큰의 수량.
  • request.receiver: [선택사항] 수신자의 주소.
  • request.licenseTemplate: [선택사항] 라이선스 템플릿의 주소.
  • request.txOptions: [선택사항] 트랜잭션 options.
const response = await client.license.mintLicenseTokens({
  licenseTermsId: "1",
  licensorIpId: "0xC92EC2f4c86458AFee7DD9EB5d8c57920BfCD0Ba",
  receiver: "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955", // optional
  amount: 1,
  maxMintingFee: BigInt(0), // disabled
  maxRevenueShare: 100, // default
  txOptions: { waitForTransaction: true },
});

console.log(
  `License Token minted at transaction hash ${response.txHash}, License IDs: ${response.licenseTokenIds}`
);

registerPILTerms

새로운 라이선스 조건을 등록하고 새로 등록된 라이선스 조건의 ID를 반환합니다.

메소드타입
registerPILTerms(request: RegisterPILTermsRequest) => Promise<RegisterPILResponse>

Parameters:

  • 예상 매개변수: 여기에 모든 예상 매개변수를 나열하는 대신, LicenseTerms 타입을 this 파일에서 참조하세요. 모두 PIL Terms에서 가져옵니다.
  • request.txOptions: [선택사항] 트랜잭션 options.
import { LicenseTerms } from "@story-protocol/core-sdk";
import { zeroAddress } from "viem";

const licenseTerms: LicenseTerms = {
  transferable: false,
  royaltyPolicy: "0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", // RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
  defaultMintingFee: 0n,
  expiration: 0n,
  commercialUse: false,
  commercialAttribution: false,
  commercializerChecker: zeroAddress,
  commercializerCheckerData: "0x",
  commercialRevShare: 10, // 10%
  commercialRevCeiling: 0n,
  derivativesAllowed: true,
  derivativesAttribution: false,
  derivativesApproval: false,
  derivativesReciprocal: false,
  derivativeRevCeiling: 0n,
  currency: "0x1514000000000000000000000000000000000000", // $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
  uri: "",
};

const response = await client.license.registerPILTerms({
  ...licenseTerms,
  txOptions: { waitForTransaction: true },
});

console.log(
  `PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`
);

registerNonComSocialRemixingPIL

레지스트리에 PIL 비상업적 소셜 리믹스 라이선스를 등록하는 편리한 함수입니다.

이 함수를 호출할 이유가 없습니다. 비상업적 소셜 리믹싱 조건은 이미 우리 프로토콜의 licenseTermdId = 1에 등록되어 있습니다. 다시 등록할 이유가 없습니다.

메소드타입
registerNonComSocialRemixingPIL(request?: RegisterNonComSocialRemixingPILRequest) => Promise<RegisterPILResponse>

Parameters:

  • request.txOptions: [선택사항] 트랜잭션 options.
const response = await client.license.registerNonComSocialRemixingPIL({
  txOptions: { waitForTransaction: true },
});

console.log(
  `PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`
);

registerCommercialUsePIL

레지스트리에 PIL 상업적 사용 라이선스를 등록하는 편리한 함수입니다.

메소드타입
registerCommercialUsePIL(request: RegisterCommercialUsePILRequest) => Promise<RegisterPILResponse>

Parameters:

  • request.defaultMintingFee: 라이선스 발행 시 지불해야 하는 수수료.
  • request.currency: 발행 수수료 지불에 사용될 ERC20 토큰으로, Story 프로토콜에 등록되어 있어야 합니다.
  • request.royaltyPolicyAddress: [선택사항] 로열티 정책 계약의 주소, 기본값은 LAP입니다.
  • request.txOptions: [선택사항] 트랜잭션 options.
import { parseEther } from "viem";

const commercialUseParams = {
  currency: "0x1514000000000000000000000000000000000000", // $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
  defaultMintingFee: parseEther("1"), // 1 $WIP
  royaltyPolicyAddress: "0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", // RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
};

const response = await client.license.registerCommercialUsePIL({
  ...commercialUseParams,
  txOptions: { waitForTransaction: true },
});

console.log(
  `PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`
);

registerCommercialRemixPIL

레지스트리에 PIL 상업적 리믹스 라이선스를 등록하는 편리한 함수입니다.

메소드타입
registerCommercialRemixPIL(request: RegisterCommercialRemixPILRequest) => Promise<RegisterPILResponse>

Parameters:

  • request.defaultMintingFee: 라이선스 발행 시 지불해야 하는 수수료.
  • request.commercialRevShare: 라이선스 제공자와 공유해야 하는 수익의 비율.
  • request.currency: 발행 수수료 지불에 사용될 ERC20 토큰으로, Story 프로토콜에 등록되어 있어야 합니다.
  • request.royaltyPolicyAddress: [선택사항] 로열티 정책 계약의 주소, 기본값은 LAP입니다.
  • request.txOptions: [선택사항] 트랜잭션 options.
import { parseEther } from "viem";

const commercialRemixParams = {
  currency: "0x1514000000000000000000000000000000000000", // $WIP address from https://docs.story.foundation/docs/deployed-smart-contracts
  defaultMintingFee: parseEther("1"), // 1 $WIP
  royaltyPolicyAddress: "0xBe54FB168b3c982b7AaE60dB6CF75Bd8447b390E", // RoyaltyPolicyLAP address from https://docs.story.foundation/docs/deployed-smart-contracts
  commercialRevShare: 10, // 10%
};

const response = await client.license.registerCommercialRemixPIL({
  ...commercialRemixParams,
  txOptions: { waitForTransaction: true },
});

console.log(
  `PIL Terms registered at transaction hash ${response.txHash}, License Terms ID: ${response.licenseTermsId}`
);

getLicenseTerms

주어진 ID의 라이선스 조건을 가져옵니다.

메소드타입
getLicenseTerms`(selectedLicenseTermsId: string \number \bigint) => PiLicenseTemplateGetLicenseTermsResponse`

Parameters:

  • selectedLicenseTermsId: 라이선스 조건의 ID.
Response Type
export type PiLicenseTemplateGetLicenseTermsResponse = {
  terms: {
    transferable: boolean;
    royaltyPolicy: Address;
    defaultMintingFee: bigint;
    expiration: bigint;
    commercialUse: boolean;
    commercialAttribution: boolean;
    commercializerChecker: Address;
    commercializerCheckerData: Hex;
    commercialRevShare: number;
    commercialRevCeiling: bigint;
    derivativesAllowed: boolean;
    derivativesAttribution: boolean;
    derivativesApproval: boolean;
    derivativesReciprocal: boolean;
    derivativeRevCeiling: bigint;
    currency: Address;
    uri: string;
  };
};

predictMintingLicenseFee

주어진 IP와 라이선스 조건에 대한 라이선스 발행 수수료를 미리 계산합니다. 이 함수는 라이선스 토큰을 발행하기 전에 라이선스 발행 수수료를 계산하는 데 사용할 수 있습니다.

메소드타입
predictMintingLicenseFee(request: PredictMintingLicenseFeeRequest) => LicensingModulePredictMintingLicenseFeeResponse

Parameters:

  • request.licensorIpId: 라이센서의 IP ID.
  • request.licenseTermsId: 라이센스 조건의 ID.
  • request.amount: 발행할 라이센스 토큰의 수량.
  • request.licenseTemplate: [선택사항] 라이센스 템플릿의 주소, 기본값은 Programmable IP License입니다.
  • request.receiver: [선택사항] 수신자의 주소, 기본값은 귀하의 지갑 주소입니다.
  • request.txOptions: [선택사항] 트랜잭션 options.
Response Type
export type LicensingModulePredictMintingLicenseFeeResponse = {
  currencyToken: Address;
  tokenAmount: bigint;
};

setLicensingConfig

IP의 특정 라이센스 조건에 대한 라이센싱 구성을 설정합니다.

메서드타입
setLicensingConfig(request: SetLicensingConfigRequest) => SetLicensingConfigResponse

Parameters:

  • request.ipId: 구성이 설정되는 IP의 주소.
  • request.licenseTermsId: 라이센스 템플릿 내의 라이센스 조건 ID.
  • request.licenseTemplate: 사용된 라이센스 템플릿의 주소. 지정되지 않으면 구성이 모든 라이센스에 적용됩니다.
  • request.licensingConfig: 라이센스에 대한 라이센싱 구성.
    • request.licensingConfig.isSet: 구성이 설정되었는지 여부.
    • request.licensingConfig.mintingFee: 라이센스 토큰 발행 시 지불해야 할 발행 수수료.
    • request.licensingConfig.hookData: 라이센싱 훅에서 사용할 데이터.
    • request.licensingConfig.licensingHook: 라이센싱 모듈의 훅 계약 주소, 또는 없는 경우 address(0).
  • request.txOptions: [선택사항] 트랜잭션 options.
Response Type
export type SetLicensingConfigResponse = {
  txHash?: string;
  encodedTxData?: EncodedTxData;
  success?: boolean;
};