diff --git a/Makefile b/Makefile index c39224d3..49d9cee6 100644 --- a/Makefile +++ b/Makefile @@ -8,11 +8,10 @@ compile_contracts: solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/RegistrationModule.sol -o packages/core-sdk/src/abi/json/tmp/RegistrationModule solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/dispute-module/DisputeModule.sol -o packages/core-sdk/src/abi/json/tmp/DisputeModule solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/LicensingModule.sol -o packages/core-sdk/src/abi/json/tmp/LicensingModule - solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/UMLPolicyFrameworkManager.sol -o packages/core-sdk/src/abi/json/tmp/UMLPolicyFrameworkManager + solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/licensing/PILPolicyFrameworkManager.sol -o packages/core-sdk/src/abi/json/tmp/PILPolicyFrameworkManager solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/modules/tagging/TaggingModule.sol -o packages/core-sdk/src/abi/json/tmp/TaggingModule solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/interfaces/registries/IIPAssetRegistry.sol -o packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/LicenseRegistry.sol -o packages/core-sdk/src/abi/json/tmp/LicenseRegistry - solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/registries/ModuleRegistry.sol -o packages/core-sdk/src/abi/json/tmp/ModuleRegistry solc @erc6551/=node_modules/erc6551/ --pretty-json --base-path packages/core-sdk/protocol-contracts --include-path packages/core-sdk/protocol-contracts/node_modules/ --abi packages/core-sdk/protocol-contracts/contracts/lib/Errors.sol -o packages/core-sdk/src/abi/json/tmp/Errors cp packages/core-sdk/src/abi/json/tmp/Errors/Errors.abi packages/core-sdk/src/abi/json/Errors.json @@ -22,12 +21,10 @@ compile_contracts: echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/RegistrationModule/RegistrationModule.abi)"' as const;' > packages/core-sdk/src/abi/json/RegistrationModule.abi.ts echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/DisputeModule/DisputeModule.abi)"' as const;' > packages/core-sdk/src/abi/json/DisputeModule.abi.ts echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicensingModule/LicensingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/LicensingModule.abi.ts - echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/UMLPolicyFrameworkManager/UMLPolicyFrameworkManager.abi)"' as const;' > packages/core-sdk/src/abi/json/UMLPolicyFrameworkManager.abi.ts + echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/PILPolicyFrameworkManager/PILPolicyFrameworkManager.abi)"' as const;' > packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.abi.ts echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/TaggingModule/TaggingModule.abi)"' as const;' > packages/core-sdk/src/abi/json/TaggingModule.abi.ts - echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/DisputeModule/DisputeModule.abi)"' as const;' > packages/core-sdk/src/abi/json/DisputeModule.abi.ts echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/IIPAssetRegistry/IIPAssetRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/IIPAssetRegistry.abi.ts echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/LicenseRegistry/LicenseRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts - echo 'export default '"$$(jq --argjson entities "$$(jq -c '.' packages/core-sdk/src/abi/sdkEntities.json)" 'map(select(.name as $$name | $$entities | if type == "array" then index($$name) else false end))' packages/core-sdk/src/abi/json/tmp/ModuleRegistry/ModuleRegistry.abi)"' as const;' > packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts rm -rf packages/core-sdk/src/abi/json/tmp rm -rf packages/core-sdk/protocol-contracts diff --git a/packages/core-sdk/package.json b/packages/core-sdk/package.json index 9eaa48c2..f3941416 100644 --- a/packages/core-sdk/package.json +++ b/packages/core-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@story-protocol/core-sdk", - "version": "0.0.1-beta-rc.2", + "version": "0.0.1-beta-rc.3", "description": "Story Protocol Core SDK", "main": "dist/story-protocol-core-sdk.cjs.js", "module": "dist/story-protocol-core-sdk.esm.js", diff --git a/packages/core-sdk/src/abi/config.ts b/packages/core-sdk/src/abi/config.ts index 910b44c2..43cdb801 100644 --- a/packages/core-sdk/src/abi/config.ts +++ b/packages/core-sdk/src/abi/config.ts @@ -1,5 +1,4 @@ import { getAddress } from "viem"; -import * as dotenv from "dotenv"; import IERC1155ABI from "./json/IERC1155.abi"; import AccessControllerABI from "./json/AccessController.abi"; @@ -7,53 +6,53 @@ import DisputeModuleABI from "./json/DisputeModule.abi"; import IPAccountImplABI from "./json/IPAccountImpl.abi"; import IPAssetRegistryABI from "./json/IIPAssetRegistry.abi"; import LicensingModuleABI from "./json/LicensingModule.abi"; -import UMLPolicyFrameworkManagerABI from "./json/UMLPolicyFrameworkManager.abi"; +import PILPolicyFrameworkManagerABI from "./json/PILPolicyFrameworkManager.abi"; import RegistrationModuleABI from "./json/RegistrationModule.abi"; import TaggingModuleABI from "./json/TaggingModule.abi"; import ErrorsABI from "./json/Errors.abi"; - -if (typeof process !== "undefined") { - dotenv.config(); -} +import { sepolia } from "../utils/env"; export const IPAccountABI = [...IPAccountImplABI, ...ErrorsABI]; export const IPAssetRegistryConfig = { abi: IPAssetRegistryABI, - address: getAddress("0xF2c66aAd2287F3fa00C3461862612Eaf1FAAEcDb"), + address: getAddress(sepolia.IPAssetRegistry), }; export const AccessControllerConfig = { abi: [...AccessControllerABI, ...ErrorsABI], - address: getAddress("0x069AD174fb6285086b692AC9a6f328DCBcB94FC3"), + address: getAddress(sepolia.AccessController), }; export const DisputeModuleConfig = { abi: [...DisputeModuleABI, ...ErrorsABI], - address: getAddress("0x0B935d36516267fc2B4c902449b7D5Cfc2d5102A"), + address: getAddress(sepolia.DisputeModule), }; export const LicenseRegistryConfig = { abi: IERC1155ABI, - address: getAddress("0x051A0441918d7c393ba796dc6754c476324dAdEC"), + address: getAddress(sepolia.LicenseRegistry), }; export const LicensingModuleConfig = { - abi: [...LicensingModuleABI, ...ErrorsABI], - address: getAddress("0x911415eb87b732443e8FbAd8aC8890Bf73BAa8Ec"), + abi: LicensingModuleABI, + //abi: [...LicensingModuleABI, ...ErrorsABI], + address: getAddress(sepolia.LicensingModule), }; export const RegistrationModuleConfig = { - abi: [...RegistrationModuleABI, ...ErrorsABI], - address: getAddress("0x1Ad58168Ae7914C3e8aA8c6F5068CFb23490F27F"), + abi: RegistrationModuleABI, + //abi: [...RegistrationModuleABI, ...ErrorsABI], + address: getAddress(sepolia.RegistrationModule), }; export const TaggingModuleConfig = { abi: [...TaggingModuleABI, ...ErrorsABI], - address: getAddress("0x333BECf0FF68C02E4387005A89c30De885b8a38F"), + address: getAddress(sepolia.TaggingModule), }; -export const UMLPolicyFrameworkManagerConfig = { - abi: [...UMLPolicyFrameworkManagerABI, ...ErrorsABI], - address: getAddress("0xae4De58808EB503E9C460C7A852c67C3152D5385"), +export const PILPolicyFrameworkManagerConfig = { + abi: PILPolicyFrameworkManagerABI, + //abi: [...PILPolicyFrameworkManagerABI, ...ErrorsABI], + address: getAddress(sepolia.PILPolicyFrameworkManager), }; diff --git a/packages/core-sdk/src/abi/json/AccessController.abi.ts b/packages/core-sdk/src/abi/json/AccessController.abi.ts index b4ffd1aa..0949af5d 100644 --- a/packages/core-sdk/src/abi/json/AccessController.abi.ts +++ b/packages/core-sdk/src/abi/json/AccessController.abi.ts @@ -2,6 +2,12 @@ export default [ { anonymous: false, inputs: [ + { + indexed: false, + internalType: "address", + name: "ipAccountOwner", + type: "address", + }, { indexed: true, internalType: "address", @@ -40,27 +46,27 @@ export default [ inputs: [ { internalType: "address", - name: "ipAccount_", + name: "ipAccount", type: "address", }, { internalType: "address", - name: "signer_", + name: "signer", type: "address", }, { internalType: "address", - name: "to_", + name: "to", type: "address", }, { internalType: "bytes4", - name: "func_", + name: "func", type: "bytes4", }, { internalType: "uint8", - name: "permission_", + name: "permission", type: "uint8", }, ], diff --git a/packages/core-sdk/src/abi/json/DisputeModule.abi.ts b/packages/core-sdk/src/abi/json/DisputeModule.abi.ts index 92493fac..306a2c5e 100644 --- a/packages/core-sdk/src/abi/json/DisputeModule.abi.ts +++ b/packages/core-sdk/src/abi/json/DisputeModule.abi.ts @@ -18,31 +18,6 @@ export default [ name: "DisputeCancelled", type: "event", }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: "uint256", - name: "disputeId", - type: "uint256", - }, - { - indexed: false, - internalType: "bool", - name: "decision", - type: "bool", - }, - { - indexed: false, - internalType: "bytes", - name: "data", - type: "bytes", - }, - ], - name: "DisputeJudgementSet", - type: "event", - }, { anonymous: false, inputs: [ @@ -109,12 +84,12 @@ export default [ inputs: [ { internalType: "uint256", - name: "_disputeId", + name: "disputeId", type: "uint256", }, { internalType: "bytes", - name: "_data", + name: "data", type: "bytes", }, ], @@ -123,39 +98,26 @@ export default [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "pure", - type: "function", - }, { inputs: [ { internalType: "address", - name: "_targetIpId", + name: "targetIpId", type: "address", }, { internalType: "string", - name: "_linkToDisputeEvidence", + name: "linkToDisputeEvidence", type: "string", }, { internalType: "bytes32", - name: "_targetTag", + name: "targetTag", type: "bytes32", }, { internalType: "bytes", - name: "_data", + name: "data", type: "bytes", }, ], @@ -174,7 +136,7 @@ export default [ inputs: [ { internalType: "uint256", - name: "_disputeId", + name: "disputeId", type: "uint256", }, ], @@ -183,68 +145,4 @@ export default [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "uint256", - name: "_disputeId", - type: "uint256", - }, - { - internalType: "bool", - name: "_decision", - type: "bool", - }, - { - internalType: "bytes", - name: "_data", - type: "bytes", - }, - ], - name: "setDisputeJudgement", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_arbitrationPolicy", - type: "address", - }, - { - internalType: "bool", - name: "_allowed", - type: "bool", - }, - ], - name: "whitelistArbitrationPolicy", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "_arbitrationPolicy", - type: "address", - }, - { - internalType: "address", - name: "_arbPolicyRelayer", - type: "address", - }, - { - internalType: "bool", - name: "_allowed", - type: "bool", - }, - ], - name: "whitelistArbitrationRelayer", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, ] as const; diff --git a/packages/core-sdk/src/abi/json/Errors.abi.ts b/packages/core-sdk/src/abi/json/Errors.abi.ts index b0faded2..cafb7704 100644 --- a/packages/core-sdk/src/abi/json/Errors.abi.ts +++ b/packages/core-sdk/src/abi/json/Errors.abi.ts @@ -94,6 +94,46 @@ export default [ name: "AccessController__SignerIsZeroAddress", type: "error", }, + { + inputs: [], + name: "AncestorsVaultLAP__AlreadyClaimed", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__ClaimerNotAnAncestor", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__ERC20BalanceNotZero", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__ETHBalanceNotZero", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__InvalidAncestorsHash", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__InvalidClaimer", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__TransferFailed", + type: "error", + }, + { + inputs: [], + name: "AncestorsVaultLAP__ZeroRoyaltyPolicyLAP", + type: "error", + }, { inputs: [], name: "ArbitrationPolicySP__NotDisputeModule", @@ -215,6 +255,11 @@ export default [ name: "IPAccount__ExpiredSignature", type: "error", }, + { + inputs: [], + name: "IPAccount__InvalidAccessController", + type: "error", + }, { inputs: [], name: "IPAccount__InvalidCalldata", @@ -282,57 +327,22 @@ export default [ }, { inputs: [], - name: "LSClaimer__AlreadyClaimed", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__ERC20BalanceNotZero", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__ETHBalanceNotZero", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__InvalidPath", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__InvalidPathFirstPosition", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__InvalidPathLastPosition", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__ZeroIpId", - type: "error", - }, - { - inputs: [], - name: "LSClaimer__ZeroLicensingModule", + name: "LicenseRegistry__CallerNotLicensingModule", type: "error", }, { inputs: [], - name: "LSClaimer__ZeroRoyaltyPolicyLS", + name: "LicenseRegistry__NotTransferable", type: "error", }, { inputs: [], - name: "LicenseRegistry__CallerNotLicensingModule", + name: "LicenseRegistry__RevokedLicense", type: "error", }, { inputs: [], - name: "LicenseRegistry__NotTransferable", + name: "LicenseRegistry__ZeroDisputeModule", type: "error", }, { @@ -370,6 +380,11 @@ export default [ name: "LicensingModule__DerivativesCannotAddPolicy", type: "error", }, + { + inputs: [], + name: "LicensingModule__DisputedIpId", + type: "error", + }, { inputs: [], name: "LicensingModule__EmptyLicenseUrl", @@ -430,6 +445,11 @@ export default [ name: "LicensingModule__LinkParentParamFailed", type: "error", }, + { + inputs: [], + name: "LicensingModule__LinkingRevokedLicense", + type: "error", + }, { inputs: [], name: "LicensingModule__MintLicenseParamFailed", @@ -437,7 +457,7 @@ export default [ }, { inputs: [], - name: "LicensingModule__MismatchBetweenCommercialRevenueShareAndMinRoyalty", + name: "LicensingModule__MintingFeeTokenNotWhitelisted", type: "error", }, { @@ -475,6 +495,16 @@ export default [ name: "LicensingModule__PolicyNotFound", type: "error", }, + { + inputs: [], + name: "LicensingModule__RegisterPolicyFrameworkMismatch", + type: "error", + }, + { + inputs: [], + name: "LicensingModule__RoyaltyPolicyNotWhitelisted", + type: "error", + }, { inputs: [], name: "LicensingModule__TransferParamFailed", @@ -545,6 +575,11 @@ export default [ name: "MetadataProvider__UpgradeUnavailable", type: "error", }, + { + inputs: [], + name: "ModuleRegistry__InterfaceIdZero", + type: "error", + }, { inputs: [], name: "ModuleRegistry__ModuleAddressNotContract", @@ -565,6 +600,26 @@ export default [ name: "ModuleRegistry__ModuleNotRegistered", type: "error", }, + { + inputs: [], + name: "ModuleRegistry__ModuleNotSupportExpectedModuleTypeInterfaceId", + type: "error", + }, + { + inputs: [], + name: "ModuleRegistry__ModuleTypeAlreadyRegistered", + type: "error", + }, + { + inputs: [], + name: "ModuleRegistry__ModuleTypeEmptyString", + type: "error", + }, + { + inputs: [], + name: "ModuleRegistry__ModuleTypeNotRegistered", + type: "error", + }, { inputs: [], name: "ModuleRegistry__NameAlreadyRegistered", @@ -585,6 +640,17 @@ export default [ name: "Module_Unauthorized", type: "error", }, + { + inputs: [ + { + internalType: "address", + name: "commercializer", + type: "address", + }, + ], + name: "PolicyFrameworkManager__CommercializerCheckerDoesNotSupportHook", + type: "error", + }, { inputs: [], name: "PolicyFrameworkManager__GettingPolicyWrongFramework", @@ -597,7 +663,7 @@ export default [ }, { inputs: [], - name: "RoyaltyModule__AlreadySetRoyaltyPolicy", + name: "RoyaltyModule__CanOnlyMintSelectedPolicy", type: "error", }, { @@ -605,6 +671,11 @@ export default [ name: "RoyaltyModule__IncompatibleRoyaltyPolicy", type: "error", }, + { + inputs: [], + name: "RoyaltyModule__NoParentsOnLinking", + type: "error", + }, { inputs: [], name: "RoyaltyModule__NoRoyaltyPolicySet", @@ -615,6 +686,11 @@ export default [ name: "RoyaltyModule__NotAllowedCaller", type: "error", }, + { + inputs: [], + name: "RoyaltyModule__NotRegisteredIpId", + type: "error", + }, { inputs: [], name: "RoyaltyModule__NotWhitelistedRoyaltyPolicy", @@ -642,47 +718,102 @@ export default [ }, { inputs: [], - name: "RoyaltyPolicyLS__InvalidMinRoyalty", + name: "RoyaltyPolicyLAP__AboveAncestorsLimit", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__AboveParentLimit", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__AboveRoyaltyStackLimit", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__ImplementationAlreadySet", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidAncestors", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidAncestorsHash", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidAncestorsLength", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidAncestorsRoyalty", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidParentRoyaltiesLength", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__InvalidRoyaltyAmountLength", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__LastPositionNotAbleToMintLicense", + type: "error", + }, + { + inputs: [], + name: "RoyaltyPolicyLAP__NotFullOwnership", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__InvalidRoyaltyStack", + name: "RoyaltyPolicyLAP__NotRoyaltyModule", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__NotRoyaltyModule", + name: "RoyaltyPolicyLAP__TransferFailed", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__TransferFailed", + name: "RoyaltyPolicyLAP__UnlinkableToParents", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__ZeroLicensingModule", + name: "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__ZeroLiquidSplitFactory", + name: "RoyaltyPolicyLAP__ZeroLicensingModule", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__ZeroLiquidSplitMain", + name: "RoyaltyPolicyLAP__ZeroLiquidSplitFactory", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__ZeroMinRoyalty", + name: "RoyaltyPolicyLAP__ZeroLiquidSplitMain", type: "error", }, { inputs: [], - name: "RoyaltyPolicyLS__ZeroRoyaltyModule", + name: "RoyaltyPolicyLAP__ZeroRoyaltyModule", type: "error", }, { diff --git a/packages/core-sdk/src/abi/json/Errors.json b/packages/core-sdk/src/abi/json/Errors.json index a76a8b2b..0f7f9114 100644 --- a/packages/core-sdk/src/abi/json/Errors.json +++ b/packages/core-sdk/src/abi/json/Errors.json @@ -94,6 +94,46 @@ "name": "AccessController__SignerIsZeroAddress", "type": "error" }, + { + "inputs": [], + "name": "AncestorsVaultLAP__AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__ClaimerNotAnAncestor", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__ERC20BalanceNotZero", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__ETHBalanceNotZero", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__InvalidAncestorsHash", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__InvalidClaimer", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "AncestorsVaultLAP__ZeroRoyaltyPolicyLAP", + "type": "error" + }, { "inputs": [], "name": "ArbitrationPolicySP__NotDisputeModule", @@ -215,6 +255,11 @@ "name": "IPAccount__ExpiredSignature", "type": "error" }, + { + "inputs": [], + "name": "IPAccount__InvalidAccessController", + "type": "error" + }, { "inputs": [], "name": "IPAccount__InvalidCalldata", @@ -282,57 +327,22 @@ }, { "inputs": [], - "name": "LSClaimer__AlreadyClaimed", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__ERC20BalanceNotZero", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__ETHBalanceNotZero", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__InvalidPath", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__InvalidPathFirstPosition", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__InvalidPathLastPosition", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__ZeroIpId", - "type": "error" - }, - { - "inputs": [], - "name": "LSClaimer__ZeroLicensingModule", + "name": "LicenseRegistry__CallerNotLicensingModule", "type": "error" }, { "inputs": [], - "name": "LSClaimer__ZeroRoyaltyPolicyLS", + "name": "LicenseRegistry__NotTransferable", "type": "error" }, { "inputs": [], - "name": "LicenseRegistry__CallerNotLicensingModule", + "name": "LicenseRegistry__RevokedLicense", "type": "error" }, { "inputs": [], - "name": "LicenseRegistry__NotTransferable", + "name": "LicenseRegistry__ZeroDisputeModule", "type": "error" }, { @@ -370,6 +380,11 @@ "name": "LicensingModule__DerivativesCannotAddPolicy", "type": "error" }, + { + "inputs": [], + "name": "LicensingModule__DisputedIpId", + "type": "error" + }, { "inputs": [], "name": "LicensingModule__EmptyLicenseUrl", @@ -430,6 +445,11 @@ "name": "LicensingModule__LinkParentParamFailed", "type": "error" }, + { + "inputs": [], + "name": "LicensingModule__LinkingRevokedLicense", + "type": "error" + }, { "inputs": [], "name": "LicensingModule__MintLicenseParamFailed", @@ -437,7 +457,7 @@ }, { "inputs": [], - "name": "LicensingModule__MismatchBetweenCommercialRevenueShareAndMinRoyalty", + "name": "LicensingModule__MintingFeeTokenNotWhitelisted", "type": "error" }, { @@ -475,6 +495,16 @@ "name": "LicensingModule__PolicyNotFound", "type": "error" }, + { + "inputs": [], + "name": "LicensingModule__RegisterPolicyFrameworkMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "LicensingModule__RoyaltyPolicyNotWhitelisted", + "type": "error" + }, { "inputs": [], "name": "LicensingModule__TransferParamFailed", @@ -545,6 +575,11 @@ "name": "MetadataProvider__UpgradeUnavailable", "type": "error" }, + { + "inputs": [], + "name": "ModuleRegistry__InterfaceIdZero", + "type": "error" + }, { "inputs": [], "name": "ModuleRegistry__ModuleAddressNotContract", @@ -565,6 +600,26 @@ "name": "ModuleRegistry__ModuleNotRegistered", "type": "error" }, + { + "inputs": [], + "name": "ModuleRegistry__ModuleNotSupportExpectedModuleTypeInterfaceId", + "type": "error" + }, + { + "inputs": [], + "name": "ModuleRegistry__ModuleTypeAlreadyRegistered", + "type": "error" + }, + { + "inputs": [], + "name": "ModuleRegistry__ModuleTypeEmptyString", + "type": "error" + }, + { + "inputs": [], + "name": "ModuleRegistry__ModuleTypeNotRegistered", + "type": "error" + }, { "inputs": [], "name": "ModuleRegistry__NameAlreadyRegistered", @@ -585,6 +640,17 @@ "name": "Module_Unauthorized", "type": "error" }, + { + "inputs": [ + { + "internalType": "address", + "name": "commercializer", + "type": "address" + } + ], + "name": "PolicyFrameworkManager__CommercializerCheckerDoesNotSupportHook", + "type": "error" + }, { "inputs": [], "name": "PolicyFrameworkManager__GettingPolicyWrongFramework", @@ -597,7 +663,7 @@ }, { "inputs": [], - "name": "RoyaltyModule__AlreadySetRoyaltyPolicy", + "name": "RoyaltyModule__CanOnlyMintSelectedPolicy", "type": "error" }, { @@ -605,6 +671,11 @@ "name": "RoyaltyModule__IncompatibleRoyaltyPolicy", "type": "error" }, + { + "inputs": [], + "name": "RoyaltyModule__NoParentsOnLinking", + "type": "error" + }, { "inputs": [], "name": "RoyaltyModule__NoRoyaltyPolicySet", @@ -615,6 +686,11 @@ "name": "RoyaltyModule__NotAllowedCaller", "type": "error" }, + { + "inputs": [], + "name": "RoyaltyModule__NotRegisteredIpId", + "type": "error" + }, { "inputs": [], "name": "RoyaltyModule__NotWhitelistedRoyaltyPolicy", @@ -642,47 +718,102 @@ }, { "inputs": [], - "name": "RoyaltyPolicyLS__InvalidMinRoyalty", + "name": "RoyaltyPolicyLAP__AboveAncestorsLimit", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__AboveParentLimit", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__AboveRoyaltyStackLimit", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__ImplementationAlreadySet", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidAncestors", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidAncestorsHash", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidAncestorsLength", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidAncestorsRoyalty", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidParentRoyaltiesLength", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__InvalidRoyaltyAmountLength", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__LastPositionNotAbleToMintLicense", + "type": "error" + }, + { + "inputs": [], + "name": "RoyaltyPolicyLAP__NotFullOwnership", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__InvalidRoyaltyStack", + "name": "RoyaltyPolicyLAP__NotRoyaltyModule", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__NotRoyaltyModule", + "name": "RoyaltyPolicyLAP__TransferFailed", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__TransferFailed", + "name": "RoyaltyPolicyLAP__UnlinkableToParents", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__ZeroLicensingModule", + "name": "RoyaltyPolicyLAP__ZeroAncestorsVaultImpl", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__ZeroLiquidSplitFactory", + "name": "RoyaltyPolicyLAP__ZeroLicensingModule", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__ZeroLiquidSplitMain", + "name": "RoyaltyPolicyLAP__ZeroLiquidSplitFactory", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__ZeroMinRoyalty", + "name": "RoyaltyPolicyLAP__ZeroLiquidSplitMain", "type": "error" }, { "inputs": [], - "name": "RoyaltyPolicyLS__ZeroRoyaltyModule", + "name": "RoyaltyPolicyLAP__ZeroRoyaltyModule", "type": "error" }, { diff --git a/packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts b/packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts index 9c04d98b..d7751266 100644 --- a/packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts +++ b/packages/core-sdk/src/abi/json/IPAccountImpl.abi.ts @@ -28,4 +28,48 @@ export default [ stateMutability: "payable", type: "function", }, + { + inputs: [ + { + internalType: "address", + name: "to", + type: "address", + }, + { + internalType: "uint256", + name: "value", + type: "uint256", + }, + { + internalType: "bytes", + name: "data", + type: "bytes", + }, + { + internalType: "address", + name: "signer", + type: "address", + }, + { + internalType: "uint256", + name: "deadline", + type: "uint256", + }, + { + internalType: "bytes", + name: "signature", + type: "bytes", + }, + ], + name: "executeWithSig", + outputs: [ + { + internalType: "bytes", + name: "result", + type: "bytes", + }, + ], + stateMutability: "payable", + type: "function", + }, ] as const; diff --git a/packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts b/packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts index ef57fe4d..239b5453 100644 --- a/packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts +++ b/packages/core-sdk/src/abi/json/LicenseRegistry.abi.ts @@ -5,52 +5,72 @@ export default [ { indexed: true, internalType: "address", - name: "creator", + name: "operator", type: "address", }, { indexed: true, internalType: "address", - name: "receiver", + name: "from", type: "address", }, { indexed: true, - internalType: "uint256", - name: "licenseId", - type: "uint256", + internalType: "address", + name: "to", + type: "address", + }, + { + indexed: false, + internalType: "uint256[]", + name: "ids", + type: "uint256[]", + }, + { + indexed: false, + internalType: "uint256[]", + name: "values", + type: "uint256[]", + }, + ], + name: "TransferBatch", + type: "event", + }, + { + anonymous: false, + inputs: [ + { + indexed: true, + internalType: "address", + name: "operator", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "from", + type: "address", + }, + { + indexed: true, + internalType: "address", + name: "to", + type: "address", }, { indexed: false, internalType: "uint256", - name: "amount", + name: "id", type: "uint256", }, { - components: [ - { - internalType: "uint256", - name: "policyId", - type: "uint256", - }, - { - internalType: "address", - name: "licensorIpId", - type: "address", - }, - { - internalType: "bool", - name: "transferable", - type: "bool", - }, - ], indexed: false, - internalType: "struct Licensing.License", - name: "licenseData", - type: "tuple", + internalType: "uint256", + name: "value", + type: "uint256", }, ], - name: "LicenseMinted", + name: "TransferSingle", type: "event", }, { @@ -62,7 +82,7 @@ export default [ }, { internalType: "address", - name: "licensorIp", + name: "licensorIpId_", type: "address", }, { diff --git a/packages/core-sdk/src/abi/json/LicensingModule.abi.ts b/packages/core-sdk/src/abi/json/LicensingModule.abi.ts index ac94a762..a945f585 100644 --- a/packages/core-sdk/src/abi/json/LicensingModule.abi.ts +++ b/packages/core-sdk/src/abi/json/LicensingModule.abi.ts @@ -64,6 +64,12 @@ export default [ { anonymous: false, inputs: [ + { + indexed: true, + internalType: "uint256", + name: "policyId", + type: "uint256", + }, { indexed: true, internalType: "address", @@ -71,17 +77,35 @@ export default [ type: "address", }, { - indexed: true, - internalType: "uint256", - name: "policyId", - type: "uint256", + indexed: false, + internalType: "bytes", + name: "frameworkData", + type: "bytes", + }, + { + indexed: false, + internalType: "address", + name: "royaltyPolicy", + type: "address", }, { indexed: false, internalType: "bytes", - name: "policy", + name: "royaltyData", type: "bytes", }, + { + indexed: false, + internalType: "uint256", + name: "mintingFee", + type: "uint256", + }, + { + indexed: false, + internalType: "address", + name: "mintingFeeToken", + type: "address", + }, ], name: "PolicyRegistered", type: "event", @@ -123,9 +147,9 @@ export default [ type: "address", }, { - internalType: "uint32", - name: "minRoyalty", - type: "uint32", + internalType: "bytes", + name: "royaltyContext", + type: "bytes", }, ], name: "linkIpToParents", @@ -142,7 +166,7 @@ export default [ }, { internalType: "address", - name: "licensorIp", + name: "licensorIpId", type: "address", }, { @@ -155,6 +179,11 @@ export default [ name: "receiver", type: "address", }, + { + internalType: "bytes", + name: "royaltyContext", + type: "bytes", + }, ], name: "mintLicense", outputs: [ @@ -167,30 +196,49 @@ export default [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [ { - internalType: "bool", - name: "isLicenseTransferable", - type: "bool", - }, - { - internalType: "bytes", - name: "data", - type: "bytes", + components: [ + { + internalType: "bool", + name: "isLicenseTransferable", + type: "bool", + }, + { + internalType: "address", + name: "policyFramework", + type: "address", + }, + { + internalType: "bytes", + name: "frameworkData", + type: "bytes", + }, + { + internalType: "address", + name: "royaltyPolicy", + type: "address", + }, + { + internalType: "bytes", + name: "royaltyData", + type: "bytes", + }, + { + internalType: "uint256", + name: "mintingFee", + type: "uint256", + }, + { + internalType: "address", + name: "mintingFeeToken", + type: "address", + }, + ], + internalType: "struct Licensing.Policy", + name: "pol", + type: "tuple", }, ], name: "registerPolicy", diff --git a/packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts b/packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts deleted file mode 100644 index 8eb27f17..00000000 --- a/packages/core-sdk/src/abi/json/ModuleRegistry.abi.ts +++ /dev/null @@ -1 +0,0 @@ -export default [] as const; diff --git a/packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.abi.ts b/packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.abi.ts new file mode 100644 index 00000000..6acf866f --- /dev/null +++ b/packages/core-sdk/src/abi/json/PILPolicyFrameworkManager.abi.ts @@ -0,0 +1,115 @@ +export default [ + { + inputs: [ + { + components: [ + { + internalType: "bool", + name: "transferable", + type: "bool", + }, + { + internalType: "address", + name: "royaltyPolicy", + type: "address", + }, + { + internalType: "uint256", + name: "mintingFee", + type: "uint256", + }, + { + internalType: "address", + name: "mintingFeeToken", + type: "address", + }, + { + components: [ + { + internalType: "bool", + name: "attribution", + type: "bool", + }, + { + internalType: "bool", + name: "commercialUse", + type: "bool", + }, + { + internalType: "bool", + name: "commercialAttribution", + type: "bool", + }, + { + internalType: "address", + name: "commercializerChecker", + type: "address", + }, + { + internalType: "bytes", + name: "commercializerCheckerData", + type: "bytes", + }, + { + internalType: "uint32", + name: "commercialRevShare", + type: "uint32", + }, + { + internalType: "bool", + name: "derivativesAllowed", + type: "bool", + }, + { + internalType: "bool", + name: "derivativesAttribution", + type: "bool", + }, + { + internalType: "bool", + name: "derivativesApproval", + type: "bool", + }, + { + internalType: "bool", + name: "derivativesReciprocal", + type: "bool", + }, + { + internalType: "string[]", + name: "territories", + type: "string[]", + }, + { + internalType: "string[]", + name: "distributionChannels", + type: "string[]", + }, + { + internalType: "string[]", + name: "contentRestrictions", + type: "string[]", + }, + ], + internalType: "struct PILPolicy", + name: "policy", + type: "tuple", + }, + ], + internalType: "struct RegisterPILPolicyParams", + name: "params", + type: "tuple", + }, + ], + name: "registerPolicy", + outputs: [ + { + internalType: "uint256", + name: "policyId", + type: "uint256", + }, + ], + stateMutability: "nonpayable", + type: "function", + }, +] as const; diff --git a/packages/core-sdk/src/abi/json/RegistrationModule.abi.ts b/packages/core-sdk/src/abi/json/RegistrationModule.abi.ts index dec5e371..c1a0764e 100644 --- a/packages/core-sdk/src/abi/json/RegistrationModule.abi.ts +++ b/packages/core-sdk/src/abi/json/RegistrationModule.abi.ts @@ -1,17 +1,4 @@ export default [ - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "pure", - type: "function", - }, { inputs: [ { @@ -45,9 +32,9 @@ export default [ type: "string", }, { - internalType: "uint32", - name: "minRoyalty", - type: "uint32", + internalType: "bytes", + name: "royaltyContext", + type: "bytes", }, ], name: "registerDerivativeIp", diff --git a/packages/core-sdk/src/abi/json/TaggingModule.abi.ts b/packages/core-sdk/src/abi/json/TaggingModule.abi.ts index 68e79b62..e64fbddf 100644 --- a/packages/core-sdk/src/abi/json/TaggingModule.abi.ts +++ b/packages/core-sdk/src/abi/json/TaggingModule.abi.ts @@ -1,54 +1,4 @@ export default [ - { - inputs: [], - name: "MAX_TAG_PERMISSIONS_AT_ONCE", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "string", - name: "tag", - type: "string", - }, - { - internalType: "address", - name: "ipId", - type: "address", - }, - ], - name: "isTagged", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [], - name: "name", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, { inputs: [ { @@ -97,71 +47,4 @@ export default [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [ - { - internalType: "address", - name: "ipId", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tagAtIndexForIp", - outputs: [ - { - internalType: "bytes32", - name: "", - type: "bytes32", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "ipId", - type: "address", - }, - { - internalType: "uint256", - name: "index", - type: "uint256", - }, - ], - name: "tagStringAtIndexForIp", - outputs: [ - { - internalType: "string", - name: "", - type: "string", - }, - ], - stateMutability: "view", - type: "function", - }, - { - inputs: [ - { - internalType: "address", - name: "ipId", - type: "address", - }, - ], - name: "totalTagsForIp", - outputs: [ - { - internalType: "uint256", - name: "", - type: "uint256", - }, - ], - stateMutability: "view", - type: "function", - }, ] as const; diff --git a/packages/core-sdk/src/abi/json/UMLPolicyFrameworkManager.abi.ts b/packages/core-sdk/src/abi/json/UMLPolicyFrameworkManager.abi.ts deleted file mode 100644 index c512c7a5..00000000 --- a/packages/core-sdk/src/abi/json/UMLPolicyFrameworkManager.abi.ts +++ /dev/null @@ -1,98 +0,0 @@ -export default [ - { - inputs: [ - { - components: [ - { - internalType: "bool", - name: "transferable", - type: "bool", - }, - { - internalType: "bool", - name: "attribution", - type: "bool", - }, - { - internalType: "bool", - name: "commercialUse", - type: "bool", - }, - { - internalType: "bool", - name: "commercialAttribution", - type: "bool", - }, - { - internalType: "string[]", - name: "commercializers", - type: "string[]", - }, - { - internalType: "uint32", - name: "commercialRevShare", - type: "uint32", - }, - { - internalType: "bool", - name: "derivativesAllowed", - type: "bool", - }, - { - internalType: "bool", - name: "derivativesAttribution", - type: "bool", - }, - { - internalType: "bool", - name: "derivativesApproval", - type: "bool", - }, - { - internalType: "bool", - name: "derivativesReciprocal", - type: "bool", - }, - { - internalType: "uint32", - name: "derivativesRevShare", - type: "uint32", - }, - { - internalType: "string[]", - name: "territories", - type: "string[]", - }, - { - internalType: "string[]", - name: "distributionChannels", - type: "string[]", - }, - { - internalType: "string[]", - name: "contentRestrictions", - type: "string[]", - }, - { - internalType: "address", - name: "royaltyPolicy", - type: "address", - }, - ], - internalType: "struct UMLPolicy", - name: "umlPolicy", - type: "tuple", - }, - ], - name: "registerPolicy", - outputs: [ - { - internalType: "uint256", - name: "policyId", - type: "uint256", - }, - ], - stateMutability: "nonpayable", - type: "function", - }, -] as const; diff --git a/packages/core-sdk/src/abi/sdkEntities.json b/packages/core-sdk/src/abi/sdkEntities.json index b9eb2ac7..34d24bc7 100644 --- a/packages/core-sdk/src/abi/sdkEntities.json +++ b/packages/core-sdk/src/abi/sdkEntities.json @@ -1,47 +1,32 @@ [ - "ipAsset", "execute", + "executeWithSig", "registerRootIp", "registerDerivativeIp", + "IPRegistered", "registerPolicy", "addPolicyToIp", + "PolicyRegistered", + "PolicyAddedToIpId", "mintLicense", "linkIpToParents", - - "setPermission", - - "whitelistDisputeTags", - "whitelistArbitrationPolicy", - "whitelistArbitrationRelayer", - "raiseDispute", - "setDisputeJudgement", - "cancelDispute", - "resolveDispute", - - "IPRegistered", - "PolicyRegistered", - "PolicyAddedToIpId", "TransferSingle", "TransferBatch", "IpIdLinkedToParents", + + "setPermission", "PermissionSet", - "setTag", - "removeTag", - "isTagged", - "totalTagsForIp", - "tagAtIndexForIp", - "tagStringAtIndexForIp", - "MAX_TAG_PERMISSIONS_AT_ONCE", "raiseDispute", - "setDisputeJudgement", "cancelDispute", "resolveDispute", - "DisputeJudgementSet", "DisputeCancelled", "DisputeResolved", - "DisputeRaised" + "DisputeRaised", + + "setTag", + "removeTag" ] diff --git a/packages/core-sdk/src/index.ts b/packages/core-sdk/src/index.ts index 35b81b13..a0d41d66 100644 --- a/packages/core-sdk/src/index.ts +++ b/packages/core-sdk/src/index.ts @@ -27,8 +27,8 @@ export type { } from "./types/resources/license"; export type { - RegisterUMLPolicyRequest, - RegisterUMLPolicyResponse, + RegisterPILPolicyRequest, + RegisterPILPolicyResponse, AddPolicyToIpRequest, AddPolicyToIpResponse, } from "./types/resources/policy"; diff --git a/packages/core-sdk/src/resources/dispute.ts b/packages/core-sdk/src/resources/dispute.ts index 89153821..6fd3d426 100644 --- a/packages/core-sdk/src/resources/dispute.ts +++ b/packages/core-sdk/src/resources/dispute.ts @@ -9,14 +9,13 @@ import { RaiseDisputeResponse, ResolveDisputeRequest, ResolveDisputeResponse, - SetDisputeJudgementRequest, - SetDisputeJudgementResponse, } from "../types/resources/dispute"; import { waitTx, waitTxAndFilterLog } from "../utils/utils"; export class DisputeClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public disputeModuleConfig = DisputeModuleConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.rpcClient = rpcClient; @@ -24,7 +23,7 @@ export class DisputeClient { } /** - * Initiates a dispute on an IP. + * Raises a dispute on a given ipId * @param request - The request object containing necessary data to raise a dispute. * @param request.targetIpId - The IP ID that is the target of the dispute. * @param request.arbitrationPolicy - The address of the arbitration policy. @@ -42,7 +41,7 @@ export class DisputeClient { public async raiseDispute(request: RaiseDisputeRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...DisputeModuleConfig, + ...this.disputeModuleConfig, functionName: "raiseDispute", args: [ request.targetIpId, @@ -56,7 +55,7 @@ export class DisputeClient { if (request.txOptions?.waitForTransaction) { const logs = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...DisputeModuleConfig, + ...this.disputeModuleConfig, eventName: "DisputeRaised", }); return { @@ -71,47 +70,7 @@ export class DisputeClient { } /** - * Sets the judgement for an existing dispute. - * @param request The request object containing details for setting the dispute judgement. - * @param request.disputeId The ID of the dispute to be judged. - * @param request.decision The decision of the dispute. - * @param request.calldata Optional additional data for the dispute judgement. - * @returns A Promise that resolves to a SetDisputeJudgementResponse containing the transaction hash. - * @throws An error if the process of setting the judgement fails. - * @throws `NotInDisputeState` if the currentTag of the Dispute is not being disputed. - * @throws `NotWhitelistedArbitrationRelayer` if the transaction executor is not a whitelisted arbitration relayer contract. - * @throws error if the Dispute's ArbitrationPolicy contract is not valid. - * @calls setDisputeJudgement(uint256 _disputeId, bool _decision, bytes calldata _data) external nonReentrant { - * @emits DisputeJudgementSet (_disputeId, _decision, _data); - */ - public async setDisputeJudgement( - request: SetDisputeJudgementRequest, - ): Promise { - try { - const { request: call } = await this.rpcClient.simulateContract({ - ...DisputeModuleConfig, - functionName: "setDisputeJudgement", - args: [ - BigInt(request.disputeId), - request.decision, - request.calldata ? request.calldata : "0x", - ], - }); - - const txHash = await this.wallet.writeContract(call); - - if (request.txOptions?.waitForTransaction) { - await waitTx(this.rpcClient, txHash); - } - - return { txHash: txHash }; - } catch (error) { - handleError(error, "Failed to raise dispute"); - } - } - - /** - * Cancels an existing dispute. + * Cancels an ongoing dispute * @param request The request object containing details to cancel the dispute. * @param request.disputeId The ID of the dispute to be cancelled. * @param request.calldata Optional additional data used in the cancellation process. @@ -125,7 +84,7 @@ export class DisputeClient { public async cancelDispute(request: CancelDisputeRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...DisputeModuleConfig, + ...this.disputeModuleConfig, functionName: "cancelDispute", args: [BigInt(request.disputeId), request.calldata ? request.calldata : "0x"], }); @@ -143,7 +102,7 @@ export class DisputeClient { } /** - * Resolves an existing dispute after a judgement has been set. + * Resolves a dispute after it has been judged * @param request The request object containing details to resolve the dispute. * @param request.disputeId The ID of the dispute to be resolved. * @returns A Promise that resolves to a ResolveDisputeResponse. @@ -154,7 +113,7 @@ export class DisputeClient { public async resolveDispute(request: ResolveDisputeRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...DisputeModuleConfig, + ...this.disputeModuleConfig, functionName: "resolveDispute", args: [BigInt(request.disputeId)], }); diff --git a/packages/core-sdk/src/resources/ipAsset.ts b/packages/core-sdk/src/resources/ipAsset.ts index ded5964b..f3010692 100644 --- a/packages/core-sdk/src/resources/ipAsset.ts +++ b/packages/core-sdk/src/resources/ipAsset.ts @@ -14,6 +14,8 @@ import { parseToBigInt, waitTxAndFilterLog } from "../utils/utils"; export class IPAssetClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public ipAssetRegistryConfig = IPAssetRegistryConfig; + public registrationModuleConfig = RegistrationModuleConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.wallet = wallet; @@ -21,15 +23,24 @@ export class IPAssetClient { } /** - * Register a root IP on Story Protocol based on the specified input asset data. - * - * @param request - the request object that contains all data needed to register a root IP. - * @returns the response object that contains results from the IP creation. + * Registers a root-level IP into the protocol. Root-level IPs can be thought of as organizational hubs + * for encapsulating policies that actual IPs can use to register through. As such, a root-level IP is not an + * actual IP, but a container for IP policy management for their child IP assets. + * @param request The request object that contains all data needed to register a root IP. + * @param request.policyId The policy that identifies the licensing terms of the IP. + * @param request.tokenContract The address of the NFT bound to the root-level IP. + * @param request.tokenId The token id of the NFT bound to the root-level IP. + * @param request.ipName [Optional] The name assigned to the new IP. + * @param request.contentHash [Optional] The content hash of the IP being registered. + * @param request.uri [Optional] An external URI to link to the IP. + * @param request.txOptions [Optional] The transaction options. + * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true. + * @emits RootIPRegistered (msg.sender, ipId, policyId) */ public async registerRootIp(request: RegisterRootIpRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...RegistrationModuleConfig, + ...this.registrationModuleConfig, functionName: "registerRootIp", args: [ parseToBigInt(request.policyId), @@ -45,7 +56,7 @@ export class IPAssetClient { const txHash = await this.wallet.writeContract(call); if (request.txOptions?.waitForTransaction) { const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...IPAssetRegistryConfig, + ...this.ipAssetRegistryConfig, eventName: "IPRegistered", }); return { txHash: txHash, ipId: targetLog.args.ipId }; @@ -58,10 +69,19 @@ export class IPAssetClient { } /** - * Register a derivative IP on Story Protocol based on the specified input asset data. - * - * @param request - the request object that contains all data needed to register a derivative IP. - * @returns the response object that contains results from the IP creation. + * Registers derivative IPs into the protocol. Derivative IPs are IP assets that inherit policies from + * parent IPs by burning acquired license NFTs. + * @param request The request object that contains all data needed to register a root IP. + * @param request.licenseIds The policy that identifies the licensing terms of the IP. + * @param request.tokenContract The address of the NFT bound to the derivative IP. + * @param request.tokenId The token id of the NFT bound to the derivative IP. + * @param request.ipName [Optional] The name assigned to the new IP. + * @param request.contentHash [Optional] The content hash of the IP being registered. + * @param request.uri [Optional] An external URI to link to the IP. + * @param request.minRoyalty [Optional] The minimum royalty percentage that the IP owner will receive. + * @param request.txOptions [Optional] The transaction options. + * @returns A Promise that resolves to an object containing the transaction hash and optional IP ID if waitForTxn is set to true. + * @emits RootIPRegistered (msg.sender, ipId, policyId) */ public async registerDerivativeIp( request: RegisterDerivativeIpRequest, @@ -72,7 +92,7 @@ export class IPAssetClient { licenseIds.push(parseToBigInt(licenseId)); }); const { request: call } = await this.rpcClient.simulateContract({ - ...RegistrationModuleConfig, + ...this.registrationModuleConfig, functionName: "registerDerivativeIp", args: [ licenseIds, @@ -81,7 +101,7 @@ export class IPAssetClient { request.ipName || "", request.contentHash || HashZero, request.uri || "", - request.minRoyalty || 0, + "0x", ], account: this.wallet.account, }); @@ -89,7 +109,7 @@ export class IPAssetClient { const txHash = await this.wallet.writeContract(call); if (request.txOptions?.waitForTransaction) { const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...IPAssetRegistryConfig, + ...this.ipAssetRegistryConfig, eventName: "IPRegistered", }); return { txHash: txHash, ipId: targetLog.args.ipId }; diff --git a/packages/core-sdk/src/resources/license.ts b/packages/core-sdk/src/resources/license.ts index a2b61228..fe54c5b3 100644 --- a/packages/core-sdk/src/resources/license.ts +++ b/packages/core-sdk/src/resources/license.ts @@ -13,32 +13,48 @@ import { export class LicenseClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public ipAccountABI = IPAccountABI; + public licenseRegistryConfig = LicenseRegistryConfig; + public licensingModuleConfig = LicensingModuleConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.wallet = wallet; this.rpcClient = rpcClient; } + /** + * Mints license NFTs representing a policy granted by a set of ipIds (licensors). This NFT needs to be + * burned in order to link a derivative IP with its parents. If this is the first combination of policy and + * licensors, a new licenseId will be created. If not, the license is fungible and an id will be reused. + * @dev Only callable by the licensing module. + * @param request The request object containing necessary data to mint a license. + * @param request.policyId The ID of the policy to be minted + * @param request.licensorIpId_ The ID of the IP granting the license (ie. licensor) + * @param request.mintAmount Number of licenses to mint. License NFT is fungible for same policy and same licensors + * @param request.receiver Receiver address of the minted license NFT(s). + * @return licenseId The ID of the minted license NFT(s). + */ public async mintLicense(request: MintLicenseRequest): Promise { try { const IPAccountConfig = { - abi: IPAccountABI, + abi: this.ipAccountABI, address: getAddress(request.licensorIpId), }; const { request: call } = await this.rpcClient.simulateContract({ ...IPAccountConfig, functionName: "execute", args: [ - LicensingModuleConfig.address, + this.licensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({ - abi: LicensingModuleConfig.abi, + abi: this.licensingModuleConfig.abi, functionName: "mintLicense", args: [ parseToBigInt(request.policyId), request.licensorIpId, parseToBigInt(request.mintAmount), getAddress(request.receiverAddress), + "0x", ], }), ], @@ -47,7 +63,7 @@ export class LicenseClient { const txHash = await this.wallet.writeContract(call); if (request.txOptions?.waitForTransaction) { const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...LicenseRegistryConfig, + ...this.licenseRegistryConfig, eventName: "TransferSingle", }); return { txHash: txHash, licenseId: targetLog.args.id.toString() }; @@ -62,7 +78,7 @@ export class LicenseClient { public async linkIpToParent(request: LinkIpToParentRequest): Promise { try { const IPAccountConfig = { - abi: IPAccountABI, + abi: this.ipAccountABI, address: getAddress(request.childIpId), }; @@ -75,12 +91,12 @@ export class LicenseClient { ...IPAccountConfig, functionName: "execute", args: [ - LicensingModuleConfig.address, + this.licensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({ - abi: LicensingModuleConfig.abi, + abi: this.licensingModuleConfig.abi, functionName: "linkIpToParents", - args: [licenseIds, getAddress(request.childIpId), request.minRoyalty], + args: [licenseIds, getAddress(request.childIpId), "0x"], }), ], account: this.wallet.account, diff --git a/packages/core-sdk/src/resources/permission.ts b/packages/core-sdk/src/resources/permission.ts index 4179ff1a..d47ad013 100644 --- a/packages/core-sdk/src/resources/permission.ts +++ b/packages/core-sdk/src/resources/permission.ts @@ -8,6 +8,8 @@ import { parseToBigInt, waitTxAndFilterLog } from "../utils/utils"; export class PermissionClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public ipAccountABI = IPAccountABI; + public accessControllerConfig = AccessControllerConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.rpcClient = rpcClient; @@ -15,29 +17,42 @@ export class PermissionClient { } /** - * Set Permission based on the specified input - * - * @param request - the request object that contains all data needed to set permission. - * @returns the response object that contains results from the set permission. + * Sets the permission for a specific function call + * Each policy is represented as a mapping from an IP account address to a signer address to a recipient + * address to a function selector to a permission level. The permission level can be 0 (ABSTAIN), 1 (ALLOW), or + * 2 (DENY). + * By default, all policies are set to 0 (ABSTAIN), which means that the permission is not set. + * The owner of ipAccount by default has all permission. + * address(0) => wildcard + * bytes4(0) => wildcard + * Specific permission overrides wildcard permission. + * @param request The request object containing necessary data to set permissions. + * @param request.ipAsset The address of the IP account that grants the permission for `signer` + * @param request.signer The address that can call `to` on behalf of the `ipAccount` + * @param request.to The address that can be called by the `signer` (currently only modules can be `to`) + * @param request.func The function selector string of `to` that can be called by the `signer` on behalf of the `ipAccount` + * @param request.permission The new permission level + * @returns A Promise that resolves to an object containing the transaction hash + * @emits PermissionSet (ipAccountOwner, ipAccount, signer, to, func, permission) */ public async setPermission(request: setPermissionsRequest): Promise { try { const IPAccountConfig = { - abi: IPAccountABI, - address: getAddress(request.ipAsset), + abi: this.ipAccountABI, + address: getAddress(request.ipId), }; const { request: call } = await this.rpcClient.simulateContract({ ...IPAccountConfig, functionName: "execute", args: [ - AccessControllerConfig.address, + this.accessControllerConfig.address, parseToBigInt(0), encodeFunctionData({ - abi: AccessControllerConfig.abi, + abi: this.accessControllerConfig.abi, functionName: "setPermission", args: [ - getAddress(request.ipAsset), // 0x Address + getAddress(request.ipId), // 0x Address getAddress(request.signer), // 0x Address getAddress(request.to), // 0x Address request.func as Hex, // bytes4 @@ -52,7 +67,7 @@ export class PermissionClient { if (request.txOptions?.waitForTransaction) { await waitTxAndFilterLog(this.rpcClient, txHash, { - ...AccessControllerConfig, + ...this.accessControllerConfig, eventName: "PermissionSet", }); return { txHash: txHash, success: true }; diff --git a/packages/core-sdk/src/resources/policy.ts b/packages/core-sdk/src/resources/policy.ts index 3b66f602..1a962e75 100644 --- a/packages/core-sdk/src/resources/policy.ts +++ b/packages/core-sdk/src/resources/policy.ts @@ -4,12 +4,12 @@ import { handleError } from "../utils/errors"; import { IPAccountABI, LicensingModuleConfig, - UMLPolicyFrameworkManagerConfig, + PILPolicyFrameworkManagerConfig, } from "../abi/config"; import { parseToBigInt, waitTxAndFilterLog } from "../utils/utils"; import { - RegisterUMLPolicyRequest, - RegisterUMLPolicyResponse, + RegisterPILPolicyRequest, + RegisterPILPolicyResponse, AddPolicyToIpRequest, AddPolicyToIpResponse, } from "../types/resources/policy"; @@ -17,6 +17,9 @@ import { export class PolicyClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public ipAccountABI = IPAccountABI; + public licensingModuleConfig = LicensingModuleConfig; + public pilPolicyFrameworkManagerConfig = PILPolicyFrameworkManagerConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.wallet = wallet; @@ -24,35 +27,53 @@ export class PolicyClient { } /** - * Create a policy on Story Protocol based on the specified params. - * - * @param request - the request object that contains all data needed to register a policy. - * @returns the response object that contains results from the policy creation. + * Registers a PIL policy to the registry + * Internally, this function must generate a Licensing.Policy struct and call registerPolicy. + * @param request - the licensing parameters for the Programmable IP License v1 (PIL) standard. + * @param request.transferable Whether or not the license is transferable + * @param request.attribution Whether or not attribution is required when reproducing the work + * @param request.commercialUse Whether or not the work can be used commercially + * @param request.commercialAttribution Whether or not attribution is required when reproducing the work commercially + * @param request.commercializerChecker commericializers that are allowed to commercially exploit the work. If zero address, then no restrictions is enforced. + * @param request.commercialRevShare Percentage of revenue that must be shared with the licensor + * @param request.derivativesAllowed Whether or not the licensee can create derivatives of his work + * @param request.derivativesAttribution Whether or not attribution is required for derivatives of the work + * @param request.derivativesApproval Whether or not the licensor must approve derivatives of the work before they can be linked to the licensor IP ID + * @param request.derivativesReciprocal Whether or not the licensee must license derivatives of the work under the same terms. + * @param request.territories List of territories where the license is valid. If empty, global. + * @param request.distributionChannels List of distribution channels where the license is valid. Empty if no restrictions. + * @param request.royaltyPolicy Address of a royalty policy contract (e.g. RoyaltyPolicyLS) that will handle royalty payments + * @returns the transaction hash and the policy ID if the txOptions.waitForTransaction is set to true */ - public async registerUMLPolicy( - request: RegisterUMLPolicyRequest, - ): Promise { + public async registerPILPolicy( + request: RegisterPILPolicyRequest, + ): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...UMLPolicyFrameworkManagerConfig, + ...this.pilPolicyFrameworkManagerConfig, functionName: "registerPolicy", args: [ { transferable: request.transferable, - attribution: request.attribution || false, - commercialUse: request.commercialUse || false, - commercialAttribution: request.commercialAttribution || false, - commercializers: request.commercializers || [], - commercialRevShare: request.commercialRevShare || 0, - derivativesAllowed: request.derivativesAllowed || false, - derivativesAttribution: request.commercialAttribution || false, - derivativesApproval: request.derivativesApproval || false, - derivativesReciprocal: request.derivativesReciprocal || false, - derivativesRevShare: request.derivativesRevShare || 0, - territories: request.territories || [], - distributionChannels: request.distributionChannels || [], - contentRestrictions: request.contentRestrictions || [], royaltyPolicy: request.royaltyPolicy || zeroAddress, + mintingFee: parseToBigInt(request.mintingFee || 0), + mintingFeeToken: request.mintingFeeToken || zeroAddress, + policy: { + attribution: request.attribution || false, + commercialUse: request.commercialUse || false, + commercialAttribution: request.commercialAttribution || false, + commercialRevShare: request.commercialRevShare || 0, + derivativesAllowed: request.derivativesAllowed || false, + derivativesAttribution: request.commercialAttribution || false, + derivativesApproval: request.derivativesApproval || false, + derivativesReciprocal: request.derivativesReciprocal || false, + commercializerChecker: request.commercializerChecker || zeroAddress, + commercializerCheckerData: (request.commercializerCheckerData || + "0x") as `0x${string}`, + territories: request.territories || [], + distributionChannels: request.distributionChannels || [], + contentRestrictions: request.contentRestrictions || [], + }, }, ], account: this.wallet.account, @@ -61,7 +82,7 @@ export class PolicyClient { if (request.txOptions?.waitForTransaction) { const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...LicensingModuleConfig, + ...this.licensingModuleConfig, eventName: "PolicyRegistered", }); return { txHash: txHash, policyId: targetLog?.args.policyId.toString() }; @@ -73,10 +94,17 @@ export class PolicyClient { } } + /** + * Adds a policy to the set of policies of an IP + * @param request The request object containing details to add a policy to an IP + * @param request.ipId The id of the IP + * @param request.polId The id of the policy + * @return the transaction hash and the index of the policy in the IP's policy set if the txOptions.waitForTransaction is set to true + */ public async addPolicyToIp(request: AddPolicyToIpRequest): Promise { try { const IPAccountConfig = { - abi: IPAccountABI, + abi: this.ipAccountABI, address: getAddress(request.ipId), }; @@ -84,10 +112,10 @@ export class PolicyClient { ...IPAccountConfig, functionName: "execute", args: [ - LicensingModuleConfig.address, + this.licensingModuleConfig.address, parseToBigInt(0), encodeFunctionData({ - abi: LicensingModuleConfig.abi, + abi: this.licensingModuleConfig.abi, functionName: "addPolicyToIp", args: [getAddress(request.ipId), parseToBigInt(request.policyId)], }), @@ -98,7 +126,7 @@ export class PolicyClient { // TODO: the emit event doesn't return anything if (request.txOptions?.waitForTransaction) { const targetLog = await waitTxAndFilterLog(this.rpcClient, txHash, { - ...LicensingModuleConfig, + ...this.licensingModuleConfig, eventName: "PolicyAddedToIpId", }); return { txHash: txHash, index: targetLog.args.index.toString() }; diff --git a/packages/core-sdk/src/resources/tagging.ts b/packages/core-sdk/src/resources/tagging.ts index 295db67f..950ad45c 100644 --- a/packages/core-sdk/src/resources/tagging.ts +++ b/packages/core-sdk/src/resources/tagging.ts @@ -13,6 +13,7 @@ import { waitTx } from "../utils/utils"; export class TaggingClient { private readonly wallet: WalletClient; private readonly rpcClient: PublicClient; + public taggingModuleConfig = TaggingModuleConfig; constructor(rpcClient: PublicClient, wallet: WalletClient) { this.rpcClient = rpcClient; @@ -22,7 +23,7 @@ export class TaggingClient { public async setTag(request: SetTagRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...TaggingModuleConfig, + ...this.taggingModuleConfig, functionName: "setTag", args: [request.tag, request.ipId], }); @@ -42,7 +43,7 @@ export class TaggingClient { public async removeTag(request: RemoveTagRequest): Promise { try { const { request: call } = await this.rpcClient.simulateContract({ - ...TaggingModuleConfig, + ...this.taggingModuleConfig, functionName: "removeTag", args: [request.tag, request.ipId], }); diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 190ee92a..7a99fa0e 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -15,7 +15,7 @@ export type MintLicenseResponse = { export type LinkIpToParentRequest = { licenseIds: string[]; - childIpId: string; + childIpId: `0x${string}`; minRoyalty: number; txOptions?: TxOptions; }; diff --git a/packages/core-sdk/src/types/resources/permission.ts b/packages/core-sdk/src/types/resources/permission.ts index ed4219f3..b878d485 100644 --- a/packages/core-sdk/src/types/resources/permission.ts +++ b/packages/core-sdk/src/types/resources/permission.ts @@ -1,9 +1,9 @@ import { TxOptions } from "../options"; export type setPermissionsRequest = { - ipAsset: string; - signer: string; - to: string; + ipId: `0x${string}`; + signer: `0x${string}`; + to: `0x${string}`; func: string; permission: number; txOptions?: TxOptions; diff --git a/packages/core-sdk/src/types/resources/policy.ts b/packages/core-sdk/src/types/resources/policy.ts index d511b6e0..88eb37f0 100644 --- a/packages/core-sdk/src/types/resources/policy.ts +++ b/packages/core-sdk/src/types/resources/policy.ts @@ -1,8 +1,110 @@ import { TxOptions } from "../options"; +/* +"components": [ + { + "internalType": "bool", + "name": "transferable", + "type": "bool" + }, + { + "internalType": "address", + "name": "royaltyPolicy", + "type": "address" + }, + { + "internalType": "uint256", + "name": "mintingFee", + "type": "uint256" + }, + { + "internalType": "address", + "name": "mintingFeeToken", + "type": "address" + }, + { + "components": [ + { + "internalType": "bool", + "name": "attribution", + "type": "bool" + }, + { + "internalType": "bool", + "name": "commercialUse", + "type": "bool" + }, + { + "internalType": "bool", + "name": "commercialAttribution", + "type": "bool" + }, + { + "internalType": "address", + "name": "commercializerChecker", + "type": "address" + }, + { + "internalType": "bytes", + "name": "commercializerCheckerData", + "type": "bytes" + }, + { + "internalType": "uint32", + "name": "commercialRevShare", + "type": "uint32" + }, + { + "internalType": "bool", + "name": "derivativesAllowed", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesAttribution", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesApproval", + "type": "bool" + }, + { + "internalType": "bool", + "name": "derivativesReciprocal", + "type": "bool" + }, + { + "internalType": "string[]", + "name": "territories", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "distributionChannels", + "type": "string[]" + }, + { + "internalType": "string[]", + "name": "contentRestrictions", + "type": "string[]" + } + ], + "internalType": "struct PILPolicy", + "name": "policy", + "type": "tuple" + } + ], + "internalType": "struct RegisterPILPolicyParams", + "name": "params", + "type": "tuple" + } +*/ -export type RegisterUMLPolicyRequest = { +export type RegisterPILPolicyRequest = { transferable: boolean; royaltyPolicy?: `0x${string}`; + mintingFee?: number; + mintingFeeToken?: `0x${string}`; attribution?: boolean; commercialUse?: boolean; commercialAttribution?: boolean; @@ -11,21 +113,21 @@ export type RegisterUMLPolicyRequest = { derivativesAttribution?: boolean; derivativesApproval?: boolean; derivativesReciprocal?: boolean; - derivativesRevShare?: number; territories?: string[]; distributionChannels?: string[]; contentRestrictions?: string[]; - commercializers?: string[]; + commercializerChecker?: `0x${string}`; + commercializerCheckerData?: string; txOptions?: TxOptions; }; -export type RegisterUMLPolicyResponse = { +export type RegisterPILPolicyResponse = { txHash: string; policyId?: string; }; export type AddPolicyToIpRequest = { - ipId: string; + ipId: `0x${string}`; policyId: string; txOptions?: TxOptions; }; diff --git a/packages/core-sdk/src/utils/env.ts b/packages/core-sdk/src/utils/env.ts new file mode 100644 index 00000000..b655452f --- /dev/null +++ b/packages/core-sdk/src/utils/env.ts @@ -0,0 +1,24 @@ +export const sepolia = { + AccessController: "0x31dd83a3FebB5fAD7F7bc8D4E05B623461B74a02", + AncestorsVaultLAP: "0x9Faa4E491a211bFa415d44554120B1b31b6f4e59", + ArbitrationPolicySP: "0x75e181d5eb307eCccf8d3b4724109eca14719A75", + DisputeModule: "0x11dAA3F573C4d6673BBE7f2D96B4C91073A0d55d", + Governance: "0xa18252Aa11Ff1B20b89C10109050CC46A4067b22", + IPAccountImpl: "0x7BBaB2BD68fd3990c8dA2c26334a6DF8Acc7E96E", + IPAccountRegistry: "0x7184bAdAdf24dc261C7C27BceFF53d7A25a06846", + IPAssetRegistry: "0xF59adB67B7CC87436A7CC41040A7dB24AE90aDB8", + IPAssetRenderer: "0x986d8E96b30b688FCD84e9A5A757C3d4304B47b6", + IPMetadataProvider: "0xfcD468A72F76e89F2Df517274063ef7210a32e2A", + IPResolver: "0xF0920314Fb4C375cdEB5b15c4e77277aCf36E3D7", + LicenseRegistry: "0x4D6a54B467332dF675cFa689cb294A4cB9122866", + LicensingModule: "0x0C72b24067a15994f91D92Fd9bA23eB5ebcF8378", + MockERC20: "0xd53C2A80D24F6B3Ff009E48CF88D3b482E8E1457", + MockERC721: "0xD3719824a768c139AAa7C5eFc8BDb5D1d13A1564", + MockTokenGatedHook: "0x2d3ED4354eD09B0E6aa252938aEF41920aB6FC40", + ModuleRegistry: "0x17Ad1cD06d44ae5F5480A675A4D8BD8DAED40410", + PILPolicyFrameworkManager: "0x49cF5C5523011F8B4A0489969096Eb68C571C197", + RegistrationModule: "0x248c8CbF469ec7CB22Dc9914E569920b93d717a3", + RoyaltyModule: "0x512bbF310452cC96E0E9818B0870EcA557b86d4D", + RoyaltyPolicyLAP: "0x8404061350BA0CA85c4E733B0be78c5519679003", + TaggingModule: "0xED445f1DeE74Cf470Aab47F4b63734653C4C9537", +}; diff --git a/packages/core-sdk/test/integration/config.test.ts b/packages/core-sdk/test/integration/config.test.ts index ae05881d..252f21c6 100644 --- a/packages/core-sdk/test/integration/config.test.ts +++ b/packages/core-sdk/test/integration/config.test.ts @@ -9,7 +9,7 @@ chai.use(chaiAsPromised); chai.config.truncateThreshold = 0; before(async function () { - const TEST_CHECKPOINT = "0x9318010dbc5cb77ff108803dbfee082653fb3258a248650c0be0b9c4b0c13a07"; + const TEST_CHECKPOINT = "0x024c376000e3bb27344a6d8bbd5b99ee22c84eb9beefdfc3caa7bb367869dc09"; const client = createPublicClient({ chain: { id: 11155111, diff --git a/packages/core-sdk/test/integration/dispute.test.ts b/packages/core-sdk/test/integration/dispute.test.ts index bf4c9c9c..a88e7eab 100644 --- a/packages/core-sdk/test/integration/dispute.test.ts +++ b/packages/core-sdk/test/integration/dispute.test.ts @@ -10,7 +10,7 @@ import { SetDisputeJudgementRequest, } from "../../src/types/resources/dispute"; -describe("Dispute Functions", () => { +describe.skip("Dispute Functions", () => { let client: StoryClient; before(function () { @@ -21,13 +21,14 @@ describe("Dispute Functions", () => { client = StoryClient.newClient(config); }); + describe("Should be able to", async function () { it.skip("raise a dispute", async () => { const raiseDisputeRequest: RaiseDisputeRequest = { - targetIpId: "0xcd3a91675b990f27eb544b85cdb6844573b66a43", - arbitrationPolicy: "0x61eb3DBc2c60Cf6aFde43a9286D89Da264899003", + targetIpId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", + arbitrationPolicy: "0xb41BC78478878B338336C5E7a34292213779cd6F", linkToDisputeEvidence: "foo", - targetTag: "bar", + targetTag: "PLAGIARISM", txOptions: { waitForTransaction: true, }, @@ -65,20 +66,5 @@ describe("Dispute Functions", () => { expect(response.txHash).to.be.a("string"); expect(response.txHash).not.empty; }); - - it.skip("set a dispute judgement", async () => { - const setDisputeJudgementRequest: SetDisputeJudgementRequest = { - disputeId: 5, - decision: true, - txOptions: { - waitForTransaction: true, - }, - }; - const response = await expect(client.dispute.setDisputeJudgement(setDisputeJudgementRequest)) - .to.not.be.rejected; - - expect(response.txHash).to.be.a("string"); - expect(response.txHash).not.empty; - }); }); }); diff --git a/packages/core-sdk/test/integration/ipAsset.test.ts b/packages/core-sdk/test/integration/ipAsset.test.ts index 0ae8c0b8..0243e247 100644 --- a/packages/core-sdk/test/integration/ipAsset.test.ts +++ b/packages/core-sdk/test/integration/ipAsset.test.ts @@ -2,6 +2,13 @@ import { expect } from "chai"; import { StoryClient, StoryConfig } from "../../src"; import { Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; +import { + RegistrationModuleConfig, + IPAssetRegistryConfig, + IPAccountABI, + LicenseRegistryConfig, + LicensingModuleConfig, +} from "./testABI"; describe("IP Asset Functions", () => { let client: StoryClient; @@ -16,6 +23,11 @@ describe("IP Asset Functions", () => { senderAddress = config.account.address; client = StoryClient.newClient(config); + client.ipAsset.registrationModuleConfig = RegistrationModuleConfig; + client.ipAsset.ipAssetRegistryConfig = IPAssetRegistryConfig; + client.license.ipAccountABI = IPAccountABI; + client.license.licenseRegistryConfig = LicenseRegistryConfig; + client.license.licensingModuleConfig = LicensingModuleConfig; }); describe("Create root IP Asset", async function () { @@ -24,8 +36,8 @@ describe("IP Asset Functions", () => { const response = await expect( client.ipAsset.registerRootIp({ policyId: "0", - tokenContractAddress: "0xcd3a91675b990f27eb544b85cdb6844573b66a43", - tokenId: "110", + tokenContractAddress: "0x7a90a7acff8bf14f13f8d1bdac5b663ef4f379ee", + tokenId: "100", txOptions: { waitForTransaction: waitForTransaction, }, @@ -47,7 +59,7 @@ describe("IP Asset Functions", () => { // 1. mint a license const mintLicenseResponse = await client.license.mintLicense({ policyId: "2", - licensorIpId: "0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431", + licensorIpId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", mintAmount: 1, receiverAddress: process.env.TEST_WALLET_ADDRESS! as `0x${string}`, txOptions: { @@ -60,8 +72,8 @@ describe("IP Asset Functions", () => { const response = await expect( client.ipAsset.registerDerivativeIp({ licenseIds: [licenseId], - tokenContractAddress: "0xcd3a91675b990f27eb544b85cdb6844573b66a43", - tokenId: "111", + tokenContractAddress: "0x7a90a7acff8bf14f13f8d1bdac5b663ef4f379ee", + tokenId: "101", txOptions: { waitForTransaction: waitForTransaction, }, diff --git a/packages/core-sdk/test/integration/license.test.ts b/packages/core-sdk/test/integration/license.test.ts index cf348a50..a384c9b1 100644 --- a/packages/core-sdk/test/integration/license.test.ts +++ b/packages/core-sdk/test/integration/license.test.ts @@ -2,7 +2,7 @@ import { expect } from "chai"; import { StoryClient, StoryConfig } from "../../src"; import { Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; -import "./ipAsset.test"; +import { IPAccountABI, LicenseRegistryConfig, LicensingModuleConfig } from "./testABI"; describe("License Functions", () => { let client: StoryClient; @@ -17,6 +17,9 @@ describe("License Functions", () => { senderAddress = config.account.address; client = StoryClient.newClient(config); + client.license.ipAccountABI = IPAccountABI; + client.license.licenseRegistryConfig = LicenseRegistryConfig; + client.license.licensingModuleConfig = LicensingModuleConfig; }); describe("Mint Licenses", async function () { @@ -25,7 +28,7 @@ describe("License Functions", () => { const response = await expect( client.license.mintLicense({ policyId: "2", - licensorIpId: "0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431", + licensorIpId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", mintAmount: 1, receiverAddress: process.env.TEST_WALLET_ADDRESS! as `0x${string}`, txOptions: { @@ -49,7 +52,7 @@ describe("License Functions", () => { // 1. mint a license const mintLicenseResponse = await client.license.mintLicense({ policyId: "2", - licensorIpId: "0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431", + licensorIpId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", mintAmount: 1, receiverAddress: process.env.TEST_WALLET_ADDRESS! as `0x${string}`, txOptions: { @@ -62,7 +65,7 @@ describe("License Functions", () => { const response = await expect( client.license.linkIpToParent({ licenseIds: [licenseId], - childIpId: "0x92f54fe4cfca3c0f7bdf4798ed0d07a2c209577e", + childIpId: "0x5a75ab16eaaee5fb1d2f66e3b217d36b4fc831f9", minRoyalty: 1, txOptions: { waitForTransaction: waitForTransaction, diff --git a/packages/core-sdk/test/integration/permission.test.ts b/packages/core-sdk/test/integration/permission.test.ts index abd8380c..ad214adf 100644 --- a/packages/core-sdk/test/integration/permission.test.ts +++ b/packages/core-sdk/test/integration/permission.test.ts @@ -2,6 +2,7 @@ import { expect } from "chai"; import { StoryClient, StoryConfig } from "../../src"; import { Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; +import { IPAccountABI, AccessControllerConfig } from "./testABI"; describe("Permission Functions", () => { let client: StoryClient; @@ -16,6 +17,8 @@ describe("Permission Functions", () => { senderAddress = config.account.address; client = StoryClient.newClient(config); + client.permission.ipAccountABI = IPAccountABI; + client.permission.accessControllerConfig = AccessControllerConfig; }); describe("Set Permission", async function () { @@ -23,9 +26,9 @@ describe("Permission Functions", () => { const waitForTransaction: boolean = true; const response = await expect( client.permission.setPermission({ - ipAsset: "0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431", - signer: process.env.TEST_WALLET_ADDRESS!, - to: "0x83BADBEaee19cd0ADB786da57E2Ff5c500ee3A50", + ipId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", + signer: process.env.TEST_WALLET_ADDRESS as `0x${string}`, + to: "0x2ac240293f12032E103458451dE8A8096c5A72E8", func: "0x00000000", permission: 1, txOptions: { diff --git a/packages/core-sdk/test/integration/policy.test.ts b/packages/core-sdk/test/integration/policy.test.ts index 3ceb6dc5..dabae622 100644 --- a/packages/core-sdk/test/integration/policy.test.ts +++ b/packages/core-sdk/test/integration/policy.test.ts @@ -2,8 +2,9 @@ import { expect } from "chai"; import { StoryClient, StoryConfig } from "../../src"; import { Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; +import { IPAccountABI, LicensingModuleConfig, PILPolicyFrameworkManagerConfig } from "./testABI"; -describe.skip("Test Policy Functions", () => { +describe("Test Policy Functions", () => { let client: StoryClient; let senderAddress: string; @@ -16,13 +17,16 @@ describe.skip("Test Policy Functions", () => { senderAddress = config.account.address; client = StoryClient.newClient(config); + client.policy.ipAccountABI = IPAccountABI; + client.policy.licensingModuleConfig = LicensingModuleConfig; + client.policy.pilPolicyFrameworkManagerConfig = PILPolicyFrameworkManagerConfig; }); // 0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431 - describe("Register UML Policy", async function () { - it("should not throw error when registering UML Policy with everything turned off", async () => { + describe("Register PIL Policy", async function () { + it("should not throw error when registering PIL Policy with everything turned off", async () => { const waitForTransaction: boolean = true; const response = await expect( - client.policy.registerUMLPolicy({ + client.policy.registerPILPolicy({ transferable: false, txOptions: { waitForTransaction: waitForTransaction, @@ -39,10 +43,10 @@ describe.skip("Test Policy Functions", () => { } }); - it("should not throw error when registering UML Policy with social remixing", async () => { + it("should not throw error when registering PIL Policy with social remixing", async () => { const waitForTransaction: boolean = true; const response = await expect( - client.policy.registerUMLPolicy({ + client.policy.registerPILPolicy({ transferable: true, attribution: true, derivativesAllowed: true, @@ -63,10 +67,10 @@ describe.skip("Test Policy Functions", () => { } }); - it("should not throw error when registering UML Policy with commercial use", async () => { + it.skip("should not throw error when registering PIL Policy with commercial use", async () => { const waitForTransaction: boolean = true; const response = await expect( - client.policy.registerUMLPolicy({ + client.policy.registerPILPolicy({ transferable: true, attribution: true, commercialUse: true, @@ -92,7 +96,7 @@ describe.skip("Test Policy Functions", () => { const waitForTransaction: boolean = true; const response = await expect( client.policy.addPolicyToIp({ - ipId: "0x3b4bdf523f5b85a466b3501efaee87f2e2ad6431", + ipId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", policyId: "1", txOptions: { waitForTransaction: waitForTransaction, diff --git a/packages/core-sdk/test/integration/tagging.test.ts b/packages/core-sdk/test/integration/tagging.test.ts index e9633d39..98c7a0c4 100644 --- a/packages/core-sdk/test/integration/tagging.test.ts +++ b/packages/core-sdk/test/integration/tagging.test.ts @@ -2,6 +2,7 @@ import { expect } from "chai"; import { StoryClient, StoryConfig } from "../../src"; import { Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; +import { TaggingModuleConfig } from "./testABI"; describe("Tagging Functions (integration tests)", () => { let client: StoryClient; @@ -16,6 +17,7 @@ describe("Tagging Functions (integration tests)", () => { senderAddress = config.account.address; client = StoryClient.newClient(config); + client.tagging.taggingModuleConfig = TaggingModuleConfig; }); describe("Should be able to", async function () { diff --git a/packages/core-sdk/test/integration/testABI.ts b/packages/core-sdk/test/integration/testABI.ts new file mode 100644 index 00000000..8beb678f --- /dev/null +++ b/packages/core-sdk/test/integration/testABI.ts @@ -0,0 +1,71 @@ +import { getAddress } from "viem"; + +import IERC1155ABI from "../../src/abi/json/IERC1155.abi"; +import AccessControllerABI from "../../src/abi/json/AccessController.abi"; +import DisputeModuleABI from "../../src/abi/json/DisputeModule.abi"; +import IPAccountImplABI from "../../src/abi/json/IPAccountImpl.abi"; +import IPAssetRegistryABI from "../../src/abi/json/IIPAssetRegistry.abi"; +import LicensingModuleABI from "../../src/abi/json/LicensingModule.abi"; +import PILPolicyFrameworkManagerABI from "../../src/abi/json/PILPolicyFrameworkManager.abi"; +import RegistrationModuleABI from "../../src/abi/json/RegistrationModule.abi"; +import TaggingModuleABI from "../../src/abi/json/TaggingModule.abi"; +import ErrorsABI from "../../src/abi/json/Errors.abi"; + +export const tenderly = { + AccessController: "0x674d6E1f7b5e2d714DBa588e9d046965225517c8", + ArbitrationPolicySP: "0xb41BC78478878B338336C5E7a34292213779cd6F", + DisputeModule: "0x3A96cad7b2aC783a6811c7c3e8DEF30E8a4cfcDb", + IPAccountImpl: "0x7481a227A11860E80f69AB39d0165258f4c139f6", + IPAccountRegistry: "0x74Cbd8CCc22290FeaaE8421D4FFc6760210B5B0C", + IPAssetRegistry: "0xb1534826Bc9D77d818CbC596435f530778C73865", + LicenseRegistry: "0x66f6865668F2B9213Ed05b97eE97beb97A75e243", + LicensingModule: "0x2ac240293f12032E103458451dE8A8096c5A72E8", + PILPolicyFrameworkManager: "0x3C30b98f56b469c0d292EFF5878e9Fb302CB13dD", + RegistrationModule: "0x193f0Cc84d51Fc38a30658d7eFffEB2C5Cc25840", + TaggingModule: "0x92787d8e2E5fE563A91Ee37B6e953BD0A4bAC1eD", +}; + +export const IPAccountABI = [...IPAccountImplABI, ...ErrorsABI]; + +export const IPAssetRegistryConfig = { + abi: IPAssetRegistryABI, + address: getAddress(tenderly.IPAssetRegistry), +}; + +export const AccessControllerConfig = { + abi: [...AccessControllerABI, ...ErrorsABI], + address: getAddress(tenderly.AccessController), +}; + +export const DisputeModuleConfig = { + abi: [...DisputeModuleABI, ...ErrorsABI], + address: getAddress(tenderly.DisputeModule), +}; + +export const LicenseRegistryConfig = { + abi: IERC1155ABI, + address: getAddress(tenderly.LicenseRegistry), +}; + +export const LicensingModuleConfig = { + abi: LicensingModuleABI, + //abi: [...LicensingModuleABI, ...ErrorsABI], + address: getAddress(tenderly.LicensingModule), +}; + +export const RegistrationModuleConfig = { + abi: RegistrationModuleABI, + //abi: [...RegistrationModuleABI, ...ErrorsABI], + address: getAddress(tenderly.RegistrationModule), +}; + +export const TaggingModuleConfig = { + abi: [...TaggingModuleABI, ...ErrorsABI], + address: getAddress(tenderly.TaggingModule), +}; + +export const PILPolicyFrameworkManagerConfig = { + abi: PILPolicyFrameworkManagerABI, + //abi: [...PILPolicyFrameworkManagerABI, ...ErrorsABI], + address: getAddress(tenderly.PILPolicyFrameworkManager), +}; diff --git a/packages/core-sdk/test/unit/resources/permission.test.ts b/packages/core-sdk/test/unit/resources/permission.test.ts index aba44164..e4e79a81 100644 --- a/packages/core-sdk/test/unit/resources/permission.test.ts +++ b/packages/core-sdk/test/unit/resources/permission.test.ts @@ -34,7 +34,7 @@ describe("Test Permission", function () { walletMock.writeContract = sinon.stub().resolves(txHash); const res = await permissionClient.setPermission({ - ipAsset: AddressZero, + ipId: AddressZero, signer: AddressZero, to: AddressZero, func: "0x00000000", @@ -54,7 +54,7 @@ describe("Test Permission", function () { walletMock.writeContract = sinon.stub().resolves(txHash); const res = await permissionClient.setPermission({ - ipAsset: AddressZero, + ipId: AddressZero, signer: AddressZero, to: AddressZero, func: "0x00000000", @@ -111,7 +111,7 @@ describe("Test Permission", function () { walletMock.writeContract = sinon.stub().rejects(new Error("http 500")); await expect( permissionClient.setPermission({ - ipAsset: AddressZero, + ipId: AddressZero, signer: AddressZero, to: AddressZero, func: "0x00000000", @@ -131,7 +131,7 @@ describe("Test Permission", function () { await expect( permissionClient.setPermission({ - ipAsset: AddressZero, + ipId: AddressZero, signer: AddressZero, to: AddressZero, func: AddressZero,