@campnetwork/origin 1.4.0-alpha.0 → 1.4.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +91 -84
- package/dist/core.d.ts +10 -6
- package/dist/core.esm.d.ts +10 -6
- package/dist/core.esm.js +112 -105
- package/dist/react/index.esm.d.ts +10 -6
- package/dist/react/index.esm.js +38 -11
- package/package.json +1 -1
package/dist/core.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{createWalletClient as e,http as t,custom as n,createPublicClient as i,zeroAddress as a,erc20Abi as s,
|
|
1
|
+
import{createWalletClient as e,http as t,custom as n,createPublicClient as i,zeroAddress as a,erc20Abi as s,encodeFunctionData as r,getAbiItem as o,formatEther as p,formatUnits as d,checksumAddress as u}from"viem";import{toAccount as l}from"viem/accounts";import{createSiweMessage as y}from"viem/siwe";import c from"axios";
|
|
2
2
|
/******************************************************************************
|
|
3
3
|
Copyright (c) Microsoft Corporation.
|
|
4
4
|
|
|
@@ -55,11 +55,11 @@ e._isSigner||e.provider&&"function"==typeof e.signMessage?new v(e):new w(e)}
|
|
|
55
55
|
* @param chain The chain to use
|
|
56
56
|
* @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
|
|
57
57
|
* @returns WalletClient
|
|
58
|
-
*/function g(n,i,a){return e({account:n,chain:i,transport:t(a)})}const C={id:123420001114,name:"Basecamp",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc-campnetwork.xyz","https://rpc.basecamp.t.raas.gelato.cloud"]}},blockExplorers:{default:{name:"Explorer",url:"https://basecamp.cloud.blockscout.com/"}}},E={id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}};class P extends Error{constructor(e,t){super(e),this.name="APIError",this.statusCode=t||500,Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:this.statusCode||500}}}class S extends Error{constructor(e){super(e),this.name="ValidationError",Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:400}}}class
|
|
58
|
+
*/function g(n,i,a){return e({account:n,chain:i,transport:t(a)})}const C={id:123420001114,name:"Basecamp",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc-campnetwork.xyz","https://rpc.basecamp.t.raas.gelato.cloud"]}},blockExplorers:{default:{name:"Explorer",url:"https://basecamp.cloud.blockscout.com/"}}},E={id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}};class P extends Error{constructor(e,t){super(e),this.name="APIError",this.statusCode=t||500,Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:this.statusCode||500}}}class S extends Error{constructor(e){super(e),this.name="ValidationError",Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:400}}}class _ extends Error{constructor(e){super(e),this.name="AuthenticationError",Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:401}}}class R extends Error{constructor(e){super(e),this.name="WalletError",Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:400}}}class x extends Error{constructor(e,t){super(e),this.name="ContractError",this.contractName=null==t?void 0:t.contractName,this.methodName=null==t?void 0:t.methodName,Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:400,contractName:this.contractName,methodName:this.methodName}}}function k(e){if(e instanceof Error)return e.message;if("string"==typeof e)return e;try{return JSON.stringify(e)}catch(t){return String(e)}}
|
|
59
59
|
// @ts-ignore
|
|
60
|
-
let k=null,N=null,M=null;const O=e=>{var n;const a=M||C;return N&&(null===(n=N.chain)||void 0===n?void 0:n.id)===a.id||(N=i({chain:a,transport:t()})),N};var B=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"appRegistry",outputs:[{internalType:"contract AppRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc6551Account",outputs:[{internalType:"contract IERC6551Account",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc6551Registry",outputs:[{internalType:"contract IERC6551Registry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getAccount",outputs:[{internalType:"address",name:"account",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getRoyaltyVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"},{internalType:"contract IERC6551Registry",name:"registry_",type:"address"},{internalType:"contract IERC6551Account",name:"implementation_",type:"address"},{internalType:"contract AppRegistry",name:"appRegistry_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"royaltyVaultFactory",outputs:[{internalType:"contract IpRoyaltyVaultFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_appRegistry",type:"address"}],name:"setAppRegistry",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_royaltyVaultFactory",type:"address"}],name:"setRoyaltyVaultFactory",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenInfo",outputs:[{components:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"},{internalType:"string",name:"appId",type:"string"}],internalType:"struct IIpNFT.TokenInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],F=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"FeesExceedMaximum",type:"error"},{inputs:[],name:"FeesMismatch",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidLicenseType",type:"error"},{inputs:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"SubscriptionNotAllowed",type:"error"},{inputs:[],name:"TermsMismatch",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"VaultNotFound",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"revenueToken",type:"address"}],name:"claimRevenue",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address[]",name:"revenueTokens",type:"address[]"}],name:"claimRevenueBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"revenueToken",type:"address"}],name:"claimableRevenue",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getRoyaltyVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getVaultRevenueTokens",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}],U=[{type:"receive",stateMutability:"payable"},{type:"function",name:"execute",inputs:[{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"},{name:"operation",type:"uint8",internalType:"uint8"}],outputs:[{name:"result",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"isValidSignature",inputs:[{name:"hash",type:"bytes32",internalType:"bytes32"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"magicValue",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"isValidSigner",inputs:[{name:"signer",type:"address",internalType:"address"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"state",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"token",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"}],$=[{inputs:[{internalType:"address",name:"_marketplace",type:"address"},{internalType:"address",name:"_ipNFT",type:"address"},{internalType:"address",name:"_appRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EmptyMintList",type:"error"},{inputs:[],name:"EmptyPurchaseList",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InvalidTotalPayment",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"MintFailed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"PurchaseFailed",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"RefundFailed",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"uint256",name:"count",type:"uint256"}],name:"BulkMintExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"uint256",name:"successCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"failureCount",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],name:"BulkMintPartial",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint256",name:"count",type:"uint256"},{indexed:!1,internalType:"uint256",name:"totalPaid",type:"uint256"}],name:"BulkPurchaseExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint256",name:"successCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"failureCount",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],name:"BulkPurchasePartial",type:"event"},{inputs:[],name:"appRegistry",outputs:[{internalType:"contract IAppRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"buildPurchaseParams",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],name:"bulkBuyAccess",outputs:[{internalType:"uint256",name:"totalPaid",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],name:"bulkBuyAccessTolerant",outputs:[{components:[{internalType:"uint256",name:"successCount",type:"uint256"},{internalType:"uint256",name:"failureCount",type:"uint256"},{internalType:"uint256",name:"totalSpent",type:"uint256"},{internalType:"uint256",name:"refundAmount",type:"uint256"},{internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.TolerantResult",name:"result",type:"tuple"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"uint8",name:"licenseType",type:"uint8"}],internalType:"struct IBatchOperations.LicenseTermsParam",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IBatchOperations.MintParams[]",name:"mints",type:"tuple[]"}],name:"bulkMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"uint8",name:"licenseType",type:"uint8"}],internalType:"struct IBatchOperations.LicenseTermsParam",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IBatchOperations.MintParams[]",name:"mints",type:"tuple[]"}],name:"bulkMintTolerant",outputs:[{components:[{internalType:"uint256",name:"successCount",type:"uint256"},{internalType:"uint256",name:"failureCount",type:"uint256"},{internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.TolerantMintResult",name:"result",type:"tuple"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"checkActiveStatus",outputs:[{internalType:"bool[]",name:"activeFlags",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipNFT",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"marketplace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"previewBulkCost",outputs:[{components:[{internalType:"uint256",name:"totalNativeCost",type:"uint256"},{internalType:"uint256",name:"totalERC20Cost",type:"uint256"},{internalType:"uint256",name:"validCount",type:"uint256"},{internalType:"uint256[]",name:"invalidTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.BulkCostPreview",name:"preview",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams",name:"params",type:"tuple"}],name:"tryERC20Purchase",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],H=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"AlreadyVoted",type:"error"},{inputs:[],name:"CoolDownPeriodActive",type:"error"},{inputs:[],name:"CoolDownPeriodOver",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EvidenceAlreadyUsed",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidBondFeeBps",type:"error"},{inputs:[],name:"InvalidChildIpId",type:"error"},{inputs:[],name:"InvalidDisputeStatus",type:"error"},{inputs:[],name:"InvalidDisputeTag",type:"error"},{inputs:[],name:"InvalidEvidenceHash",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidTargetIp",type:"error"},{inputs:[],name:"NoVotingPower",type:"error"},{inputs:[],name:"NotAParentIp",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"NotInitiator",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentNotDisputed",type:"error"},{inputs:[],name:"SelfAssertionNotAllowed",type:"error"},{inputs:[],name:"StakedAfterDispute",type:"error"},{inputs:[],name:"TagNotAllowed",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"VotingPeriodActive",type:"error"},{inputs:[],name:"VotingPeriodOver",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"cancelDispute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bytes32",name:"_counterEvidenceHash",type:"bytes32"}],name:"disputeAssertion",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"disputeBond",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeCoolDownPeriod",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeJudgementPeriod",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeQuorum",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeToken",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"disputes",outputs:[{internalType:"address",name:"initiator",type:"address"},{internalType:"uint256",name:"targetId",type:"uint256"},{internalType:"bytes32",name:"disputeTag",type:"bytes32"},{internalType:"bytes32",name:"disputeEvidenceHash",type:"bytes32"},{internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"},{internalType:"uint256",name:"disputeTimestamp",type:"uint256"},{internalType:"uint256",name:"assertionTimestamp",type:"uint256"},{internalType:"uint256",name:"yesVotes",type:"uint256"},{internalType:"uint256",name:"noVotes",type:"uint256"},{internalType:"enum DisputeModule.DisputeStatus",name:"status",type:"uint8"},{internalType:"uint256",name:"bondAmount",type:"uint256"},{internalType:"uint256",name:"protocolFeeAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"hasVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IIpNFT",name:"_ipToken",type:"address"},{internalType:"contract IMarketplace",name:"_marketplace",type:"address"},{internalType:"contract IERC20",name:"_disputeToken",type:"address"},{internalType:"uint256",name:"_disputeBond",type:"uint256"},{internalType:"uint256",name:"_disputeCoolDownPeriod",type:"uint256"},{internalType:"uint256",name:"_disputeJudgementPeriod",type:"uint256"},{internalType:"uint16",name:"_bondFeeBPS",type:"uint16"},{internalType:"uint256",name:"_stakingThreshold",type:"uint256"},{internalType:"contract ICampStakingVault",name:"_stakingVault",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"isUsedEvidenceHash",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"marketplace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolDisputeFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_targetIpId",type:"uint256"},{internalType:"bytes32",name:"_disputeEvidenceHash",type:"bytes32"},{internalType:"bytes32",name:"_disputeTag",type:"bytes32"}],name:"raiseDispute",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"resolveDispute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_disputeQuorum",type:"uint256"}],name:"setDisputeQuorum",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stakingThreshold",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"stakingVault",outputs:[{internalType:"contract ICampStakingVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_childIpId",type:"uint256"},{internalType:"uint256",name:"_infringerDisputeId",type:"uint256"}],name:"tagChildIp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"voteOnDispute",outputs:[],stateMutability:"nonpayable",type:"function"}],V=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"AppAlreadyActive",type:"error"},{inputs:[],name:"AppAlreadyExists",type:"error"},{inputs:[],name:"AppAlreadyInactive",type:"error"},{inputs:[],name:"AppNotFound",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidAppId",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"}],name:"AppDeactivated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"}],name:"AppReactivated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"},{indexed:!1,internalType:"address",name:"treasury",type:"address"},{indexed:!1,internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"AppRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"},{indexed:!1,internalType:"address",name:"treasury",type:"address"},{indexed:!1,internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"AppUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"",type:"string"}],name:"appExists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"",type:"string"}],name:"apps",outputs:[{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"},{internalType:"bool",name:"isActive",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"deactivateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"getAppInfo",outputs:[{components:[{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"},{internalType:"bool",name:"isActive",type:"bool"}],internalType:"struct AppRegistry.AppInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"reactivateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"},{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"registerApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"},{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"updateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}],j=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"FailedDeployment",type:"error"},{inputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"VaultAlreadyExists",type:"error"},{inputs:[],name:"VaultNotFound",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldImplementation",type:"address"},{indexed:!0,internalType:"address",name:"newImplementation",type:"address"}],name:"ImplementationUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"},{indexed:!0,internalType:"address",name:"initialOwner",type:"address"}],name:"VaultDeployed",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"initialOwner",type:"address"}],name:"deployVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"deployVaultForExistingNFT",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"ipNft_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipNft",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isVault",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"predictVaultAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"setImplementation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"vaults",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],L="Connect with Camp Network",z=2628e3,q=86400,J=1e15,Y=1,G=1e4;const W={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://origin-backend-iota.vercel.app",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x4d9aF5800701A4A686Df6b096A27B81486de36eB",MARKETPLACE_CONTRACT_ADDRESS:"0x68B202caA162C418d3A2DF92F29fA1CAF90C58c1",BATCH_OPERATIONS_CONTRACT_ADDRESS:"0xe1247F1663925B99Db62e60480B53e37f2bb8738",DISPUTE_CONTRACT_ADDRESS:"0x45719337b1450b0D105cA671972be4263E6A9380",APP_REGISTRY_CONTRACT_ADDRESS:"0x2096eb980Dd590DDF690Cb698572b80552B6F9Bb",IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS:"0x16e01D1CB5de9460f8ed9D1883f5aFD377798f38",CHAIN:C,IPNFT_ABI:B,MARKETPLACE_ABI:F,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,APP_REGISTRY_ABI:V,IP_ROYALTY_VAULT_FACTORY_ABI:j},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://origin-backend-mainnet.vercel.app",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",BATCH_OPERATIONS_CONTRACT_ADDRESS:"0x6B89810768b708465f31b6a8B8d753cc986489F1",DISPUTE_CONTRACT_ADDRESS:"0x947A3C4A45f7039e77643026A090025D5412EDa2",
|
|
60
|
+
let D=null,N=null,M=null;const B=e=>{var n;const a=M||C;return N&&(null===(n=N.chain)||void 0===n?void 0:n.id)===a.id||(N=i({chain:a,transport:t()})),N};var O=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"appRegistry",outputs:[{internalType:"contract AppRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc6551Account",outputs:[{internalType:"contract IERC6551Account",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"erc6551Registry",outputs:[{internalType:"contract IERC6551Registry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getAccount",outputs:[{internalType:"address",name:"account",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getRoyaltyVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"},{internalType:"contract IERC6551Registry",name:"registry_",type:"address"},{internalType:"contract IERC6551Account",name:"implementation_",type:"address"},{internalType:"contract AppRegistry",name:"appRegistry_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"royaltyVaultFactory",outputs:[{internalType:"contract IpRoyaltyVaultFactory",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_appRegistry",type:"address"}],name:"setAppRegistry",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_royaltyVaultFactory",type:"address"}],name:"setRoyaltyVaultFactory",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"tokenInfo",outputs:[{components:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"},{internalType:"string",name:"appId",type:"string"}],internalType:"struct IIpNFT.TokenInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"enum IIpNFT.LicenseType",name:"licenseType",type:"uint8"}],internalType:"struct IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],F=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"FeesExceedMaximum",type:"error"},{inputs:[],name:"FeesMismatch",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidLicenseType",type:"error"},{inputs:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"SubscriptionNotAllowed",type:"error"},{inputs:[],name:"TermsMismatch",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"VaultNotFound",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"revenueToken",type:"address"}],name:"claimRevenue",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address[]",name:"revenueTokens",type:"address[]"}],name:"claimRevenueBatch",outputs:[{internalType:"uint256[]",name:"",type:"uint256[]"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"holder",type:"address"},{internalType:"address",name:"revenueToken",type:"address"}],name:"claimableRevenue",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getRoyaltyVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getVaultRevenueTokens",outputs:[{internalType:"address[]",name:"",type:"address[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}],U=[{type:"receive",stateMutability:"payable"},{type:"function",name:"execute",inputs:[{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"},{name:"operation",type:"uint8",internalType:"uint8"}],outputs:[{name:"result",type:"bytes",internalType:"bytes"}],stateMutability:"payable"},{type:"function",name:"isValidSignature",inputs:[{name:"hash",type:"bytes32",internalType:"bytes32"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[{name:"magicValue",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"isValidSigner",inputs:[{name:"signer",type:"address",internalType:"address"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"state",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"token",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"}],$=[{inputs:[{internalType:"address",name:"_marketplace",type:"address"},{internalType:"address",name:"_ipNFT",type:"address"},{internalType:"address",name:"_appRegistry",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EmptyMintList",type:"error"},{inputs:[],name:"EmptyPurchaseList",type:"error"},{inputs:[],name:"InsufficientAllowance",type:"error"},{inputs:[],name:"InvalidTotalPayment",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"MintFailed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"PurchaseFailed",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"RefundFailed",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"uint256",name:"count",type:"uint256"}],name:"BulkMintExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"uint256",name:"successCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"failureCount",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],name:"BulkMintPartial",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint256",name:"count",type:"uint256"},{indexed:!1,internalType:"uint256",name:"totalPaid",type:"uint256"}],name:"BulkPurchaseExecuted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint256",name:"successCount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"failureCount",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],name:"BulkPurchasePartial",type:"event"},{inputs:[],name:"appRegistry",outputs:[{internalType:"contract IAppRegistry",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"buildPurchaseParams",outputs:[{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],name:"bulkBuyAccess",outputs:[{internalType:"uint256",name:"totalPaid",type:"uint256"}],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams[]",name:"purchases",type:"tuple[]"}],name:"bulkBuyAccessTolerant",outputs:[{components:[{internalType:"uint256",name:"successCount",type:"uint256"},{internalType:"uint256",name:"failureCount",type:"uint256"},{internalType:"uint256",name:"totalSpent",type:"uint256"},{internalType:"uint256",name:"refundAmount",type:"uint256"},{internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.TolerantResult",name:"result",type:"tuple"}],stateMutability:"payable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"uint8",name:"licenseType",type:"uint8"}],internalType:"struct IBatchOperations.LicenseTermsParam",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IBatchOperations.MintParams[]",name:"mints",type:"tuple[]"}],name:"bulkMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"},{internalType:"uint8",name:"licenseType",type:"uint8"}],internalType:"struct IBatchOperations.LicenseTermsParam",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"bool",name:"isIP",type:"bool"},{internalType:"string",name:"appId",type:"string"},{internalType:"bytes",name:"signature",type:"bytes"}],internalType:"struct IBatchOperations.MintParams[]",name:"mints",type:"tuple[]"}],name:"bulkMintTolerant",outputs:[{components:[{internalType:"uint256",name:"successCount",type:"uint256"},{internalType:"uint256",name:"failureCount",type:"uint256"},{internalType:"uint256[]",name:"failedTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.TolerantMintResult",name:"result",type:"tuple"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"checkActiveStatus",outputs:[{internalType:"bool[]",name:"activeFlags",type:"bool[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipNFT",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"marketplace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256[]",name:"tokenIds",type:"uint256[]"}],name:"previewBulkCost",outputs:[{components:[{internalType:"uint256",name:"totalNativeCost",type:"uint256"},{internalType:"uint256",name:"totalERC20Cost",type:"uint256"},{internalType:"uint256",name:"validCount",type:"uint256"},{internalType:"uint256[]",name:"invalidTokenIds",type:"uint256[]"}],internalType:"struct IBatchOperations.BulkCostPreview",name:"preview",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{components:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"},{internalType:"uint16",name:"expectedProtocolFeeBps",type:"uint16"},{internalType:"uint16",name:"expectedAppFeeBps",type:"uint16"}],internalType:"struct IBatchOperations.BuyParams",name:"params",type:"tuple"}],name:"tryERC20Purchase",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}],H=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"AlreadyVoted",type:"error"},{inputs:[],name:"CoolDownPeriodActive",type:"error"},{inputs:[],name:"CoolDownPeriodOver",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"EvidenceAlreadyUsed",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidBondFeeBps",type:"error"},{inputs:[],name:"InvalidChildIpId",type:"error"},{inputs:[],name:"InvalidDisputeStatus",type:"error"},{inputs:[],name:"InvalidDisputeTag",type:"error"},{inputs:[],name:"InvalidEvidenceHash",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidTargetIp",type:"error"},{inputs:[],name:"NoVotingPower",type:"error"},{inputs:[],name:"NotAParentIp",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[],name:"NotInitiator",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"ParentNotDisputed",type:"error"},{inputs:[],name:"SelfAssertionNotAllowed",type:"error"},{inputs:[],name:"StakedAfterDispute",type:"error"},{inputs:[],name:"TagNotAllowed",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"VotingPeriodActive",type:"error"},{inputs:[],name:"VotingPeriodOver",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"agentId",type:"uint256"},{indexed:!0,internalType:"uint256",name:"ipNftId",type:"uint256"},{indexed:!1,internalType:"address",name:"agentAddress",type:"address"}],name:"AgentRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"appRegistry",type:"address"}],name:"AppRegistryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"childIpId",type:"uint256"},{indexed:!1,internalType:"uint256[]",name:"parentIds",type:"uint256[]"},{indexed:!1,internalType:"uint16",name:"totalRoyaltyBps",type:"uint16"}],name:"ParentIpsSet",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"ProtocolFeeUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"}],name:"RoyaltyVaultDeployed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"royaltyVaultFactory",type:"address"}],name:"RoyaltyVaultFactoryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newTreasury",type:"address"}],name:"TreasuryUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"voter",type:"address"},{indexed:!1,internalType:"bool",name:"support",type:"bool"},{indexed:!1,internalType:"uint256",name:"weight",type:"uint256"}],name:"Voted",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"cancelDispute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bytes32",name:"_counterEvidenceHash",type:"bytes32"}],name:"disputeAssertion",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"disputeBond",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeCoolDownPeriod",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeCounter",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeJudgementPeriod",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeQuorum",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeToken",outputs:[{internalType:"contract IERC20",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"disputes",outputs:[{internalType:"address",name:"initiator",type:"address"},{internalType:"uint256",name:"targetId",type:"uint256"},{internalType:"bytes32",name:"disputeTag",type:"bytes32"},{internalType:"bytes32",name:"disputeEvidenceHash",type:"bytes32"},{internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"},{internalType:"uint256",name:"disputeTimestamp",type:"uint256"},{internalType:"uint256",name:"assertionTimestamp",type:"uint256"},{internalType:"uint256",name:"yesVotes",type:"uint256"},{internalType:"uint256",name:"noVotes",type:"uint256"},{internalType:"enum DisputeModule.DisputeStatus",name:"status",type:"uint8"},{internalType:"uint256",name:"bondAmount",type:"uint256"},{internalType:"uint256",name:"protocolFeeAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"hasVoted",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"contract IIpNFT",name:"_ipToken",type:"address"},{internalType:"contract IMarketplace",name:"_marketplace",type:"address"},{internalType:"contract IERC20",name:"_disputeToken",type:"address"},{internalType:"uint256",name:"_disputeBond",type:"uint256"},{internalType:"uint256",name:"_disputeCoolDownPeriod",type:"uint256"},{internalType:"uint256",name:"_disputeJudgementPeriod",type:"uint256"},{internalType:"uint16",name:"_bondFeeBPS",type:"uint16"},{internalType:"uint256",name:"_stakingThreshold",type:"uint256"},{internalType:"contract ICampStakingVault",name:"_stakingVault",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"isUsedEvidenceHash",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"marketplace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolDisputeFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_targetIpId",type:"uint256"},{internalType:"bytes32",name:"_disputeEvidenceHash",type:"bytes32"},{internalType:"bytes32",name:"_disputeTag",type:"bytes32"}],name:"raiseDispute",outputs:[{internalType:"uint256",name:"id",type:"uint256"}],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"}],name:"resolveDispute",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"_disputeQuorum",type:"uint256"}],name:"setDisputeQuorum",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"stakingThreshold",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"stakingVault",outputs:[{internalType:"contract ICampStakingVault",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_childIpId",type:"uint256"},{internalType:"uint256",name:"_infringerDisputeId",type:"uint256"}],name:"tagChildIp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"id",type:"uint256"},{internalType:"bool",name:"support",type:"bool"}],name:"voteOnDispute",outputs:[],stateMutability:"nonpayable",type:"function"}],V=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[],name:"AppAlreadyActive",type:"error"},{inputs:[],name:"AppAlreadyExists",type:"error"},{inputs:[],name:"AppAlreadyInactive",type:"error"},{inputs:[],name:"AppNotFound",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"InvalidAppId",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"}],name:"AppDeactivated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"}],name:"AppReactivated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"},{indexed:!1,internalType:"address",name:"treasury",type:"address"},{indexed:!1,internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"AppRegistered",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"appId",type:"string"},{indexed:!1,internalType:"address",name:"treasury",type:"address"},{indexed:!1,internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"AppUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"",type:"string"}],name:"appExists",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"",type:"string"}],name:"apps",outputs:[{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"},{internalType:"bool",name:"isActive",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"deactivateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"getAppInfo",outputs:[{components:[{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"},{internalType:"bool",name:"isActive",type:"bool"}],internalType:"struct AppRegistry.AppInfo",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"}],name:"reactivateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"},{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"registerApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"appId",type:"string"},{internalType:"address",name:"treasury",type:"address"},{internalType:"uint16",name:"revenueShareBps",type:"uint16"}],name:"updateApp",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"}],j=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"FailedCall",type:"error"},{inputs:[],name:"FailedDeployment",type:"error"},{inputs:[{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"InsufficientBalance",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"VaultAlreadyExists",type:"error"},{inputs:[],name:"VaultNotFound",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"oldImplementation",type:"address"},{indexed:!0,internalType:"address",name:"newImplementation",type:"address"}],name:"ImplementationUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"vault",type:"address"},{indexed:!0,internalType:"address",name:"initialOwner",type:"address"}],name:"VaultDeployed",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"initialOwner",type:"address"}],name:"deployVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"deployVaultForExistingNFT",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getVault",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"implementation",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"ipNft_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"ipNft",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"isVault",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"predictVaultAddress",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"}],name:"setImplementation",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"vaults",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],L="Connect with Camp Network",z=2628e3,q=86400,J=1e15,Y=1,G=1e4;const W={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://origin-backend-iota.vercel.app",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x4d9aF5800701A4A686Df6b096A27B81486de36eB",MARKETPLACE_CONTRACT_ADDRESS:"0x68B202caA162C418d3A2DF92F29fA1CAF90C58c1",BATCH_OPERATIONS_CONTRACT_ADDRESS:"0xe1247F1663925B99Db62e60480B53e37f2bb8738",DISPUTE_CONTRACT_ADDRESS:"0x45719337b1450b0D105cA671972be4263E6A9380",APP_REGISTRY_CONTRACT_ADDRESS:"0x2096eb980Dd590DDF690Cb698572b80552B6F9Bb",IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS:"0x16e01D1CB5de9460f8ed9D1883f5aFD377798f38",CHAIN:C,IPNFT_ABI:O,MARKETPLACE_ABI:F,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,APP_REGISTRY_ABI:V,IP_ROYALTY_VAULT_FACTORY_ABI:j},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://origin-backend-mainnet.vercel.app",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",BATCH_OPERATIONS_CONTRACT_ADDRESS:"0x6B89810768b708465f31b6a8B8d753cc986489F1",DISPUTE_CONTRACT_ADDRESS:"0x947A3C4A45f7039e77643026A090025D5412EDa2",
|
|
61
61
|
// TODO: update with real factory address once deployed
|
|
62
|
-
IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS:"",APP_REGISTRY_CONTRACT_ADDRESS:"0xd09F15aA280F9109aCd403cA920e67D40Cb6C3FA",CHAIN:E,IPNFT_ABI:
|
|
62
|
+
IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS:"",APP_REGISTRY_CONTRACT_ADDRESS:"0xd09F15aA280F9109aCd403cA920e67D40Cb6C3FA",CHAIN:E,IPNFT_ABI:O,MARKETPLACE_ABI:F,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,APP_REGISTRY_ABI:V,IP_ROYALTY_VAULT_FACTORY_ABI:j}};let K=[];const Q=()=>K,X=e=>{function t(t){K.some((e=>e.info.uuid===t.detail.info.uuid))||(K=[...K,t.detail],e(K))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)},Z=(e,t,n)=>{const i=[];let a=[],s=!1,r=0;const o=e.length;return new Promise(((p,d)=>{function u(){n(r/o*100)}function l(e,t,n){return m(this,arguments,void 0,(function*(e,t,n,i=0){var a;try{const i=null===(a=(yield c.put(t,e,{headers:{"Content-Type":e.type||"application/octet-stream"},timeout:3e5})).headers.etag)||void 0===a?void 0:a.replace(/"/g,"");if(!i)throw new Error(`Missing ETag for part ${n}`);return{ETag:i,PartNumber:n}}catch(a){if(i<3){const a=1e3*Math.pow(2,i);// Exponential backoff
|
|
63
63
|
return yield new Promise((e=>setTimeout(e,a))),l(e,t,n,i+1)}throw new Error(`Part ${n} failed after 3 retries: ${a.message}`)}}))}
|
|
64
64
|
// Expose abort method
|
|
65
65
|
Z.abort=()=>{s=!0,c.isCancel("Upload aborted")},u(),// Initial 0%
|
|
@@ -183,7 +183,7 @@ const l=null!==(u=null!=d?d:this.appId)&&void 0!==u?u:"";return yield this.callC
|
|
|
183
183
|
* "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
|
|
184
184
|
* );
|
|
185
185
|
* ```
|
|
186
|
-
*/function fe(e,t,n){return m(this,void 0,void 0,(function*(){const i=
|
|
186
|
+
*/function fe(e,t,n){return m(this,void 0,void 0,(function*(){const i=B(),s=this.environment.DISPUTE_CONTRACT_ADDRESS,r=this.environment.DISPUTE_ABI,[o,p,d]=yield Promise.all([i.readContract({address:s,abi:r,functionName:"disputeBond"}),i.readContract({address:s,abi:r,functionName:"protocolDisputeFee"}),i.readContract({address:s,abi:r,functionName:"disputeToken"})]),u=d===a,l=o+p;
|
|
187
187
|
// Call the raiseDispute contract method
|
|
188
188
|
// Pass the total (bond + protocol fee) as msg.value if using native token
|
|
189
189
|
return u||(yield this.approveERC20IfNeeded(d,s,l)),this.callContractMethod(s,r,"raiseDispute",[e,t,n],{waitForReceipt:!0,value:u?l:void 0})}))}
|
|
@@ -380,7 +380,7 @@ n.set(t,4),"b"+function(e){let t="",n=0,i=0;for(const a of e)for(i=i<<8|a,n+=8;n
|
|
|
380
380
|
* // After parent IP (tokenId 1) has been disputed, tag child IP (tokenId 2)
|
|
381
381
|
* await origin.tagChildIp(2n, 1n); // childIpId, disputeId of parent
|
|
382
382
|
* ```
|
|
383
|
-
*/function
|
|
383
|
+
*/function _e(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"tagChildIp",[e,t],{waitForReceipt:!0})}))}
|
|
384
384
|
/**
|
|
385
385
|
* Gets the details of a dispute by its ID.
|
|
386
386
|
*
|
|
@@ -394,7 +394,7 @@ n.set(t,4),"b"+function(e){let t="",n=0,i=0;for(const a of e)for(i=i<<8|a,n+=8;n
|
|
|
394
394
|
* console.log(`Yes votes: ${dispute.yesVotes}`);
|
|
395
395
|
* console.log(`No votes: ${dispute.noVotes}`);
|
|
396
396
|
* ```
|
|
397
|
-
*/function
|
|
397
|
+
*/function Re(e){return m(this,void 0,void 0,(function*(){const t=yield this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"disputes",[e]),[n,i,a,s,r,o,p,d,u,l,y,c]=t;
|
|
398
398
|
// Contract returns a tuple, map it to the Dispute interface
|
|
399
399
|
return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidenceHash:r,disputeTimestamp:o,assertionTimestamp:p,yesVotes:d,noVotes:u,status:l,bondAmount:y,protocolFeeAmount:c}}))}
|
|
400
400
|
/**
|
|
@@ -405,13 +405,14 @@ return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidence
|
|
|
405
405
|
* @param address Optional address to use directly.
|
|
406
406
|
* @returns The resolved wallet address.
|
|
407
407
|
* @throws Error if no address provided and no wallet connected or no accounts found.
|
|
408
|
-
*/
|
|
408
|
+
*/
|
|
409
409
|
/**
|
|
410
410
|
* Enum representing the type of license for an IP NFT.
|
|
411
411
|
* - DURATION_BASED: License expires after a set duration (subscription model).
|
|
412
412
|
* - SINGLE_PAYMENT: One-time payment for perpetual access.
|
|
413
413
|
* - X402: HTTP 402-based micropayment license (no on-chain payments).
|
|
414
|
-
*/
|
|
414
|
+
*/
|
|
415
|
+
var xe,ke,De;!function(e){e[e.DURATION_BASED=0]="DURATION_BASED",e[e.SINGLE_PAYMENT=1]="SINGLE_PAYMENT",e[e.X402=2]="X402"}(xe||(xe={})),function(e){e[e.ACTIVE=0]="ACTIVE",e[e.DELETED=1]="DELETED",e[e.DISPUTED=2]="DISPUTED"}(ke||(ke={})),function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Raised=1]="Raised",e[e.Asserted=2]="Asserted",e[e.Resolved=3]="Resolved",e[e.Cancelled=4]="Cancelled"}(De||(De={}));
|
|
415
416
|
/**
|
|
416
417
|
* Creates license terms for a digital asset.
|
|
417
418
|
* @param price The price of the asset in wei.
|
|
@@ -421,7 +422,7 @@ return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidence
|
|
|
421
422
|
* @param licenseType The type of license (defaults to DURATION_BASED).
|
|
422
423
|
* @returns The created license terms.
|
|
423
424
|
*/
|
|
424
|
-
const
|
|
425
|
+
const Ne=(e,t,n,i,a=xe.DURATION_BASED)=>{if(n<Y||n>G)throw new Error(`Royalty basis points must be between ${Y} and ${G}`);if(a===xe.DURATION_BASED){if(t<q||t>z)throw new Error(`Duration must be between ${q} and ${z} seconds for DURATION_BASED licenses`)}else if((a===xe.SINGLE_PAYMENT||a===xe.X402)&&t>0)throw new Error(`Duration must be 0 for ${xe[a]} licenses`);if(e<J)throw new Error(`Price must be at least ${J} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i,licenseType:a}},Me=[{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{name:"account",type:"address"}],name:"userStakeTimestamp",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"}];
|
|
425
426
|
// minimal ABI for staking vault
|
|
426
427
|
/**
|
|
427
428
|
* Checks if a user meets the requirements to vote on a dispute.
|
|
@@ -443,15 +444,15 @@ const Me=(e,t,n,i,a=De.DURATION_BASED)=>{if(n<Y||n>G)throw new Error(`Royalty ba
|
|
|
443
444
|
* }
|
|
444
445
|
* ```
|
|
445
446
|
*/
|
|
446
|
-
function Be(e,t){return m(this,void 0,void 0,(function*(){const n=yield
|
|
447
|
+
function Be(e,t){return m(this,void 0,void 0,(function*(){const n=yield function(e,t){return m(this,void 0,void 0,(function*(){if(t)return t;if(!e)throw new Error("No address provided and no wallet connected. Please provide an address or connect a wallet.");if(e.account)return e.account.address;const n=yield e.request({method:"eth_requestAccounts",params:[]});if(!n||0===n.length)throw new Error("No accounts found in connected wallet.");return n[0]}))}(this.viemClient,t),i=B(),a=this.environment.DISPUTE_CONTRACT_ADDRESS,s=this.environment.DISPUTE_ABI,[r,o,p,d,u,l]=yield Promise.all([this.getDispute(e),i.readContract({address:a,abi:s,functionName:"stakingVault",args:[]}),i.readContract({address:a,abi:s,functionName:"stakingThreshold",args:[]}),i.readContract({address:a,abi:s,functionName:"disputeCoolDownPeriod",args:[]}),i.readContract({address:a,abi:s,functionName:"disputeJudgementPeriod",args:[]}),i.readContract({address:a,abi:s,functionName:"hasVoted",args:[e,n]})]),y=r.status,c=r.disputeTimestamp,h=r.assertionTimestamp,[T,f]=yield Promise.all([i.readContract({address:o,abi:Me,functionName:"userStakeTimestamp",args:[n]}),i.readContract({address:o,abi:Me,functionName:"balanceOf",args:[n]})]),v=BigInt(Math.floor(Date.now()/1e3));let w,A=!1;y===De.Asserted?(
|
|
447
448
|
// for asserted disputes, voting period is relative to assertion timestamp
|
|
448
|
-
|
|
449
|
+
w=h+u,A=v<=w):y===De.Raised&&(
|
|
449
450
|
// for raised disputes, voting period extends from cooldown through judgement
|
|
450
|
-
|
|
451
|
+
w=c+d+u,A=v<=w);
|
|
451
452
|
// build base result
|
|
452
|
-
const
|
|
453
|
+
const I={canVote:!1,votingWeight:f,stakingThreshold:p,hasAlreadyVoted:l,userStakeTimestamp:T,disputeTimestamp:c,disputeStatus:y,isVotingPeriodActive:A};
|
|
453
454
|
// check all requirements
|
|
454
|
-
return y!==
|
|
455
|
+
return y!==De.Raised&&y!==De.Asserted?Object.assign(Object.assign({},I),{reason:`Dispute is not in a voteable status (current: ${De[y]})`}):A?l?Object.assign(Object.assign({},I),{reason:"You have already voted on this dispute"}):T===BigInt(0)?Object.assign(Object.assign({},I),{reason:"You have never staked CAMP tokens"}):T>=c?Object.assign(Object.assign({},I),{reason:"You staked after this dispute was raised (vote recycling prevention)"}):f<p?Object.assign(Object.assign({},I),{reason:`Insufficient stake: you have ${f} but need at least ${p}`}):Object.assign(Object.assign({},I),{canVote:!0}):Object.assign(Object.assign({},I),{reason:"Voting period has ended"})}))}
|
|
455
456
|
/**
|
|
456
457
|
* Gets detailed progress and voting statistics for a dispute.
|
|
457
458
|
* Includes vote counts, percentages, quorum progress, and timeline.
|
|
@@ -473,17 +474,17 @@ return y!==Ne.Raised&&y!==Ne.Asserted?Object.assign(Object.assign({},A),{reason:
|
|
|
473
474
|
* console.log(`Can resolve in ${progress.timeline.timeUntilResolution} seconds`);
|
|
474
475
|
* }
|
|
475
476
|
* ```
|
|
476
|
-
*/function
|
|
477
|
+
*/function Oe(e){return m(this,void 0,void 0,(function*(){var t,n,i,a,s,r,o,p,d;const u=B(),l=this.environment.DISPUTE_CONTRACT_ADDRESS,y=this.environment.DISPUTE_ABI,[c,m,h,T]=yield Promise.all([u.readContract({address:l,abi:y,functionName:"disputes",args:[e]}),u.readContract({address:l,abi:y,functionName:"disputeQuorum",args:[]}),u.readContract({address:l,abi:y,functionName:"disputeCoolDownPeriod",args:[]}),u.readContract({address:l,abi:y,functionName:"disputeJudgementPeriod",args:[]})]),f=Number(null!==(t=c.status)&&void 0!==t?t:c[9]),v=BigInt(null!==(i=null!==(n=c.disputeTimestamp)&&void 0!==n?n:c[5])&&void 0!==i?i:0),w=BigInt(null!==(s=null!==(a=c.assertionTimestamp)&&void 0!==a?a:c[6])&&void 0!==s?s:0),A=BigInt(null!==(o=null!==(r=c.yesVotes)&&void 0!==r?r:c[7])&&void 0!==o?o:0),I=BigInt(null!==(d=null!==(p=c.noVotes)&&void 0!==p?p:c[8])&&void 0!==d?d:0),b=A+I;let g=0,C=0;b>BigInt(0)&&(g=Number(A*BigInt(1e4)/b)/100,C=Number(I*BigInt(1e4)/b)/100);
|
|
477
478
|
// calculate quorum progress
|
|
478
479
|
let E=0;m>BigInt(0)&&(E=Number(b*BigInt(1e4)/m)/100);const P=b>=m;
|
|
479
480
|
// determine projected outcome
|
|
480
481
|
let S;S=P?A>I?"dispute_succeeds":"dispute_fails":"no_quorum";
|
|
481
482
|
// calculate timeline
|
|
482
|
-
const
|
|
483
|
+
const _=BigInt(Math.floor(Date.now()/1e3)),R=new Date(1e3*Number(v)),x=new Date(1e3*Number(v+h));let k,D;f===De.Asserted?(
|
|
483
484
|
// for asserted disputes, voting ends relative to assertion
|
|
484
|
-
|
|
485
|
+
k=new Date(1e3*Number(w+T)),D=w+T):(
|
|
485
486
|
// for raised disputes, voting ends after cooldown + judgement
|
|
486
|
-
|
|
487
|
+
k=new Date(1e3*Number(v+h+T)),D=v+h+T);const N=(f===De.Raised||f===De.Asserted)&&_>D,M=N?0:Number(D-_);return{disputeId:e,status:f,yesVotes:A,noVotes:I,totalVotes:b,yesPercentage:g,noPercentage:C,quorum:m,quorumPercentage:E,quorumMet:P,projectedOutcome:S,timeline:{raisedAt:R,cooldownEndsAt:x,votingEndsAt:k,canResolveNow:N,timeUntilResolution:M}}}))}
|
|
487
488
|
/**
|
|
488
489
|
* Gets the requirements for raising a dispute, including balance check.
|
|
489
490
|
*
|
|
@@ -497,7 +498,7 @@ D=new Date(1e3*Number(v+h+T)),k=v+h+T);const N=(f===Ne.Raised||f===Ne.Asserted)&
|
|
|
497
498
|
* console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
|
|
498
499
|
* }
|
|
499
500
|
* ```
|
|
500
|
-
*/function
|
|
501
|
+
*/function Fe(e){return m(this,void 0,void 0,(function*(){const t=B(),n=this.environment.DISPUTE_CONTRACT_ADDRESS,i=this.environment.DISPUTE_ABI,[r,o,p]=yield Promise.all([t.readContract({address:n,abi:i,functionName:"disputeBond"}),t.readContract({address:n,abi:i,functionName:"protocolDisputeFee"}),t.readContract({address:n,abi:i,functionName:"disputeToken"})]),d=p===a,u=r+o;
|
|
501
502
|
// Get user's balance
|
|
502
503
|
let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:p,abi:s,functionName:"balanceOf",args:[e]}),{bondAmount:r,protocolFee:o,totalRequired:u,tokenAddress:p,isNativeToken:d,userBalance:l,hasSufficientBalance:l>=u}}))}
|
|
503
504
|
/**
|
|
@@ -506,55 +507,61 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:p
|
|
|
506
507
|
*
|
|
507
508
|
* @param tokenId The token ID to look up.
|
|
508
509
|
* @returns The vault address, or null if no vault exists.
|
|
509
|
-
*/function
|
|
510
|
+
*/function Ue(e){return m(this,void 0,void 0,(function*(){const t=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getRoyaltyVault",[e]);return t&&t!==a?t:null}))}
|
|
510
511
|
/**
|
|
511
512
|
* Gets the list of revenue token addresses that have accumulated in a token's vault.
|
|
512
513
|
*
|
|
513
514
|
* @param tokenId The token ID to look up.
|
|
514
515
|
* @returns An array of ERC20 token addresses with revenue in the vault.
|
|
515
|
-
*/function
|
|
516
|
+
*/function $e(e){return m(this,void 0,void 0,(function*(){return(yield this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"getVaultRevenueTokens",[e]))||[]}))}
|
|
516
517
|
/**
|
|
517
518
|
* Returns the amount of revenue claimable by a holder for a given token and revenue token.
|
|
518
|
-
* If no holder is provided, the
|
|
519
|
+
* If no holder is provided, the NFT's Token Bound Account (TBA) is used,
|
|
520
|
+
* since RT tokens are held in the TBA by default.
|
|
519
521
|
*
|
|
520
522
|
* @param tokenId The token ID whose vault to query.
|
|
521
523
|
* @param revenueToken The ERC20 revenue token address.
|
|
522
|
-
* @param holder Optional holder address. Defaults to
|
|
524
|
+
* @param holder Optional holder address. Defaults to the NFT's TBA.
|
|
523
525
|
* @returns The claimable amount in the revenue token's smallest unit.
|
|
524
|
-
*/function
|
|
526
|
+
*/function He(e,t,n){return m(this,void 0,void 0,(function*(){const i=n||(yield this.getTokenBoundAccount(e));return yield this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"claimableRevenue",[e,i,t])}))}
|
|
525
527
|
/**
|
|
526
528
|
* Claims accumulated revenue for a token from a specific revenue token.
|
|
527
|
-
*
|
|
529
|
+
* Executes the claim through the NFT's Token Bound Account (TBA),
|
|
530
|
+
* since the TBA holds the Royalty Tokens.
|
|
528
531
|
*
|
|
529
532
|
* @param tokenId The token ID whose vault to claim from.
|
|
530
533
|
* @param revenueToken The ERC20 revenue token address to claim.
|
|
531
534
|
* @returns The transaction result.
|
|
532
|
-
*/function
|
|
535
|
+
*/function Ve(e,t){return m(this,void 0,void 0,(function*(){const n=yield this.getTokenBoundAccount(e),i=r({abi:this.environment.MARKETPLACE_ABI,functionName:"claimRevenue",args:[e,t]});return this.callContractMethod(n,this.environment.TBA_ABI,"execute",[this.environment.MARKETPLACE_CONTRACT_ADDRESS,BigInt(0),i,0],{waitForReceipt:!0,value:BigInt(0)})}))}
|
|
533
536
|
/**
|
|
534
537
|
* Claims accumulated revenue for a token from multiple revenue tokens in a single transaction.
|
|
535
|
-
*
|
|
538
|
+
* Executes the claim through the NFT's Token Bound Account (TBA),
|
|
539
|
+
* since the TBA holds the Royalty Tokens.
|
|
536
540
|
*
|
|
537
541
|
* @param tokenId The token ID whose vault to claim from.
|
|
538
542
|
* @param revenueTokens Array of ERC20 revenue token addresses to claim.
|
|
539
543
|
* @returns The transaction result.
|
|
540
|
-
*/function
|
|
544
|
+
*/function je(e,t){return m(this,void 0,void 0,(function*(){const n=yield this.getTokenBoundAccount(e),i=r({abi:this.environment.MARKETPLACE_ABI,functionName:"claimRevenueBatch",args:[e,t]});return this.callContractMethod(n,this.environment.TBA_ABI,"execute",[this.environment.MARKETPLACE_CONTRACT_ADDRESS,BigInt(0),i,0],{waitForReceipt:!0,value:BigInt(0)})}))}
|
|
541
545
|
/**
|
|
542
546
|
* Deploys a new royalty vault for an existing NFT that was minted before the vault system.
|
|
543
547
|
* This is used to migrate old NFTs to the new royalty vault system.
|
|
544
548
|
*
|
|
545
549
|
* @param tokenId The token ID to deploy a vault for.
|
|
546
550
|
* @returns The transaction result including the new vault address.
|
|
547
|
-
*/function
|
|
551
|
+
*/function Le(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS,this.environment.IP_ROYALTY_VAULT_FACTORY_ABI,"deployVaultForExistingNFT",[e],{waitForReceipt:!0})}))}const ze=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];
|
|
548
552
|
/**
|
|
549
553
|
* Gets the Royalty Token balance for a holder in a token's vault.
|
|
550
|
-
* If no holder is provided, the
|
|
554
|
+
* If no holder is provided, the NFT's Token Bound Account (TBA) is used,
|
|
555
|
+
* since RT tokens are minted to the TBA by default.
|
|
551
556
|
*
|
|
552
557
|
* @param tokenId The token ID whose vault to query.
|
|
553
|
-
* @param holder Optional holder address. Defaults to
|
|
558
|
+
* @param holder Optional holder address. Defaults to the NFT's TBA.
|
|
554
559
|
* @returns The royalty token balance info including vault address, balance, total supply, percentage, and decimals.
|
|
555
|
-
*/function
|
|
560
|
+
*/function qe(e,t){return m(this,void 0,void 0,(function*(){
|
|
561
|
+
// Default to the NFT's TBA, since RT tokens are minted there
|
|
562
|
+
const n=t||(yield this.getTokenBoundAccount(e)),i=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getRoyaltyVault",[e]);
|
|
556
563
|
// Get vault address
|
|
557
|
-
if(!i||i===a)throw new Error(`No royalty vault found for token ${e}. Deploy a vault first using deployVaultForExistingNFT.`);const s=
|
|
564
|
+
if(!i||i===a)throw new Error(`No royalty vault found for token ${e}. Deploy a vault first using deployVaultForExistingNFT.`);const s=B(),[r,o,p]=yield Promise.all([s.readContract({address:i,abi:ze,functionName:"balanceOf",args:[n]}),s.readContract({address:i,abi:ze,functionName:"totalSupply"}),s.readContract({address:i,abi:ze,functionName:"decimals"})]);
|
|
558
565
|
// Read balance, totalSupply, and decimals in parallel
|
|
559
566
|
return{vaultAddress:i,balance:r,totalSupply:o,percentage:o>BigInt(0)?Number(r*BigInt(1e4)/o)/100:0,decimals:Number(p)}}))}
|
|
560
567
|
/**
|
|
@@ -570,13 +577,13 @@ return{vaultAddress:i,balance:r,totalSupply:o,percentage:o>BigInt(0)?Number(r*Bi
|
|
|
570
577
|
* console.log(`Revenue Share: ${appInfo.revenueShareBps / 100}%`);
|
|
571
578
|
* console.log(`Active: ${appInfo.isActive}`);
|
|
572
579
|
* ```
|
|
573
|
-
*/function
|
|
580
|
+
*/function Je(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.APP_REGISTRY_CONTRACT_ADDRESS,this.environment.APP_REGISTRY_ABI,"getAppInfo",[e])}))}
|
|
574
581
|
/**
|
|
575
582
|
* Approves a spender to spend a specified amount of tokens on behalf of the owner.
|
|
576
583
|
* If the current allowance is less than the specified amount, it will perform the approval.
|
|
577
584
|
* Waits for the approval transaction to be confirmed before returning.
|
|
578
585
|
* @param {ApproveParams} params - The parameters for the approval.
|
|
579
|
-
*/function
|
|
586
|
+
*/function Ye(e){return m(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:r,chain:o}){if((yield t.readContract({address:n,abi:s,functionName:"allowance",args:[i,a]}))<r){const p=yield e.writeContract({address:n,account:i,abi:s,functionName:"approve",args:[a,r],chain:o});
|
|
580
587
|
// Wait for the approval transaction to be confirmed with extra confirmations
|
|
581
588
|
yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e=>setTimeout(e,1e3)))}}))}
|
|
582
589
|
/**
|
|
@@ -597,7 +604,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
597
604
|
* const totalValue = 3000000000000000n;
|
|
598
605
|
* await origin.bulkBuyAccess(buyerAddress, purchases, totalValue);
|
|
599
606
|
* ```
|
|
600
|
-
*/function
|
|
607
|
+
*/function Ge(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccess",[e,t],{waitForReceipt:!0,value:n})}
|
|
601
608
|
/**
|
|
602
609
|
* Executes a fault-tolerant bulk purchase of multiple IP-NFT licenses.
|
|
603
610
|
* Individual purchases can fail without reverting the entire transaction.
|
|
@@ -614,7 +621,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
614
621
|
* console.log(`Purchased ${result.successCount} of ${purchases.length} IPs`);
|
|
615
622
|
* console.log(`Failed tokens: ${result.failedTokenIds}`);
|
|
616
623
|
* ```
|
|
617
|
-
*/function
|
|
624
|
+
*/function We(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccessTolerant",[e,t],{waitForReceipt:!0,value:n})}
|
|
618
625
|
/**
|
|
619
626
|
* Previews the total cost of purchasing multiple IP-NFT licenses.
|
|
620
627
|
* This is a view function that doesn't require a transaction.
|
|
@@ -628,7 +635,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
628
635
|
* console.log(`Total cost: ${preview.totalNativeCost} wei`);
|
|
629
636
|
* console.log(`Valid tokens: ${preview.validCount}`);
|
|
630
637
|
* ```
|
|
631
|
-
*/function
|
|
638
|
+
*/function Ke(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"previewBulkCost",[e])}
|
|
632
639
|
/**
|
|
633
640
|
* Builds purchase parameters for multiple tokens by fetching their current license terms.
|
|
634
641
|
* This is a view function that doesn't require a transaction.
|
|
@@ -641,7 +648,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
641
648
|
* const params = await origin.buildPurchaseParams([1n, 2n, 3n]);
|
|
642
649
|
* await origin.bulkBuyAccess(buyer, params, totalValue);
|
|
643
650
|
* ```
|
|
644
|
-
*/function
|
|
651
|
+
*/function Qe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"buildPurchaseParams",[e])}
|
|
645
652
|
/**
|
|
646
653
|
* Checks the active status of multiple tokens.
|
|
647
654
|
*
|
|
@@ -653,7 +660,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
653
660
|
* const activeFlags = await origin.checkActiveStatus([1n, 2n, 3n]);
|
|
654
661
|
* const activeTokens = tokenIds.filter((_, i) => activeFlags[i]);
|
|
655
662
|
* ```
|
|
656
|
-
*/function
|
|
663
|
+
*/function Xe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"checkActiveStatus",[e])}
|
|
657
664
|
/**
|
|
658
665
|
* Smart bulk purchase that automatically fetches terms and handles the entire purchase flow.
|
|
659
666
|
* This is the recommended method for most use cases.
|
|
@@ -670,9 +677,9 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
|
|
|
670
677
|
* // Tolerant purchase - continue even if some fail
|
|
671
678
|
* const result = await origin.bulkBuyAccessSmart([1n, 2n, 3n], { tolerant: true });
|
|
672
679
|
* ```
|
|
673
|
-
*/function
|
|
680
|
+
*/function Ze(e,t){return m(this,void 0,void 0,(function*(){if(!e||0===e.length)throw new S("No token IDs provided for bulk purchase. Please provide at least one token ID.");
|
|
674
681
|
// Get the buyer's wallet address
|
|
675
|
-
const n=this.viemClient;if(!n)throw new
|
|
682
|
+
const n=this.viemClient;if(!n)throw new R("Cannot perform bulk purchase: wallet not connected. Please connect a wallet first.");let i;if(n.account)i=n.account.address;else{const e=yield n.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new R("No accounts found in connected wallet. Please unlock your wallet or add an account.");i=e[0]}
|
|
676
683
|
// Build purchase params from on-chain data
|
|
677
684
|
const s=yield this.buildPurchaseParams(e);
|
|
678
685
|
// Calculate total native token cost
|
|
@@ -680,7 +687,7 @@ let r=BigInt(0);const o=[];for(const e of s)if(e.expectedPaymentToken===a)r+=e.e
|
|
|
680
687
|
// Group ERC20 purchases by token
|
|
681
688
|
const t=o.find((t=>t.token===e.expectedPaymentToken));t?t.amount+=e.expectedPrice:o.push({token:e.expectedPaymentToken,amount:e.expectedPrice})}
|
|
682
689
|
// Approve ERC20 tokens if needed
|
|
683
|
-
const p=
|
|
690
|
+
const p=B();for(const e of o)yield Ye({walletClient:n,publicClient:p,tokenAddress:e.token,owner:i,spender:this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,amount:e.amount,chain:this.environment.CHAIN});
|
|
684
691
|
// Execute the purchase
|
|
685
692
|
return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuyAccess(i,s,r)}))}
|
|
686
693
|
/**
|
|
@@ -708,7 +715,7 @@ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuy
|
|
|
708
715
|
* ];
|
|
709
716
|
* await origin.bulkMint(mints);
|
|
710
717
|
* ```
|
|
711
|
-
*/function
|
|
718
|
+
*/function et(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMint",[e],{waitForReceipt:!0})}
|
|
712
719
|
/**
|
|
713
720
|
* Executes a fault-tolerant bulk mint of multiple IP-NFTs.
|
|
714
721
|
* Individual mints can fail without reverting the entire transaction.
|
|
@@ -722,38 +729,38 @@ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuy
|
|
|
722
729
|
* console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
|
|
723
730
|
* console.log(`Failed tokens: ${result.failedTokenIds}`);
|
|
724
731
|
* ```
|
|
725
|
-
*/function
|
|
732
|
+
*/function tt(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMintTolerant",[e],{waitForReceipt:!0})}var nt,it,at,st,rt,ot,pt,dt,ut,lt,yt,ct,mt,ht,Tt,ft,vt,wt,At,It,bt,gt;
|
|
726
733
|
/**
|
|
727
734
|
* The Origin class
|
|
728
735
|
* Handles interactions with Origin protocol.
|
|
729
|
-
*/class
|
|
736
|
+
*/class Ct{constructor(e,t,n,i,a){nt.add(this),t?this.jwt=t:console.warn("JWT not provided. Some features may be unavailable."),this.viemClient=n,this.environment="string"==typeof e?W[e]:e||W.DEVELOPMENT,this.baseParentId=i,this.appId=a,
|
|
730
737
|
// DataNFT methods
|
|
731
738
|
this.mintWithSignature=ee.bind(this),this.registerIpNFT=te.bind(this),this.updateTerms=ne.bind(this),this.finalizeDelete=ie.bind(this),this.getTerms=ae.bind(this),this.ownerOf=se.bind(this),this.balanceOf=re.bind(this),this.tokenURI=oe.bind(this),this.dataStatus=pe.bind(this),this.isApprovedForAll=de.bind(this),this.transferFrom=ue.bind(this),this.safeTransferFrom=le.bind(this),this.approve=ye.bind(this),this.setApprovalForAll=ce.bind(this),
|
|
732
739
|
// Marketplace methods
|
|
733
740
|
this.buyAccess=me.bind(this),this.hasAccess=he.bind(this),this.subscriptionExpiry=Te.bind(this),
|
|
734
741
|
// Bulk purchase methods
|
|
735
|
-
this.bulkBuyAccess=
|
|
742
|
+
this.bulkBuyAccess=Ge.bind(this),this.bulkBuyAccessTolerant=We.bind(this),this.bulkBuyAccessSmart=Ze.bind(this),this.previewBulkCost=Ke.bind(this),this.buildPurchaseParams=Qe.bind(this),this.checkActiveStatus=Xe.bind(this),
|
|
736
743
|
// Bulk mint methods
|
|
737
|
-
this.bulkMint=
|
|
744
|
+
this.bulkMint=et.bind(this),this.bulkMintTolerant=tt.bind(this),
|
|
738
745
|
// Dispute module methods
|
|
739
|
-
this.raiseDispute=fe.bind(this),this.raiseDisputeSmart=be.bind(this),this.disputeAssertion=ge.bind(this),this.disputeAssertionSmart=Ce.bind(this),this.voteOnDispute=Ee.bind(this),this.resolveDispute=Pe.bind(this),this.cancelDispute=Se.bind(this),this.tagChildIp=
|
|
746
|
+
this.raiseDispute=fe.bind(this),this.raiseDisputeSmart=be.bind(this),this.disputeAssertion=ge.bind(this),this.disputeAssertionSmart=Ce.bind(this),this.voteOnDispute=Ee.bind(this),this.resolveDispute=Pe.bind(this),this.cancelDispute=Se.bind(this),this.tagChildIp=_e.bind(this),this.getDispute=Re.bind(this),this.canVoteOnDispute=Be.bind(this),this.getDisputeProgress=Oe.bind(this),this.getDisputeRequirements=Fe.bind(this),
|
|
740
747
|
// Royalty vault module methods
|
|
741
|
-
this.getRoyaltyVault
|
|
748
|
+
this.getRoyaltyVault=Ue.bind(this),this.getVaultRevenueTokens=$e.bind(this),this.claimableRevenue=He.bind(this),this.claimRevenue=Ve.bind(this),this.claimRevenueBatch=je.bind(this),this.deployVaultForExistingNFT=Le.bind(this),this.getRoyaltyTokenBalance=qe.bind(this),
|
|
742
749
|
// AppRegistry module methods
|
|
743
|
-
this.getAppInfo=
|
|
750
|
+
this.getAppInfo=Je.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
|
|
744
751
|
/**
|
|
745
752
|
* Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
|
|
746
753
|
* Waits for the approval transaction to be confirmed before returning.
|
|
747
754
|
* @param tokenAddress The address of the ERC20 token.
|
|
748
755
|
* @param spender The address that will be approved to spend the tokens.
|
|
749
756
|
* @param amount The amount of tokens to approve.
|
|
750
|
-
*/approveERC20IfNeeded(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,
|
|
757
|
+
*/approveERC20IfNeeded(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,nt,"m",yt).call(this);yield Ye({walletClient:this.viemClient,publicClient:B(),tokenAddress:e,owner:i,spender:t,amount:n,chain:this.environment.CHAIN})}))}
|
|
751
758
|
/**
|
|
752
759
|
* Uploads a JSON object to IPFS and returns the resulting CID.
|
|
753
760
|
* @param data The JSON object to upload.
|
|
754
761
|
* @returns The CID of the uploaded JSON.
|
|
755
762
|
* @throws {APIError} If the upload fails.
|
|
756
|
-
*/uploadJSONToIPFS(e){return m(this,void 0,void 0,(function*(){const t=JSON.stringify(e),n=new File([t],"evidence.json",{type:"application/json"}),i=yield h(this,
|
|
763
|
+
*/uploadJSONToIPFS(e){return m(this,void 0,void 0,(function*(){const t=JSON.stringify(e),n=new File([t],"evidence.json",{type:"application/json"}),i=yield h(this,nt,"m",st).call(this,n);if(!i)throw new P("Failed to upload evidence to IPFS");return i}))}
|
|
757
764
|
/**
|
|
758
765
|
* Mints a file-based IpNFT.
|
|
759
766
|
* @param file The file to mint.
|
|
@@ -762,10 +769,10 @@ this.getAppInfo=Ye.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.vie
|
|
|
762
769
|
* @param parents Optional parent token IDs for lineage tracking.
|
|
763
770
|
* @param options Optional parameters including progress callback, preview image, and use asset as preview flag.
|
|
764
771
|
* @returns The token ID of the minted IpNFT as a string, or null if minting failed.
|
|
765
|
-
*/mintFile(e,t,n,i,a){return m(this,void 0,void 0,(function*(){let s,r=null;try{r=yield h(this,
|
|
772
|
+
*/mintFile(e,t,n,i,a){return m(this,void 0,void 0,(function*(){let s,r=null;try{r=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot mint file "${e.name}": wallet not connected. Please connect a wallet first.`)}try{if(s=yield h(this,nt,"m",rt).call(this,e,a),!s||!s.key)throw new P(`Failed to upload file "${e.name}": no upload info returned from server`)}catch(t){if(t instanceof P||t instanceof R)throw t;throw new P(`Failed to upload file "${e.name}": ${k(t)}`)}e.type&&(t.mimetype=e.type);let o=null;(null==a?void 0:a.previewImage)&&(null==a?void 0:a.previewImage.type.startsWith("image/"))?o=yield h(this,nt,"m",st).call(this,a.previewImage):(null==a?void 0:a.useAssetAsPreview)&&e.type.startsWith("image/")&&(o=yield h(this,nt,"m",st).call(this,e)),o&&(t.image=`ipfs://${o}`);const p=BigInt(Date.now()+6e5);// 10 minutes from now
|
|
766
773
|
let d;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{d=yield this.registerIpNFT("file",p,n,t,!0,// isIp
|
|
767
774
|
s.key,// fileKey
|
|
768
|
-
i,this.appId)}catch(e){throw yield h(this,
|
|
775
|
+
i,this.appId)}catch(e){throw yield h(this,nt,"m",at).call(this,s.key,s.uploadId,[]),new Error(`Failed to register IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:u,signerAddress:l,creatorContentHash:y,signature:c,uri:m}=d;if(!(u&&l&&y&&void 0!==c&&m))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");try{const e=yield this.mintWithSignature(r,u,i||[],!0,y,m,n,p,c,this.appId);if(-1===["0x1","success"].indexOf(e.receipt.status))throw yield h(this,nt,"m",at).call(this,s.key,s.uploadId,[]),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield h(this,nt,"m",at).call(this,s.key,s.uploadId,[]),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return u.toString()}))}
|
|
769
776
|
/**
|
|
770
777
|
* Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
|
|
771
778
|
* Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
|
|
@@ -785,30 +792,30 @@ i,this.appId)}catch(e){throw yield h(this,it,"m",st).call(this,s.key,s.uploadId,
|
|
|
785
792
|
* // Tolerant mode - continue even if some mints fail
|
|
786
793
|
* const result = await origin.bulkMintFile(entries, { tolerant: true });
|
|
787
794
|
* ```
|
|
788
|
-
*/bulkMintFile(e,t){return m(this,void 0,void 0,(function*(){var n,i;if(!e||0===e.length)throw new S("No file entries provided for bulk mint. Please provide at least one entry.");let a=null;try{a=yield h(this,
|
|
795
|
+
*/bulkMintFile(e,t){return m(this,void 0,void 0,(function*(){var n,i;if(!e||0===e.length)throw new S("No file entries provided for bulk mint. Please provide at least one entry.");let a=null;try{a=yield h(this,nt,"m",dt).call(this)}catch(e){throw new R("Cannot bulk mint files: wallet not connected. Please connect a wallet first.")}const s=[],r=[],o=[];for(let p=0;p<e.length;p++){const d=e[p],{file:u,metadata:l,license:y}=d;let c,{parents:m}=d;
|
|
789
796
|
// Upload file
|
|
790
|
-
try{if(c=yield h(this,
|
|
797
|
+
try{if(c=yield h(this,nt,"m",rt).call(this,u,{progressCallback:n=>{var i;null===(i=null==t?void 0:t.progressCallback)||void 0===i||i.call(t,{fileIndex:p,fileCount:e.length,stage:"uploading",percent:n})}}),!c||!c.key)throw new P(`Failed to upload file "${u.name}": no upload info returned from server`)}catch(e){if(e instanceof P||e instanceof R)throw e;throw new P(`Failed to upload file "${u.name}": ${k(e)}`)}o.push(c),
|
|
791
798
|
// Set mimetype
|
|
792
799
|
u.type&&(l.mimetype=u.type);
|
|
793
800
|
// Handle preview image
|
|
794
|
-
let T=null;d.previewImage&&d.previewImage.type.startsWith("image/")?T=yield h(this,
|
|
801
|
+
let T=null;d.previewImage&&d.previewImage.type.startsWith("image/")?T=yield h(this,nt,"m",st).call(this,d.previewImage):d.useAssetAsPreview&&u.type.startsWith("image/")&&(T=yield h(this,nt,"m",st).call(this,u)),T&&(l.image=`ipfs://${T}`);const f=BigInt(Date.now()+6e5);// 10 minutes from now
|
|
795
802
|
// Prepare parents
|
|
796
803
|
let v;this.baseParentId&&(m||(m=[]),m=[this.baseParentId,...m]),
|
|
797
804
|
// Register IpNFT to get signature
|
|
798
805
|
null===(n=null==t?void 0:t.progressCallback)||void 0===n||n.call(t,{fileIndex:p,fileCount:e.length,stage:"registering",percent:100});try{v=yield this.registerIpNFT("file",f,y,l,!0,// isIp
|
|
799
806
|
c.key,// fileKey
|
|
800
|
-
m,this.appId)}catch(e){throw yield h(this,
|
|
807
|
+
m,this.appId)}catch(e){throw yield h(this,nt,"m",at).call(this,c.key,c.uploadId,[]),new Error(`Failed to register IpNFT for file "${u.name}": ${e instanceof Error?e.message:String(e)}`)}const{tokenId:w,creatorContentHash:A,signature:I,uri:b}=v;if(!w||!A||void 0===I||!b)throw yield h(this,nt,"m",at).call(this,c.key,c.uploadId,[]),new Error(`Failed to register IpNFT for file "${u.name}": Missing required fields in registration response.`);r.push(w.toString()),s.push({to:a,tokenId:BigInt(w),creatorContentHash:A,uri:b,licenseTerms:y,deadline:f,parents:m||[],isIP:!0,appId:null!==(i=this.appId)&&void 0!==i?i:"",signature:I})}
|
|
801
808
|
// Execute bulk mint
|
|
802
809
|
try{let e;return e=(null==t?void 0:t.tolerant)?yield this.bulkMintTolerant(s):yield this.bulkMint(s),{tokenIds:r,result:e}}catch(e){
|
|
803
810
|
// Mark all uploads as failed
|
|
804
|
-
for(const e of o)try{yield h(this,
|
|
811
|
+
for(const e of o)try{yield h(this,nt,"m",at).call(this,e.key,e.uploadId,[])}catch(e){}throw new Error(`Bulk mint transaction failed: ${e instanceof Error?e.message:String(e)}`)}}))}
|
|
805
812
|
/**
|
|
806
813
|
* Mints a social IpNFT.
|
|
807
814
|
* @param source The social media source (spotify, twitter, tiktok).
|
|
808
815
|
* @param metadata The metadata associated with the social media content.
|
|
809
816
|
* @param license The license terms for the IpNFT.
|
|
810
817
|
* @return The token ID of the minted IpNFT as a string, or null if minting failed.
|
|
811
|
-
*/mintSocial(e,t,n){return m(this,void 0,void 0,(function*(){let i=null;try{i=yield h(this,
|
|
818
|
+
*/mintSocial(e,t,n){return m(this,void 0,void 0,(function*(){let i=null;try{i=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot mint ${e} social IP: wallet not connected. Please connect a wallet first.`)}t.mimetype=`social/${e}`;const a=BigInt(Math.floor(Date.now()/1e3)+600);// 10 minutes from now
|
|
812
819
|
let s,r=this.baseParentId?[this.baseParentId]:[];try{s=yield this.registerIpNFT(e,a,n,t,!0,// isIp
|
|
813
820
|
void 0,// fileKey
|
|
814
821
|
r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:o,signerAddress:p,creatorContentHash:d,signature:u,uri:l}=s;if(!(o&&p&&d&&void 0!==u&&l))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");try{const e=yield this.mintWithSignature(i,o,r,!0,d,l,n,a,u,this.appId);if(-1===["0x1","success"].indexOf(e.receipt.status))throw new Error(`Minting Social IpNFT failed with status: ${e.receipt.status}`)}catch(e){throw new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return o.toString()}))}
|
|
@@ -821,9 +828,9 @@ r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e ins
|
|
|
821
828
|
* @param {CallOptions} [options] The call options.
|
|
822
829
|
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
823
830
|
* @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
|
|
824
|
-
*/callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s;let
|
|
831
|
+
*/callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s;let r=null;try{r=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const p=o({abi:t,name:n});if(p&&"stateMutability"in p&&("view"===p.stateMutability||"pure"===p.stateMutability)){const a=B();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}yield h(this,nt,"m",pt).call(this,this.environment.CHAIN);const d=B(),{result:u,request:l}=yield d.simulateContract({account:r,address:e,abi:t,functionName:n,args:i,value:a.value});
|
|
825
832
|
// simulate
|
|
826
|
-
if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?void 0:s.writeContract(l);if("string"!=typeof t)throw new x(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:u};return{txHash:t,receipt:yield h(this,
|
|
833
|
+
if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?void 0:s.writeContract(l);if("string"!=typeof t)throw new x(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:u};return{txHash:t,receipt:yield h(this,nt,"m",ot).call(this,t),simulatedResult:u}}catch(t){if(t instanceof x||t instanceof R)throw t;throw new x(`Transaction for "${n}" failed: ${k(t)}`,{contractName:e,methodName:n})}}))}
|
|
827
834
|
/**
|
|
828
835
|
* Gets comprehensive token information in a single call.
|
|
829
836
|
* Combines owner, status, terms, URI, and access information.
|
|
@@ -865,13 +872,13 @@ let d=!1,u=null;if("0x0000000000000000000000000000000000000000"!==i)try{[d,u]=yi
|
|
|
865
872
|
* console.log("Access purchased:", result.txHash);
|
|
866
873
|
* }
|
|
867
874
|
* ```
|
|
868
|
-
*/buyAccessSmart(e){return m(this,void 0,void 0,(function*(){let t=null;try{t=yield h(this,
|
|
875
|
+
*/buyAccessSmart(e){return m(this,void 0,void 0,(function*(){let t=null;try{t=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot buy access to token ${e}: wallet not connected. Please connect a wallet first.`)}
|
|
869
876
|
// Check if user already has access
|
|
870
877
|
if(yield this.hasAccess(t,e))return console.log("User already has access to this asset"),null;const n=yield this.getTerms(e);if(!n)throw new P(`Failed to fetch license terms for token ${e}: no terms returned`);const{price:i,paymentToken:s,duration:r}=n;if(void 0===i||void 0===s||void 0===r)throw new P(`Invalid license terms for token ${e}: missing price, paymentToken, or duration`);
|
|
871
878
|
// Fetch protocol fee from marketplace
|
|
872
|
-
const o=yield h(this,
|
|
879
|
+
const o=yield h(this,nt,"m",ut).call(this),p=yield h(this,nt,"m",lt).call(this,e),d=i;
|
|
873
880
|
// Fetch app fee from token's appId
|
|
874
|
-
return s===a?this.buyAccess(t,e,d,r,s,o,p,d):(yield
|
|
881
|
+
return s===a?this.buyAccess(t,e,d,r,s,o,p,d):(yield Ye({walletClient:this.viemClient,publicClient:B(),tokenAddress:s,owner:t,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:d,chain:this.environment.CHAIN}),this.buyAccess(t,e,d,r,s,o,p))}))}
|
|
875
882
|
/**
|
|
876
883
|
* Fetch the underlying data associated with a specific token ID.
|
|
877
884
|
* @param {bigint} tokenId - The token ID to fetch data for.
|
|
@@ -903,9 +910,9 @@ return s===a?this.buyAccess(t,e,d,r,s,o,p,d):(yield Ge({walletClient:this.viemCl
|
|
|
903
910
|
* // Get ERC20 token royalties for a specific token
|
|
904
911
|
* const royalties = await origin.getRoyalties(1n, "0x1234...");
|
|
905
912
|
* ```
|
|
906
|
-
*/getRoyalties(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield this.getTokenBoundAccount(e),i=
|
|
913
|
+
*/getRoyalties(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield this.getTokenBoundAccount(e),i=B();let s,r;if(t&&t!==a){
|
|
907
914
|
// erc20 (wrapped camp)
|
|
908
|
-
const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];s=yield this.callContractMethod(t,e,"balanceOf",[n]);const i=yield this.callContractMethod(t,e,"decimals",[]);r=
|
|
915
|
+
const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];s=yield this.callContractMethod(t,e,"balanceOf",[n]);const i=yield this.callContractMethod(t,e,"decimals",[]);r=d(s,i)}else s=yield i.getBalance({address:n}),r=p(s);return{tokenBoundAccount:n,balance:s,balanceFormatted:r}}catch(t){throw new Error(`Failed to retrieve royalties for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
|
|
909
916
|
/**
|
|
910
917
|
* Claim royalties from a token's Token Bound Account (TBA).
|
|
911
918
|
* @param {bigint} tokenId - The token ID to claim royalties from.
|
|
@@ -921,25 +928,25 @@ const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
|
|
|
921
928
|
* // Claim ERC20 token royalties to a specific address
|
|
922
929
|
* await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
|
|
923
930
|
* ```
|
|
924
|
-
*/claimRoyalties(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,
|
|
931
|
+
*/claimRoyalties(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,nt,"m",yt).call(this,t),s=yield this.getTokenBoundAccount(e),o=(yield this.getRoyalties(e,n)).balance;if(o===BigInt(0))throw new Error("No royalties available to claim");let p,d,u;
|
|
925
932
|
// Call execute on the TBA
|
|
926
933
|
return n&&n!==a?(
|
|
927
934
|
// ERC20 token transfer
|
|
928
|
-
|
|
935
|
+
p=n,d=BigInt(0),
|
|
929
936
|
// Encode ERC20 transfer call: transfer(address to, uint256 amount)
|
|
930
|
-
u=
|
|
937
|
+
u=r({abi:[{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],functionName:"transfer",args:[i,o]})):(
|
|
931
938
|
// Native token transfer
|
|
932
|
-
|
|
933
|
-
{waitForReceipt:!0,value:BigInt(0)})}))}}
|
|
939
|
+
p=i,d=o,u="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[p,d,u,0],// operation: 0 = CALL
|
|
940
|
+
{waitForReceipt:!0,value:BigInt(0)})}))}}nt=new WeakSet,it=function(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type,partCount:t}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok)throw new Error(`HTTP ${n.status}: ${n.statusText}`);const i=yield n.json();if(i.isError)throw new Error(i.message||"Failed to generate upload URL");return i.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},at=function(e,t,n){return m(this,void 0,void 0,(function*(){try{const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/update-status`,{method:"PATCH",body:JSON.stringify({fileKey:e,uploadId:t,parts:n}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!i.ok){const e=yield i.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${i.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},st=function(e){return m(this,void 0,void 0,(function*(){var t;if(!e)return null;try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/upload-url-ipfs`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.jwt}`},body:JSON.stringify({fileName:e.name,fileType:e.type})});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`Failed to get presigned URL (HTTP ${n.status}): ${e}`)}const i=yield n.json(),{isError:a,data:s,message:r}=i;if(a||!s)throw new Error(`Failed to get presigned URL: ${r||"No URL returned from server"}`);const o=new FormData;o.append("file",e);const p=yield fetch(s,{method:"POST",body:o});if(!p.ok){const e=yield p.text().catch((()=>p.statusText));throw new Error(`Failed to upload preview image to IPFS (HTTP ${p.status}): ${e}`)}const d=yield p.json();if(!d||!d.data)throw new Error("Invalid response from IPFS upload: Missing data field");return null===(t=d.data)||void 0===t?void 0:t.cid}catch(e){const t=e instanceof Error?e.message:String(e);throw console.error("Error uploading preview image to IPFS:",t),new Error(`Failed to upload preview image to IPFS: ${t}`)}}))},rt=function(e,t){return m(this,void 0,void 0,(function*(){let n,i;try{i=((e,t)=>{const n=[];let i=0;for(;i<e.size;)n.push(e.slice(i,i+t)),i+=t;return n})(e,10485760),n=yield h(this,nt,"m",it).call(this,e,i.length)}catch(e){throw console.error("Failed to generate upload URL:",e),new Error(`Failed to generate upload URL: ${e instanceof Error?e.message:String(e)}`)}if(!n)throw new Error("Failed to generate upload URL: No upload info returned");let a;try{a=yield Z(i,n.urls,(null==t?void 0:t.progressCallback)||(()=>{}))}catch(e){try{yield h(this,nt,"m",at).call(this,n.key,n.uploadId,a||[])}catch(e){console.error("Failed to update status to failed:",e)}const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to upload file: ${t}`)}try{yield h(this,nt,"m",at).call(this,n.key,n.uploadId,a)}catch(e){console.error("Failed to update status to success:",e)}return n}))},ot=function(e){return m(this,arguments,void 0,(function*(e,t={}){var n,i,a;const s=B();let r=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,p=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,d=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield s.waitForTransactionReceipt({hash:r,confirmations:o,timeout:p,pollingInterval:d,onReplaced:e=>{r=e.transaction.hash}})}catch(e){
|
|
934
941
|
// fallback
|
|
935
|
-
const t=Date.now();for(;Date.now()-t<p;){try{const e=yield s.getTransactionReceipt({hash:r});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,d)))}throw e}}))},
|
|
942
|
+
const t=Date.now();for(;Date.now()-t<p;){try{const e=yield s.getTransactionReceipt({hash:r});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,d)))}throw e}}))},pt=function(e){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new R(`Cannot switch to chain "${e.name}": wallet not connected. Please connect a wallet first.`);let t=yield this.viemClient.request({method:"eth_chainId",params:[]});if("string"==typeof t&&(t=parseInt(t,16)),t!==e.id){(e=>{M=e,N=null})// reset public client to be recreated with new chain
|
|
936
943
|
(e);try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
|
|
937
944
|
// Unrecognized chain
|
|
938
|
-
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}}))},
|
|
945
|
+
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}}))},dt=function(){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new R("No wallet connected. Please connect a wallet to perform this action.");
|
|
939
946
|
// If account is already set on the client, return it directly
|
|
940
947
|
if(this.viemClient.account)return this.viemClient.account.address;
|
|
941
948
|
// Otherwise request accounts (browser wallet flow)
|
|
942
|
-
const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new
|
|
949
|
+
const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new R("No accounts found in connected wallet. Please unlock your wallet or add an account.");return e[0]}))},ut=function(){return m(this,void 0,void 0,(function*(){try{const e=yield this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"protocolFeeBps",[]);return Number(e)}catch(e){return console.warn("Failed to fetch protocol fee, defaulting to 0:",e),0}}))},lt=function(e){return m(this,void 0,void 0,(function*(){try{
|
|
943
950
|
// First, get the token info to find its appId
|
|
944
951
|
const t=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenInfo",[e]),n=null==t?void 0:t.appId;if(!n||""===n)return 0;
|
|
945
952
|
// Check if app registry is configured
|
|
@@ -947,17 +954,17 @@ if(!this.environment.APP_REGISTRY_CONTRACT_ADDRESS||!this.environment.APP_REGIST
|
|
|
947
954
|
// Fetch app info from registry
|
|
948
955
|
const i=yield this.callContractMethod(this.environment.APP_REGISTRY_CONTRACT_ADDRESS,this.environment.APP_REGISTRY_ABI,"getAppInfo",[n]);
|
|
949
956
|
// Only return fee if app is active
|
|
950
|
-
return(null==i?void 0:i.isActive)?Number(i.revenueShareBps):0}catch(e){return console.warn("Failed to fetch app fee, defaulting to 0:",e),0}}))},
|
|
957
|
+
return(null==i?void 0:i.isActive)?Number(i.revenueShareBps):0}catch(e){return console.warn("Failed to fetch app fee, defaulting to 0:",e),0}}))},yt=function(e){return m(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new R("No wallet address provided and no wallet connected. Please provide an address or connect a wallet.");
|
|
951
958
|
// If account is already set on the client, return it directly
|
|
952
959
|
if(this.viemClient.account)return this.viemClient.account.address;
|
|
953
960
|
// Otherwise request accounts (browser wallet flow)
|
|
954
|
-
const t=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!t||0===t.length)throw new
|
|
961
|
+
const t=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!t||0===t.length)throw new R("No accounts found in connected wallet. Please unlock your wallet or add an account.");return t[0]}))};
|
|
955
962
|
/**
|
|
956
963
|
* The Auth class.
|
|
957
964
|
* @class
|
|
958
965
|
* @classdesc The Auth class is used to authenticate the user.
|
|
959
966
|
*/
|
|
960
|
-
class
|
|
967
|
+
class Et{
|
|
961
968
|
/**
|
|
962
969
|
* Constructor for the Auth class.
|
|
963
970
|
* @param {object} options The options object.
|
|
@@ -967,13 +974,13 @@ class Pt{
|
|
|
967
974
|
* @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
|
|
968
975
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
969
976
|
*/
|
|
970
|
-
constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(
|
|
977
|
+
constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(ct.add(this),mt.set(this,void 0),ht.set(this,void 0),Tt.set(this,void 0),ft.set(this,void 0),!e)throw new S("clientId is required");
|
|
971
978
|
// if (!appId) {
|
|
972
979
|
// throw new ValidationError("appId is required");
|
|
973
980
|
// }
|
|
974
|
-
if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new S(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,
|
|
981
|
+
if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new S(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,ht,"undefined"==typeof window,"f"),T(this,ft,s||(h(this,ht,"f")?new b:new I),"f"),this.viem=null,this.environment=W[i],this.baseParentId=a,this.redirectUri=(e=>{const t=["twitter","spotify"];return"object"==typeof e?t.reduce(((t,n)=>(t[n]=e[n]||("undefined"!=typeof window?window.location.href:""),t)),{}):"string"==typeof e?t.reduce(((t,n)=>(t[n]=e,t)),{}):e?{}:t.reduce(((e,t)=>(e[t]="undefined"!=typeof window?window.location.href:"",e)),{})})(n),this.clientId=e,this.appId=t,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,T(this,mt,{},"f"),
|
|
975
982
|
// only subscribe to providers in browser environment
|
|
976
|
-
h(this,
|
|
983
|
+
h(this,ht,"f")||X((e=>{h(this,ct,"m",vt).call(this,"providers",e)})),h(this,ct,"m",wt).call(this)}
|
|
977
984
|
/**
|
|
978
985
|
* Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
|
|
979
986
|
* @param {("state"|"provider"|"providers"|"viem")} event The event.
|
|
@@ -983,26 +990,26 @@ h(this,Tt,"f")||X((e=>{h(this,mt,"m",wt).call(this,"providers",e)})),h(this,mt,"
|
|
|
983
990
|
* auth.on("state", (state) => {
|
|
984
991
|
* console.log(state);
|
|
985
992
|
* });
|
|
986
|
-
*/on(e,t){h(this,
|
|
993
|
+
*/on(e,t){h(this,mt,"f")[e]||(h(this,mt,"f")[e]=[]),h(this,mt,"f")[e].push(t),"providers"===e&&t(Q())}
|
|
987
994
|
/**
|
|
988
995
|
* Unsubscribe from an event. Possible events are "state", "provider", "providers", and "viem".
|
|
989
996
|
* @param {("state"|"provider"|"providers"|"viem")} event The event.
|
|
990
997
|
* @param {function} callback The callback function.
|
|
991
998
|
* @returns {void}
|
|
992
|
-
*/off(e,t){h(this,
|
|
999
|
+
*/off(e,t){h(this,mt,"f")[e]&&(h(this,mt,"f")[e]=h(this,mt,"f")[e].filter((e=>e!==t)))}
|
|
993
1000
|
/**
|
|
994
1001
|
* Set the loading state.
|
|
995
1002
|
* @param {boolean} loading The loading state.
|
|
996
1003
|
* @returns {void}
|
|
997
|
-
*/setLoading(e){h(this,
|
|
1004
|
+
*/setLoading(e){h(this,ct,"m",vt).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
|
|
998
1005
|
/**
|
|
999
1006
|
* Set the provider. This is useful for setting the provider when the user selects a provider from the UI or when dApp wishes to use a specific provider.
|
|
1000
1007
|
* @param {object} options The options object. Includes the provider and the provider info.
|
|
1001
1008
|
* @returns {void}
|
|
1002
1009
|
* @throws {APIError} - Throws an error if the provider is not provided.
|
|
1003
|
-
*/setProvider({provider:t,info:i,address:a}){if(!t)throw new P("provider is required");this.viem=((t,i="window.ethereum",a,s)=>{var r,o;if(!t&&!
|
|
1010
|
+
*/setProvider({provider:t,info:i,address:a}){if(!t)throw new P("provider is required");this.viem=((t,i="window.ethereum",a,s)=>{var r,o;if(!t&&!D)return console.warn("Provider is required to create a client."),null;const p=a||C;if(!D||D.transport.name!==i&&t||s!==(null===(r=D.account)||void 0===r?void 0:r.address)&&t||(null==M?void 0:M.id)!==p.id){const a={chain:p,transport:n(t,{name:i})};s&&(a.account=l(s)),D=e(a),M=p,N&&(null===(o=N.chain)||void 0===o?void 0:o.id)!==p.id&&(N=null)}return D})(t,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
|
|
1004
1011
|
// TODO: only use one of these
|
|
1005
|
-
h(this,
|
|
1012
|
+
h(this,ct,"m",vt).call(this,"viem",this.viem),h(this,ct,"m",vt).call(this,"provider",{provider:t,info:i}),h(this,ft,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
|
|
1006
1013
|
/**
|
|
1007
1014
|
* Set the wallet address. This is useful for edge cases where the provider can't return the wallet address. Don't use this unless you know what you're doing.
|
|
1008
1015
|
* @param {string} walletAddress The wallet address.
|
|
@@ -1011,7 +1018,7 @@ h(this,mt,"m",wt).call(this,"viem",this.viem),h(this,mt,"m",wt).call(this,"provi
|
|
|
1011
1018
|
/**
|
|
1012
1019
|
* Recover the provider from local storage.
|
|
1013
1020
|
* @returns {Promise<void>}
|
|
1014
|
-
*/recoverProvider(){return m(this,void 0,void 0,(function*(){var e,t,n,i,a,s,r,o,p,d,u,l,y;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const c=yield h(this,
|
|
1021
|
+
*/recoverProvider(){return m(this,void 0,void 0,(function*(){var e,t,n,i,a,s,r,o,p,d,u,l,y;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const c=yield h(this,ft,"f").getItem("camp-sdk:provider");if(!c)return;const m=JSON.parse(c);let T;const f=null!==(e=Q())&&void 0!==e?e:[];
|
|
1015
1022
|
// first pass: try to find provider by UUID/name and check if it has the right address
|
|
1016
1023
|
// without prompting (using eth_accounts)
|
|
1017
1024
|
for(const e of f)try{if(m.uuid&&(null===(t=e.info)||void 0===t?void 0:t.uuid)===m.uuid||m.name&&(null===(n=e.info)||void 0===n?void 0:n.name)===m.name){
|
|
@@ -1028,12 +1035,12 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
|
|
|
1028
1035
|
/**
|
|
1029
1036
|
* Disconnect the user.
|
|
1030
1037
|
* @returns {Promise<void>}
|
|
1031
|
-
*/disconnect(){return m(this,void 0,void 0,(function*(){this.isAuthenticated&&(h(this,
|
|
1038
|
+
*/disconnect(){return m(this,void 0,void 0,(function*(){this.isAuthenticated&&(h(this,ct,"m",vt).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,T(this,Tt,void 0,"f"),yield h(this,ft,"f").removeItem("camp-sdk:wallet-address"),yield h(this,ft,"f").removeItem("camp-sdk:user-id"),yield h(this,ft,"f").removeItem("camp-sdk:jwt"),yield h(this,ft,"f").removeItem("camp-sdk:environment"))}))}
|
|
1032
1039
|
/**
|
|
1033
1040
|
* Connect the user's wallet and sign the message.
|
|
1034
1041
|
* @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
|
|
1035
1042
|
* @throws {APIError} - Throws an error if the user cannot be authenticated.
|
|
1036
|
-
*/connect(){return m(this,void 0,void 0,(function*(){h(this,
|
|
1043
|
+
*/connect(){return m(this,void 0,void 0,(function*(){h(this,ct,"m",vt).call(this,"state","loading");try{this.walletAddress||(yield h(this,ct,"m",At).call(this)),this.walletAddress=u(this.walletAddress);const e=yield h(this,ct,"m",It).call(this),t=h(this,ct,"m",gt).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield h(this,ct,"m",bt).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new Ct(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,ft,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,ft,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,ft,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,ft,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,ct,"m",vt).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,ct,"m",vt).call(this,"state","unauthenticated"),new P("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,h(this,ct,"m",vt).call(this,"state","unauthenticated"),e instanceof P||e instanceof R)throw e;throw new P(`Failed to authenticate: ${k(e)}`)}}))}
|
|
1037
1044
|
/**
|
|
1038
1045
|
* Connect with a custom signer (for Node.js or custom wallet implementations).
|
|
1039
1046
|
* This method bypasses browser wallet interactions and uses the provided signer directly.
|
|
@@ -1052,9 +1059,9 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
|
|
|
1052
1059
|
* const account = privateKeyToAccount('0x...');
|
|
1053
1060
|
* const client = createWalletClient({ account, chain: mainnet, transport: http() });
|
|
1054
1061
|
* await auth.connectWithSigner(client);
|
|
1055
|
-
*/connectWithSigner(e,t){return m(this,void 0,void 0,(function*(){h(this,
|
|
1062
|
+
*/connectWithSigner(e,t){return m(this,void 0,void 0,(function*(){h(this,ct,"m",vt).call(this,"state","loading");try{T(this,Tt,A(e),"f"),this.walletAddress=u(yield h(this,Tt,"f").getAddress()),
|
|
1056
1063
|
// store the signer as viem client if it's a viem client, otherwise keep adapter
|
|
1057
|
-
"viem"===h(this,
|
|
1064
|
+
"viem"===h(this,Tt,"f").type&&(this.viem=e);const n=yield h(this,ct,"m",It).call(this),i=h(this,ct,"m",gt).call(this,n,null==t?void 0:t.domain,null==t?void 0:t.uri),a=yield h(this,Tt,"f").signMessage(i),s=yield h(this,ct,"m",bt).call(this,i,a);if(s.success)return this.isAuthenticated=!0,this.userId=s.userId,this.jwt=s.token,this.origin=new Ct(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,ft,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,ft,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,ft,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,ft,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,ct,"m",vt).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,ct,"m",vt).call(this,"state","unauthenticated"),new P("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,T(this,Tt,void 0,"f"),h(this,ct,"m",vt).call(this,"state","unauthenticated"),e instanceof P||e instanceof R)throw e;throw new P(`Failed to authenticate: ${k(e)}`)}}))}
|
|
1058
1065
|
/**
|
|
1059
1066
|
* Get the user's linked social accounts.
|
|
1060
1067
|
* @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
|
|
@@ -1063,34 +1070,34 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
|
|
|
1063
1070
|
* const auth = new Auth({ clientId: "your-client-id" });
|
|
1064
1071
|
* const socials = await auth.getLinkedSocials();
|
|
1065
1072
|
* console.log(socials);
|
|
1066
|
-
*/getLinkedSocials(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1073
|
+
*/getLinkedSocials(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to get linked social accounts");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/client-user/connections-sdk`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"}}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to fetch connections");{const t={};return Object.keys(e.data.data).forEach((n=>{t[n.split("User")[0]]=e.data.data[n]})),t}}))}
|
|
1067
1074
|
/**
|
|
1068
1075
|
* Link the user's Twitter account.
|
|
1069
1076
|
* @returns {Promise<void>}
|
|
1070
1077
|
* @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
|
|
1071
|
-
*/linkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1078
|
+
*/linkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to link Twitter account");if(h(this,ht,"f"))throw new P("Cannot link Twitter: OAuth flow requires a browser environment");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
|
|
1072
1079
|
/**
|
|
1073
1080
|
* Link the user's Discord account.
|
|
1074
1081
|
* @returns {Promise<void>}
|
|
1075
1082
|
* @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
|
|
1076
|
-
*/linkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1083
|
+
*/linkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to link Discord account");if(h(this,ht,"f"))throw new P("Cannot link Discord: OAuth flow requires a browser environment");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
|
|
1077
1084
|
/**
|
|
1078
1085
|
* Link the user's Spotify account.
|
|
1079
1086
|
* @returns {Promise<void>}
|
|
1080
1087
|
* @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
|
|
1081
|
-
*/linkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1088
|
+
*/linkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to link Spotify account");if(h(this,ht,"f"))throw new P("Cannot link Spotify: OAuth flow requires a browser environment");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
|
|
1082
1089
|
/**
|
|
1083
1090
|
* Link the user's TikTok account.
|
|
1084
1091
|
* @param {string} handle The user's TikTok handle.
|
|
1085
1092
|
* @returns {Promise<any>} A promise that resolves with the TikTok account data.
|
|
1086
1093
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
1087
|
-
*/linkTikTok(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1094
|
+
*/linkTikTok(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to link TikTok account");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new P("TikTok service is currently unavailable, try again later"):new P(t.message||"Failed to link TikTok account");return t.data}))}
|
|
1088
1095
|
/**
|
|
1089
1096
|
* Send an OTP to the user's Telegram account.
|
|
1090
1097
|
* @param {string} phoneNumber The user's phone number.
|
|
1091
1098
|
* @returns {Promise<any>} A promise that resolves with the OTP data.
|
|
1092
1099
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
1093
|
-
*/sendTelegramOTP(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1100
|
+
*/sendTelegramOTP(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to send Telegram OTP");if(!e)throw new S("Phone number is required to send Telegram OTP");yield this.unlinkTelegram();const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/sendOTP-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e})}).then((e=>e.json()));if(t.isError)throw new P(t.message||"Failed to send Telegram OTP");return t.data}))}
|
|
1094
1101
|
/**
|
|
1095
1102
|
* Link the user's Telegram account.
|
|
1096
1103
|
* @param {string} phoneNumber The user's phone number.
|
|
@@ -1098,34 +1105,34 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
|
|
|
1098
1105
|
* @param {string} phoneCodeHash The phone code hash.
|
|
1099
1106
|
* @returns {Promise<object>} A promise that resolves with the Telegram account data.
|
|
1100
1107
|
* @throws {APIError|Error} - Throws an error if the user is not authenticated. Also throws an error if the phone number, OTP, and phone code hash are not provided.
|
|
1101
|
-
*/linkTelegram(e,t,n){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1108
|
+
*/linkTelegram(e,t,n){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to link Telegram account");if(!e||!t||!n)throw new S("Phone number, OTP, and phone code hash are all required to link Telegram");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new P(i.message||"Failed to link Telegram account");return i.data}))}
|
|
1102
1109
|
/**
|
|
1103
1110
|
* Unlink the user's Twitter account.
|
|
1104
1111
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
1105
1112
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
1106
1113
|
* @throws {APIError} - Throws an error if the request fails.
|
|
1107
|
-
*/unlinkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1114
|
+
*/unlinkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to unlink Twitter account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/twitter/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to unlink Twitter account");return e.data}))}
|
|
1108
1115
|
/**
|
|
1109
1116
|
* Unlink the user's Discord account.
|
|
1110
1117
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
1111
1118
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
1112
1119
|
* @throws {APIError} - Throws an error if the request fails.
|
|
1113
|
-
*/unlinkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1120
|
+
*/unlinkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to unlink Discord account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/discord/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to unlink Discord account");return e.data}))}
|
|
1114
1121
|
/**
|
|
1115
1122
|
* Unlink the user's Spotify account.
|
|
1116
1123
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
1117
1124
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
1118
1125
|
* @throws {APIError} - Throws an error if the request fails.
|
|
1119
|
-
*/unlinkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1126
|
+
*/unlinkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to unlink Spotify account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/spotify/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to unlink Spotify account");return e.data}))}
|
|
1120
1127
|
/**
|
|
1121
1128
|
* Unlink the user's TikTok account.
|
|
1122
1129
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
1123
1130
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
1124
1131
|
* @throws {APIError} - Throws an error if the request fails.
|
|
1125
|
-
*/unlinkTikTok(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1132
|
+
*/unlinkTikTok(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to unlink TikTok account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to unlink TikTok account");return e.data}))}
|
|
1126
1133
|
/**
|
|
1127
1134
|
* Unlink the user's Telegram account.
|
|
1128
1135
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
1129
1136
|
* @throws {Error} - Throws an error if the user is not authenticated.
|
|
1130
1137
|
* @throws {APIError} - Throws an error if the request fails.
|
|
1131
|
-
*/unlinkTelegram(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new
|
|
1138
|
+
*/unlinkTelegram(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new _("User must be authenticated to unlink Telegram account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new P(e.message||"Failed to unlink Telegram account");return e.data}))}}mt=new WeakMap,ht=new WeakMap,Tt=new WeakMap,ft=new WeakMap,ct=new WeakSet,vt=function(e,t){h(this,mt,"f")[e]&&h(this,mt,"f")[e].forEach((e=>e(t)))},wt=function(e){return m(this,void 0,void 0,(function*(){const t=yield h(this,ft,"f").getItem("camp-sdk:wallet-address"),n=yield h(this,ft,"f").getItem("camp-sdk:user-id"),i=yield h(this,ft,"f").getItem("camp-sdk:jwt"),a=yield h(this,ft,"f").getItem("camp-sdk:environment");t&&n&&i&&(a===this.environment.NAME||!a)?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new Ct(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):h(this,ht,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},At=function(){return m(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=u(e),this.walletAddress}catch(e){throw new R(`Failed to connect wallet: ${k(e)}`)}}))},It=function(){return m(this,void 0,void 0,(function*(){try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();if(200!==e.status)throw new P(t.message||`Failed to fetch nonce (HTTP ${e.status})`,e.status);return t.data}catch(e){if(e instanceof P)throw e;throw new P(`Failed to fetch nonce: ${k(e)}`)}}))},bt=function(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],s=JSON.parse(atob(a));return{success:!i.isError,userId:s.id,token:i.data}}catch(e){throw new P(`Failed to verify signature: ${k(e)}`)}}))},gt=function(e,t,n){return y({domain:t||(h(this,ht,"f")?"localhost":window.location.host),address:this.walletAddress,statement:L,uri:n||(h(this,ht,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})};export{Et as Auth,I as BrowserStorage,w as CustomSignerAdapter,ke as DataStatus,De as DisputeStatus,v as EthersSignerAdapter,xe as LicenseType,b as MemoryStorage,Ct as Origin,f as ViemSignerAdapter,E as campMainnet,C as campTestnet,Ne as createLicenseTerms,g as createNodeWalletClient,A as createSignerAdapter,Ie as decodeCidFromBytes32,Ae as encodeCidToBytes32};
|