diff --git a/packages/core-sdk/package.json b/packages/core-sdk/package.json index 3af853cf..e561d47e 100644 --- a/packages/core-sdk/package.json +++ b/packages/core-sdk/package.json @@ -1,6 +1,6 @@ { "name": "@story-protocol/core-sdk", - "version": "1.0.0-rc.4", + "version": "1.0.0-rc.5", "description": "Story Protocol Core SDK", "main": "dist/story-protocol-core-sdk.cjs.js", "module": "dist/story-protocol-core-sdk.esm.js", @@ -78,11 +78,11 @@ "src/index.ts", "src/types/**/*" ], - "check-coverage": false, - "lines": 70, - "functions": 70, - "branches": 70, - "statements": 70 + "check-coverage": true, + "lines": 90, + "functions": 90, + "branches": 90, + "statements": 90 }, "typedoc": { "entryPoint": "./src/index.ts", diff --git a/packages/core-sdk/src/abi/generated.ts b/packages/core-sdk/src/abi/generated.ts index 958a71b5..370bc0c7 100644 --- a/packages/core-sdk/src/abi/generated.ts +++ b/packages/core-sdk/src/abi/generated.ts @@ -19,10 +19,17 @@ import { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c) */ export const accessControllerAbi = [ - { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "constructor", + inputs: [ + { name: "ipAccountRegistry", internalType: "address", type: "address" }, + { name: "moduleRegistry", internalType: "address", type: "address" }, + ], + stateMutability: "nonpayable", + }, { type: "error", inputs: [ @@ -31,7 +38,11 @@ export const accessControllerAbi = [ ], name: "AccessController__BothCallerAndRecipientAreNotRegisteredModule", }, - { type: "error", inputs: [], name: "AccessController__CallerIsNotIPAccount" }, + { + type: "error", + inputs: [], + name: "AccessController__CallerIsNotIPAccountOrOwner", + }, { type: "error", inputs: [{ name: "ipAccount", internalType: "address", type: "address" }], @@ -54,6 +65,36 @@ export const accessControllerAbi = [ }, { type: "error", inputs: [], name: "AccessController__PermissionIsNotValid" }, { type: "error", inputs: [], name: "AccessController__SignerIsZeroAddress" }, + { + type: "error", + inputs: [], + name: "AccessController__ToAndFuncAreZeroAddressShouldCallSetAllPermissions", + }, + { type: "error", inputs: [], name: "AccessController__ZeroAccessManager" }, + { + type: "error", + inputs: [], + name: "AccessController__ZeroIPAccountRegistry", + }, + { type: "error", inputs: [], name: "AccessController__ZeroModuleRegistry" }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -65,16 +106,9 @@ export const accessControllerAbi = [ name: "ERC1967InvalidImplementation", }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { type: "error", inputs: [], name: "Governance__ProtocolPaused" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "UUPSUnauthorizedCallContext" }, @@ -88,13 +122,13 @@ export const accessControllerAbi = [ anonymous: false, inputs: [ { - name: "newGovernance", + name: "authority", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "GovernanceUpdated", + name: "AuthorityUpdated", }, { type: "event", @@ -109,6 +143,19 @@ export const accessControllerAbi = [ ], name: "Initialized", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Paused", + }, { type: "event", anonymous: false, @@ -142,6 +189,19 @@ export const accessControllerAbi = [ ], name: "PermissionSet", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, { type: "event", anonymous: false, @@ -155,6 +215,26 @@ export const accessControllerAbi = [ ], name: "Upgraded", }, + { + type: "function", + inputs: [], + name: "IP_ACCOUNT_REGISTRY", + outputs: [ + { + name: "", + internalType: "contract IIPAccountRegistry", + type: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "MODULE_REGISTRY", + outputs: [{ name: "", internalType: "contract IModuleRegistry", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -162,6 +242,20 @@ export const accessControllerAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "authority", + outputs: [{ name: "", internalType: "address", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -174,13 +268,6 @@ export const accessControllerAbi = [ outputs: [], stateMutability: "view", }, - { - type: "function", - inputs: [], - name: "getGovernance", - outputs: [{ name: "", internalType: "address", type: "address" }], - stateMutability: "view", - }, { type: "function", inputs: [ @@ -195,11 +282,32 @@ export const accessControllerAbi = [ }, { type: "function", - inputs: [{ name: "governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -210,10 +318,18 @@ export const accessControllerAbi = [ { type: "function", inputs: [ - { name: "ipAccountRegistry", internalType: "address", type: "address" }, - { name: "moduleRegistry", internalType: "address", type: "address" }, + { name: "ipAccount", internalType: "address", type: "address" }, + { name: "signer", internalType: "address", type: "address" }, + { name: "permission", internalType: "uint8", type: "uint8" }, ], - name: "setAddresses", + name: "setAllPermissions", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, @@ -240,32 +356,20 @@ export const accessControllerAbi = [ { type: "function", inputs: [ + { name: "ipAccount", internalType: "address", type: "address" }, { name: "signer", internalType: "address", type: "address" }, { name: "to", internalType: "address", type: "address" }, { name: "func", internalType: "bytes4", type: "bytes4" }, { name: "permission", internalType: "uint8", type: "uint8" }, ], - name: "setGlobalPermission", - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + name: "setPermission", outputs: [], stateMutability: "nonpayable", }, { type: "function", - inputs: [ - { name: "ipAccount", internalType: "address", type: "address" }, - { name: "signer", internalType: "address", type: "address" }, - { name: "to", internalType: "address", type: "address" }, - { name: "func", internalType: "bytes4", type: "bytes4" }, - { name: "permission", internalType: "uint8", type: "uint8" }, - ], - name: "setPermission", + inputs: [], + name: "unpause", outputs: [], stateMutability: "nonpayable", }, @@ -282,14 +386,14 @@ export const accessControllerAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c) */ export const accessControllerAddress = { - 1513: "0x7e253Df9b0fC872746877Fa362b2cAf32712d770", + 11155111: "0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c) */ export const accessControllerConfig = { address: accessControllerAddress, @@ -301,14 +405,15 @@ export const accessControllerConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e) */ export const disputeModuleAbi = [ { type: "constructor", inputs: [ - { name: "controller", internalType: "address", type: "address" }, - { name: "assetRegistry", internalType: "address", type: "address" }, + { name: "accessController", internalType: "address", type: "address" }, + { name: "ipAssetRegistry", internalType: "address", type: "address" }, + { name: "licenseRegistry", internalType: "address", type: "address" }, ], stateMutability: "nonpayable", }, @@ -318,12 +423,31 @@ export const disputeModuleAbi = [ name: "AccessControlled__NotIpAccount", }, { type: "error", inputs: [], name: "AccessControlled__ZeroAddress" }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], name: "AddressEmptyCode", }, { type: "error", inputs: [], name: "DisputeModule__NotAbleToResolve" }, + { type: "error", inputs: [], name: "DisputeModule__NotDerivative" }, { type: "error", inputs: [], name: "DisputeModule__NotDisputeInitiator" }, { type: "error", inputs: [], name: "DisputeModule__NotInDisputeState" }, { type: "error", inputs: [], name: "DisputeModule__NotRegisteredIpId" }, @@ -342,9 +466,20 @@ export const disputeModuleAbi = [ inputs: [], name: "DisputeModule__NotWhitelistedDisputeTag", }, + { + type: "error", + inputs: [], + name: "DisputeModule__ParentDisputeNotResolved", + }, + { type: "error", inputs: [], name: "DisputeModule__ParentIpIdMismatch" }, + { type: "error", inputs: [], name: "DisputeModule__ParentNotTagged" }, + { type: "error", inputs: [], name: "DisputeModule__ZeroAccessController" }, + { type: "error", inputs: [], name: "DisputeModule__ZeroAccessManager" }, { type: "error", inputs: [], name: "DisputeModule__ZeroArbitrationPolicy" }, { type: "error", inputs: [], name: "DisputeModule__ZeroArbitrationRelayer" }, { type: "error", inputs: [], name: "DisputeModule__ZeroDisputeTag" }, + { type: "error", inputs: [], name: "DisputeModule__ZeroIPAssetRegistry" }, + { type: "error", inputs: [], name: "DisputeModule__ZeroLicenseRegistry" }, { type: "error", inputs: [], @@ -356,15 +491,9 @@ export const disputeModuleAbi = [ name: "ERC1967InvalidImplementation", }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" }, @@ -432,6 +561,19 @@ export const disputeModuleAbi = [ ], name: "ArbitrationRelayerWhitelistUpdated", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "authority", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AuthorityUpdated", + }, { type: "event", anonymous: false, @@ -445,6 +587,32 @@ export const disputeModuleAbi = [ ], name: "DefaultArbitrationPolicyUpdated", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "parentIpId", + internalType: "address", + type: "address", + indexed: false, + }, + { + name: "derivativeIpId", + internalType: "address", + type: "address", + indexed: false, + }, + { + name: "parentDisputeId", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { name: "tag", internalType: "bytes32", type: "bytes32", indexed: false }, + ], + name: "DerivativeTaggedOnParentInfringement", + }, { type: "event", anonymous: false, @@ -536,26 +704,26 @@ export const disputeModuleAbi = [ anonymous: false, inputs: [ { - name: "newGovernance", - internalType: "address", - type: "address", - indexed: true, + name: "version", + internalType: "uint64", + type: "uint64", + indexed: false, }, ], - name: "GovernanceUpdated", + name: "Initialized", }, { type: "event", anonymous: false, inputs: [ { - name: "version", - internalType: "uint64", - type: "uint64", + name: "account", + internalType: "address", + type: "address", indexed: false, }, ], - name: "Initialized", + name: "Paused", }, { type: "event", @@ -566,6 +734,19 @@ export const disputeModuleAbi = [ ], name: "TagWhitelistUpdated", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, { type: "event", anonymous: false, @@ -613,6 +794,13 @@ export const disputeModuleAbi = [ outputs: [{ name: "", internalType: "contract IIPAssetRegistry", type: "address" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "LICENSE_REGISTRY", + outputs: [{ name: "", internalType: "contract ILicenseRegistry", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -620,6 +808,13 @@ export const disputeModuleAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [{ name: "ipId", internalType: "address", type: "address" }], @@ -627,6 +822,13 @@ export const disputeModuleAbi = [ outputs: [{ name: "policy", internalType: "address", type: "address" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "authority", + outputs: [{ name: "", internalType: "address", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -666,23 +868,24 @@ export const disputeModuleAbi = [ }, { name: "targetTag", internalType: "bytes32", type: "bytes32" }, { name: "currentTag", internalType: "bytes32", type: "bytes32" }, + { name: "parentDisputeId", internalType: "uint256", type: "uint256" }, ], stateMutability: "view", }, { type: "function", - inputs: [], - name: "getGovernance", - outputs: [{ name: "", internalType: "address", type: "address" }], - stateMutability: "view", - }, - { - type: "function", - inputs: [{ name: "_governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "ipId", internalType: "address", type: "address" }], @@ -714,6 +917,13 @@ export const disputeModuleAbi = [ outputs: [{ name: "allowed", internalType: "bool", type: "bool" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "data", internalType: "bytes[]", type: "bytes[]" }], + name: "multicall", + outputs: [{ name: "results", internalType: "bytes[]", type: "bytes[]" }], + stateMutability: "nonpayable", + }, { type: "function", inputs: [], @@ -721,6 +931,20 @@ export const disputeModuleAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -742,7 +966,10 @@ export const disputeModuleAbi = [ }, { type: "function", - inputs: [{ name: "disputeId", internalType: "uint256", type: "uint256" }], + inputs: [ + { name: "disputeId", internalType: "uint256", type: "uint256" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], name: "resolveDispute", outputs: [], stateMutability: "nonpayable", @@ -757,6 +984,13 @@ export const disputeModuleAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [{ name: "arbitrationPolicy", internalType: "address", type: "address" }], @@ -777,17 +1011,28 @@ export const disputeModuleAbi = [ }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [ + { name: "parentIpId", internalType: "address", type: "address" }, + { name: "derivativeIpId", internalType: "address", type: "address" }, + { name: "parentDisputeId", internalType: "uint256", type: "uint256" }, + ], + name: "tagDerivativeIfParentInfringed", outputs: [], stateMutability: "nonpayable", }, { type: "function", - inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], - name: "supportsInterface", - outputs: [{ name: "", internalType: "bool", type: "bool" }], - stateMutability: "view", + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", }, { type: "function", @@ -833,14 +1078,14 @@ export const disputeModuleAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e) */ export const disputeModuleAddress = { - 1513: "0x6d54456Ae5DCbDC0C9E2713cC8E650fE4f445c7C", + 11155111: "0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e) */ export const disputeModuleConfig = { address: disputeModuleAddress, @@ -852,19 +1097,29 @@ export const disputeModuleConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6) */ export const ipAccountImplAbi = [ { type: "constructor", - inputs: [{ name: "accessController_", internalType: "address", type: "address" }], + inputs: [ + { name: "accessController", internalType: "address", type: "address" }, + { name: "ipAssetRegistry", internalType: "address", type: "address" }, + { name: "licenseRegistry", internalType: "address", type: "address" }, + { name: "moduleRegistry", internalType: "address", type: "address" }, + ], stateMutability: "nonpayable", }, + { + type: "error", + inputs: [{ name: "module", internalType: "address", type: "address" }], + name: "IPAccountStorage__NotRegisteredModule", + }, { type: "error", inputs: [], name: "IPAccount__ExpiredSignature" }, - { type: "error", inputs: [], name: "IPAccount__InvalidAccessController" }, { type: "error", inputs: [], name: "IPAccount__InvalidCalldata" }, { type: "error", inputs: [], name: "IPAccount__InvalidSignature" }, { type: "error", inputs: [], name: "IPAccount__InvalidSigner" }, + { type: "error", inputs: [], name: "IPAccount__ZeroAccessController" }, { type: "event", anonymous: false, @@ -928,28 +1183,29 @@ export const ipAccountImplAbi = [ { type: "function", inputs: [], - name: "accessController", + name: "ACCESS_CONTROLLER", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { type: "function", - inputs: [ - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - ], - name: "addressData", + inputs: [], + name: "IP_ASSET_REGISTRY", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { type: "function", - inputs: [ - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - ], - name: "boolData", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "LICENSE_REGISTRY", + outputs: [{ name: "", internalType: "address", type: "address" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "MODULE_REGISTRY", + outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { @@ -1113,16 +1369,6 @@ export const ipAccountImplAbi = [ outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, - { - type: "function", - inputs: [ - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - ], - name: "stringData", - outputs: [{ name: "", internalType: "string", type: "string" }], - stateMutability: "view", - }, { type: "function", inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], @@ -1141,28 +1387,18 @@ export const ipAccountImplAbi = [ ], stateMutability: "view", }, - { - type: "function", - inputs: [ - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - ], - name: "uint256Data", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - stateMutability: "view", - }, { type: "receive", stateMutability: "payable" }, ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6) */ export const ipAccountImplAddress = { - 1513: "0x38cAfD16502B1d61c6399A18d6Fa1Ea8CEca3678", + 11155111: "0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6) */ export const ipAccountImplConfig = { address: ipAccountImplAddress, @@ -1174,7 +1410,7 @@ export const ipAccountImplConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x84c177633adCD26157732e18dd9E145E442E6aCb) */ export const ipAssetRegistryAbi = [ { @@ -1182,19 +1418,42 @@ export const ipAssetRegistryAbi = [ inputs: [ { name: "erc6551Registry", internalType: "address", type: "address" }, { name: "ipAccountImpl", internalType: "address", type: "address" }, - { name: "governance", internalType: "address", type: "address" }, ], stateMutability: "nonpayable", }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, { type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, + { + type: "error", + inputs: [{ name: "target", internalType: "address", type: "address" }], + name: "AddressEmptyCode", + }, + { + type: "error", + inputs: [{ name: "implementation", internalType: "address", type: "address" }], + name: "ERC1967InvalidImplementation", }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, - { type: "error", inputs: [], name: "IPAccountRegistry_InvalidIpAccountImpl" }, + { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, + { type: "error", inputs: [], name: "FailedInnerCall" }, + { type: "error", inputs: [], name: "IPAccountRegistry_ZeroIpAccountImpl" }, { type: "error", inputs: [], name: "IPAssetRegistry__AlreadyRegistered" }, { type: "error", @@ -1214,18 +1473,35 @@ export const ipAssetRegistryAbi = [ inputs: [{ name: "contractAddress", internalType: "address", type: "address" }], name: "IPAssetRegistry__UnsupportedIERC721Metadata", }, + { type: "error", inputs: [], name: "IPAssetRegistry__ZeroAccessManager" }, + { type: "error", inputs: [], name: "InvalidInitialization" }, + { type: "error", inputs: [], name: "NotInitializing" }, + { + type: "error", + inputs: [ + { name: "value", internalType: "uint256", type: "uint256" }, + { name: "length", internalType: "uint256", type: "uint256" }, + ], + name: "StringsInsufficientHexLength", + }, + { type: "error", inputs: [], name: "UUPSUnauthorizedCallContext" }, + { + type: "error", + inputs: [{ name: "slot", internalType: "bytes32", type: "bytes32" }], + name: "UUPSUnsupportedProxiableUUID", + }, { type: "event", anonymous: false, inputs: [ { - name: "newGovernance", + name: "authority", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "GovernanceUpdated", + name: "AuthorityUpdated", }, { type: "event", @@ -1303,6 +1579,58 @@ export const ipAssetRegistryAbi = [ ], name: "IPRegistered", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "version", + internalType: "uint64", + type: "uint64", + indexed: false, + }, + ], + name: "Initialized", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Paused", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "implementation", + internalType: "address", + type: "address", + indexed: true, + }, + ], + name: "Upgraded", + }, { type: "function", inputs: [], @@ -1327,24 +1655,38 @@ export const ipAssetRegistryAbi = [ { type: "function", inputs: [], - name: "getGovernance", - outputs: [{ name: "", internalType: "address", type: "address" }], + name: "UPGRADE_INTERFACE_VERSION", + outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [], - name: "getIPAccountImpl", + name: "authority", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { type: "function", inputs: [], - name: "governance", + name: "getIPAccountImpl", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "initialize", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [ @@ -1367,6 +1709,13 @@ export const ipAssetRegistryAbi = [ outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "id", internalType: "address", type: "address" }], @@ -1374,9 +1723,31 @@ export const ipAssetRegistryAbi = [ outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + stateMutability: "view", + }, { type: "function", inputs: [ + { name: "chainid", internalType: "uint256", type: "uint256" }, { name: "tokenContract", internalType: "address", type: "address" }, { name: "tokenId", internalType: "uint256", type: "uint256" }, ], @@ -1397,8 +1768,8 @@ export const ipAssetRegistryAbi = [ }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, @@ -1409,17 +1780,34 @@ export const ipAssetRegistryAbi = [ outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [ + { name: "newImplementation", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + }, ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x84c177633adCD26157732e18dd9E145E442E6aCb) */ export const ipAssetRegistryAddress = { - 1513: "0x862de97662a1231FFc14038eC1BE93aB129D2169", + 11155111: "0x84c177633adCD26157732e18dd9E145E442E6aCb", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x84c177633adCD26157732e18dd9E145E442E6aCb) */ export const ipAssetRegistryConfig = { address: ipAssetRegistryAddress, @@ -1431,7 +1819,7 @@ export const ipAssetRegistryConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598) */ export const ipRoyaltyVaultImplAbi = [ { @@ -1444,6 +1832,7 @@ export const ipRoyaltyVaultImplAbi = [ }, { type: "error", inputs: [], name: "IpRoyaltyVault__AlreadyClaimed" }, { type: "error", inputs: [], name: "IpRoyaltyVault__ClaimerNotAnAncestor" }, + { type: "error", inputs: [], name: "IpRoyaltyVault__EnforcedPause" }, { type: "error", inputs: [], name: "IpRoyaltyVault__IpTagged" }, { type: "error", inputs: [], name: "IpRoyaltyVault__NotRoyaltyPolicyLAP" }, { @@ -1452,7 +1841,6 @@ export const ipRoyaltyVaultImplAbi = [ name: "IpRoyaltyVault__SnapshotIntervalTooShort", }, { type: "error", inputs: [], name: "IpRoyaltyVault__ZeroDisputeModule" }, - { type: "error", inputs: [], name: "IpRoyaltyVault__ZeroIpId" }, { type: "error", inputs: [], name: "IpRoyaltyVault__ZeroRoyaltyPolicyLAP" }, { type: "event", @@ -1593,7 +1981,7 @@ export const ipRoyaltyVaultImplAbi = [ type: "function", inputs: [{ name: "token", internalType: "address", type: "address" }], name: "addIpRoyaltyVaultTokens", - outputs: [], + outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "nonpayable", }, { @@ -1610,7 +1998,7 @@ export const ipRoyaltyVaultImplAbi = [ type: "function", inputs: [{ name: "token", internalType: "address", type: "address" }], name: "ancestorsVaultAmount", - outputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, { @@ -1654,7 +2042,7 @@ export const ipRoyaltyVaultImplAbi = [ type: "function", inputs: [ { name: "snapshotId", internalType: "uint256", type: "uint256" }, - { name: "tokens", internalType: "address[]", type: "address[]" }, + { name: "tokenList", internalType: "address[]", type: "address[]" }, ], name: "claimRevenueByTokenBatch", outputs: [], @@ -1664,7 +2052,7 @@ export const ipRoyaltyVaultImplAbi = [ type: "function", inputs: [{ name: "token", internalType: "address", type: "address" }], name: "claimVaultAmount", - outputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, { @@ -1674,7 +2062,7 @@ export const ipRoyaltyVaultImplAbi = [ { name: "token", internalType: "address", type: "address" }, ], name: "claimableAtSnapshot", - outputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, { @@ -1712,13 +2100,6 @@ export const ipRoyaltyVaultImplAbi = [ outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "nonpayable", }, - { - type: "function", - inputs: [], - name: "getVaultTokens", - outputs: [{ name: "", internalType: "address[]", type: "address[]" }], - stateMutability: "view", - }, { type: "function", inputs: [ @@ -1763,7 +2144,7 @@ export const ipRoyaltyVaultImplAbi = [ { type: "function", inputs: [{ name: "ancestorIpId", internalType: "address", type: "address" }], - name: "isClaimedByAncestor", + name: "isCollectedByAncestor", outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, @@ -1795,6 +2176,13 @@ export const ipRoyaltyVaultImplAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "tokens", + outputs: [{ name: "", internalType: "address[]", type: "address[]" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -1834,7 +2222,7 @@ export const ipRoyaltyVaultImplAbi = [ type: "function", inputs: [{ name: "snapshotId", internalType: "uint256", type: "uint256" }], name: "unclaimedAtSnapshot", - outputs: [{ name: "tokenAmount", internalType: "uint32", type: "uint32" }], + outputs: [{ name: "", internalType: "uint32", type: "uint32" }], stateMutability: "view", }, { @@ -1847,14 +2235,14 @@ export const ipRoyaltyVaultImplAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598) */ export const ipRoyaltyVaultImplAddress = { - 1513: "0x8Be22cc2D13ADF496a417D9C616dA4a253c68Af8", + 11155111: "0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598) */ export const ipRoyaltyVaultImplConfig = { address: ipRoyaltyVaultImplAddress, @@ -1866,10 +2254,35 @@ export const ipRoyaltyVaultImplConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40) */ export const licenseRegistryAbi = [ - { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "constructor", + inputs: [ + { name: "licensingModule", internalType: "address", type: "address" }, + { name: "disputeModule", internalType: "address", type: "address" }, + ], + stateMutability: "nonpayable", + }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -1882,14 +2295,6 @@ export const licenseRegistryAbi = [ }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", @@ -1911,6 +2316,15 @@ export const licenseRegistryAbi = [ inputs: [{ name: "ipId", internalType: "address", type: "address" }], name: "LicenseRegistry__DerivativeIsParent", }, + { + type: "error", + inputs: [ + { name: "ipId", internalType: "address", type: "address" }, + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + ], + name: "LicenseRegistry__DuplicateLicense", + }, { type: "error", inputs: [ @@ -1925,6 +2339,15 @@ export const licenseRegistryAbi = [ inputs: [{ name: "ipId", internalType: "address", type: "address" }], name: "LicenseRegistry__IpExpired", }, + { + type: "error", + inputs: [ + { name: "ipId", internalType: "address", type: "address" }, + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + ], + name: "LicenseRegistry__LicenseTermsAlreadyAttached", + }, { type: "error", inputs: [ @@ -1933,6 +2356,15 @@ export const licenseRegistryAbi = [ ], name: "LicenseRegistry__LicenseTermsNotExists", }, + { + type: "error", + inputs: [ + { name: "ipId", internalType: "address", type: "address" }, + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + ], + name: "LicenseRegistry__LicensorIpHasNoLicenseTerms", + }, { type: "error", inputs: [], name: "LicenseRegistry__NoParentIp" }, { type: "error", @@ -1963,13 +2395,23 @@ export const licenseRegistryAbi = [ { name: "ipId", internalType: "address", type: "address" }, { name: "licenseTemplate", internalType: "address", type: "address" }, ], - name: "LicenseRegistry__ParentIpUnmachedLicenseTemplate", + name: "LicenseRegistry__ParentIpUnmatchedLicenseTemplate", + }, + { + type: "error", + inputs: [ + { name: "ipId", internalType: "address", type: "address" }, + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "newLicenseTemplate", internalType: "address", type: "address" }, + ], + name: "LicenseRegistry__UnmatchedLicenseTemplate", }, { type: "error", inputs: [{ name: "licenseTemplate", internalType: "address", type: "address" }], name: "LicenseRegistry__UnregisteredLicenseTemplate", }, + { type: "error", inputs: [], name: "LicenseRegistry__ZeroAccessManager" }, { type: "error", inputs: [], name: "LicenseRegistry__ZeroDisputeModule" }, { type: "error", inputs: [], name: "LicenseRegistry__ZeroLicensingModule" }, { @@ -1996,28 +2438,28 @@ export const licenseRegistryAbi = [ type: "event", anonymous: false, inputs: [ - { name: "ipId", internalType: "address", type: "address", indexed: true }, { - name: "expireTime", - internalType: "uint256", - type: "uint256", + name: "authority", + internalType: "address", + type: "address", indexed: false, }, ], - name: "ExpirationTimeSet", + name: "AuthorityUpdated", }, { type: "event", anonymous: false, inputs: [ + { name: "ipId", internalType: "address", type: "address", indexed: true }, { - name: "newGovernance", - internalType: "address", - type: "address", - indexed: true, + name: "expireTime", + internalType: "uint256", + type: "uint256", + indexed: false, }, ], - name: "GovernanceUpdated", + name: "ExpirationTimeSet", }, { type: "event", @@ -2051,28 +2493,19 @@ export const licenseRegistryAbi = [ inputs: [ { name: "ipId", internalType: "address", type: "address", indexed: true }, { - name: "mintingLicenseConfig", - internalType: "struct Licensing.MintingLicenseConfig", + name: "licensingConfig", + internalType: "struct Licensing.LicensingConfig", type: "tuple", components: [ { name: "isSet", internalType: "bool", type: "bool" }, { name: "mintingFee", internalType: "uint256", type: "uint256" }, - { - name: "mintingFeeModule", - internalType: "address", - type: "address", - }, - { - name: "receiverCheckModule", - internalType: "address", - type: "address", - }, - { name: "receiverCheckData", internalType: "bytes", type: "bytes" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, ], indexed: false, }, ], - name: "MintingLicenseConfigSetForIP", + name: "LicensingConfigSetForIP", }, { type: "event", @@ -2092,7 +2525,7 @@ export const licenseRegistryAbi = [ indexed: true, }, ], - name: "MintingLicenseConfigSetLicense", + name: "LicensingConfigSetForLicense", }, { type: "event", @@ -2107,6 +2540,13 @@ export const licenseRegistryAbi = [ ], name: "Upgraded", }, + { + type: "function", + inputs: [], + name: "DISPUTE_MODULE", + outputs: [{ name: "", internalType: "contract IDisputeModule", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -2114,6 +2554,13 @@ export const licenseRegistryAbi = [ outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "LICENSING_MODULE", + outputs: [{ name: "", internalType: "contract ILicensingModule", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -2135,8 +2582,8 @@ export const licenseRegistryAbi = [ { type: "function", inputs: [], - name: "disputeModule", - outputs: [{ name: "", internalType: "contract IDisputeModule", type: "address" }], + name: "authority", + outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { @@ -2203,13 +2650,6 @@ export const licenseRegistryAbi = [ outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, - { - type: "function", - inputs: [], - name: "getGovernance", - outputs: [{ name: "", internalType: "address", type: "address" }], - stateMutability: "view", - }, { type: "function", inputs: [ @@ -2217,26 +2657,17 @@ export const licenseRegistryAbi = [ { name: "licenseTemplate", internalType: "address", type: "address" }, { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, ], - name: "getMintingLicenseConfig", + name: "getLicensingConfig", outputs: [ { name: "", - internalType: "struct Licensing.MintingLicenseConfig", + internalType: "struct Licensing.LicensingConfig", type: "tuple", components: [ { name: "isSet", internalType: "bool", type: "bool" }, { name: "mintingFee", internalType: "uint256", type: "uint256" }, - { - name: "mintingFeeModule", - internalType: "address", - type: "address", - }, - { - name: "receiverCheckModule", - internalType: "address", - type: "address", - }, - { name: "receiverCheckData", internalType: "bytes", type: "bytes" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, ], }, ], @@ -2279,11 +2710,18 @@ export const licenseRegistryAbi = [ }, { type: "function", - inputs: [{ name: "governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "childIpId", internalType: "address", type: "address" }], @@ -2293,16 +2731,26 @@ export const licenseRegistryAbi = [ }, { type: "function", - inputs: [{ name: "licenseTemplate", internalType: "address", type: "address" }], - name: "isRegisteredLicenseTemplate", + inputs: [{ name: "ipId", internalType: "address", type: "address" }], + name: "isExpiredNow", outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, { type: "function", - inputs: [], - name: "licensingModule", - outputs: [{ name: "", internalType: "contract ILicensingModule", type: "address" }], + inputs: [ + { name: "parentIpId", internalType: "address", type: "address" }, + { name: "childIpId", internalType: "address", type: "address" }, + ], + name: "isParentIp", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [{ name: "licenseTemplate", internalType: "address", type: "address" }], + name: "isRegisteredLicenseTemplate", + outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, { @@ -2333,18 +2781,18 @@ export const licenseRegistryAbi = [ }, { type: "function", - inputs: [ - { name: "newLicenseTemplate", internalType: "address", type: "address" }, - { name: "newLicenseTermsId", internalType: "uint256", type: "uint256" }, - ], - name: "setDefaultLicenseTerms", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, { type: "function", - inputs: [{ name: "newDisputeModule", internalType: "address", type: "address" }], - name: "setDisputeModule", + inputs: [ + { name: "newLicenseTemplate", internalType: "address", type: "address" }, + { name: "newLicenseTermsId", internalType: "uint256", type: "uint256" }, + ], + name: "setDefaultLicenseTerms", outputs: [], stateMutability: "nonpayable", }, @@ -2358,46 +2806,23 @@ export const licenseRegistryAbi = [ outputs: [], stateMutability: "nonpayable", }, - { - type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - inputs: [{ name: "newLicensingModule", internalType: "address", type: "address" }], - name: "setLicensingModule", - outputs: [], - stateMutability: "nonpayable", - }, { type: "function", inputs: [ { name: "ipId", internalType: "address", type: "address" }, { - name: "mintingLicenseConfig", - internalType: "struct Licensing.MintingLicenseConfig", + name: "licensingConfig", + internalType: "struct Licensing.LicensingConfig", type: "tuple", components: [ { name: "isSet", internalType: "bool", type: "bool" }, { name: "mintingFee", internalType: "uint256", type: "uint256" }, - { - name: "mintingFeeModule", - internalType: "address", - type: "address", - }, - { - name: "receiverCheckModule", - internalType: "address", - type: "address", - }, - { name: "receiverCheckData", internalType: "bytes", type: "bytes" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, ], }, ], - name: "setMintingLicenseConfigForIp", + name: "setLicensingConfigForIp", outputs: [], stateMutability: "nonpayable", }, @@ -2408,27 +2833,18 @@ export const licenseRegistryAbi = [ { name: "licenseTemplate", internalType: "address", type: "address" }, { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, { - name: "mintingLicenseConfig", - internalType: "struct Licensing.MintingLicenseConfig", + name: "licensingConfig", + internalType: "struct Licensing.LicensingConfig", type: "tuple", components: [ { name: "isSet", internalType: "bool", type: "bool" }, { name: "mintingFee", internalType: "uint256", type: "uint256" }, - { - name: "mintingFeeModule", - internalType: "address", - type: "address", - }, - { - name: "receiverCheckModule", - internalType: "address", - type: "address", - }, - { name: "receiverCheckData", internalType: "bytes", type: "bytes" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, ], }, ], - name: "setMintingLicenseConfigForLicense", + name: "setLicensingConfigForLicense", outputs: [], stateMutability: "nonpayable", }, @@ -2454,22 +2870,13 @@ export const licenseRegistryAbi = [ outputs: [ { name: "", - internalType: "struct Licensing.MintingLicenseConfig", + internalType: "struct Licensing.LicensingConfig", type: "tuple", components: [ { name: "isSet", internalType: "bool", type: "bool" }, { name: "mintingFee", internalType: "uint256", type: "uint256" }, - { - name: "mintingFeeModule", - internalType: "address", - type: "address", - }, - { - name: "receiverCheckModule", - internalType: "address", - type: "address", - }, - { name: "receiverCheckData", internalType: "bytes", type: "bytes" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, ], }, ], @@ -2478,14 +2885,14 @@ export const licenseRegistryAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40) */ export const licenseRegistryAddress = { - 1513: "0x0c3D467537FAd845a78728CEdc3D9447338c5422", + 11155111: "0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40) */ export const licenseRegistryConfig = { address: licenseRegistryAddress, @@ -2497,10 +2904,35 @@ export const licenseRegistryConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xCe9862F0a6f39631A2A790237086bd48635e3e42) */ export const licenseTokenAbi = [ - { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "constructor", + inputs: [ + { name: "licensingModule", internalType: "address", type: "address" }, + { name: "disputeModule", internalType: "address", type: "address" }, + ], + stateMutability: "nonpayable", + }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -2569,14 +3001,6 @@ export const licenseTokenAbi = [ name: "ERC721OutOfBoundsIndex", }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", @@ -2591,15 +3015,6 @@ export const licenseTokenAbi = [ name: "LicenseToken__AllLicenseTokensMustFromSameLicenseTemplate", }, { type: "error", inputs: [], name: "LicenseToken__CallerNotLicensingModule" }, - { - type: "error", - inputs: [ - { name: "tokenId", internalType: "uint256", type: "uint256" }, - { name: "expiredAt", internalType: "uint256", type: "uint256" }, - { name: "currentTimestamp", internalType: "uint256", type: "uint256" }, - ], - name: "LicenseToken__LicenseTokenExpired", - }, { type: "error", inputs: [ @@ -2615,8 +3030,7 @@ export const licenseTokenAbi = [ inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], name: "LicenseToken__RevokedLicense", }, - { type: "error", inputs: [], name: "LicenseToken__ZeroDisputeModule" }, - { type: "error", inputs: [], name: "LicenseToken__ZeroLicensingModule" }, + { type: "error", inputs: [], name: "LicenseToken__ZeroAccessManager" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", @@ -2677,6 +3091,19 @@ export const licenseTokenAbi = [ ], name: "ApprovalForAll", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "authority", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AuthorityUpdated", + }, { type: "event", anonymous: false, @@ -2696,19 +3123,6 @@ export const licenseTokenAbi = [ ], name: "BatchMetadataUpdate", }, - { - type: "event", - anonymous: false, - inputs: [ - { - name: "newGovernance", - internalType: "address", - type: "address", - indexed: true, - }, - ], - name: "GovernanceUpdated", - }, { type: "event", anonymous: false, @@ -2775,6 +3189,20 @@ export const licenseTokenAbi = [ ], name: "Upgraded", }, + { + type: "function", + inputs: [], + name: "DISPUTE_MODULE", + outputs: [{ name: "", internalType: "contract IDisputeModule", type: "address" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "LICENSING_MODULE", + outputs: [{ name: "", internalType: "contract ILicensingModule", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -2792,6 +3220,13 @@ export const licenseTokenAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "authority", + outputs: [{ name: "", internalType: "address", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "owner", internalType: "address", type: "address" }], @@ -2811,22 +3246,8 @@ export const licenseTokenAbi = [ }, { type: "function", - inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], - name: "getApproved", - outputs: [{ name: "", internalType: "address", type: "address" }], - stateMutability: "view", - }, - { - type: "function", - inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], - name: "getExpirationTime", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - stateMutability: "view", - }, - { - type: "function", - inputs: [], - name: "getGovernance", + inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], + name: "getApproved", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, @@ -2858,8 +3279,6 @@ export const licenseTokenAbi = [ { name: "licenseTemplate", internalType: "address", type: "address" }, { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, { name: "transferable", internalType: "bool", type: "bool" }, - { name: "mintedAt", internalType: "uint256", type: "uint256" }, - { name: "expiresAt", internalType: "uint256", type: "uint256" }, ], }, ], @@ -2875,7 +3294,7 @@ export const licenseTokenAbi = [ { type: "function", inputs: [ - { name: "governance", internalType: "address", type: "address" }, + { name: "accessManager", internalType: "address", type: "address" }, { name: "imageUrl", internalType: "string", type: "string" }, ], name: "initialize", @@ -2894,16 +3313,16 @@ export const licenseTokenAbi = [ }, { type: "function", - inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], - name: "isLicenseTokenRevoked", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], stateMutability: "view", }, { type: "function", - inputs: [], - name: "licensingModule", - outputs: [{ name: "", internalType: "contract ILicensingModule", type: "address" }], + inputs: [{ name: "tokenId", internalType: "uint256", type: "uint256" }], + name: "isLicenseTokenRevoked", + outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, { @@ -2976,15 +3395,8 @@ export const licenseTokenAbi = [ }, { type: "function", - inputs: [{ name: "newDisputeModule", internalType: "address", type: "address" }], - name: "setDisputeModule", - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, @@ -2995,13 +3407,6 @@ export const licenseTokenAbi = [ outputs: [], stateMutability: "nonpayable", }, - { - type: "function", - inputs: [{ name: "newLicensingModule", internalType: "address", type: "address" }], - name: "setLicensingModule", - outputs: [], - stateMutability: "nonpayable", - }, { type: "function", inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], @@ -3093,14 +3498,14 @@ export const licenseTokenAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xCe9862F0a6f39631A2A790237086bd48635e3e42) */ export const licenseTokenAddress = { - 1513: "0xD40b7bCA204f96a346021e31c9ad54FF495226e7", + 11155111: "0xCe9862F0a6f39631A2A790237086bd48635e3e42", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xCe9862F0a6f39631A2A790237086bd48635e3e42) */ export const licenseTokenConfig = { address: licenseTokenAddress, @@ -3112,7 +3517,7 @@ export const licenseTokenConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992) */ export const licensingModuleAbi = [ { @@ -3120,8 +3525,9 @@ export const licensingModuleAbi = [ inputs: [ { name: "accessController", internalType: "address", type: "address" }, { name: "ipAccountRegistry", internalType: "address", type: "address" }, + { name: "moduleRegistry", internalType: "address", type: "address" }, { name: "royaltyModule", internalType: "address", type: "address" }, - { name: "registry", internalType: "address", type: "address" }, + { name: "licenseRegistry", internalType: "address", type: "address" }, { name: "disputeModule", internalType: "address", type: "address" }, { name: "licenseToken", internalType: "address", type: "address" }, ], @@ -3133,6 +3539,24 @@ export const licensingModuleAbi = [ name: "AccessControlled__NotIpAccount", }, { type: "error", inputs: [], name: "AccessControlled__ZeroAddress" }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -3144,15 +3568,9 @@ export const licensingModuleAbi = [ name: "ERC1967InvalidImplementation", }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "LicensingModule__DisputedIpId" }, { @@ -3167,6 +3585,28 @@ export const licensingModuleAbi = [ ], name: "LicensingModule__IncompatibleRoyaltyPolicy", }, + { + type: "error", + inputs: [ + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + ], + name: "LicensingModule__InvalidLicenseTermsId", + }, + { + type: "error", + inputs: [{ name: "hook", internalType: "address", type: "address" }], + name: "LicensingModule__InvalidLicensingHook", + }, + { + type: "error", + inputs: [ + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + { name: "licensorIpId", internalType: "address", type: "address" }, + ], + name: "LicensingModule__LicenseDenyMintLicenseToken", + }, { type: "error", inputs: [{ name: "childIpId", internalType: "address", type: "address" }], @@ -3191,12 +3631,13 @@ export const licensingModuleAbi = [ { type: "error", inputs: [], name: "LicensingModule__MintAmountZero" }, { type: "error", inputs: [], name: "LicensingModule__NoLicenseToken" }, { type: "error", inputs: [], name: "LicensingModule__NoParentIp" }, - { - type: "error", - inputs: [{ name: "receiver", internalType: "address", type: "address" }], - name: "LicensingModule__ReceiverCheckFailed", - }, { type: "error", inputs: [], name: "LicensingModule__ReceiverZeroAddress" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroAccessManager" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroDisputeModule" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroLicenseRegistry" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroLicenseToken" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroModuleRegistry" }, + { type: "error", inputs: [], name: "LicensingModule__ZeroRoyaltyModule" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" }, { type: "error", inputs: [], name: "UUPSUnauthorizedCallContext" }, @@ -3205,6 +3646,19 @@ export const licensingModuleAbi = [ inputs: [{ name: "slot", internalType: "bytes32", type: "bytes32" }], name: "UUPSUnsupportedProxiableUUID", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "authority", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AuthorityUpdated", + }, { type: "event", anonymous: false, @@ -3248,19 +3702,6 @@ export const licensingModuleAbi = [ ], name: "DerivativeRegistered", }, - { - type: "event", - anonymous: false, - inputs: [ - { - name: "newGovernance", - internalType: "address", - type: "address", - indexed: true, - }, - ], - name: "GovernanceUpdated", - }, { type: "event", anonymous: false, @@ -3349,6 +3790,32 @@ export const licensingModuleAbi = [ ], name: "LicenseTokensMinted", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Paused", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, { type: "event", anonymous: false, @@ -3403,6 +3870,13 @@ export const licensingModuleAbi = [ outputs: [{ name: "", internalType: "contract ILicenseRegistry", type: "address" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "MODULE_REGISTRY", + outputs: [{ name: "", internalType: "contract IModuleRegistry", type: "address" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -3417,6 +3891,13 @@ export const licensingModuleAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [ @@ -3431,17 +3912,24 @@ export const licensingModuleAbi = [ { type: "function", inputs: [], - name: "getGovernance", + name: "authority", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { type: "function", - inputs: [{ name: "governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -3463,6 +3951,20 @@ export const licensingModuleAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -3496,8 +3998,30 @@ export const licensingModuleAbi = [ }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [ + { name: "ipId", internalType: "address", type: "address" }, + { name: "licenseTemplate", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, + { + name: "licensingConfig", + internalType: "struct Licensing.LicensingConfig", + type: "tuple", + components: [ + { name: "isSet", internalType: "bool", type: "bool" }, + { name: "mintingFee", internalType: "uint256", type: "uint256" }, + { name: "licensingHook", internalType: "address", type: "address" }, + { name: "hookData", internalType: "bytes", type: "bytes" }, + ], + }, + ], + name: "setLicensingConfig", outputs: [], stateMutability: "nonpayable", }, @@ -3508,6 +4032,13 @@ export const licensingModuleAbi = [ outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [ @@ -3521,14 +4052,14 @@ export const licensingModuleAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992) */ export const licensingModuleAddress = { - 1513: "0xEeDDE5529122b621105798860F235c28FD3aBA40", + 11155111: "0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992) */ export const licensingModuleConfig = { address: licensingModuleAddress, @@ -3540,10 +4071,28 @@ export const licensingModuleConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x59b37bb4D6913eFE32f40D09b5290ff5509E6738) */ export const moduleRegistryAbi = [ { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -3556,14 +4105,6 @@ export const moduleRegistryAbi = [ }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "ModuleRegistry__InterfaceIdZero" }, { @@ -3601,6 +4142,7 @@ export const moduleRegistryAbi = [ { type: "error", inputs: [], name: "ModuleRegistry__NameAlreadyRegistered" }, { type: "error", inputs: [], name: "ModuleRegistry__NameDoesNotMatch" }, { type: "error", inputs: [], name: "ModuleRegistry__NameEmptyString" }, + { type: "error", inputs: [], name: "ModuleRegistry__ZeroAccessManager" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "UUPSUnauthorizedCallContext" }, { @@ -3613,13 +4155,13 @@ export const moduleRegistryAbi = [ anonymous: false, inputs: [ { - name: "newGovernance", + name: "authority", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "GovernanceUpdated", + name: "AuthorityUpdated", }, { type: "event", @@ -3697,7 +4239,7 @@ export const moduleRegistryAbi = [ { type: "function", inputs: [], - name: "getGovernance", + name: "authority", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, @@ -3724,11 +4266,18 @@ export const moduleRegistryAbi = [ }, { type: "function", - inputs: [{ name: "governance_", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "moduleAddress", internalType: "address", type: "address" }], @@ -3790,8 +4339,8 @@ export const moduleRegistryAbi = [ }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, @@ -3808,14 +4357,14 @@ export const moduleRegistryAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x59b37bb4D6913eFE32f40D09b5290ff5509E6738) */ export const moduleRegistryAddress = { - 1513: "0xf2965E3B6251905Dd1E8671077760D07b0408cf2", + 11155111: "0x59b37bb4D6913eFE32f40D09b5290ff5509E6738", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x59b37bb4D6913eFE32f40D09b5290ff5509E6738) */ export const moduleRegistryConfig = { address: moduleRegistryAddress, @@ -3827,7 +4376,7 @@ export const moduleRegistryConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFD474b0938303613AAa377BE375c3A571cAA04fb) */ export const piLicenseTemplateAbi = [ { @@ -3837,7 +4386,6 @@ export const piLicenseTemplateAbi = [ { name: "ipAccountRegistry", internalType: "address", type: "address" }, { name: "licenseRegistry", internalType: "address", type: "address" }, { name: "royaltyModule", internalType: "address", type: "address" }, - { name: "licenseToken", internalType: "address", type: "address" }, ], stateMutability: "nonpayable", }, @@ -3847,6 +4395,36 @@ export const piLicenseTemplateAbi = [ name: "AccessControlled__NotIpAccount", }, { type: "error", inputs: [], name: "AccessControlled__ZeroAddress" }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, + { + type: "error", + inputs: [{ name: "target", internalType: "address", type: "address" }], + name: "AddressEmptyCode", + }, + { + type: "error", + inputs: [{ name: "implementation", internalType: "address", type: "address" }], + name: "ERC1967InvalidImplementation", + }, + { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "FailedInnerCall" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "NotInitializing" }, { @@ -3909,6 +4487,9 @@ export const piLicenseTemplateAbi = [ inputs: [], name: "PILicenseTemplate__RoyaltyPolicyRequiresCurrencyToken", }, + { type: "error", inputs: [], name: "PILicenseTemplate__ZeroAccessManager" }, + { type: "error", inputs: [], name: "PILicenseTemplate__ZeroLicenseRegistry" }, + { type: "error", inputs: [], name: "PILicenseTemplate__ZeroRoyaltyModule" }, { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" }, { type: "error", @@ -3918,12 +4499,31 @@ export const piLicenseTemplateAbi = [ ], name: "StringsInsufficientHexLength", }, + { type: "error", inputs: [], name: "UUPSUnauthorizedCallContext" }, + { + type: "error", + inputs: [{ name: "slot", internalType: "bytes32", type: "bytes32" }], + name: "UUPSUnsupportedProxiableUUID", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "authority", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AuthorityUpdated", + }, { type: "event", anonymous: false, inputs: [ { - name: "licenseTokenId", + name: "licenseTermsId", internalType: "uint256", type: "uint256", indexed: true, @@ -3977,6 +4577,19 @@ export const piLicenseTemplateAbi = [ ], name: "LicenseTermsRegistered", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "implementation", + internalType: "address", + type: "address", + indexed: true, + }, + ], + name: "Upgraded", + }, { type: "function", inputs: [], @@ -4000,22 +4613,29 @@ export const piLicenseTemplateAbi = [ { type: "function", inputs: [], - name: "LICENSE_NFT", - outputs: [{ name: "", internalType: "contract ILicenseToken", type: "address" }], + name: "LICENSE_REGISTRY", + outputs: [{ name: "", internalType: "contract ILicenseRegistry", type: "address" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "ROYALTY_MODULE", + outputs: [{ name: "", internalType: "contract IRoyaltyModule", type: "address" }], stateMutability: "view", }, { type: "function", inputs: [], - name: "LICENSE_REGISTRY", - outputs: [{ name: "", internalType: "contract ILicenseRegistry", type: "address" }], + name: "UPGRADE_INTERFACE_VERSION", + outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, { type: "function", inputs: [], - name: "ROYALTY_MODULE", - outputs: [{ name: "", internalType: "contract IRoyaltyModule", type: "address" }], + name: "authority", + outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { @@ -4045,6 +4665,68 @@ export const piLicenseTemplateAbi = [ outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, + { + type: "function", + inputs: [ + { + name: "selectedLicenseTermsId", + internalType: "uint256", + type: "uint256", + }, + ], + name: "getLicenseTerms", + outputs: [ + { + name: "terms", + internalType: "struct PILTerms", + type: "tuple", + components: [ + { name: "transferable", internalType: "bool", type: "bool" }, + { name: "royaltyPolicy", internalType: "address", type: "address" }, + { name: "mintingFee", internalType: "uint256", type: "uint256" }, + { name: "expiration", internalType: "uint256", type: "uint256" }, + { name: "commercialUse", internalType: "bool", type: "bool" }, + { name: "commercialAttribution", internalType: "bool", type: "bool" }, + { + name: "commercializerChecker", + internalType: "address", + type: "address", + }, + { + name: "commercializerCheckerData", + internalType: "bytes", + type: "bytes", + }, + { + name: "commercialRevShare", + internalType: "uint32", + type: "uint32", + }, + { + name: "commercialRevCelling", + internalType: "uint256", + type: "uint256", + }, + { name: "derivativesAllowed", internalType: "bool", type: "bool" }, + { + name: "derivativesAttribution", + internalType: "bool", + type: "bool", + }, + { name: "derivativesApproval", internalType: "bool", type: "bool" }, + { name: "derivativesReciprocal", internalType: "bool", type: "bool" }, + { + name: "derivativeRevCelling", + internalType: "uint256", + type: "uint256", + }, + { name: "currency", internalType: "address", type: "address" }, + { name: "uri", internalType: "string", type: "string" }, + ], + }, + ], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -4093,6 +4775,7 @@ export const piLicenseTemplateAbi = [ type: "uint256", }, { name: "currency", internalType: "address", type: "address" }, + { name: "uri", internalType: "string", type: "string" }, ], }, ], @@ -4106,6 +4789,13 @@ export const piLicenseTemplateAbi = [ ], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "licenseTermsId", internalType: "uint256", type: "uint256" }], + name: "getLicenseTermsURI", + outputs: [{ name: "", internalType: "string", type: "string" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -4128,6 +4818,7 @@ export const piLicenseTemplateAbi = [ { type: "function", inputs: [ + { name: "accessManager", internalType: "address", type: "address" }, { name: "name", internalType: "string", type: "string" }, { name: "metadataURI", internalType: "string", type: "string" }, ], @@ -4135,10 +4826,18 @@ export const piLicenseTemplateAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [ - { name: "licenseTokenId", internalType: "uint256", type: "uint256" }, + { name: "parentIpId", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, { name: "childIpId", internalType: "address", type: "address" }, ], name: "isDerivativeApproved", @@ -4159,6 +4858,13 @@ export const piLicenseTemplateAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -4207,6 +4913,7 @@ export const piLicenseTemplateAbi = [ type: "uint256", }, { name: "currency", internalType: "address", type: "address" }, + { name: "uri", internalType: "string", type: "string" }, ], }, ], @@ -4217,7 +4924,8 @@ export const piLicenseTemplateAbi = [ { type: "function", inputs: [ - { name: "licenseTokenId", internalType: "uint256", type: "uint256" }, + { name: "parentIpId", internalType: "address", type: "address" }, + { name: "licenseTermsId", internalType: "uint256", type: "uint256" }, { name: "childIpId", internalType: "address", type: "address" }, { name: "approved", internalType: "bool", type: "bool" }, ], @@ -4225,6 +4933,13 @@ export const piLicenseTemplateAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], @@ -4246,6 +4961,16 @@ export const piLicenseTemplateAbi = [ outputs: [{ name: "", internalType: "uint256", type: "uint256" }], stateMutability: "view", }, + { + type: "function", + inputs: [ + { name: "newImplementation", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + name: "upgradeToAndCall", + outputs: [], + stateMutability: "payable", + }, { type: "function", inputs: [{ name: "licenseTermsIds", internalType: "uint256[]", type: "uint256[]" }], @@ -4292,14 +5017,14 @@ export const piLicenseTemplateAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFD474b0938303613AAa377BE375c3A571cAA04fb) */ export const piLicenseTemplateAddress = { - 1513: "0xd0Be223ae9719bBD93447ecf5289319CCf8cA227", + 11155111: "0xFD474b0938303613AAa377BE375c3A571cAA04fb", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xFD474b0938303613AAa377BE375c3A571cAA04fb) */ export const piLicenseTemplateConfig = { address: piLicenseTemplateAddress, @@ -4311,10 +5036,36 @@ export const piLicenseTemplateConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xE50BB9D71b4d5c587d36849460F57df5bc939dab) */ export const royaltyModuleAbi = [ - { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "constructor", + inputs: [ + { name: "licensingModule", internalType: "address", type: "address" }, + { name: "disputeModule", internalType: "address", type: "address" }, + { name: "licenseRegistry", internalType: "address", type: "address" }, + ], + stateMutability: "nonpayable", + }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -4326,15 +5077,9 @@ export const royaltyModuleAbi = [ name: "ERC1967InvalidImplementation", }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" }, @@ -4348,6 +5093,7 @@ export const royaltyModuleAbi = [ inputs: [], name: "RoyaltyModule__IncompatibleRoyaltyPolicy", }, + { type: "error", inputs: [], name: "RoyaltyModule__IpIsExpired" }, { type: "error", inputs: [], name: "RoyaltyModule__IpIsTagged" }, { type: "error", inputs: [], name: "RoyaltyModule__NoParentsOnLinking" }, { type: "error", inputs: [], name: "RoyaltyModule__NoRoyaltyPolicySet" }, @@ -4362,7 +5108,9 @@ export const royaltyModuleAbi = [ inputs: [], name: "RoyaltyModule__NotWhitelistedRoyaltyToken", }, + { type: "error", inputs: [], name: "RoyaltyModule__ZeroAccessManager" }, { type: "error", inputs: [], name: "RoyaltyModule__ZeroDisputeModule" }, + { type: "error", inputs: [], name: "RoyaltyModule__ZeroLicenseRegistry" }, { type: "error", inputs: [], name: "RoyaltyModule__ZeroLicensingModule" }, { type: "error", inputs: [], name: "RoyaltyModule__ZeroRoyaltyPolicy" }, { type: "error", inputs: [], name: "RoyaltyModule__ZeroRoyaltyToken" }, @@ -4377,13 +5125,13 @@ export const royaltyModuleAbi = [ anonymous: false, inputs: [ { - name: "newGovernance", + name: "authority", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "GovernanceUpdated", + name: "AuthorityUpdated", }, { type: "event", @@ -4429,6 +5177,19 @@ export const royaltyModuleAbi = [ ], name: "LicenseMintingFeePaid", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Paused", + }, { type: "event", anonymous: false, @@ -4494,6 +5255,19 @@ export const royaltyModuleAbi = [ ], name: "RoyaltyTokenWhitelistUpdated", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, { type: "event", anonymous: false, @@ -4510,31 +5284,59 @@ export const royaltyModuleAbi = [ { type: "function", inputs: [], - name: "UPGRADE_INTERFACE_VERSION", - outputs: [{ name: "", internalType: "string", type: "string" }], + name: "DISPUTE_MODULE", + outputs: [{ name: "", internalType: "contract IDisputeModule", type: "address" }], stateMutability: "view", }, { type: "function", inputs: [], - name: "disputeModule", - outputs: [{ name: "", internalType: "address", type: "address" }], + name: "LICENSE_REGISTRY", + outputs: [{ name: "", internalType: "contract ILicenseRegistry", type: "address" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "LICENSING_MODULE", + outputs: [{ name: "", internalType: "contract ILicensingModule", type: "address" }], + stateMutability: "view", + }, + { + type: "function", + inputs: [], + name: "UPGRADE_INTERFACE_VERSION", + outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [], - name: "getGovernance", + name: "authority", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, { type: "function", - inputs: [{ name: "_governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [{ name: "royaltyPolicy", internalType: "address", type: "address" }], @@ -4549,13 +5351,6 @@ export const royaltyModuleAbi = [ outputs: [{ name: "", internalType: "bool", type: "bool" }], stateMutability: "view", }, - { - type: "function", - inputs: [], - name: "licensingModule", - outputs: [{ name: "", internalType: "address", type: "address" }], - stateMutability: "view", - }, { type: "function", inputs: [], @@ -4588,6 +5383,20 @@ export const royaltyModuleAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -4633,32 +5442,25 @@ export const royaltyModuleAbi = [ }, { type: "function", - inputs: [{ name: "dispute", internalType: "address", type: "address" }], - name: "setDisputeModule", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", - outputs: [], - stateMutability: "nonpayable", + inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], + name: "supportsInterface", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", }, { type: "function", - inputs: [{ name: "licensing", internalType: "address", type: "address" }], - name: "setLicensingModule", + inputs: [], + name: "unpause", outputs: [], stateMutability: "nonpayable", }, - { - type: "function", - inputs: [{ name: "interfaceId", internalType: "bytes4", type: "bytes4" }], - name: "supportsInterface", - outputs: [{ name: "", internalType: "bool", type: "bool" }], - stateMutability: "view", - }, { type: "function", inputs: [ @@ -4692,14 +5494,14 @@ export const royaltyModuleAbi = [ ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xE50BB9D71b4d5c587d36849460F57df5bc939dab) */ export const royaltyModuleAddress = { - 1513: "0x551AD8CD7893003cE00500aC2aCF1E327763D9f6", + 11155111: "0xE50BB9D71b4d5c587d36849460F57df5bc939dab", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xE50BB9D71b4d5c587d36849460F57df5bc939dab) */ export const royaltyModuleConfig = { address: royaltyModuleAddress, @@ -4711,7 +5513,7 @@ export const royaltyModuleConfig = { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c) */ export const royaltyPolicyLapAbi = [ { @@ -4722,6 +5524,24 @@ export const royaltyPolicyLapAbi = [ ], stateMutability: "nonpayable", }, + { + type: "error", + inputs: [{ name: "authority", internalType: "address", type: "address" }], + name: "AccessManagedInvalidAuthority", + }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "delay", internalType: "uint32", type: "uint32" }, + ], + name: "AccessManagedRequiredDelay", + }, + { + type: "error", + inputs: [{ name: "caller", internalType: "address", type: "address" }], + name: "AccessManagedUnauthorized", + }, { type: "error", inputs: [{ name: "target", internalType: "address", type: "address" }], @@ -4738,15 +5558,9 @@ export const royaltyPolicyLapAbi = [ name: "ERC1967InvalidImplementation", }, { type: "error", inputs: [], name: "ERC1967NonPayable" }, + { type: "error", inputs: [], name: "EnforcedPause" }, + { type: "error", inputs: [], name: "ExpectedPause" }, { type: "error", inputs: [], name: "FailedInnerCall" }, - { type: "error", inputs: [], name: "Governance__InconsistentState" }, - { type: "error", inputs: [], name: "Governance__OnlyProtocolAdmin" }, - { - type: "error", - inputs: [{ name: "interfaceName", internalType: "string", type: "string" }], - name: "Governance__UnsupportedInterface", - }, - { type: "error", inputs: [], name: "Governance__ZeroAddress" }, { type: "error", inputs: [], name: "InvalidInitialization" }, { type: "error", inputs: [], name: "NotInitializing" }, { type: "error", inputs: [], name: "ReentrancyGuardReentrantCall" }, @@ -4769,6 +5583,7 @@ export const royaltyPolicyLapAbi = [ }, { type: "error", inputs: [], name: "RoyaltyPolicyLAP__NotRoyaltyModule" }, { type: "error", inputs: [], name: "RoyaltyPolicyLAP__UnlinkableToParents" }, + { type: "error", inputs: [], name: "RoyaltyPolicyLAP__ZeroAccessManager" }, { type: "error", inputs: [], @@ -4792,13 +5607,13 @@ export const royaltyPolicyLapAbi = [ anonymous: false, inputs: [ { - name: "newGovernance", + name: "authority", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "GovernanceUpdated", + name: "AuthorityUpdated", }, { type: "event", @@ -4813,6 +5628,19 @@ export const royaltyPolicyLapAbi = [ ], name: "Initialized", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Paused", + }, { type: "event", anonymous: false, @@ -4850,6 +5678,38 @@ export const royaltyPolicyLapAbi = [ ], name: "PolicyInitialized", }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "token", + internalType: "address", + type: "address", + indexed: false, + }, + { + name: "vault", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "RevenueTokenAddedToVault", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "Unpaused", + }, { type: "event", anonymous: false, @@ -4905,10 +5765,17 @@ export const royaltyPolicyLapAbi = [ outputs: [{ name: "", internalType: "string", type: "string" }], stateMutability: "view", }, + { + type: "function", + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], + name: "__ProtocolPausable_init", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [], - name: "getGovernance", + name: "authority", outputs: [{ name: "", internalType: "address", type: "address" }], stateMutability: "view", }, @@ -4941,11 +5808,18 @@ export const royaltyPolicyLapAbi = [ }, { type: "function", - inputs: [{ name: "governance", internalType: "address", type: "address" }], + inputs: [{ name: "accessManager", internalType: "address", type: "address" }], name: "initialize", outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "isConsumingScheduledOp", + outputs: [{ name: "", internalType: "bytes4", type: "bytes4" }], + stateMutability: "view", + }, { type: "function", inputs: [ @@ -4981,6 +5855,20 @@ export const royaltyPolicyLapAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "pause", + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + inputs: [], + name: "paused", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + stateMutability: "view", + }, { type: "function", inputs: [], @@ -4990,8 +5878,8 @@ export const royaltyPolicyLapAbi = [ }, { type: "function", - inputs: [{ name: "newGovernance", internalType: "address", type: "address" }], - name: "setGovernance", + inputs: [{ name: "newAuthority", internalType: "address", type: "address" }], + name: "setAuthority", outputs: [], stateMutability: "nonpayable", }, @@ -5009,6 +5897,13 @@ export const royaltyPolicyLapAbi = [ outputs: [], stateMutability: "nonpayable", }, + { + type: "function", + inputs: [], + name: "unpause", + outputs: [], + stateMutability: "nonpayable", + }, { type: "function", inputs: [ @@ -5019,17 +5914,24 @@ export const royaltyPolicyLapAbi = [ outputs: [], stateMutability: "payable", }, + { + type: "function", + inputs: [{ name: "newVault", internalType: "address", type: "address" }], + name: "upgradeVaults", + outputs: [], + stateMutability: "nonpayable", + }, ] as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c) */ export const royaltyPolicyLapAddress = { - 1513: "0x2EcdB5bD12a037dCb9De0Ab7957f35FEeF758eA6", + 11155111: "0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c", } as const; /** - * + * [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c) */ export const royaltyPolicyLapConfig = { address: royaltyPolicyLapAddress, @@ -5257,9 +6159,11 @@ export type DisputeModuleRaiseDisputeRequest = { * DisputeModuleResolveDisputeRequest * * @param disputeId uint256 + * @param data bytes */ export type DisputeModuleResolveDisputeRequest = { disputeId: bigint; + data: Hex; }; /** @@ -5461,7 +6365,7 @@ export class DisputeModuleClient extends DisputeModuleEventClient { address: this.address, functionName: "resolveDispute", account: this.wallet.account, - args: [request.disputeId], + args: [request.disputeId, request.data], }); return await this.wallet.writeContract(call as WriteContractParameters); } @@ -5611,10 +6515,12 @@ export type IpAssetRegistryIsRegisteredResponse = boolean; /** * IpAssetRegistryRegisterRequest * + * @param chainid uint256 * @param tokenContract address * @param tokenId uint256 */ export type IpAssetRegistryRegisterRequest = { + chainid: bigint; tokenContract: Address; tokenId: bigint; }; @@ -5737,7 +6643,7 @@ export class IpAssetRegistryClient extends IpAssetRegistryReadOnlyClient { address: this.address, functionName: "register", account: this.wallet.account, - args: [request.tokenContract, request.tokenId], + args: [request.chainid, request.tokenContract, request.tokenId], }); return await this.wallet.writeContract(call as WriteContractParameters); } @@ -5814,11 +6720,11 @@ export type IpRoyaltyVaultImplClaimRevenueBySnapshotBatchRequest = { * IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest * * @param snapshotId uint256 - * @param tokens address[] + * @param tokenList address[] */ export type IpRoyaltyVaultImplClaimRevenueByTokenBatchRequest = { snapshotId: bigint; - tokens: readonly Address[]; + tokenList: readonly Address[]; }; /** @@ -6050,7 +6956,7 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { address: this.address, functionName: "claimRevenueByTokenBatch", account: this.wallet.account, - args: [request.snapshotId, request.tokens], + args: [request.snapshotId, request.tokenList], }); return await this.wallet.writeContract(call as WriteContractParameters); } @@ -6093,6 +6999,15 @@ export class IpRoyaltyVaultImplClient extends IpRoyaltyVaultImplReadOnlyClient { // Contract LicenseRegistry ============================================================= +/** + * LicenseRegistryAuthorityUpdatedEvent + * + * @param authority address + */ +export type LicenseRegistryAuthorityUpdatedEvent = { + authority: Address; +}; + /** * LicenseRegistryExpirationTimeSetEvent * @@ -6104,15 +7019,6 @@ export type LicenseRegistryExpirationTimeSetEvent = { expireTime: bigint; }; -/** - * LicenseRegistryGovernanceUpdatedEvent - * - * @param newGovernance address - */ -export type LicenseRegistryGovernanceUpdatedEvent = { - newGovernance: Address; -}; - /** * LicenseRegistryInitializedEvent * @@ -6132,30 +7038,29 @@ export type LicenseRegistryLicenseTemplateRegisteredEvent = { }; /** - * LicenseRegistryMintingLicenseConfigSetForIpEvent + * LicenseRegistryLicensingConfigSetForIpEvent * * @param ipId address - * @param mintingLicenseConfig tuple + * @param licensingConfig tuple */ -export type LicenseRegistryMintingLicenseConfigSetForIpEvent = { +export type LicenseRegistryLicensingConfigSetForIpEvent = { ipId: Address; - mintingLicenseConfig: { + licensingConfig: { isSet: boolean; mintingFee: bigint; - mintingFeeModule: Address; - receiverCheckModule: Address; - receiverCheckData: Hex; + licensingHook: Address; + hookData: Hex; }; }; /** - * LicenseRegistryMintingLicenseConfigSetLicenseEvent + * LicenseRegistryLicensingConfigSetForLicenseEvent * * @param ipId address * @param licenseTemplate address * @param licenseTermsId uint256 */ -export type LicenseRegistryMintingLicenseConfigSetLicenseEvent = { +export type LicenseRegistryLicensingConfigSetForLicenseEvent = { ipId: Address; licenseTemplate: Address; licenseTermsId: bigint; @@ -6170,11 +7075,15 @@ export type LicenseRegistryUpgradedEvent = { implementation: Address; }; +export type LicenseRegistryDisputeModuleResponse = Address; + export type LicenseRegistryExpirationTimeResponse = Hex; +export type LicenseRegistryLicensingModuleResponse = Address; + export type LicenseRegistryUpgradeInterfaceVersionResponse = string; -export type LicenseRegistryDisputeModuleResponse = Address; +export type LicenseRegistryAuthorityResponse = Address; /** * LicenseRegistryExistsRequest @@ -6275,27 +7184,24 @@ export type LicenseRegistryGetExpireTimeRequest = { export type LicenseRegistryGetExpireTimeResponse = bigint; -export type LicenseRegistryGetGovernanceResponse = Address; - /** - * LicenseRegistryGetMintingLicenseConfigRequest + * LicenseRegistryGetLicensingConfigRequest * * @param ipId address * @param licenseTemplate address * @param licenseTermsId uint256 */ -export type LicenseRegistryGetMintingLicenseConfigRequest = { +export type LicenseRegistryGetLicensingConfigRequest = { ipId: Address; licenseTemplate: Address; licenseTermsId: bigint; }; -export type LicenseRegistryGetMintingLicenseConfigResponse = { +export type LicenseRegistryGetLicensingConfigResponse = { isSet: boolean; mintingFee: bigint; - mintingFeeModule: Address; - receiverCheckModule: Address; - receiverCheckData: Hex; + licensingHook: Address; + hookData: Hex; }; /** @@ -6355,6 +7261,8 @@ export type LicenseRegistryHasIpAttachedLicenseTermsRequest = { export type LicenseRegistryHasIpAttachedLicenseTermsResponse = boolean; +export type LicenseRegistryIsConsumingScheduledOpResponse = Hex; + /** * LicenseRegistryIsDerivativeIpRequest * @@ -6366,6 +7274,30 @@ export type LicenseRegistryIsDerivativeIpRequest = { export type LicenseRegistryIsDerivativeIpResponse = boolean; +/** + * LicenseRegistryIsExpiredNowRequest + * + * @param ipId address + */ +export type LicenseRegistryIsExpiredNowRequest = { + ipId: Address; +}; + +export type LicenseRegistryIsExpiredNowResponse = boolean; + +/** + * LicenseRegistryIsParentIpRequest + * + * @param parentIpId address + * @param childIpId address + */ +export type LicenseRegistryIsParentIpRequest = { + parentIpId: Address; + childIpId: Address; +}; + +export type LicenseRegistryIsParentIpResponse = boolean; + /** * LicenseRegistryIsRegisteredLicenseTemplateRequest * @@ -6377,8 +7309,6 @@ export type LicenseRegistryIsRegisteredLicenseTemplateRequest = { export type LicenseRegistryIsRegisteredLicenseTemplateResponse = boolean; -export type LicenseRegistryLicensingModuleResponse = Address; - export type LicenseRegistryProxiableUuidResponse = Hex; /** @@ -6399,9 +7329,8 @@ export type LicenseRegistryVerifyMintLicenseTokenRequest = { export type LicenseRegistryVerifyMintLicenseTokenResponse = { isSet: boolean; mintingFee: bigint; - mintingFeeModule: Address; - receiverCheckModule: Address; - receiverCheckData: Hex; + licensingHook: Address; + hookData: Hex; }; /** @@ -6420,10 +7349,10 @@ export type LicenseRegistryAttachLicenseTermsToIpRequest = { /** * LicenseRegistryInitializeRequest * - * @param governance address + * @param accessManager address */ export type LicenseRegistryInitializeRequest = { - governance: Address; + accessManager: Address; }; /** @@ -6450,6 +7379,15 @@ export type LicenseRegistryRegisterLicenseTemplateRequest = { licenseTemplate: Address; }; +/** + * LicenseRegistrySetAuthorityRequest + * + * @param newAuthority address + */ +export type LicenseRegistrySetAuthorityRequest = { + newAuthority: Address; +}; + /** * LicenseRegistrySetDefaultLicenseTermsRequest * @@ -6461,15 +7399,6 @@ export type LicenseRegistrySetDefaultLicenseTermsRequest = { newLicenseTermsId: bigint; }; -/** - * LicenseRegistrySetDisputeModuleRequest - * - * @param newDisputeModule address - */ -export type LicenseRegistrySetDisputeModuleRequest = { - newDisputeModule: Address; -}; - /** * LicenseRegistrySetExpireTimeRequest * @@ -6482,58 +7411,38 @@ export type LicenseRegistrySetExpireTimeRequest = { }; /** - * LicenseRegistrySetGovernanceRequest - * - * @param newGovernance address - */ -export type LicenseRegistrySetGovernanceRequest = { - newGovernance: Address; -}; - -/** - * LicenseRegistrySetLicensingModuleRequest - * - * @param newLicensingModule address - */ -export type LicenseRegistrySetLicensingModuleRequest = { - newLicensingModule: Address; -}; - -/** - * LicenseRegistrySetMintingLicenseConfigForIpRequest + * LicenseRegistrySetLicensingConfigForIpRequest * * @param ipId address - * @param mintingLicenseConfig tuple + * @param licensingConfig tuple */ -export type LicenseRegistrySetMintingLicenseConfigForIpRequest = { +export type LicenseRegistrySetLicensingConfigForIpRequest = { ipId: Address; - mintingLicenseConfig: { + licensingConfig: { isSet: boolean; mintingFee: bigint; - mintingFeeModule: Address; - receiverCheckModule: Address; - receiverCheckData: Hex; + licensingHook: Address; + hookData: Hex; }; }; /** - * LicenseRegistrySetMintingLicenseConfigForLicenseRequest + * LicenseRegistrySetLicensingConfigForLicenseRequest * * @param ipId address * @param licenseTemplate address * @param licenseTermsId uint256 - * @param mintingLicenseConfig tuple + * @param licensingConfig tuple */ -export type LicenseRegistrySetMintingLicenseConfigForLicenseRequest = { +export type LicenseRegistrySetLicensingConfigForLicenseRequest = { ipId: Address; licenseTemplate: Address; licenseTermsId: bigint; - mintingLicenseConfig: { + licensingConfig: { isSet: boolean; mintingFee: bigint; - mintingFeeModule: Address; - receiverCheckModule: Address; - receiverCheckData: Hex; + licensingHook: Address; + hookData: Hex; }; }; @@ -6561,15 +7470,15 @@ export class LicenseRegistryEventClient { } /** - * event ExpirationTimeSet for contract LicenseRegistry + * event AuthorityUpdated for contract LicenseRegistry */ - public watchExpirationTimeSetEvent( - onLogs: (txHash: Hex, ev: Partial) => void, + public watchAuthorityUpdatedEvent( + onLogs: (txHash: Hex, ev: Partial) => void, ): WatchContractEventReturnType { return this.rpcClient.watchContractEvent({ abi: licenseRegistryAbi, address: this.address, - eventName: "ExpirationTimeSet", + eventName: "AuthorityUpdated", onLogs: (evs) => { evs.forEach((it) => onLogs(it.transactionHash, it.args)); }, @@ -6577,21 +7486,21 @@ export class LicenseRegistryEventClient { } /** - * parse tx receipt event ExpirationTimeSet for contract LicenseRegistry + * parse tx receipt event AuthorityUpdated for contract LicenseRegistry */ - public parseTxExpirationTimeSetEvent( + public parseTxAuthorityUpdatedEvent( txReceipt: TransactionReceipt, - ): Array { - const targetLogs: Array = []; + ): Array { + const targetLogs: Array = []; for (const log of txReceipt.logs) { try { const event = decodeEventLog({ abi: licenseRegistryAbi, - eventName: "ExpirationTimeSet", + eventName: "AuthorityUpdated", data: log.data, topics: log.topics, }); - if (event.eventName === "ExpirationTimeSet") { + if (event.eventName === "AuthorityUpdated") { targetLogs.push(event.args); } } catch (e) { @@ -6602,15 +7511,15 @@ export class LicenseRegistryEventClient { } /** - * event GovernanceUpdated for contract LicenseRegistry + * event ExpirationTimeSet for contract LicenseRegistry */ - public watchGovernanceUpdatedEvent( - onLogs: (txHash: Hex, ev: Partial) => void, + public watchExpirationTimeSetEvent( + onLogs: (txHash: Hex, ev: Partial) => void, ): WatchContractEventReturnType { return this.rpcClient.watchContractEvent({ abi: licenseRegistryAbi, address: this.address, - eventName: "GovernanceUpdated", + eventName: "ExpirationTimeSet", onLogs: (evs) => { evs.forEach((it) => onLogs(it.transactionHash, it.args)); }, @@ -6618,21 +7527,21 @@ export class LicenseRegistryEventClient { } /** - * parse tx receipt event GovernanceUpdated for contract LicenseRegistry + * parse tx receipt event ExpirationTimeSet for contract LicenseRegistry */ - public parseTxGovernanceUpdatedEvent( + public parseTxExpirationTimeSetEvent( txReceipt: TransactionReceipt, - ): Array { - const targetLogs: Array = []; + ): Array { + const targetLogs: Array = []; for (const log of txReceipt.logs) { try { const event = decodeEventLog({ abi: licenseRegistryAbi, - eventName: "GovernanceUpdated", + eventName: "ExpirationTimeSet", data: log.data, topics: log.topics, }); - if (event.eventName === "GovernanceUpdated") { + if (event.eventName === "ExpirationTimeSet") { targetLogs.push(event.args); } } catch (e) { @@ -6725,15 +7634,15 @@ export class LicenseRegistryEventClient { } /** - * event MintingLicenseConfigSetForIP for contract LicenseRegistry + * event LicensingConfigSetForIP for contract LicenseRegistry */ - public watchMintingLicenseConfigSetForIpEvent( - onLogs: (txHash: Hex, ev: Partial) => void, + public watchLicensingConfigSetForIpEvent( + onLogs: (txHash: Hex, ev: Partial) => void, ): WatchContractEventReturnType { return this.rpcClient.watchContractEvent({ abi: licenseRegistryAbi, address: this.address, - eventName: "MintingLicenseConfigSetForIP", + eventName: "LicensingConfigSetForIP", onLogs: (evs) => { evs.forEach((it) => onLogs(it.transactionHash, it.args)); }, @@ -6741,21 +7650,21 @@ export class LicenseRegistryEventClient { } /** - * parse tx receipt event MintingLicenseConfigSetForIP for contract LicenseRegistry + * parse tx receipt event LicensingConfigSetForIP for contract LicenseRegistry */ - public parseTxMintingLicenseConfigSetForIpEvent( + public parseTxLicensingConfigSetForIpEvent( txReceipt: TransactionReceipt, - ): Array { - const targetLogs: Array = []; + ): Array { + const targetLogs: Array = []; for (const log of txReceipt.logs) { try { const event = decodeEventLog({ abi: licenseRegistryAbi, - eventName: "MintingLicenseConfigSetForIP", + eventName: "LicensingConfigSetForIP", data: log.data, topics: log.topics, }); - if (event.eventName === "MintingLicenseConfigSetForIP") { + if (event.eventName === "LicensingConfigSetForIP") { targetLogs.push(event.args); } } catch (e) { @@ -6766,15 +7675,15 @@ export class LicenseRegistryEventClient { } /** - * event MintingLicenseConfigSetLicense for contract LicenseRegistry + * event LicensingConfigSetForLicense for contract LicenseRegistry */ - public watchMintingLicenseConfigSetLicenseEvent( - onLogs: (txHash: Hex, ev: Partial) => void, + public watchLicensingConfigSetForLicenseEvent( + onLogs: (txHash: Hex, ev: Partial) => void, ): WatchContractEventReturnType { return this.rpcClient.watchContractEvent({ abi: licenseRegistryAbi, address: this.address, - eventName: "MintingLicenseConfigSetLicense", + eventName: "LicensingConfigSetForLicense", onLogs: (evs) => { evs.forEach((it) => onLogs(it.transactionHash, it.args)); }, @@ -6782,21 +7691,21 @@ export class LicenseRegistryEventClient { } /** - * parse tx receipt event MintingLicenseConfigSetLicense for contract LicenseRegistry + * parse tx receipt event LicensingConfigSetForLicense for contract LicenseRegistry */ - public parseTxMintingLicenseConfigSetLicenseEvent( + public parseTxLicensingConfigSetForLicenseEvent( txReceipt: TransactionReceipt, - ): Array { - const targetLogs: Array = []; + ): Array { + const targetLogs: Array = []; for (const log of txReceipt.logs) { try { const event = decodeEventLog({ abi: licenseRegistryAbi, - eventName: "MintingLicenseConfigSetLicense", + eventName: "LicensingConfigSetForLicense", data: log.data, topics: log.topics, }); - if (event.eventName === "MintingLicenseConfigSetLicense") { + if (event.eventName === "LicensingConfigSetForLicense") { targetLogs.push(event.args); } } catch (e) { @@ -6854,6 +7763,20 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { super(rpcClient, address); } + /** + * method DISPUTE_MODULE for contract LicenseRegistry + * + * @param request LicenseRegistryDisputeModuleRequest + * @return Promise + */ + public async disputeModule(): Promise { + return await this.rpcClient.readContract({ + abi: licenseRegistryAbi, + address: this.address, + functionName: "DISPUTE_MODULE", + }); + } + /** * method EXPIRATION_TIME for contract LicenseRegistry * @@ -6868,6 +7791,20 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { }); } + /** + * method LICENSING_MODULE for contract LicenseRegistry + * + * @param request LicenseRegistryLicensingModuleRequest + * @return Promise + */ + public async licensingModule(): Promise { + return await this.rpcClient.readContract({ + abi: licenseRegistryAbi, + address: this.address, + functionName: "LICENSING_MODULE", + }); + } + /** * method UPGRADE_INTERFACE_VERSION for contract LicenseRegistry * @@ -6883,16 +7820,16 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { } /** - * method disputeModule for contract LicenseRegistry + * method authority for contract LicenseRegistry * - * @param request LicenseRegistryDisputeModuleRequest - * @return Promise + * @param request LicenseRegistryAuthorityRequest + * @return Promise */ - public async disputeModule(): Promise { + public async authority(): Promise { return await this.rpcClient.readContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "disputeModule", + functionName: "authority", }); } @@ -7024,32 +7961,18 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { } /** - * method getGovernance for contract LicenseRegistry - * - * @param request LicenseRegistryGetGovernanceRequest - * @return Promise - */ - public async getGovernance(): Promise { - return await this.rpcClient.readContract({ - abi: licenseRegistryAbi, - address: this.address, - functionName: "getGovernance", - }); - } - - /** - * method getMintingLicenseConfig for contract LicenseRegistry + * method getLicensingConfig for contract LicenseRegistry * - * @param request LicenseRegistryGetMintingLicenseConfigRequest - * @return Promise + * @param request LicenseRegistryGetLicensingConfigRequest + * @return Promise */ - public async getMintingLicenseConfig( - request: LicenseRegistryGetMintingLicenseConfigRequest, - ): Promise { + public async getLicensingConfig( + request: LicenseRegistryGetLicensingConfigRequest, + ): Promise { return await this.rpcClient.readContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "getMintingLicenseConfig", + functionName: "getLicensingConfig", args: [request.ipId, request.licenseTemplate, request.licenseTermsId], }); } @@ -7125,6 +8048,20 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { }); } + /** + * method isConsumingScheduledOp for contract LicenseRegistry + * + * @param request LicenseRegistryIsConsumingScheduledOpRequest + * @return Promise + */ + public async isConsumingScheduledOp(): Promise { + return await this.rpcClient.readContract({ + abi: licenseRegistryAbi, + address: this.address, + functionName: "isConsumingScheduledOp", + }); + } + /** * method isDerivativeIp for contract LicenseRegistry * @@ -7143,33 +8080,53 @@ export class LicenseRegistryReadOnlyClient extends LicenseRegistryEventClient { } /** - * method isRegisteredLicenseTemplate for contract LicenseRegistry + * method isExpiredNow for contract LicenseRegistry * - * @param request LicenseRegistryIsRegisteredLicenseTemplateRequest - * @return Promise + * @param request LicenseRegistryIsExpiredNowRequest + * @return Promise */ - public async isRegisteredLicenseTemplate( - request: LicenseRegistryIsRegisteredLicenseTemplateRequest, - ): Promise { + public async isExpiredNow( + request: LicenseRegistryIsExpiredNowRequest, + ): Promise { return await this.rpcClient.readContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "isRegisteredLicenseTemplate", - args: [request.licenseTemplate], + functionName: "isExpiredNow", + args: [request.ipId], }); } /** - * method licensingModule for contract LicenseRegistry + * method isParentIp for contract LicenseRegistry * - * @param request LicenseRegistryLicensingModuleRequest - * @return Promise + * @param request LicenseRegistryIsParentIpRequest + * @return Promise */ - public async licensingModule(): Promise { + public async isParentIp( + request: LicenseRegistryIsParentIpRequest, + ): Promise { + return await this.rpcClient.readContract({ + abi: licenseRegistryAbi, + address: this.address, + functionName: "isParentIp", + args: [request.parentIpId, request.childIpId], + }); + } + + /** + * method isRegisteredLicenseTemplate for contract LicenseRegistry + * + * @param request LicenseRegistryIsRegisteredLicenseTemplateRequest + * @return Promise + */ + public async isRegisteredLicenseTemplate( + request: LicenseRegistryIsRegisteredLicenseTemplateRequest, + ): Promise { return await this.rpcClient.readContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "licensingModule", + functionName: "isRegisteredLicenseTemplate", + args: [request.licenseTemplate], }); } @@ -7254,7 +8211,7 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { address: this.address, functionName: "initialize", account: this.wallet.account, - args: [request.governance], + args: [request.accessManager], }); return await this.wallet.writeContract(call as WriteContractParameters); } @@ -7303,138 +8260,100 @@ export class LicenseRegistryClient extends LicenseRegistryReadOnlyClient { } /** - * method setDefaultLicenseTerms for contract LicenseRegistry - * - * @param request LicenseRegistrySetDefaultLicenseTermsRequest - * @return Promise - */ - public async setDefaultLicenseTerms( - request: LicenseRegistrySetDefaultLicenseTermsRequest, - ): Promise { - const { request: call } = await this.rpcClient.simulateContract({ - abi: licenseRegistryAbi, - address: this.address, - functionName: "setDefaultLicenseTerms", - account: this.wallet.account, - args: [request.newLicenseTemplate, request.newLicenseTermsId], - }); - return await this.wallet.writeContract(call as WriteContractParameters); - } - - /** - * method setDisputeModule for contract LicenseRegistry - * - * @param request LicenseRegistrySetDisputeModuleRequest - * @return Promise - */ - public async setDisputeModule( - request: LicenseRegistrySetDisputeModuleRequest, - ): Promise { - const { request: call } = await this.rpcClient.simulateContract({ - abi: licenseRegistryAbi, - address: this.address, - functionName: "setDisputeModule", - account: this.wallet.account, - args: [request.newDisputeModule], - }); - return await this.wallet.writeContract(call as WriteContractParameters); - } - - /** - * method setExpireTime for contract LicenseRegistry + * method setAuthority for contract LicenseRegistry * - * @param request LicenseRegistrySetExpireTimeRequest + * @param request LicenseRegistrySetAuthorityRequest * @return Promise */ - public async setExpireTime( - request: LicenseRegistrySetExpireTimeRequest, + public async setAuthority( + request: LicenseRegistrySetAuthorityRequest, ): Promise { const { request: call } = await this.rpcClient.simulateContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "setExpireTime", + functionName: "setAuthority", account: this.wallet.account, - args: [request.ipId, request.expireTime], + args: [request.newAuthority], }); return await this.wallet.writeContract(call as WriteContractParameters); } /** - * method setGovernance for contract LicenseRegistry + * method setDefaultLicenseTerms for contract LicenseRegistry * - * @param request LicenseRegistrySetGovernanceRequest + * @param request LicenseRegistrySetDefaultLicenseTermsRequest * @return Promise */ - public async setGovernance( - request: LicenseRegistrySetGovernanceRequest, + public async setDefaultLicenseTerms( + request: LicenseRegistrySetDefaultLicenseTermsRequest, ): Promise { const { request: call } = await this.rpcClient.simulateContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "setGovernance", + functionName: "setDefaultLicenseTerms", account: this.wallet.account, - args: [request.newGovernance], + args: [request.newLicenseTemplate, request.newLicenseTermsId], }); return await this.wallet.writeContract(call as WriteContractParameters); } /** - * method setLicensingModule for contract LicenseRegistry + * method setExpireTime for contract LicenseRegistry * - * @param request LicenseRegistrySetLicensingModuleRequest + * @param request LicenseRegistrySetExpireTimeRequest * @return Promise */ - public async setLicensingModule( - request: LicenseRegistrySetLicensingModuleRequest, + public async setExpireTime( + request: LicenseRegistrySetExpireTimeRequest, ): Promise { const { request: call } = await this.rpcClient.simulateContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "setLicensingModule", + functionName: "setExpireTime", account: this.wallet.account, - args: [request.newLicensingModule], + args: [request.ipId, request.expireTime], }); return await this.wallet.writeContract(call as WriteContractParameters); } /** - * method setMintingLicenseConfigForIp for contract LicenseRegistry + * method setLicensingConfigForIp for contract LicenseRegistry * - * @param request LicenseRegistrySetMintingLicenseConfigForIpRequest + * @param request LicenseRegistrySetLicensingConfigForIpRequest * @return Promise */ - public async setMintingLicenseConfigForIp( - request: LicenseRegistrySetMintingLicenseConfigForIpRequest, + public async setLicensingConfigForIp( + request: LicenseRegistrySetLicensingConfigForIpRequest, ): Promise { const { request: call } = await this.rpcClient.simulateContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "setMintingLicenseConfigForIp", + functionName: "setLicensingConfigForIp", account: this.wallet.account, - args: [request.ipId, request.mintingLicenseConfig], + args: [request.ipId, request.licensingConfig], }); return await this.wallet.writeContract(call as WriteContractParameters); } /** - * method setMintingLicenseConfigForLicense for contract LicenseRegistry + * method setLicensingConfigForLicense for contract LicenseRegistry * - * @param request LicenseRegistrySetMintingLicenseConfigForLicenseRequest + * @param request LicenseRegistrySetLicensingConfigForLicenseRequest * @return Promise */ - public async setMintingLicenseConfigForLicense( - request: LicenseRegistrySetMintingLicenseConfigForLicenseRequest, + public async setLicensingConfigForLicense( + request: LicenseRegistrySetLicensingConfigForLicenseRequest, ): Promise { const { request: call } = await this.rpcClient.simulateContract({ abi: licenseRegistryAbi, address: this.address, - functionName: "setMintingLicenseConfigForLicense", + functionName: "setLicensingConfigForLicense", account: this.wallet.account, args: [ request.ipId, request.licenseTemplate, request.licenseTermsId, - request.mintingLicenseConfig, + request.licensingConfig, ], }); return await this.wallet.writeContract(call as WriteContractParameters); @@ -7786,16 +8705,25 @@ export class ModuleRegistryReadOnlyClient { // Contract PILicenseTemplate ============================================================= +/** + * PiLicenseTemplateAuthorityUpdatedEvent + * + * @param authority address + */ +export type PiLicenseTemplateAuthorityUpdatedEvent = { + authority: Address; +}; + /** * PiLicenseTemplateDerivativeApprovedEvent * - * @param licenseTokenId uint256 + * @param licenseTermsId uint256 * @param ipId address * @param caller address * @param approved bool */ export type PiLicenseTemplateDerivativeApprovedEvent = { - licenseTokenId: bigint; + licenseTermsId: bigint; ipId: Address; caller: Address; approved: boolean; @@ -7823,16 +8751,27 @@ export type PiLicenseTemplateLicenseTermsRegisteredEvent = { licenseTerms: Hex; }; +/** + * PiLicenseTemplateUpgradedEvent + * + * @param implementation address + */ +export type PiLicenseTemplateUpgradedEvent = { + implementation: Address; +}; + export type PiLicenseTemplateAccessControllerResponse = Address; export type PiLicenseTemplateIpAccountRegistryResponse = Address; -export type PiLicenseTemplateLicenseNftResponse = Address; - export type PiLicenseTemplateLicenseRegistryResponse = Address; export type PiLicenseTemplateRoyaltyModuleResponse = Address; +export type PiLicenseTemplateUpgradeInterfaceVersionResponse = string; + +export type PiLicenseTemplateAuthorityResponse = Address; + /** * PiLicenseTemplateExistsRequest * @@ -7870,6 +8809,42 @@ export type PiLicenseTemplateGetExpireTimeRequest = { export type PiLicenseTemplateGetExpireTimeResponse = bigint; +/** + * PiLicenseTemplateGetLicenseTermsRequest + * + * @param selectedLicenseTermsId uint256 + */ +export type PiLicenseTemplateGetLicenseTermsRequest = { + selectedLicenseTermsId: bigint; +}; + +/** + * PiLicenseTemplateGetLicenseTermsResponse + * + * @param terms tuple + */ +export type PiLicenseTemplateGetLicenseTermsResponse = { + terms: { + transferable: boolean; + royaltyPolicy: Address; + mintingFee: bigint; + expiration: bigint; + commercialUse: boolean; + commercialAttribution: boolean; + commercializerChecker: Address; + commercializerCheckerData: Hex; + commercialRevShare: number; + commercialRevCelling: bigint; + derivativesAllowed: boolean; + derivativesAttribution: boolean; + derivativesApproval: boolean; + derivativesReciprocal: boolean; + derivativeRevCelling: bigint; + currency: Address; + uri: string; + }; +}; + /** * PiLicenseTemplateGetLicenseTermsIdRequest * @@ -7893,6 +8868,7 @@ export type PiLicenseTemplateGetLicenseTermsIdRequest = { derivativesReciprocal: boolean; derivativeRevCelling: bigint; currency: Address; + uri: string; }; }; @@ -7905,6 +8881,17 @@ export type PiLicenseTemplateGetLicenseTermsIdResponse = { selectedLicenseTermsId: bigint; }; +/** + * PiLicenseTemplateGetLicenseTermsUriRequest + * + * @param licenseTermsId uint256 + */ +export type PiLicenseTemplateGetLicenseTermsUriRequest = { + licenseTermsId: bigint; +}; + +export type PiLicenseTemplateGetLicenseTermsUriResponse = string; + export type PiLicenseTemplateGetMetadataUriResponse = string; /** @@ -7931,14 +8918,18 @@ export type PiLicenseTemplateGetRoyaltyPolicyResponse = { currency: Address; }; +export type PiLicenseTemplateIsConsumingScheduledOpResponse = Hex; + /** * PiLicenseTemplateIsDerivativeApprovedRequest * - * @param licenseTokenId uint256 + * @param parentIpId address + * @param licenseTermsId uint256 * @param childIpId address */ export type PiLicenseTemplateIsDerivativeApprovedRequest = { - licenseTokenId: bigint; + parentIpId: Address; + licenseTermsId: bigint; childIpId: Address; }; @@ -7957,6 +8948,8 @@ export type PiLicenseTemplateIsLicenseTransferableResponse = boolean; export type PiLicenseTemplateNameResponse = string; +export type PiLicenseTemplateProxiableUuidResponse = Hex; + /** * PiLicenseTemplateSupportsInterfaceRequest * @@ -7995,10 +8988,12 @@ export type PiLicenseTemplateVerifyCompatibleLicensesResponse = boolean; /** * PiLicenseTemplateInitializeRequest * + * @param accessManager address * @param name string * @param metadataURI string */ export type PiLicenseTemplateInitializeRequest = { + accessManager: Address; name: string; metadataURI: string; }; @@ -8026,22 +9021,45 @@ export type PiLicenseTemplateRegisterLicenseTermsRequest = { derivativesReciprocal: boolean; derivativeRevCelling: bigint; currency: Address; + uri: string; }; }; /** * PiLicenseTemplateSetApprovalRequest * - * @param licenseTokenId uint256 + * @param parentIpId address + * @param licenseTermsId uint256 * @param childIpId address * @param approved bool */ export type PiLicenseTemplateSetApprovalRequest = { - licenseTokenId: bigint; + parentIpId: Address; + licenseTermsId: bigint; childIpId: Address; approved: boolean; }; +/** + * PiLicenseTemplateSetAuthorityRequest + * + * @param newAuthority address + */ +export type PiLicenseTemplateSetAuthorityRequest = { + newAuthority: Address; +}; + +/** + * PiLicenseTemplateUpgradeToAndCallRequest + * + * @param newImplementation address + * @param data bytes + */ +export type PiLicenseTemplateUpgradeToAndCallRequest = { + newImplementation: Address; + data: Hex; +}; + /** * PiLicenseTemplateVerifyMintLicenseTokenRequest * @@ -8099,6 +9117,47 @@ export class PiLicenseTemplateEventClient { this.rpcClient = rpcClient; } + /** + * event AuthorityUpdated for contract PILicenseTemplate + */ + public watchAuthorityUpdatedEvent( + onLogs: (txHash: Hex, ev: Partial) => void, + ): WatchContractEventReturnType { + return this.rpcClient.watchContractEvent({ + abi: piLicenseTemplateAbi, + address: this.address, + eventName: "AuthorityUpdated", + onLogs: (evs) => { + evs.forEach((it) => onLogs(it.transactionHash, it.args)); + }, + }); + } + + /** + * parse tx receipt event AuthorityUpdated for contract PILicenseTemplate + */ + public parseTxAuthorityUpdatedEvent( + txReceipt: TransactionReceipt, + ): Array { + const targetLogs: Array = []; + for (const log of txReceipt.logs) { + try { + const event = decodeEventLog({ + abi: piLicenseTemplateAbi, + eventName: "AuthorityUpdated", + data: log.data, + topics: log.topics, + }); + if (event.eventName === "AuthorityUpdated") { + targetLogs.push(event.args); + } + } catch (e) { + /* empty */ + } + } + return targetLogs; + } + /** * event DerivativeApproved for contract PILicenseTemplate */ @@ -8221,6 +9280,47 @@ export class PiLicenseTemplateEventClient { } return targetLogs; } + + /** + * event Upgraded for contract PILicenseTemplate + */ + public watchUpgradedEvent( + onLogs: (txHash: Hex, ev: Partial) => void, + ): WatchContractEventReturnType { + return this.rpcClient.watchContractEvent({ + abi: piLicenseTemplateAbi, + address: this.address, + eventName: "Upgraded", + onLogs: (evs) => { + evs.forEach((it) => onLogs(it.transactionHash, it.args)); + }, + }); + } + + /** + * parse tx receipt event Upgraded for contract PILicenseTemplate + */ + public parseTxUpgradedEvent( + txReceipt: TransactionReceipt, + ): Array { + const targetLogs: Array = []; + for (const log of txReceipt.logs) { + try { + const event = decodeEventLog({ + abi: piLicenseTemplateAbi, + eventName: "Upgraded", + data: log.data, + topics: log.topics, + }); + if (event.eventName === "Upgraded") { + targetLogs.push(event.args); + } + } catch (e) { + /* empty */ + } + } + return targetLogs; + } } /** @@ -8259,20 +9359,6 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }); } - /** - * method LICENSE_NFT for contract PILicenseTemplate - * - * @param request PiLicenseTemplateLicenseNftRequest - * @return Promise - */ - public async licenseNft(): Promise { - return await this.rpcClient.readContract({ - abi: piLicenseTemplateAbi, - address: this.address, - functionName: "LICENSE_NFT", - }); - } - /** * method LICENSE_REGISTRY for contract PILicenseTemplate * @@ -8301,6 +9387,34 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }); } + /** + * method UPGRADE_INTERFACE_VERSION for contract PILicenseTemplate + * + * @param request PiLicenseTemplateUpgradeInterfaceVersionRequest + * @return Promise + */ + public async upgradeInterfaceVersion(): Promise { + return await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "UPGRADE_INTERFACE_VERSION", + }); + } + + /** + * method authority for contract PILicenseTemplate + * + * @param request PiLicenseTemplateAuthorityRequest + * @return Promise + */ + public async authority(): Promise { + return await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "authority", + }); + } + /** * method exists for contract PILicenseTemplate * @@ -8352,6 +9466,26 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }); } + /** + * method getLicenseTerms for contract PILicenseTemplate + * + * @param request PiLicenseTemplateGetLicenseTermsRequest + * @return Promise + */ + public async getLicenseTerms( + request: PiLicenseTemplateGetLicenseTermsRequest, + ): Promise { + const result = await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "getLicenseTerms", + args: [request.selectedLicenseTermsId], + }); + return { + terms: result, + }; + } + /** * method getLicenseTermsId for contract PILicenseTemplate * @@ -8372,6 +9506,23 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }; } + /** + * method getLicenseTermsURI for contract PILicenseTemplate + * + * @param request PiLicenseTemplateGetLicenseTermsUriRequest + * @return Promise + */ + public async getLicenseTermsUri( + request: PiLicenseTemplateGetLicenseTermsUriRequest, + ): Promise { + return await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "getLicenseTermsURI", + args: [request.licenseTermsId], + }); + } + /** * method getMetadataURI for contract PILicenseTemplate * @@ -8409,6 +9560,20 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }; } + /** + * method isConsumingScheduledOp for contract PILicenseTemplate + * + * @param request PiLicenseTemplateIsConsumingScheduledOpRequest + * @return Promise + */ + public async isConsumingScheduledOp(): Promise { + return await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "isConsumingScheduledOp", + }); + } + /** * method isDerivativeApproved for contract PILicenseTemplate * @@ -8422,7 +9587,7 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien abi: piLicenseTemplateAbi, address: this.address, functionName: "isDerivativeApproved", - args: [request.licenseTokenId, request.childIpId], + args: [request.parentIpId, request.licenseTermsId, request.childIpId], }); } @@ -8457,6 +9622,20 @@ export class PiLicenseTemplateReadOnlyClient extends PiLicenseTemplateEventClien }); } + /** + * method proxiableUUID for contract PILicenseTemplate + * + * @param request PiLicenseTemplateProxiableUuidRequest + * @return Promise + */ + public async proxiableUuid(): Promise { + return await this.rpcClient.readContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "proxiableUUID", + }); + } + /** * method supportsInterface for contract PILicenseTemplate * @@ -8548,7 +9727,7 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { address: this.address, functionName: "initialize", account: this.wallet.account, - args: [request.name, request.metadataURI], + args: [request.accessManager, request.name, request.metadataURI], }); return await this.wallet.writeContract(call as WriteContractParameters); } @@ -8586,7 +9765,45 @@ export class PiLicenseTemplateClient extends PiLicenseTemplateReadOnlyClient { address: this.address, functionName: "setApproval", account: this.wallet.account, - args: [request.licenseTokenId, request.childIpId, request.approved], + args: [request.parentIpId, request.licenseTermsId, request.childIpId, request.approved], + }); + return await this.wallet.writeContract(call as WriteContractParameters); + } + + /** + * method setAuthority for contract PILicenseTemplate + * + * @param request PiLicenseTemplateSetAuthorityRequest + * @return Promise + */ + public async setAuthority( + request: PiLicenseTemplateSetAuthorityRequest, + ): Promise { + const { request: call } = await this.rpcClient.simulateContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "setAuthority", + account: this.wallet.account, + args: [request.newAuthority], + }); + return await this.wallet.writeContract(call as WriteContractParameters); + } + + /** + * method upgradeToAndCall for contract PILicenseTemplate + * + * @param request PiLicenseTemplateUpgradeToAndCallRequest + * @return Promise + */ + public async upgradeToAndCall( + request: PiLicenseTemplateUpgradeToAndCallRequest, + ): Promise { + const { request: call } = await this.rpcClient.simulateContract({ + abi: piLicenseTemplateAbi, + address: this.address, + functionName: "upgradeToAndCall", + account: this.wallet.account, + args: [request.newImplementation, request.data], }); return await this.wallet.writeContract(call as WriteContractParameters); } diff --git a/packages/core-sdk/src/resources/dispute.ts b/packages/core-sdk/src/resources/dispute.ts index 19eca996..469d4999 100644 --- a/packages/core-sdk/src/resources/dispute.ts +++ b/packages/core-sdk/src/resources/dispute.ts @@ -92,6 +92,7 @@ export class DisputeClient { * 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. + * @param request.data The data to resolve the dispute. * @returns A Promise that resolves to a ResolveDisputeResponse. * @throws NotAbleToResolve, if currentTag is still in dispute (i.e still needs a judgement to be set) * @throws NotDisputeInitiator, if the transaction executor is not the one that initiated the dispute @@ -101,6 +102,7 @@ export class DisputeClient { try { const txHash = await this.disputeModuleClient.resolveDispute({ disputeId: BigInt(request.disputeId), + data: request.data, }); if (request.txOptions?.waitForTransaction) { diff --git a/packages/core-sdk/src/resources/ipAsset.ts b/packages/core-sdk/src/resources/ipAsset.ts index 1deaccf8..22e55098 100644 --- a/packages/core-sdk/src/resources/ipAsset.ts +++ b/packages/core-sdk/src/resources/ipAsset.ts @@ -41,7 +41,7 @@ export class IPAssetClient { /** * Registers an NFT as IP, creating a corresponding IP record. - * @param request The request object that contains all data needed to register IP. + * @param request - The request object that contains all data needed to register IP. * @param request.tokenContract The address of the NFT. * @param request.tokenId The token identifier of the NFT. * @param request.txOptions [Optional] The transaction options. @@ -57,7 +57,8 @@ export class IPAssetClient { } const txHash = await this.ipAssetRegistryClient.register({ tokenContract: getAddress(request.tokenContract), - tokenId: tokenId, + tokenId, + chainid: BigInt(chain[this.chainId]), }); if (request.txOptions?.waitForTransaction) { const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); @@ -77,7 +78,7 @@ export class IPAssetClient { * The license terms must be attached to the parent IP before calling this function. * All IPs attached default license terms by default. * The derivative IP owner must be the caller or an authorized operator. - * @param request The request object that contains all data needed to register derivative IP. + * @param request - The request object that contains all data needed to register derivative IP. * @param request.childIpId The derivative IP ID. * @param request.parentIpIds The parent IP IDs. * @param request.licenseTermsIds The IDs of the license terms that the parent IP supports. @@ -138,7 +139,7 @@ export class IPAssetClient { * the derivative IP is registered with license tokens minted from the parent IP's license terms. * the license terms of the parent IPs issued with license tokens are attached to the derivative IP. * the caller must be the derivative IP owner or an authorized operator. - * @param request The request object that contains all data needed to register derivative license tokens. + * @param request - The request object that contains all data needed to register derivative license tokens. * @param request.childIpId The derivative IP ID. * @param request.licenseTokenIds The IDs of the license tokens. * @param request.txOptions [Optional] The transaction options. diff --git a/packages/core-sdk/src/resources/license.ts b/packages/core-sdk/src/resources/license.ts index e837806f..2a55c502 100644 --- a/packages/core-sdk/src/resources/license.ts +++ b/packages/core-sdk/src/resources/license.ts @@ -73,6 +73,7 @@ export class LicenseClient { derivativesReciprocal: true, derivativeRevCelling: BigInt(0), currency: zeroAddress, + uri: "", }; const licenseTermsId = await this.getLicenseTermsId(licenseTerms); if (licenseTermsId !== 0) { @@ -121,6 +122,7 @@ export class LicenseClient { derivativesReciprocal: false, derivativeRevCelling: BigInt(0), currency: request.currency, + uri: "", }; const licenseTermsId = await this.getLicenseTermsId(licenseTerms); if (licenseTermsId !== 0) { @@ -170,6 +172,7 @@ export class LicenseClient { derivativesReciprocal: true, derivativeRevCelling: BigInt(0), currency: request.currency, + uri: "", }; const licenseTermsId = await this.getLicenseTermsId(licenseTerms); if (licenseTermsId !== 0) { diff --git a/packages/core-sdk/src/resources/royalty.ts b/packages/core-sdk/src/resources/royalty.ts index 39026470..7183df14 100644 --- a/packages/core-sdk/src/resources/royalty.ts +++ b/packages/core-sdk/src/resources/royalty.ts @@ -1,4 +1,4 @@ -import { Hex, PublicClient } from "viem"; +import { Hex, PublicClient, encodeFunctionData } from "viem"; import { handleError } from "../utils/errors"; import { @@ -20,12 +20,15 @@ import { RoyaltyModuleClient, RoyaltyPolicyLapClient, SimpleWalletClient, + ipRoyaltyVaultImplAbi, } from "../abi/generated"; +import { IPAccountClient } from "./ipAccount"; export class RoyaltyClient { public royaltyPolicyLapClient: RoyaltyPolicyLapClient; public royaltyModuleClient: RoyaltyModuleClient; public ipAssetRegistryClient: IpAssetRegistryClient; + public ipAccountClient: IPAccountClient; private readonly rpcClient: PublicClient; private readonly wallet: SimpleWalletClient; @@ -33,6 +36,7 @@ export class RoyaltyClient { this.royaltyPolicyLapClient = new RoyaltyPolicyLapClient(rpcClient, wallet); this.royaltyModuleClient = new RoyaltyModuleClient(rpcClient, wallet); this.ipAssetRegistryClient = new IpAssetRegistryClient(rpcClient, wallet); + this.ipAccountClient = new IPAccountClient(rpcClient, wallet); this.rpcClient = rpcClient; this.wallet = wallet; } @@ -98,19 +102,19 @@ export class RoyaltyClient { id: request.receiverIpId, }); if (!isReceiverRegistered) { - throw new Error(`The receiver IP with id ${request.receiverIpId} is not registered`); + throw new Error(`The receiver IP with id ${request.receiverIpId} is not registered.`); } const isPayerRegistered = await this.ipAssetRegistryClient.isRegistered({ id: request.payerIpId, }); if (!isPayerRegistered) { - throw new Error(`The payer IP with id ${request.payerIpId} is not registered`); + throw new Error(`The payer IP with id ${request.payerIpId} is not registered.`); } const txHash = await this.royaltyModuleClient.payRoyaltyOnBehalf({ receiverIpId: request.receiverIpId, payerIpId: request.payerIpId, token: request.token, - amount: request.amount, + amount: BigInt(request.amount), }); if (request.txOptions?.waitForTransaction) { await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); @@ -143,11 +147,12 @@ export class RoyaltyClient { this.wallet, proxyAddress, ); - return await ipRoyaltyVault.claimableRevenue({ + const amount = await ipRoyaltyVault.claimableRevenue({ account: request.account, snapshotId: BigInt(request.snapshotId), token: request.token, }); + return amount.toString(); } catch (error) { handleError(error, "Failed to calculate claimable revenue"); } @@ -171,14 +176,26 @@ export class RoyaltyClient { this.wallet, proxyAddress, ); - const txHash = await ipRoyaltyVault.claimRevenueBySnapshotBatch({ - snapshotIds: request.snapshotIds.map((id) => BigInt(id)), - token: request.token, + const iPAccountExecuteResponse = await this.ipAccountClient.execute({ + to: proxyAddress, + value: 0, + accountAddress: request.account, + txOptions: { + waitForTransaction: true, + }, + data: encodeFunctionData({ + abi: ipRoyaltyVaultImplAbi, + functionName: "claimRevenueBySnapshotBatch", + args: [request.snapshotIds.map((item) => BigInt(item)), request.token], + }), }); + const txHash = iPAccountExecuteResponse.txHash as Hex; if (request.txOptions?.waitForTransaction) { - const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); + const txReceipt = await this.rpcClient.waitForTransactionReceipt({ + hash: txHash, + }); const targetLogs = ipRoyaltyVault.parseTxRevenueTokenClaimedEvent(txReceipt); - return { txHash, claimableToken: targetLogs[0].amount }; + return { txHash, claimableToken: targetLogs[0].amount.toString() }; } else { return { txHash }; } @@ -206,7 +223,7 @@ export class RoyaltyClient { if (request.txOptions?.waitForTransaction) { const txReceipt = await this.rpcClient.waitForTransactionReceipt({ hash: txHash }); const targetLogs = ipRoyaltyVault.parseTxSnapshotCompletedEvent(txReceipt); - return { txHash, snapshotId: targetLogs[0].snapshotId }; + return { txHash, snapshotId: targetLogs[0].snapshotId.toString() }; } else { return { txHash }; } diff --git a/packages/core-sdk/src/types/resources/dispute.ts b/packages/core-sdk/src/types/resources/dispute.ts index 840522e7..45129942 100644 --- a/packages/core-sdk/src/types/resources/dispute.ts +++ b/packages/core-sdk/src/types/resources/dispute.ts @@ -1,33 +1,35 @@ +import { Hex } from "viem"; + import { TxOptions } from "../options"; export type Dispute = { - targetIpId: `0x${string}`; // The ipId that is the target of the dispute - disputeInitiator: `0x${string}`; // The address of the dispute initiator - arbitrationPolicy: `0x${string}`; // The address of the arbitration policy + targetIpId: Hex; // The ipId that is the target of the dispute + disputeInitiator: Hex; // The address of the dispute initiator + arbitrationPolicy: Hex; // The address of the arbitration policy linkToDisputeEvidence: string; // The link of the dispute evidence targetTag: string; // The target tag of the dispute currentTag: string; // The current tag of the dispute }; export type RaiseDisputeRequest = { - targetIpId: `0x${string}`; - arbitrationPolicy: `0x${string}`; + targetIpId: Hex; + arbitrationPolicy: Hex; linkToDisputeEvidence: string; targetTag: string; - calldata?: `0x${string}`; + calldata?: Hex; txOptions?: TxOptions; }; export type RaiseDisputeResponse = { txHash: string; - disputeId?: `0x${string}`; - arbitrationPolicy?: `0x${string}`; + disputeId?: Hex; + arbitrationPolicy?: Hex; }; export type SetDisputeJudgementRequest = { disputeId: number; decision: boolean; - calldata?: `0x${string}`; + calldata?: Hex; txOptions?: TxOptions; }; @@ -35,12 +37,12 @@ export type SetDisputeJudgementResponse = { txHash: string; disputeId?: bigint; decision?: boolean; - data?: `0x${string}`; + data?: Hex; }; export type CancelDisputeRequest = { disputeId: number | string | bigint; - calldata?: `0x${string}`; + calldata?: Hex; txOptions?: TxOptions; }; @@ -50,6 +52,7 @@ export type CancelDisputeResponse = { export type ResolveDisputeRequest = { disputeId: number | string | bigint; + data: Hex; txOptions?: TxOptions; }; diff --git a/packages/core-sdk/src/types/resources/license.ts b/packages/core-sdk/src/types/resources/license.ts index 81872b30..596bdf5b 100644 --- a/packages/core-sdk/src/types/resources/license.ts +++ b/packages/core-sdk/src/types/resources/license.ts @@ -33,6 +33,7 @@ export type LicenseTerms = { derivativesApproval: boolean; derivativesReciprocal: boolean; currency: Hex; + uri: string; }; export type LicenseTermsIdResponse = number; diff --git a/packages/core-sdk/src/types/resources/royalty.ts b/packages/core-sdk/src/types/resources/royalty.ts index 2303e370..c44331e9 100644 --- a/packages/core-sdk/src/types/resources/royalty.ts +++ b/packages/core-sdk/src/types/resources/royalty.ts @@ -45,16 +45,15 @@ export type ClaimableRevenueRequest = { account: Hex; snapshotId: string; token: Hex; - txOptions?: TxOptions; }; -export type ClaimableRevenueResponse = bigint; +export type ClaimableRevenueResponse = string; export type PayRoyaltyOnBehalfRequest = { receiverIpId: Hex; payerIpId: Hex; token: Hex; - amount: bigint; + amount: string; txOptions?: TxOptions; }; @@ -70,18 +69,19 @@ export type SnapshotRequest = { export type claimRevenueRequest = { snapshotIds: string[]; token: Hex; + account: Hex; royaltyVaultIpId: Hex; txOptions?: TxOptions; }; export type claimRevenueResponse = { txHash: string; - claimableToken?: bigint; + claimableToken?: string; }; export type SnapshotResponse = { txHash: string; - snapshotId?: bigint; + snapshotId?: string; }; export type RoyaltyVaultAddress = Hex; diff --git a/packages/core-sdk/test/integration/config.test.ts b/packages/core-sdk/test/integration/config.test.ts deleted file mode 100644 index 282fa0ff..00000000 --- a/packages/core-sdk/test/integration/config.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import chai from "chai"; -import chaiAsPromised from "chai-as-promised"; -import { createPublicClient, http } from "viem"; -import * as dotenv from "dotenv"; - -dotenv.config(); -chai.use(chaiAsPromised); -chai.config.truncateThreshold = 0; - -// before(async function () { -// const TEST_CHECKPOINT = "0x024c376000e3bb27344a6d8bbd5b99ee22c84eb9beefdfc3caa7bb367869dc09"; -// const client = createPublicClient({ -// chain: { -// id: 11155111, -// name: "Tenderly", -// network: "paris", -// nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, -// rpcUrls: { -// default: { -// http: [process.env.RPC_PROVIDER_URL!], -// }, -// public: { -// http: [process.env.RPC_PROVIDER_URL!], -// }, -// }, -// }, -// transport: http(), -// }); -// -// // @ts-ignore -// await client.request({ method: "evm_revert", params: [TEST_CHECKPOINT] }); -// -// // @ts-ignore -// const checkpoint = (await client.request({ method: "evm_snapshot", params: [] })) as string; -// console.log("Checkpoint created:", checkpoint); -// }); diff --git a/packages/core-sdk/test/integration/dispute.test.ts b/packages/core-sdk/test/integration/dispute.test.ts index abb13501..bf4666ba 100644 --- a/packages/core-sdk/test/integration/dispute.test.ts +++ b/packages/core-sdk/test/integration/dispute.test.ts @@ -1,36 +1,37 @@ import { expect } from "chai"; -import { Hex, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { StoryClient, StoryConfig } from "../../src"; +import { StoryClient } from "../../src"; import { CancelDisputeRequest, RaiseDisputeRequest, ResolveDisputeRequest, } from "../../src/types/resources/dispute"; +import { MockERC721, getStoryClientInSepolia, getTokenId } from "./util"; describe.skip("Dispute Functions", () => { let client: StoryClient; before(function () { - const config: StoryConfig = { - transport: http(process.env.RPC_PROVIDER_URL), - account: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as Hex), - }; - - client = StoryClient.newClient(config); + client = getStoryClientInSepolia(); }); describe("Should be able to", async function () { it("raise a dispute", async () => { - const waitForTransaction = true; + const tokenId = await getTokenId(); + const registerResult = await client.ipAsset.register({ + tokenContract: MockERC721, + tokenId: tokenId!, + txOptions: { + waitForTransaction: true, + }, + }); const raiseDisputeRequest: RaiseDisputeRequest = { - targetIpId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", + targetIpId: registerResult.ipId!, arbitrationPolicy: "0xb41BC78478878B338336C5E7a34292213779cd6F", linkToDisputeEvidence: "foo", targetTag: "PLAGIARISM", txOptions: { - waitForTransaction: waitForTransaction, + waitForTransaction: true, }, }; const response = await expect(client.dispute.raiseDispute(raiseDisputeRequest)).to.not.be @@ -39,7 +40,7 @@ describe.skip("Dispute Functions", () => { expect(response.txHash).to.be.a("string"); expect(response.txHash).not.empty; - if (waitForTransaction) { + if (true) { expect(response.disputeId).to.be.a("string"); expect(response.disputeId).not.empty; } @@ -48,6 +49,7 @@ describe.skip("Dispute Functions", () => { it.skip("resolve a dispute", async () => { const resolveDisputeRequest: ResolveDisputeRequest = { disputeId: 3, + data: "0x", txOptions: { waitForTransaction: true, }, diff --git a/packages/core-sdk/test/integration/ipAccount.test.ts b/packages/core-sdk/test/integration/ipAccount.test.ts index be010c4b..e0e92ad9 100644 --- a/packages/core-sdk/test/integration/ipAccount.test.ts +++ b/packages/core-sdk/test/integration/ipAccount.test.ts @@ -1,46 +1,39 @@ -import { expect } from "chai"; -import { StoryClient, StoryConfig } from "../../src"; -import { Hex, http, Account } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; - +import chai from "chai"; +import chaiAsPromised from "chai-as-promised"; +import { StoryClient } from "../../src"; +import { getStoryClientInSepolia } from "./util"; +chai.use(chaiAsPromised); +const expect = chai.expect; describe.skip("Permission Functions", () => { let client: StoryClient; - let senderAddress: string; before(function () { - const config: StoryConfig = { - chainId: "sepolia", - transport: http(process.env.RPC_PROVIDER_URL), - account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex), - }; - - const configAccount: Account = config.account as Account; - senderAddress = configAccount.address; - client = StoryClient.newClient(config); + client = getStoryClientInSepolia(); }); describe("Execute Set Permission", async function () { it("should not throw error when execute setting permission", async () => { const waitForTransaction: boolean = true; - const response = await expect( - client.ipAccount.execute({ - accountAddress: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", - value: 0, - to: "0x674d6E1f7b5e2d714DBa588e9d046965225517c8", - data: "0x7bac65fd000000000000000000000000004e38104adc39cbf4cea9bd8876440a969e3d0b0000000000000000000000009965507d1a55bcc2695c58ba16fb37d819b0a4dc0000000000000000000000002ac240293f12032e103458451de8a8096c5a72e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", - txOptions: { - waitForTransaction: waitForTransaction, - }, - }), - ).to.not.be.rejected; + // const response = await expect( + // ).to.not.be.rejected; + const response = await client.ipAccount.execute({ + accountAddress: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", + value: 0, + to: "0x674d6E1f7b5e2d714DBa588e9d046965225517c8", + data: "0x7bac65fd000000000000000000000000004e38104adc39cbf4cea9bd8876440a969e3d0b0000000000000000000000009965507d1a55bcc2695c58ba16fb37d819b0a4dc0000000000000000000000002ac240293f12032e103458451de8a8096c5a72e800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", + txOptions: { + waitForTransaction: waitForTransaction, + }, + }); + console.log("response", response); expect(response.txHash).to.be.a("string"); expect(response.txHash).not.empty; }); }); describe("Execute with sig Set Permission", async function () { - it.skip("should not throw error when executeWithSig setting permission", async () => { + it("should not throw error when executeWithSig setting permission", async () => { const waitForTransaction: boolean = true; const response = await expect( client.ipAccount.executeWithSig({ diff --git a/packages/core-sdk/test/integration/storyTestNet/ipAsset.storyTest.test.ts b/packages/core-sdk/test/integration/ipAsset.test.ts similarity index 77% rename from packages/core-sdk/test/integration/storyTestNet/ipAsset.storyTest.test.ts rename to packages/core-sdk/test/integration/ipAsset.test.ts index e4996f37..90fb2979 100644 --- a/packages/core-sdk/test/integration/storyTestNet/ipAsset.storyTest.test.ts +++ b/packages/core-sdk/test/integration/ipAsset.test.ts @@ -1,31 +1,30 @@ import chai from "chai"; -import { StoryClient, StoryConfig } from "../../../src"; -import { Hex, http } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; +import { StoryClient } from "../../src"; +import { Hex } from "viem"; import chaiAsPromised from "chai-as-promised"; -import { MockERC721, getTokenId } from "./util"; +import { MockERC721, getStoryClientInSepolia, getTokenId } from "./util"; chai.use(chaiAsPromised); const expect = chai.expect; let parentIpId: Hex; let childIpId: Hex; -const noCommercialLicenseTermsId = "6"; -let startTokenId = 176; -describe.skip("IP Asset Functions in storyTestnet", () => { +let noCommercialLicenseTermsId: string; +describe.skip("IP Asset Functions ", () => { let client: StoryClient; - before(function () { - const config: StoryConfig = { - chainId: "storyTestnet", - transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL), - account: privateKeyToAccount(process.env.STORY_TEST_NET_WALLET_PRIVATE_KEY as Hex), - }; - client = StoryClient.newClient(config); + before(async function () { + client = getStoryClientInSepolia(); + const registerResult = await client.license.registerNonComSocialRemixingPIL({ + txOptions: { + waitForTransaction: true, + }, + }); + noCommercialLicenseTermsId = registerResult.licenseTermsId!; }); describe("Create IP Asset", async function () { it("should not throw error when registering a IP Asset", async () => { - const tokenId = await getTokenId(startTokenId++); + const tokenId = await getTokenId(); const waitForTransaction: boolean = true; const response = await expect( client.ipAsset.register({ @@ -43,7 +42,7 @@ describe.skip("IP Asset Functions in storyTestnet", () => { }); it("should not throw error when registering derivative", async () => { - const tokenId = await getTokenId(startTokenId++); + const tokenId = await getTokenId(); parentIpId = ( await client.ipAsset.register({ tokenContract: MockERC721, @@ -74,7 +73,7 @@ describe.skip("IP Asset Functions in storyTestnet", () => { }); it("should not throw error when registering derivative with license tokens", async () => { - const tokenId = await getTokenId(startTokenId++); + const tokenId = await getTokenId(); const ipId = ( await client.ipAsset.register({ tokenContract: MockERC721, diff --git a/packages/core-sdk/test/integration/storyTestNet/license.storyTest.test.ts b/packages/core-sdk/test/integration/license.test.ts similarity index 86% rename from packages/core-sdk/test/integration/storyTestNet/license.storyTest.test.ts rename to packages/core-sdk/test/integration/license.test.ts index 80d6c7cd..408dc1c1 100644 --- a/packages/core-sdk/test/integration/storyTestNet/license.storyTest.test.ts +++ b/packages/core-sdk/test/integration/license.test.ts @@ -1,25 +1,20 @@ import chai from "chai"; -import { StoryClient, StoryConfig } from "../../../src"; +import { StoryClient } from "../../src"; import { createPublicClient, createWalletClient, Hex, http } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import chaiAsPromised from "chai-as-promised"; -import { chainStringToViemChain } from "../../../src/utils/utils"; -import { MockERC20, MockERC721 } from "./util"; +import { chainStringToViemChain } from "../../src/utils/utils"; +import { MockERC20, MockERC721, getStoryClientInSepolia } from "./util"; chai.use(chaiAsPromised); const expect = chai.expect; describe.skip("License Functions in storyTestnet", () => { let client: StoryClient; - const account = privateKeyToAccount(process.env.STORY_TEST_NET_WALLET_PRIVATE_KEY as Hex); + const account = privateKeyToAccount(process.env.SEPOLIA_WALLET_PRIVATE_KEY as Hex); before(function () { - const config: StoryConfig = { - chainId: "storyTestnet", - transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL), - account, - }; - client = StoryClient.newClient(config); + client = getStoryClientInSepolia(); }); describe("registering license with different types", async function () { it("should not throw error when registering license with non commercial social remixing PIL", async function () { @@ -28,7 +23,6 @@ describe.skip("License Functions in storyTestnet", () => { waitForTransaction: true, }, }); - // expect(result.txHash).to.a("string").and.not.empty; expect(result.licenseTermsId).to.be.a("string").and.not.empty; }); @@ -40,7 +34,6 @@ describe.skip("License Functions in storyTestnet", () => { waitForTransaction: true, }, }); - // expect(result.txHash).to.be.a("string").and.not.empty; expect(result.licenseTermsId).to.be.a("string").not.empty; }); @@ -53,7 +46,6 @@ describe.skip("License Functions in storyTestnet", () => { waitForTransaction: true, }, }); - // expect(result.txHash).to.be.a("string").and.not.empty; expect(result.licenseTermsId).to.be.a("string").and.not.empty; }); }); diff --git a/packages/core-sdk/test/integration/permission.test.ts b/packages/core-sdk/test/integration/permission.test.ts index 72cecfd1..bd2e09c7 100644 --- a/packages/core-sdk/test/integration/permission.test.ts +++ b/packages/core-sdk/test/integration/permission.test.ts @@ -1,31 +1,30 @@ import { expect } from "chai"; -import { StoryClient, StoryConfig } from "../../src"; -import { Hex, http, Account } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; +import { StoryClient } from "../../src"; +import { MockERC721, getStoryClientInSepolia, getTokenId } from "./util"; +import { Hex } from "viem"; describe.skip("Permission Functions", () => { let client: StoryClient; - let senderAddress: string; before(function () { - const config: StoryConfig = { - chainId: "sepolia", - transport: http(process.env.RPC_PROVIDER_URL), - account: privateKeyToAccount((process.env.WALLET_PRIVATE_KEY || "0x") as Hex), - }; - - const configAccount: Account = config.account as Account; - senderAddress = configAccount.address; - client = StoryClient.newClient(config); + client = getStoryClientInSepolia(); }); describe("Set Permission", async function () { it("should not throw error when setting permission", async () => { const waitForTransaction: boolean = true; + const tokenId = await getTokenId(); + const registerResult = await client.ipAsset.register({ + tokenContract: MockERC721, + tokenId: tokenId!, + txOptions: { + waitForTransaction: true, + }, + }); const response = await expect( client.permission.setPermission({ - ipId: "0x004e38104adc39cbf4cea9bd8876440a969e3d0b", - signer: process.env.TEST_WALLET_ADDRESS as `0x${string}`, + ipId: registerResult.ipId!, + signer: process.env.TEST_WALLET_ADDRESS as Hex, to: "0x2ac240293f12032E103458451dE8A8096c5A72E8", func: "0x00000000", permission: 1, diff --git a/packages/core-sdk/test/integration/storyTestNet/royalty.storyTest.test.ts b/packages/core-sdk/test/integration/royalty.test.ts similarity index 83% rename from packages/core-sdk/test/integration/storyTestNet/royalty.storyTest.test.ts rename to packages/core-sdk/test/integration/royalty.test.ts index db0be8c8..3e9c202e 100644 --- a/packages/core-sdk/test/integration/storyTestNet/royalty.storyTest.test.ts +++ b/packages/core-sdk/test/integration/royalty.test.ts @@ -1,5 +1,5 @@ import chai from "chai"; -import { StoryClient, StoryConfig } from "../../../src"; +import { StoryClient } from "../../src"; import { Hex, http, @@ -10,40 +10,34 @@ import { } from "viem"; import { privateKeyToAccount } from "viem/accounts"; import chaiAsPromised from "chai-as-promised"; -import { chainStringToViemChain, waitTx } from "../../../src/utils/utils"; -import { MockERC721, MockERC20, getTokenId } from "./util"; +import { chainStringToViemChain, waitTx } from "../../src/utils/utils"; +import { MockERC721, MockERC20, getTokenId, getStoryClientInSepolia } from "./util"; chai.use(chaiAsPromised); const expect = chai.expect; -let startTokenId = 198; -let snapshotId: bigint; +let snapshotId: string; describe.skip("Test royalty Functions", () => { let client: StoryClient; let publicClient: PublicClient; let walletClient: WalletClient; before(function () { - const config: StoryConfig = { - chainId: "storyTestnet", - transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL), - account: privateKeyToAccount(process.env.STORY_TEST_NET_WALLET_PRIVATE_KEY as Hex), - }; - client = StoryClient.newClient(config); + client = getStoryClientInSepolia(); const baseConfig = { - chain: chainStringToViemChain("storyTestnet"), - transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL), + chain: chainStringToViemChain("sepolia"), + transport: http(process.env.SEPOLIA_RPC_PROVIDER_URL), } as const; publicClient = createPublicClient(baseConfig); walletClient = createWalletClient({ ...baseConfig, - account: privateKeyToAccount(process.env.STORY_TEST_NET_WALLET_PRIVATE_KEY as Hex), + account: privateKeyToAccount(process.env.SEPOLIA_WALLET_PRIVATE_KEY as Hex), }); }); describe("Royalty in storyTestNet", async function () { let ipId1: Hex; let ipId2: Hex; const getIpId = async (): Promise => { - const tokenId = await getTokenId(startTokenId++); + const tokenId = await getTokenId(); const response = await client.ipAsset.register({ tokenContract: MockERC721, tokenId: tokenId!, @@ -78,7 +72,9 @@ describe.skip("Test royalty Functions", () => { before(async () => { ipId1 = await getIpId(); ipId2 = await getIpId(); + console.log("ipId1", ipId1, "ipId2", ipId2); const licenseTermsId = await getCommercialPolicyId(); + console.log("licenseTermsId", licenseTermsId); await attachLicenseTerms(ipId1, licenseTermsId); await client.ipAsset.registerDerivative({ childIpId: ipId2, @@ -160,7 +156,7 @@ describe.skip("Test royalty Functions", () => { receiverIpId: ipId1, payerIpId: ipId2, token: MockERC20, - amount: BigInt(10), + amount: "10", txOptions: { waitForTransaction: true, }, @@ -176,7 +172,7 @@ describe.skip("Test royalty Functions", () => { }, }); expect(response.txHash).to.be.a("string").not.empty; - expect(response.snapshotId).to.be.a("bigint"); + expect(response.snapshotId).to.be.a("string"); snapshotId = response.snapshotId!; }); @@ -198,24 +194,26 @@ describe.skip("Test royalty Functions", () => { account: ipId1, snapshotId: snapshotId.toString(), token: "0xA36F2A4A02f5C215d1b3630f71A4Ff55B5492AAE", - txOptions: { - waitForTransaction: true, - }, }); - expect(response).to.be.a("bigint"); + expect(response).to.be.a("string"); }); it("should not throw error when claim revenue", async () => { + const parentIpId = "0x66f90435a01173E727Fffd1BbB5b033a50561325"; + const childIpId = "0x286e816704883a4087e214C89983A7d84219e4cF"; + snapshotId = "1"; + console.log("snapshotId", snapshotId.toString(), "ipId1", ipId1, "ipId2", ipId2); const response = await client.royalty.claimRevenue({ - royaltyVaultIpId: ipId2, + royaltyVaultIpId: childIpId, + account: parentIpId, snapshotIds: [snapshotId.toString()], token: "0xA36F2A4A02f5C215d1b3630f71A4Ff55B5492AAE", txOptions: { waitForTransaction: true, }, }); - - expect(response.claimableToken).to.be.a("bigint"); + console.log("response", response); + expect(response.claimableToken).to.be.a("string"); }); }); }); diff --git a/packages/core-sdk/test/integration/storyTestNet/util.ts b/packages/core-sdk/test/integration/storyTestNet/util.ts deleted file mode 100644 index f9c9e834..00000000 --- a/packages/core-sdk/test/integration/storyTestNet/util.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { http, createPublicClient, createWalletClient, Hex } from "viem"; -import { privateKeyToAccount } from "viem/accounts"; -import { chainStringToViemChain } from "../../../src/utils/utils"; - -export const getTokenId = async (tokenId: number): Promise => { - const baseConfig = { - chain: chainStringToViemChain("storyTestnet"), - transport: http(process.env.STORY_TEST_NET_RPC_PROVIDER_URL), - } as const; - const publicClient = createPublicClient(baseConfig); - const walletClient = createWalletClient({ - ...baseConfig, - account: privateKeyToAccount(process.env.STORY_TEST_NET_WALLET_PRIVATE_KEY as Hex), - }); - const { request } = await publicClient.simulateContract({ - abi: [ - { - inputs: [ - { internalType: "address", name: "to", type: "address" }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256", - }, - ], - name: "mintId", - outputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], - stateMutability: "nonpayable", - type: "function", - }, - ], - address: MockERC721, - functionName: "mintId", - args: [process.env.STORY_TEST_NET_TEST_WALLET_ADDRESS as Hex, BigInt(tokenId)], - account: walletClient.account, - }); - const hash = await walletClient.writeContract(request); - const { logs } = await publicClient.waitForTransactionReceipt({ - hash, - }); - if (logs[0].topics[3]) { - return parseInt(logs[0].topics[3], 16).toString(); - } -}; - -export const MockERC20 = "0xA36F2A4A02f5C215d1b3630f71A4Ff55B5492AAE"; -export const MockERC721 = "0x83DD606d14CcEb629dE9Bf8Aad7aE63767dB476f"; diff --git a/packages/core-sdk/test/integration/util.ts b/packages/core-sdk/test/integration/util.ts new file mode 100644 index 00000000..5a285886 --- /dev/null +++ b/packages/core-sdk/test/integration/util.ts @@ -0,0 +1,50 @@ +import { privateKeyToAccount } from "viem/accounts"; +import { chainStringToViemChain } from "../../src/utils/utils"; +import { http, createPublicClient, createWalletClient, Hex } from "viem"; +import { StoryClient, StoryConfig } from "../../src"; + +export const getTokenId = async (): Promise => { + const baseConfig = { + chain: chainStringToViemChain("sepolia"), + transport: http(process.env.SEPOLIA_RPC_PROVIDER_URL), + } as const; + const publicClient = createPublicClient(baseConfig); + const walletClient = createWalletClient({ + ...baseConfig, + account: privateKeyToAccount(process.env.SEPOLIA_WALLET_PRIVATE_KEY as Hex), + }); + const { request } = await publicClient.simulateContract({ + abi: [ + { + inputs: [{ internalType: "address", name: "to", type: "address" }], + name: "mint", + outputs: [{ internalType: "uint256", name: "tokenId", type: "uint256" }], + stateMutability: "nonpayable", + type: "function", + }, + ], + address: MockERC721, + functionName: "mint", + args: [process.env.SEPOLIA_TEST_WALLET_ADDRESS as Hex], + account: walletClient.account, + }); + const hash = await walletClient.writeContract(request); + const { logs } = await publicClient.waitForTransactionReceipt({ + hash, + }); + if (logs[0].topics[3]) { + return parseInt(logs[0].topics[3], 16).toString(); + } +}; + +export const MockERC20 = "0x857308523a01B430cB112400976B9FC4A6429D55"; +export const MockERC721 = "0x7ee32b8B515dEE0Ba2F25f612A04a731eEc24F49"; + +export const getStoryClientInSepolia = (): StoryClient => { + const config: StoryConfig = { + chainId: "sepolia", + transport: http(process.env.SEPOLIA_RPC_PROVIDER_URL), + account: privateKeyToAccount(process.env.SEPOLIA_WALLET_PRIVATE_KEY as Hex), + }; + return StoryClient.newClient(config); +}; diff --git a/packages/core-sdk/test/unit/client.test.ts b/packages/core-sdk/test/unit/client.test.ts index 3cc93148..dfef91c3 100644 --- a/packages/core-sdk/test/unit/client.test.ts +++ b/packages/core-sdk/test/unit/client.test.ts @@ -10,6 +10,7 @@ import { StoryConfig, } from "../../src"; import { StoryAPIClient } from "../../src/clients/storyAPI"; +import { RoyaltyClient } from "../../src/resources/royalty"; describe("Test StoryClient", function () { describe("Test constructor", function () { @@ -37,6 +38,39 @@ describe("Test StoryClient", function () { }); }).to.throw("must specify a wallet or account"); }); + + it("should succeed when passing in wallet", function () { + const client = StoryClient.newClient({ + transport: http(process.env.RPC_PROVIDER_URL), + wallet: createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: sepolia, + transport: http(process.env.RPC_PROVIDER_URL), + }), + }); + + expect(client).to.be.instanceOf(StoryClient); + }); + + it("should return client storyClient when new newClientUseWallet given wallet config", () => { + const client = StoryClient.newClientUseWallet({ + transport: http(process.env.RPC_PROVIDER_URL), + wallet: createWalletClient({ + account: privateKeyToAccount(generatePrivateKey()), + chain: sepolia, + transport: http(process.env.RPC_PROVIDER_URL), + }), + }); + expect(client).to.be.instanceOf(StoryClient); + }); + + it("should return client storyClient when new newClientUseAccount given account config", () => { + const client = StoryClient.newClientUseAccount({ + transport: http(process.env.RPC_PROVIDER_URL), + account: privateKeyToAccount(generatePrivateKey()), + }); + expect(client).to.be.instanceOf(StoryClient); + }); }); describe("Test getters", function () { @@ -86,5 +120,11 @@ describe("Test StoryClient", function () { expect(client.dispute).to.not.equal(null); expect(client.dispute).to.not.equal(undefined); }); + + it("should return client royalty", () => { + const royalty = new RoyaltyClient(rpcClient, wallet); + expect(client.royalty).to.not.equal(null); + expect(client.royalty).to.not.equal(undefined); + }); }); }); diff --git a/packages/core-sdk/test/unit/resources/dispute.test.ts b/packages/core-sdk/test/unit/resources/dispute.test.ts index 002cdbb5..4fec0352 100644 --- a/packages/core-sdk/test/unit/resources/dispute.test.ts +++ b/packages/core-sdk/test/unit/resources/dispute.test.ts @@ -190,14 +190,15 @@ describe("Test DisputeClient", function () { rpcMock.waitForTransactionReceipt = sinon.stub().resolves(); walletMock.writeContract = sinon.stub().resolves(mock.txHash); - const cancelDisputeRequest: ResolveDisputeRequest = { + const resolveDisputeRequest: ResolveDisputeRequest = { disputeId: 1, + data: "0x1111", txOptions: { waitForTransaction: true, }, }; try { - await disputeClient.resolveDispute(cancelDisputeRequest); + await disputeClient.resolveDispute(resolveDisputeRequest); } catch (err) { expect((err as Error).message.includes("simulateContract error")); } @@ -206,14 +207,15 @@ describe("Test DisputeClient", function () { it("should throw writeContract error if writeContract throws an error", async () => { rpcMock.simulateContract = sinon.stub().resolves({ request: null }); walletMock.writeContract = sinon.stub().throws(new Error("writeContract error")); - const cancelDisputeRequest: CancelDisputeRequest = { + const resolveDisputeRequest: ResolveDisputeRequest = { disputeId: 1, + data: "0x1111", txOptions: { waitForTransaction: true, }, }; try { - await disputeClient.resolveDispute(cancelDisputeRequest); + await disputeClient.resolveDispute(resolveDisputeRequest); } catch (err) { expect((err as Error).message.includes("writeContract error")); } @@ -223,27 +225,29 @@ describe("Test DisputeClient", function () { rpcMock.simulateContract = sinon.stub().resolves({ request: null }); rpcMock.waitForTransactionReceipt = sinon.stub().resolves(); walletMock.writeContract = sinon.stub().resolves(mock.txHash); - const cancelDisputeRequest: CancelDisputeRequest = { + const resolveDisputeRequest: ResolveDisputeRequest = { disputeId: 1, + data: "0x1111", txOptions: { waitForTransaction: true, }, }; - const result = await disputeClient.resolveDispute(cancelDisputeRequest); + const result = await disputeClient.resolveDispute(resolveDisputeRequest); expect(result.txHash).to.equal(mock.txHash); }); it("should return txHash if txOptions.waitForTransaction is falsy", async () => { rpcMock.simulateContract = sinon.stub().resolves({ request: null }); walletMock.writeContract = sinon.stub().resolves(mock.txHash); - const cancelDisputeRequest: CancelDisputeRequest = { + const resolveDisputeRequest: ResolveDisputeRequest = { disputeId: 1, + data: "0x1111", txOptions: { waitForTransaction: false, }, }; - const result = await disputeClient.resolveDispute(cancelDisputeRequest); + const result = await disputeClient.resolveDispute(resolveDisputeRequest); expect(result.txHash).to.equal(mock.txHash); }); }); diff --git a/packages/core-sdk/test/unit/resources/royalty.test.ts b/packages/core-sdk/test/unit/resources/royalty.test.ts index da5a44a6..ac6a3a8b 100644 --- a/packages/core-sdk/test/unit/resources/royalty.test.ts +++ b/packages/core-sdk/test/unit/resources/royalty.test.ts @@ -4,11 +4,8 @@ import * as sinon from "sinon"; import { PublicClient, WalletClient, Account } from "viem"; import chaiAsPromised from "chai-as-promised"; import { RoyaltyClient } from "../../../src/resources/royalty"; -import { - IpRoyaltyVaultImplClient, - RoyaltyPolicyLapGetRoyaltyDataResponse, -} from "../../../src/abi/generated"; - +import { RoyaltyPolicyLapGetRoyaltyDataResponse } from "../../../src/abi/generated"; +const { IpRoyaltyVaultImplClient } = require("../../../src/abi/generated"); chai.use(chaiAsPromised); const expect = chai.expect; const txHash = "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"; @@ -103,5 +100,361 @@ describe("Test RoyaltyClient", function () { ); } }); + + it("should return txHash when call collectRoyaltyTokens given correct args", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "collectRoyaltyTokens").resolves(txHash); + + const result = await royaltyClient.collectRoyaltyTokens({ + parentIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + + expect(result.txHash).equals(txHash); + }); + + it("should return txHash when call collectRoyaltyTokens given given correct args and waitForTransaction is true", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "collectRoyaltyTokens").resolves(txHash); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "parseTxRoyaltyTokensCollectedEvent").returns([ + { + ancestorIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyTokensCollected: 1, + }, + ]); + const result = await royaltyClient.collectRoyaltyTokens({ + parentIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + txOptions: { waitForTransaction: true }, + }); + + expect(result.txHash).equals(txHash); + expect(result.royaltyTokensCollected).equals("1"); + }); + }); + + describe("Test royaltyClient.payRoyaltyOnBehalf", async function () { + it("should throw receiverIpId error when call payRoyaltyOnBehalf given receiverIpId is not registered", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(false); + + try { + await royaltyClient.payRoyaltyOnBehalf({ + receiverIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + payerIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + amount: "1", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to pay royalty on behalf: The receiver IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 is not registered.", + ); + } + }); + + it("should throw payerIpId error when call payRoyaltyOnBehalf given payerIpId is not registered", async function () { + sinon + .stub(royaltyClient.ipAssetRegistryClient, "isRegistered") + .onFirstCall() + .resolves(true) + .onSecondCall() + .resolves(false); + + try { + await royaltyClient.payRoyaltyOnBehalf({ + receiverIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + payerIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + amount: "1", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to pay royalty on behalf: The payer IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 is not registered.", + ); + } + }); + + it("should return txHash when call payRoyaltyOnBehalf given correct args", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon.stub(royaltyClient.royaltyModuleClient, "payRoyaltyOnBehalf").resolves(txHash); + + const result = await royaltyClient.payRoyaltyOnBehalf({ + receiverIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + payerIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + amount: "1", + }); + + expect(result.txHash).equals(txHash); + }); + + it("should return txHash when call payRoyaltyOnBehalf given given correct args and waitForTransaction is true", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon.stub(royaltyClient.royaltyModuleClient, "payRoyaltyOnBehalf").resolves(txHash); + + const result = await royaltyClient.payRoyaltyOnBehalf({ + receiverIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + payerIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + amount: "1", + txOptions: { waitForTransaction: true }, + }); + + expect(result.txHash).equals(txHash); + }); + }); + + describe("Test royaltyClient.claimableRevenue", async function () { + it("should throw royaltyVaultIpId error when call claimableRevenue given royaltyVaultIpId is not registered", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(false); + + try { + await royaltyClient.claimableRevenue({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotId: "1", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to calculate claimable revenue: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 is not registered.", + ); + } + }); + + it("should throw royaltyVaultAddress error when call claimableRevenue given royalty vault address is 0x", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([true, "0x", 1, ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], [1]]); + + try { + await royaltyClient.claimableRevenue({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotId: "1", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to calculate claimable revenue: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 address is not set.", + ); + } + }); + + it("should return txHash when call claimableRevenue given correct args", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "claimableRevenue").resolves(1); + + const result = await royaltyClient.claimableRevenue({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotId: "1", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + expect(result).equals("1"); + }); + }); + + describe("Test royaltyClient.claimRevenue", async function () { + it("should throw royaltyVaultIpId error when call claimRevenue given royaltyVaultIpId is not registered", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(false); + + try { + await royaltyClient.claimRevenue({ + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotIds: ["1"], + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to claim revenue: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 is not registered.", + ); + } + }); + + it("should throw royaltyVaultAddress error when call claimRevenue given royalty vault address is 0x", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([true, "0x", 1, ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], [1]]); + + try { + await royaltyClient.claimRevenue({ + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotIds: ["1"], + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to claim revenue: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 address is not set.", + ); + } + }); + + it("should return txHash when call claimRevenue given correct args", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(royaltyClient.ipAccountClient, "execute").resolves({ txHash }); + const result = await royaltyClient.claimRevenue({ + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotIds: ["1"], + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + expect(result.txHash).equals(txHash); + }); + + it("should return txHash when call claimRevenue given correct args and waitForTransaction is true", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon + .stub(IpRoyaltyVaultImplClient.prototype, "claimRevenueBySnapshotBatch") + .resolves(txHash); + sinon.stub(royaltyClient.ipAccountClient, "execute").resolves({ txHash }); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "parseTxRevenueTokenClaimedEvent").returns([ + { + claimer: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + amount: 1, + }, + ]); + + const result = await royaltyClient.claimRevenue({ + account: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + snapshotIds: ["1"], + token: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + txOptions: { waitForTransaction: true }, + }); + + expect(result.txHash).equals(txHash); + expect(result.claimableToken).equals("1"); + }); + }); + + describe("Test royaltyClient.snapshot", async function () { + it("should throw royaltyVaultIpId error when call snapshot given royaltyVaultIpId is not registered", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(false); + + try { + await royaltyClient.snapshot({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to snapshot: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 is not registered.", + ); + } + }); + + it("should throw royaltyVaultAddress error when call snapshot given royalty vault address is 0x", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([true, "0x", 1, ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], [1]]); + + try { + await royaltyClient.snapshot({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + } catch (err) { + expect((err as Error).message).equals( + "Failed to snapshot: The royalty vault IP with id 0x73fcb515cee99e4991465ef586cfe2b072ebb512 address is not set.", + ); + } + }); + + it("should return txHash when call snapshot given correct args", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "snapshot").resolves(txHash); + + const result = await royaltyClient.snapshot({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + }); + expect(result.txHash).equals(txHash); + }); + + it("should return txHash when call snapshot given correct args and waitForTransaction is true", async function () { + sinon.stub(royaltyClient.ipAssetRegistryClient, "isRegistered").resolves(true); + sinon + .stub(royaltyClient.royaltyPolicyLapClient, "getRoyaltyData") + .resolves([ + true, + "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + 1, + ["0x73fcb515cee99e4991465ef586cfe2b072ebb512"], + [1], + ]); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "snapshot").resolves(txHash); + sinon.stub(IpRoyaltyVaultImplClient.prototype, "parseTxSnapshotCompletedEvent").returns([ + { + snapshotId: 1, + snapshotTimestamp: 1, + unclaimedTokens: "1", + }, + ]); + + const result = await royaltyClient.snapshot({ + royaltyVaultIpId: "0x73fcb515cee99e4991465ef586cfe2b072ebb512", + txOptions: { waitForTransaction: true }, + }); + + expect(result.txHash).equals(txHash); + expect(result.snapshotId).equals("1"); + }); }); }); diff --git a/packages/core-sdk/test/unit/utils/utils.test.ts b/packages/core-sdk/test/unit/utils/utils.test.ts index e4fe5e99..050f7da1 100644 --- a/packages/core-sdk/test/unit/utils/utils.test.ts +++ b/packages/core-sdk/test/unit/utils/utils.test.ts @@ -14,6 +14,7 @@ import { typedDataArrayToBytesArray, chainStringToViemChain, storyTestnet, + waitTx, } from "../../../src/utils/utils"; import { createMock } from "../testUtils"; import { licensingModuleAbi } from "../../../src/abi/generated"; @@ -277,3 +278,16 @@ describe("Test chainStringToViemChain", () => { expect(chain).to.equal(storyTestnet); }); }); + +describe("Test waitTx", () => { + it("should return txHash when call waitTx", async () => { + const txHash = "0x129f7dd802200f096221dd89d5b086e4bd3ad6eafb378a0c75e3b04fc375f997"; + let rpcMock: viem.PublicClient = createMock(); + const spyWaitForTransactionReceipt = sinon.spy(); + rpcMock.waitForTransactionReceipt = spyWaitForTransactionReceipt; + + await waitTx(rpcMock, txHash); + + expect(spyWaitForTransactionReceipt.called); + }); +}); diff --git a/packages/wagmi-generater/wagmi.config.ts b/packages/wagmi-generater/wagmi.config.ts index 032da8dc..006ba9f9 100644 --- a/packages/wagmi-generater/wagmi.config.ts +++ b/packages/wagmi-generater/wagmi.config.ts @@ -4,96 +4,94 @@ import {sdk} from './sdk' import type {Evaluate} from "@wagmi/cli/src/types"; import type {ContractConfig} from "@wagmi/cli/src/config"; import {resolveProxyContracts} from "./resolveProxyContracts"; - -const storyTestnetId = 1513 - +const storyTestnetId = 1513; +const sepoliaChainId = 11155111; export default defineConfig(async () => { const contracts: Evaluate>[] = [ { name: "AccessController", address: { - // [sepolia.id]: "0xad64a4b2e18FF7D2f97aF083E7b193d7Dd141735", - [storyTestnetId]: "0x7e253Df9b0fC872746877Fa362b2cAf32712d770", + [sepoliaChainId]: "0xFbD5BE3815b71564Dc51C3C8301c47770fC9a61c", + // [storyTestnetId]: "0x7e253Df9b0fC872746877Fa362b2cAf32712d770", } }, { name: "DisputeModule", address: { - // [sepolia.id]: "0x6157B19CBc151af2b36e0a2581001d32a22b2661", - [storyTestnetId]: "0x6d54456Ae5DCbDC0C9E2713cC8E650fE4f445c7C", + [sepoliaChainId]: "0xd0194dD93968DE60dBe10610fb6Ce2C86a51A78e", + // [storyTestnetId]: "0x6d54456Ae5DCbDC0C9E2713cC8E650fE4f445c7C", } }, { name: "IPAccountImpl", address: { - // [sepolia.id]: "0x79792DccC6C58C303510fc1F7649e481C431aFb1", - [storyTestnetId]: "0x38cAfD16502B1d61c6399A18d6Fa1Ea8CEca3678", + [sepoliaChainId]: "0x71898BD128039BC5bb8D2451Cfc43A55F64fb9c6", + // [storyTestnetId]: "0x38cAfD16502B1d61c6399A18d6Fa1Ea8CEca3678", } }, { name: "IPAssetRegistry", address: { - // [sepolia.id]: "0x292639452A975630802C17c9267169D93BD5a793", - [storyTestnetId]: "0x862de97662a1231FFc14038eC1BE93aB129D2169", + [sepoliaChainId]: "0x84c177633adCD26157732e18dd9E145E442E6aCb", + // [storyTestnetId]: "0x862de97662a1231FFc14038eC1BE93aB129D2169", } }, { name: "IpRoyaltyVaultImpl", address: { - // [sepolia.id]: "", - [storyTestnetId]: "0x8Be22cc2D13ADF496a417D9C616dA4a253c68Af8", + [sepoliaChainId]: "0xDdAa6A42399F8eA503048ACb93A5fAe6e6b39598", + // [storyTestnetId]: "0x8Be22cc2D13ADF496a417D9C616dA4a253c68Af8", } }, { name: "LicenseRegistry", address: { - // [sepolia.id]: "0xc2BC7a2d5784768BDEd98436f2522A4931e2FBb4", - [storyTestnetId]: "0x0c3D467537FAd845a78728CEdc3D9447338c5422", + [sepoliaChainId]: "0xbbcb7b0Bd15b1CfcA0A923791e526A6E90774D40", + // [storyTestnetId]: "0x0c3D467537FAd845a78728CEdc3D9447338c5422", } }, { name: "LicenseToken", address: { - // [sepolia.id]: "0x950d766A1a0afDc33c3e653C861A8765cb42DbdC", - [storyTestnetId]: "0xD40b7bCA204f96a346021e31c9ad54FF495226e7", + [sepoliaChainId]: "0xCe9862F0a6f39631A2A790237086bd48635e3e42", + // [storyTestnetId]: "0xD40b7bCA204f96a346021e31c9ad54FF495226e7", } }, { name: "LicensingModule", address: { - // [sepolia.id]: "0x950d766A1a0afDc33c3e653C861A8765cb42DbdC", - [storyTestnetId]: "0xEeDDE5529122b621105798860F235c28FD3aBA40", + [sepoliaChainId]: "0xf6C72a97E6ef70A9AB0F96c6E4baB93b868DC992", + // [storyTestnetId]: "0xEeDDE5529122b621105798860F235c28FD3aBA40", } }, { name: "PILicenseTemplate", address: { - // [sepolia.id]: "", - [storyTestnetId]: "0xd0Be223ae9719bBD93447ecf5289319CCf8cA227", + [sepoliaChainId]: "0xFD474b0938303613AAa377BE375c3A571cAA04fb", + // [storyTestnetId]: "0xd0Be223ae9719bBD93447ecf5289319CCf8cA227", } }, { name: "ModuleRegistry", address: { - // [sepolia.id]: "0x5Aac3177F496F503Ac724A0D0A697f6ba9dA2C27", - [storyTestnetId]: "0xf2965E3B6251905Dd1E8671077760D07b0408cf2", + [sepoliaChainId]: "0x59b37bb4D6913eFE32f40D09b5290ff5509E6738", + // [storyTestnetId]: "0xf2965E3B6251905Dd1E8671077760D07b0408cf2", } }, { name: "RoyaltyModule", address: { - // [sepolia.id]: "0xA6bEf9CC650A16939566c1da5d5088f3F028a865", - [storyTestnetId]: "0x551AD8CD7893003cE00500aC2aCF1E327763D9f6", + [sepoliaChainId]: "0xE50BB9D71b4d5c587d36849460F57df5bc939dab", + // [storyTestnetId]: "0x551AD8CD7893003cE00500aC2aCF1E327763D9f6", } }, { name: "RoyaltyPolicyLAP", address: { - // [sepolia.id]: "0x16eF58e959522727588921A92e9084d36E5d3855", - [storyTestnetId]: "0x2EcdB5bD12a037dCb9De0Ab7957f35FEeF758eA6", + [sepoliaChainId]: "0xf4f93F779BAe88898BA0Fc6ddb6FAA05632ee13c", + // [storyTestnetId]: "0x2EcdB5bD12a037dCb9De0Ab7957f35FEeF758eA6", } }, ] - return { out: '../core-sdk/src/abi/generated.ts', contracts: [], plugins: [ blockExplorer({ - baseUrl: 'https://story-network.explorer.caldera.xyz/api', - name: 'StoryScan', + baseUrl: 'https://api-sepolia.etherscan.io/api', + name: 'Etherscan', getAddress: await resolveProxyContracts({ - baseUrl: 'https://story-network.rpc.caldera.xyz/http', + baseUrl: 'https://rpc.sepolia.org', contracts: contracts, - chainId: storyTestnetId, + chainId: sepoliaChainId, }), contracts: contracts, }), @@ -162,4 +160,4 @@ export default defineConfig(async () => { }), ], } -}) +}) \ No newline at end of file