@campnetwork/origin 1.4.0-alpha.3 → 1.4.0-alpha.5

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.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,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";
1
+ import{createWalletClient as e,http as t,custom as n,createPublicClient as i,zeroAddress as a,erc20Abi as s,getAbiItem as r,formatEther as o,formatUnits as d,encodeFunctionData as p,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
 
@@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */function m(e,t,n,i){return new(n||(n=Promise))((function(a,s){function r(e){try{p(i.next(e))}catch(e){s(e)}}function o(e){try{p(i.throw(e))}catch(e){s(e)}}function p(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,o)}p((i=i.apply(e,t||[])).next())}))}function h(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function T(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;
16
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */function m(e,t,n,i){return new(n||(n=Promise))((function(a,s){function r(e){try{d(i.next(e))}catch(e){s(e)}}function o(e){try{d(i.throw(e))}catch(e){s(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,o)}d((i=i.apply(e,t||[])).next())}))}function h(e,t,n,i){if("a"===n&&!i)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===n?i:"a"===n?i.call(e):i?i.value:t.get(e)}function T(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?a.call(e,n):a?a.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;
17
17
  /**
18
18
  * Adapter for viem WalletClient
19
19
  */
@@ -38,38 +38,38 @@ return"function"==typeof this.signer.getChainId?yield this.signer.getChainId():4
38
38
  }))}}
39
39
  /**
40
40
  * Factory function to create appropriate adapter based on signer type
41
- */function A(e){
41
+ */function I(e){
42
42
  // Check for viem WalletClient
43
43
  return e.transport&&e.chain&&"function"==typeof e.signMessage?new f(e):
44
44
  // Check for ethers signer (v5 or v6)
45
45
  e._isSigner||e.provider&&"function"==typeof e.signMessage?new v(e):new w(e)}
46
46
  /**
47
47
  * Browser localStorage adapter
48
- */class I{getItem(e){return m(this,void 0,void 0,(function*(){return"undefined"==typeof localStorage?null:localStorage.getItem(e)}))}setItem(e,t){return m(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}))}removeItem(e){return m(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.removeItem(e)}))}}
48
+ */class A{getItem(e){return m(this,void 0,void 0,(function*(){return"undefined"==typeof localStorage?null:localStorage.getItem(e)}))}setItem(e,t){return m(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}))}removeItem(e){return m(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.removeItem(e)}))}}
49
49
  /**
50
50
  * In-memory storage adapter for Node.js
51
- */class b{constructor(){this.storage=new Map}getItem(e){return m(this,void 0,void 0,(function*(){return this.storage.get(e)||null}))}setItem(e,t){return m(this,void 0,void 0,(function*(){this.storage.set(e,t)}))}removeItem(e){return m(this,void 0,void 0,(function*(){this.storage.delete(e)}))}clear(){this.storage.clear()}}
51
+ */class g{constructor(){this.storage=new Map}getItem(e){return m(this,void 0,void 0,(function*(){return this.storage.get(e)||null}))}setItem(e,t){return m(this,void 0,void 0,(function*(){this.storage.set(e,t)}))}removeItem(e){return m(this,void 0,void 0,(function*(){this.storage.delete(e)}))}clear(){this.storage.clear()}}
52
52
  /**
53
53
  * Create a wallet client for Node.js environment
54
54
  * @param account The viem account
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 _ 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)}}
58
+ */function b(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 k 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 R 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 x(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 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",
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 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:[{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"}],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:[],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"}],j=[{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"}],V=[{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=20971520,q=2628e3,J=86400,Y=1e15,W=1,K=1e4;const G={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:F,MARKETPLACE_ABI:O,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,APP_REGISTRY_ABI:j,IP_ROYALTY_VAULT_FACTORY_ABI:V},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: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
62
+ IP_ROYALTY_VAULT_FACTORY_CONTRACT_ADDRESS:"",APP_REGISTRY_CONTRACT_ADDRESS:"0xd09F15aA280F9109aCd403cA920e67D40Cb6C3FA",CHAIN:E,IPNFT_ABI:F,MARKETPLACE_ABI:O,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,APP_REGISTRY_ABI:j,IP_ROYALTY_VAULT_FACTORY_ABI:V}};let Q=[];const X=()=>Q,Z=e=>{function t(t){Q.some((e=>e.info.uuid===t.detail.info.uuid))||(Q=[...Q,t.detail],e(Q))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)},ee=(e,t,n)=>{const i=[];let a=[],s=!1,r=0;const o=e.length;return new Promise(((d,p)=>{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
- Z.abort=()=>{s=!0,c.isCancel("Upload aborted")},u(),// Initial 0%
66
- function(){return m(this,void 0,void 0,(function*(){const n=[];for(let p=0;p<o&&!s;p++){const s=(()=>m(this,void 0,void 0,(function*(){try{if(a.includes(p))return;const n=yield l(e[p],t[p],p+1);i.push(n),r++,u()}catch(e){if(console.error(`Part ${p+1} failed:`,e),a.push(p),a.length>.1*o)
65
+ ee.abort=()=>{s=!0,c.isCancel("Upload aborted")},u(),// Initial 0%
66
+ function(){return m(this,void 0,void 0,(function*(){const n=[];for(let d=0;d<o&&!s;d++){const s=(()=>m(this,void 0,void 0,(function*(){try{if(a.includes(d))return;const n=yield l(e[d],t[d],d+1);i.push(n),r++,u()}catch(e){if(console.error(`Part ${d+1} failed:`,e),a.push(d),a.length>.1*o)
67
67
  // Fail fast if >10% fail
68
68
  throw e}})))();n.push(s),
69
69
  // Limit concurrency
70
70
  n.length>=4&&(yield Promise.race(n),
71
71
  // Remove settled promises to continue
72
- n.splice(0,n.length,...(yield Promise.allSettled(n)).map(((e,t)=>n[t])).filter(Boolean)))}yield Promise.allSettled(n),s?d(new Error("Upload aborted by user")):a.length>0?d(new Error(`Failed to upload ${a.length}/${o} parts: ${a.join(", ")}`)):(i.sort(((e,t)=>e.PartNumber-t.PartNumber)),p(i))}))}().catch(d)}))};
72
+ n.splice(0,n.length,...(yield Promise.allSettled(n)).map(((e,t)=>n[t])).filter(Boolean)))}yield Promise.allSettled(n),s?p(new Error("Upload aborted by user")):a.length>0?p(new Error(`Failed to upload ${a.length}/${o} parts: ${a.join(", ")}`)):(i.sort(((e,t)=>e.PartNumber-t.PartNumber)),d(i))}))}().catch(p)}))};
73
73
  /**
74
74
  * Uploads chunks to respective presigned URLs with progress tracking.
75
75
  * Falls back to a simple fetch request if XMLHttpRequest is not available.
@@ -92,9 +92,9 @@ n.splice(0,n.length,...(yield Promise.allSettled(n)).map(((e,t)=>n[t])).filter(B
92
92
  * @param appId Optional app ID for the minting operation.
93
93
  * @returns A promise that resolves when the minting is complete.
94
94
  */
95
- function ee(e,t,n,i,a,s,r,o,p,d){return m(this,void 0,void 0,(function*(){var u;
95
+ function te(e,t,n,i,a,s,r,o,d,p){return m(this,void 0,void 0,(function*(){var u;
96
96
  // use provided appId, else use instance appId, else default to empty string
97
- const l=null!==(u=null!=d?d:this.appId)&&void 0!==u?u:"";return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,a,s,r,o,n,i,l,p],{waitForReceipt:!0})}))}
97
+ const l=null!==(u=null!=p?p:this.appId)&&void 0!==u?u:"";return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,a,s,r,o,n,i,l,d],{waitForReceipt:!0})}))}
98
98
  /**
99
99
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
100
100
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -104,38 +104,38 @@ const l=null!==(u=null!=d?d:this.appId)&&void 0!==u?u:"";return yield this.callC
104
104
  * @param fileKey The file key(s) if the source is "file".
105
105
  * @param parents The IDs of the parent NFTs, if applicable.
106
106
  * @return A promise that resolves with the registration data.
107
- */function te(e,t,n,i,a,s,r,o){return m(this,void 0,void 0,(function*(){var p;const d=null!==(p=null!=o?o:this.appId)&&void 0!==p?p:"",u={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken,licenseType:n.licenseType},appId:d,isIp:a,metadata:i,parentId:r?r.map((e=>e.toString())):[]};void 0!==s&&(u.fileKey=s);const l=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(u)}),y=yield l.json();if(y.isError)throw new Error(`Failed to get signature: ${y.message}`);if(!l.ok)throw new Error(`Failed to get signature: ${l.statusText}`);return y.data}))}
107
+ */function ne(e,t,n,i,a,s,r,o){return m(this,void 0,void 0,(function*(){var d;const p=null!==(d=null!=o?o:this.appId)&&void 0!==d?d:"",u={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken,licenseType:n.licenseType},appId:p,isIp:a,metadata:i,parentId:r?r.map((e=>e.toString())):[]};void 0!==s&&(u.fileKey=s);const l=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(u)}),y=yield l.json();if(y.isError)throw new Error(`Failed to get signature: ${y.message}`);if(!l.ok)throw new Error(`Failed to get signature: ${l.statusText}`);return y.data}))}
108
108
  /**
109
109
  * Updates the license terms of a specified IPNFT.
110
110
  * @param tokenId The ID of the IPNFT to update.
111
111
  * @param newTerms The new license terms to set.
112
112
  * @returns A promise that resolves when the transaction is complete.
113
- */function ne(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
113
+ */function ie(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
114
114
  /**
115
115
  * Sets the IPNFT as deleted
116
116
  * @param tokenId The token ID to set as deleted.
117
117
  * @returns A promise that resolves when the transaction is complete.
118
- */function ie(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
118
+ */function ae(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
119
119
  /**
120
120
  * Returns the license terms associated with a specific token ID.
121
121
  * @param tokenId The token ID to query.
122
122
  * @returns The license terms of the token ID.
123
- */function ae(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
123
+ */function se(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
124
124
  /**
125
125
  * Returns the owner of the specified IPNFT.
126
126
  * @param tokenId The ID of the IPNFT to query.
127
127
  * @returns The address of the owner of the IPNFT.
128
- */function se(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
128
+ */function re(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
129
129
  /**
130
130
  * Returns the number of IPNFTs owned by the given address.
131
131
  * @param owner The address to query.
132
132
  * @returns The number of IPNFTs owned by the address.
133
- */function re(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
133
+ */function oe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
134
134
  /**
135
135
  * Returns the metadata URI associated with a specific token ID.
136
136
  * @param tokenId The token ID to query.
137
137
  * @returns The metadata URI of the token ID.
138
- */function oe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
138
+ */function de(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
139
139
  /**
140
140
  * Returns the data status of the given token ID.
141
141
  * @param tokenId The token ID to query.
@@ -146,7 +146,7 @@ const l=null!==(u=null!=d?d:this.appId)&&void 0!==u?u:"";return yield this.callC
146
146
  * @param owner The address of the asset owner.
147
147
  * @param operator The address of the operator to check.
148
148
  * @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
149
- */function de(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function ue(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function le(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"safeTransferFrom",a)}function ye(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function ce(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
149
+ */function ue(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function le(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function ye(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"safeTransferFrom",a)}function ce(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function me(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
150
150
  /**
151
151
  * Buys access to a data NFT for a specified duration.
152
152
  * @param buyer The address of the buyer.
@@ -158,13 +158,13 @@ const l=null!==(u=null!=d?d:this.appId)&&void 0!==u?u:"";return yield this.callC
158
158
  * @param expectedAppFeeBps The expected app fee in basis points (0-10000). Defaults to 0.
159
159
  * @param value The amount of native token to send (only required if paying with native token).
160
160
  * @returns A promise that resolves when the transaction is confirmed.
161
- */function me(e,t,n,i,a,s=0,r=0,o){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,a,s,r],{waitForReceipt:!0,value:o})}
161
+ */function he(e,t,n,i,a,s=0,r=0,o){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,a,s,r],{waitForReceipt:!0,value:o})}
162
162
  /**
163
163
  * Checks if a user has access to a specific token based on subscription expiry.
164
164
  * @param user - The address of the user.
165
165
  * @param tokenId - The ID of the token.
166
166
  * @returns A promise that resolves to a boolean indicating if the user has access.
167
- */function he(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield this.subscriptionExpiry(t,e);return n>BigInt(Math.floor(Date.now()/1e3))}catch(e){return!1}}))}function Te(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
167
+ */function Te(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield this.subscriptionExpiry(t,e);return n>BigInt(Math.floor(Date.now()/1e3))}catch(e){return!1}}))}function fe(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
168
168
  /**
169
169
  * Raises a dispute against an IP NFT.
170
170
  * Automatically handles token approval for ERC20 bonds or native token value.
@@ -183,20 +183,20 @@ 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=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;
186
+ */function ve(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,d,p]=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=p===a,l=o+d;
187
187
  // Call the raiseDispute contract method
188
188
  // Pass the total (bond + protocol fee) as msg.value if using native token
189
- return u||(yield this.approveERC20IfNeeded(d,s,l)),this.callContractMethod(s,r,"raiseDispute",[e,t,n],{waitForReceipt:!0,value:u?l:void 0})}))}
189
+ return u||(yield this.approveERC20IfNeeded(p,s,l)),this.callContractMethod(s,r,"raiseDispute",[e,t,n],{waitForReceipt:!0,value:u?l:void 0})}))}
190
190
  // base-x encoding / decoding
191
191
  // Copyright (c) 2018 base-x contributors
192
192
  // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
193
193
  // Distributed under the MIT software license, see the accompanying
194
194
  // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
195
- var ve=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const i=e.charAt(n),a=i.charCodeAt(0);if(255!==t[a])throw new TypeError(i+" is ambiguous");t[a]=n}const n=e.length,i=e.charAt(0),a=Math.log(n)/Math.log(256),s=Math.log(256)/Math.log(n);function r(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let s=0,r=0,o=0;
195
+ var we=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){const i=e.charAt(n),a=i.charCodeAt(0);if(255!==t[a])throw new TypeError(i+" is ambiguous");t[a]=n}const n=e.length,i=e.charAt(0),a=Math.log(n)/Math.log(256),s=Math.log(256)/Math.log(n);function r(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;let s=0,r=0,o=0;
196
196
  // Skip and count leading '1's.
197
197
  for(;e[s]===i;)r++,s++;
198
198
  // Allocate enough space in big-endian base256 representation.
199
- const p=(e.length-s)*a+1>>>0,d=new Uint8Array(p);// log(58) / log(256), rounded up.
199
+ const d=(e.length-s)*a+1>>>0,p=new Uint8Array(d);// log(58) / log(256), rounded up.
200
200
  // Process the characters.
201
201
  for(;s<e.length;){
202
202
  // Find code of next character
@@ -206,35 +206,35 @@ if(i>255)return;
206
206
  // Decode character
207
207
  let a=t[i];
208
208
  // Invalid character
209
- if(255===a)return;let r=0;for(let e=p-1;(0!==a||r<o)&&-1!==e;e--,r++)a+=n*d[e]>>>0,d[e]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");o=r,s++}
209
+ if(255===a)return;let r=0;for(let e=d-1;(0!==a||r<o)&&-1!==e;e--,r++)a+=n*p[e]>>>0,p[e]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");o=r,s++}
210
210
  // Skip leading zeroes in b256.
211
- let u=p-o;for(;u!==p&&0===d[u];)u++;const l=new Uint8Array(r+(p-u));let y=r;for(;u!==p;)l[y++]=d[u++];return l}return{encode:// log(256) / log(BASE), rounded up
211
+ let u=d-o;for(;u!==d&&0===p[u];)u++;const l=new Uint8Array(r+(d-u));let y=r;for(;u!==d;)l[y++]=p[u++];return l}return{encode:// log(256) / log(BASE), rounded up
212
212
  function(t){if(
213
213
  // eslint-disable-next-line no-empty
214
214
  t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";
215
215
  // Skip & count leading zeroes.
216
- let a=0,r=0,o=0;const p=t.length;for(;o!==p&&0===t[o];)o++,a++;
216
+ let a=0,r=0,o=0;const d=t.length;for(;o!==d&&0===t[o];)o++,a++;
217
217
  // Allocate enough space in big-endian base58 representation.
218
- const d=(p-o)*s+1>>>0,u=new Uint8Array(d);
218
+ const p=(d-o)*s+1>>>0,u=new Uint8Array(p);
219
219
  // Process the bytes.
220
- for(;o!==p;){let e=t[o],i=0;
220
+ for(;o!==d;){let e=t[o],i=0;
221
221
  // Apply "b58 = b58 * 256 + ch".
222
- for(let t=d-1;(0!==e||i<r)&&-1!==t;t--,i++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");r=i,o++}
222
+ for(let t=p-1;(0!==e||i<r)&&-1!==t;t--,i++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");r=i,o++}
223
223
  // Skip leading zeroes in base58 result.
224
- let l=d-r;for(;l!==d&&0===u[l];)l++;
224
+ let l=p-r;for(;l!==p&&0===u[l];)l++;
225
225
  // Translate the result into a string.
226
- let y=i.repeat(a);for(;l<d;++l)y+=e.charAt(u[l]);return y},decodeUnsafe:r,decode:function(e){const t=r(e);if(t)return t;throw new Error("Non-base"+n+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
226
+ let y=i.repeat(a);for(;l<p;++l)y+=e.charAt(u[l]);return y},decodeUnsafe:r,decode:function(e){const t=r(e);if(t)return t;throw new Error("Non-base"+n+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
227
227
  // RFC 4648 base32 alphabet (lowercase)
228
- const we="abcdefghijklmnopqrstuvwxyz234567";
228
+ const Ie="abcdefghijklmnopqrstuvwxyz234567";
229
229
  /**
230
230
  * Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
231
231
  * Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
232
232
  */
233
233
  function Ae(e){let t;if(e.startsWith("Qm")){
234
234
  // CIDv0: base58-encoded multihash (0x1220 + 32-byte digest)
235
- const n=ve.decode(e);if(18!==n[0]||32!==n[1]||34!==n.length)throw new Error("Invalid CIDv0: expected SHA-256 multihash");t=n.slice(2)}else{if(!e.startsWith("b"))throw new Error("Unsupported CID format: must start with 'Qm' or 'b'");{
235
+ const n=we.decode(e);if(18!==n[0]||32!==n[1]||34!==n.length)throw new Error("Invalid CIDv0: expected SHA-256 multihash");t=n.slice(2)}else{if(!e.startsWith("b"))throw new Error("Unsupported CID format: must start with 'Qm' or 'b'");{
236
236
  // CIDv1: multibase 'b' prefix + base32-encoded (version + codec + multihash)
237
- const n=function(e){const t={};for(let e=0;e<32;e++)t[we[e]]=e;let n=0,i=0;const a=[];for(const s of e.toLowerCase()){if(!(s in t))throw new Error(`Invalid base32 character: ${s}`);i=i<<5|t[s],n+=5,n>=8&&(n-=8,a.push(i>>n&255))}return new Uint8Array(a)}(e.slice(1));
237
+ const n=function(e){const t={};for(let e=0;e<32;e++)t[Ie[e]]=e;let n=0,i=0;const a=[];for(const s of e.toLowerCase()){if(!(s in t))throw new Error(`Invalid base32 character: ${s}`);i=i<<5|t[s],n+=5,n>=8&&(n-=8,a.push(i>>n&255))}return new Uint8Array(a)}(e.slice(1));
238
238
  // CIDv1 structure: version (1 byte) + codec (varint) + multihash
239
239
  // For raw codec with sha2-256: 0x01 + 0x55 + 0x12 + 0x20 + 32-byte digest
240
240
  // For dag-pb with sha2-256: 0x01 + 0x70 + 0x12 + 0x20 + 32-byte digest
@@ -242,7 +242,7 @@ if(1!==n[0]||36!==n.length)throw new Error("Invalid CIDv1: expected version 1 wi
242
242
  /**
243
243
  * Decode bytes32 back to CIDv1 format (base32, raw codec).
244
244
  * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
245
- */function Ie(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
245
+ */function ge(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
246
246
  // Build CIDv1: version (0x01) + raw codec (0x55) + sha2-256 (0x12) + length (0x20) + digest
247
247
  const n=new Uint8Array(36);
248
248
  // Encode with base32 and add 'b' multibase prefix
@@ -250,7 +250,7 @@ return n[0]=1,// CIDv1
250
250
  n[1]=85,// raw codec (used by Pinata for raw data uploads like JSON)
251
251
  n[2]=18,// sha2-256 hash function
252
252
  n[3]=32,// 32 byte length
253
- 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>=5;)n-=5,t+=we[i>>n&31];return n>0&&(t+=we[i<<5-n&31]),t}(n)}
253
+ 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>=5;)n-=5,t+=Ie[i>>n&31];return n>0&&(t+=Ie[i<<5-n&31]),t}(n)}
254
254
  /**
255
255
  * Raises a dispute with automatic evidence upload to IPFS.
256
256
  * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
@@ -292,7 +292,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
292
292
  * ```typescript
293
293
  * await origin.disputeAssertion(1n, "0x1234..."); // counter-evidence hash
294
294
  * ```
295
- */function ge(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"disputeAssertion",[e,t],{waitForReceipt:!0})}))}
295
+ */function Ce(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"disputeAssertion",[e,t],{waitForReceipt:!0})}))}
296
296
  /**
297
297
  * Asserts a dispute with automatic counter-evidence upload to IPFS.
298
298
  * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
@@ -321,7 +321,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
321
321
  * // Fetch counter-evidence via IPFS gateway
322
322
  * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
323
323
  * ```
324
- */function Ce(e,t){return m(this,void 0,void 0,(function*(){const n=yield this.uploadJSONToIPFS(t),i=Ae(n);return{transactionResult:yield this.disputeAssertion(e,i),counterEvidenceCid:n,counterEvidenceHash:i}}))}
324
+ */function Ee(e,t){return m(this,void 0,void 0,(function*(){const n=yield this.uploadJSONToIPFS(t),i=Ae(n);return{transactionResult:yield this.disputeAssertion(e,i),counterEvidenceCid:n,counterEvidenceHash:i}}))}
325
325
  /**
326
326
  * Votes on a dispute as a CAMP token staker.
327
327
  * Only users who staked before the dispute was raised can vote.
@@ -339,7 +339,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
339
339
  * // Vote against the dispute
340
340
  * await origin.voteOnDispute(1n, false);
341
341
  * ```
342
- */function Ee(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"voteOnDispute",[e,t],{waitForReceipt:!0})}))}
342
+ */function Pe(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"voteOnDispute",[e,t],{waitForReceipt:!0})}))}
343
343
  /**
344
344
  * Resolves a dispute after the voting period has ended.
345
345
  * Can be called by anyone - resolution is deterministic based on votes and quorum.
@@ -353,7 +353,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
353
353
  * ```typescript
354
354
  * await origin.resolveDispute(1n);
355
355
  * ```
356
- */function Pe(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"resolveDispute",[e],{waitForReceipt:!0})}))}
356
+ */function Se(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"resolveDispute",[e],{waitForReceipt:!0})}))}
357
357
  /**
358
358
  * Cancels a dispute that is still in the raised state.
359
359
  * Can only be called by the dispute initiator during the cooldown period.
@@ -366,7 +366,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
366
366
  * ```typescript
367
367
  * await origin.cancelDispute(1n);
368
368
  * ```
369
- */function Se(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"cancelDispute",[e],{waitForReceipt:!0})}))}
369
+ */function _e(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"cancelDispute",[e],{waitForReceipt:!0})}))}
370
370
  /**
371
371
  * Tags a child IP as disputed if its parent has been successfully disputed.
372
372
  * This propagates the dispute status to derivative IPs.
@@ -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 _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})}))}
383
+ */function ke(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,9 +394,9 @@ 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 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;
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,d,p,u,l,y,c]=t;
398
398
  // Contract returns a tuple, map it to the Dispute interface
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}}))}
399
+ return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidenceHash:r,disputeTimestamp:o,assertionTimestamp:d,yesVotes:p,noVotes:u,status:l,bondAmount:y,protocolFeeAmount:c}}))}
400
400
  /**
401
401
  * Resolves a wallet address from an optional address parameter or connected wallet.
402
402
  * Checks viemClient.account first, then falls back to eth_requestAccounts.
@@ -412,7 +412,7 @@ return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidence
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
+ var xe,De,Ne;!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"}(De||(De={})),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"}(Ne||(Ne={}));
416
416
  /**
417
417
  * Creates license terms for a digital asset.
418
418
  * @param price The price of the asset in wei.
@@ -422,7 +422,7 @@ var xe,ke,De;!function(e){e[e.DURATION_BASED=0]="DURATION_BASED",e[e.SINGLE_PAYM
422
422
  * @param licenseType The type of license (defaults to DURATION_BASED).
423
423
  * @returns The created license terms.
424
424
  */
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
+ const Me=(e,t,n,i,a=xe.DURATION_BASED)=>{if(n<W||n>K)throw new Error(`Royalty basis points must be between ${W} and ${K}`);if(a===xe.DURATION_BASED){if(t<J||t>q)throw new Error(`Duration must be between ${J} and ${q} 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<Y)throw new Error(`Price must be at least ${Y} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i,licenseType:a}},Be=[{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"}];
426
426
  // minimal ABI for staking vault
427
427
  /**
428
428
  * Checks if a user meets the requirements to vote on a dispute.
@@ -444,15 +444,15 @@ const Ne=(e,t,n,i,a=xe.DURATION_BASED)=>{if(n<Y||n>G)throw new Error(`Royalty ba
444
444
  * }
445
445
  * ```
446
446
  */
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
+ function Fe(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,d,p,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:Be,functionName:"userStakeTimestamp",args:[n]}),i.readContract({address:o,abi:Be,functionName:"balanceOf",args:[n]})]),v=BigInt(Math.floor(Date.now()/1e3));let w,I=!1;y===Ne.Asserted?(
448
448
  // for asserted disputes, voting period is relative to assertion timestamp
449
- w=h+u,A=v<=w):y===De.Raised&&(
449
+ w=h+u,I=v<=w):y===Ne.Raised&&(
450
450
  // for raised disputes, voting period extends from cooldown through judgement
451
- w=c+d+u,A=v<=w);
451
+ w=c+p+u,I=v<=w);
452
452
  // build base result
453
- const I={canVote:!1,votingWeight:f,stakingThreshold:p,hasAlreadyVoted:l,userStakeTimestamp:T,disputeTimestamp:c,disputeStatus:y,isVotingPeriodActive:A};
453
+ const A={canVote:!1,votingWeight:f,stakingThreshold:d,hasAlreadyVoted:l,userStakeTimestamp:T,disputeTimestamp:c,disputeStatus:y,isVotingPeriodActive:I};
454
454
  // check all requirements
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
+ return y!==Ne.Raised&&y!==Ne.Asserted?Object.assign(Object.assign({},A),{reason:`Dispute is not in a voteable status (current: ${Ne[y]})`}):I?l?Object.assign(Object.assign({},A),{reason:"You have already voted on this dispute"}):T===BigInt(0)?Object.assign(Object.assign({},A),{reason:"You have never staked CAMP tokens"}):T>=c?Object.assign(Object.assign({},A),{reason:"You staked after this dispute was raised (vote recycling prevention)"}):f<d?Object.assign(Object.assign({},A),{reason:`Insufficient stake: you have ${f} but need at least ${d}`}):Object.assign(Object.assign({},A),{canVote:!0}):Object.assign(Object.assign({},A),{reason:"Voting period has ended"})}))}
456
456
  /**
457
457
  * Gets detailed progress and voting statistics for a dispute.
458
458
  * Includes vote counts, percentages, quorum progress, and timeline.
@@ -474,17 +474,17 @@ return y!==De.Raised&&y!==De.Asserted?Object.assign(Object.assign({},I),{reason:
474
474
  * console.log(`Can resolve in ${progress.timeline.timeUntilResolution} seconds`);
475
475
  * }
476
476
  * ```
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
+ */function Oe(e){return m(this,void 0,void 0,(function*(){var t,n,i,a,s,r,o,d,p;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),I=BigInt(null!==(o=null!==(r=c.yesVotes)&&void 0!==r?r:c[7])&&void 0!==o?o:0),A=BigInt(null!==(p=null!==(d=c.noVotes)&&void 0!==d?d:c[8])&&void 0!==p?p:0),g=I+A;let b=0,C=0;g>BigInt(0)&&(b=Number(I*BigInt(1e4)/g)/100,C=Number(A*BigInt(1e4)/g)/100);
478
478
  // calculate quorum progress
479
- let E=0;m>BigInt(0)&&(E=Number(b*BigInt(1e4)/m)/100);const P=b>=m;
479
+ let E=0;m>BigInt(0)&&(E=Number(g*BigInt(1e4)/m)/100);const P=g>=m;
480
480
  // determine projected outcome
481
- let S;S=P?A>I?"dispute_succeeds":"dispute_fails":"no_quorum";
481
+ let S;S=P?I>A?"dispute_succeeds":"dispute_fails":"no_quorum";
482
482
  // calculate timeline
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
+ const _=BigInt(Math.floor(Date.now()/1e3)),k=new Date(1e3*Number(v)),R=new Date(1e3*Number(v+h));let x,D;f===Ne.Asserted?(
484
484
  // for asserted disputes, voting ends relative to assertion
485
- k=new Date(1e3*Number(w+T)),D=w+T):(
485
+ x=new Date(1e3*Number(w+T)),D=w+T):(
486
486
  // for raised disputes, voting ends after cooldown + judgement
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
+ x=new Date(1e3*Number(v+h+T)),D=v+h+T);const N=(f===Ne.Raised||f===Ne.Asserted)&&_>D,M=N?0:Number(D-_);return{disputeId:e,status:f,yesVotes:I,noVotes:A,totalVotes:g,yesPercentage:b,noPercentage:C,quorum:m,quorumPercentage:E,quorumMet:P,projectedOutcome:S,timeline:{raisedAt:k,cooldownEndsAt:R,votingEndsAt:x,canResolveNow:N,timeUntilResolution:M}}}))}
488
488
  /**
489
489
  * Gets the requirements for raising a dispute, including balance check.
490
490
  *
@@ -498,72 +498,72 @@ k=new Date(1e3*Number(v+h+T)),D=v+h+T);const N=(f===De.Raised||f===De.Asserted)&
498
498
  * console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
499
499
  * }
500
500
  * ```
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
+ */function Ue(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,d]=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"})]),p=d===a,u=r+o;
502
502
  // Get user's balance
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
+ let l;return l=p?yield t.getBalance({address:e}):yield t.readContract({address:d,abi:s,functionName:"balanceOf",args:[e]}),{bondAmount:r,protocolFee:o,totalRequired:u,tokenAddress:d,isNativeToken:p,userBalance:l,hasSufficientBalance:l>=u}}))}
504
504
  /**
505
505
  * Gets the royalty vault address for a given token ID.
506
506
  * Returns null if no vault has been deployed yet.
507
507
  *
508
508
  * @param tokenId The token ID to look up.
509
509
  * @returns The vault address, or null if no vault exists.
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
+ */function $e(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}))}
511
511
  /**
512
512
  * Gets the list of revenue token addresses that have accumulated in a token's vault.
513
513
  *
514
514
  * @param tokenId The token ID to look up.
515
515
  * @returns An array of ERC20 token addresses with revenue in the vault.
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
+ */function He(e){return m(this,void 0,void 0,(function*(){return(yield this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"getVaultRevenueTokens",[e]))||[]}))}
517
517
  /**
518
518
  * Returns the amount of revenue claimable by a holder for a given token and revenue token.
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
+ * If no holder is provided, the connected wallet address is used,
520
+ * since RT tokens are sent directly to the wallet.
521
521
  *
522
522
  * @param tokenId The token ID whose vault to query.
523
523
  * @param revenueToken The ERC20 revenue token address.
524
- * @param holder Optional holder address. Defaults to the NFT's TBA.
524
+ * @param holder Optional holder address. Defaults to the connected wallet.
525
525
  * @returns The claimable amount in the revenue token's smallest unit.
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])}))}
526
+ */function je(e,t,n){return m(this,void 0,void 0,(function*(){const i=n||(yield this.getWalletAddress());return yield this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"claimableRevenue",[e,i,t])}))}
527
527
  /**
528
528
  * Claims accumulated revenue for a token from a specific revenue token.
529
- * Executes the claim through the NFT's Token Bound Account (TBA),
530
- * since the TBA holds the Royalty Tokens.
529
+ * The connected wallet must hold Royalty Tokens for the given token.
530
+ * Revenue is sent directly to the connected wallet.
531
531
  *
532
532
  * @param tokenId The token ID whose vault to claim from.
533
533
  * @param revenueToken The ERC20 revenue token address to claim.
534
534
  * @returns The transaction result.
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)})}))}
535
+ */function Ve(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"claimRevenue",[e,t],{waitForReceipt:!0})}))}
536
536
  /**
537
537
  * Claims accumulated revenue for a token from multiple revenue tokens in a single transaction.
538
- * Executes the claim through the NFT's Token Bound Account (TBA),
539
- * since the TBA holds the Royalty Tokens.
538
+ * The connected wallet must hold Royalty Tokens for the given token.
539
+ * Revenue is sent directly to the connected wallet.
540
540
  *
541
541
  * @param tokenId The token ID whose vault to claim from.
542
542
  * @param revenueTokens Array of ERC20 revenue token addresses to claim.
543
543
  * @returns The transaction result.
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)})}))}
544
+ */function Le(e,t){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"claimRevenueBatch",[e,t],{waitForReceipt:!0})}))}
545
545
  /**
546
546
  * Deploys a new royalty vault for an existing NFT that was minted before the vault system.
547
547
  * This is used to migrate old NFTs to the new royalty vault system.
548
548
  *
549
549
  * @param tokenId The token ID to deploy a vault for.
550
550
  * @returns The transaction result including the new vault address.
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"}];
551
+ */function ze(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 qe=[{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"}];
552
552
  /**
553
553
  * Gets the Royalty Token balance for a holder in a token's vault.
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.
554
+ * If no holder is provided, the connected wallet address is used,
555
+ * since RT tokens are sent directly to the wallet.
556
556
  *
557
557
  * @param tokenId The token ID whose vault to query.
558
- * @param holder Optional holder address. Defaults to the NFT's TBA.
558
+ * @param holder Optional holder address. Defaults to the connected wallet.
559
559
  * @returns The royalty token balance info including vault address, balance, total supply, percentage, and decimals.
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]);
560
+ */function Je(e,t){return m(this,void 0,void 0,(function*(){
561
+ // Default to the connected wallet, since RT tokens are sent there directly
562
+ const n=t||(yield this.getWalletAddress()),i=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getRoyaltyVault",[e]);
563
563
  // Get vault address
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"})]);
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,d]=yield Promise.all([s.readContract({address:i,abi:qe,functionName:"balanceOf",args:[n]}),s.readContract({address:i,abi:qe,functionName:"totalSupply"}),s.readContract({address:i,abi:qe,functionName:"decimals"})]);
565
565
  // Read balance, totalSupply, and decimals in parallel
566
- return{vaultAddress:i,balance:r,totalSupply:o,percentage:o>BigInt(0)?Number(r*BigInt(1e4)/o)/100:0,decimals:Number(p)}}))}
566
+ return{vaultAddress:i,balance:r,totalSupply:o,percentage:o>BigInt(0)?Number(r*BigInt(1e4)/o)/100:0,decimals:Number(d)}}))}
567
567
  /**
568
568
  * Gets information about a registered app from the AppRegistry.
569
569
  *
@@ -577,15 +577,15 @@ return{vaultAddress:i,balance:r,totalSupply:o,percentage:o>BigInt(0)?Number(r*Bi
577
577
  * console.log(`Revenue Share: ${appInfo.revenueShareBps / 100}%`);
578
578
  * console.log(`Active: ${appInfo.isActive}`);
579
579
  * ```
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])}))}
580
+ */function Ye(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])}))}
581
581
  /**
582
582
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
583
583
  * If the current allowance is less than the specified amount, it will perform the approval.
584
584
  * Waits for the approval transaction to be confirmed before returning.
585
585
  * @param {ApproveParams} params - The parameters for the approval.
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});
586
+ */function We(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 d=yield e.writeContract({address:n,account:i,abi:s,functionName:"approve",args:[a,r],chain:o});
587
587
  // Wait for the approval transaction to be confirmed with extra confirmations
588
- yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e=>setTimeout(e,1e3)))}}))}
588
+ yield t.waitForTransactionReceipt({hash:d,confirmations:2}),yield new Promise((e=>setTimeout(e,1e3)))}}))}
589
589
  /**
590
590
  * Executes an atomic bulk purchase of multiple IP-NFT licenses.
591
591
  * All purchases succeed or all fail together.
@@ -604,7 +604,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
604
604
  * const totalValue = 3000000000000000n;
605
605
  * await origin.bulkBuyAccess(buyerAddress, purchases, totalValue);
606
606
  * ```
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})}
607
+ */function Ke(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccess",[e,t],{waitForReceipt:!0,value:n})}
608
608
  /**
609
609
  * Executes a fault-tolerant bulk purchase of multiple IP-NFT licenses.
610
610
  * Individual purchases can fail without reverting the entire transaction.
@@ -621,7 +621,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
621
621
  * console.log(`Purchased ${result.successCount} of ${purchases.length} IPs`);
622
622
  * console.log(`Failed tokens: ${result.failedTokenIds}`);
623
623
  * ```
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})}
624
+ */function Ge(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccessTolerant",[e,t],{waitForReceipt:!0,value:n})}
625
625
  /**
626
626
  * Previews the total cost of purchasing multiple IP-NFT licenses.
627
627
  * This is a view function that doesn't require a transaction.
@@ -635,7 +635,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
635
635
  * console.log(`Total cost: ${preview.totalNativeCost} wei`);
636
636
  * console.log(`Valid tokens: ${preview.validCount}`);
637
637
  * ```
638
- */function Ke(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"previewBulkCost",[e])}
638
+ */function Qe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"previewBulkCost",[e])}
639
639
  /**
640
640
  * Builds purchase parameters for multiple tokens by fetching their current license terms.
641
641
  * This is a view function that doesn't require a transaction.
@@ -648,7 +648,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
648
648
  * const params = await origin.buildPurchaseParams([1n, 2n, 3n]);
649
649
  * await origin.bulkBuyAccess(buyer, params, totalValue);
650
650
  * ```
651
- */function Qe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"buildPurchaseParams",[e])}
651
+ */function Xe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"buildPurchaseParams",[e])}
652
652
  /**
653
653
  * Checks the active status of multiple tokens.
654
654
  *
@@ -660,7 +660,7 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
660
660
  * const activeFlags = await origin.checkActiveStatus([1n, 2n, 3n]);
661
661
  * const activeTokens = tokenIds.filter((_, i) => activeFlags[i]);
662
662
  * ```
663
- */function Xe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"checkActiveStatus",[e])}
663
+ */function Ze(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"checkActiveStatus",[e])}
664
664
  /**
665
665
  * Smart bulk purchase that automatically fetches terms and handles the entire purchase flow.
666
666
  * This is the recommended method for most use cases.
@@ -677,9 +677,9 @@ yield t.waitForTransactionReceipt({hash:p,confirmations:2}),yield new Promise((e
677
677
  * // Tolerant purchase - continue even if some fail
678
678
  * const result = await origin.bulkBuyAccessSmart([1n, 2n, 3n], { tolerant: true });
679
679
  * ```
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.");
680
+ */function et(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.");
681
681
  // Get the buyer's wallet address
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]}
682
+ const n=this.viemClient;if(!n)throw new k("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 k("No accounts found in connected wallet. Please unlock your wallet or add an account.");i=e[0]}
683
683
  // Build purchase params from on-chain data
684
684
  const s=yield this.buildPurchaseParams(e);
685
685
  // Calculate total native token cost
@@ -687,7 +687,7 @@ let r=BigInt(0);const o=[];for(const e of s)if(e.expectedPaymentToken===a)r+=e.e
687
687
  // Group ERC20 purchases by token
688
688
  const t=o.find((t=>t.token===e.expectedPaymentToken));t?t.amount+=e.expectedPrice:o.push({token:e.expectedPaymentToken,amount:e.expectedPrice})}
689
689
  // Approve ERC20 tokens if needed
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});
690
+ const d=B();for(const e of o)yield We({walletClient:n,publicClient:d,tokenAddress:e.token,owner:i,spender:this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,amount:e.amount,chain:this.environment.CHAIN});
691
691
  // Execute the purchase
692
692
  return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuyAccess(i,s,r)}))}
693
693
  /**
@@ -706,7 +706,7 @@ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuy
706
706
  * creatorContentHash: "0x...",
707
707
  * uri: "ipfs://...",
708
708
  * licenseTerms: { price: 1000n, duration: 86400, royaltyBps: 500, paymentToken: zeroAddress, licenseType: 0 },
709
- * deadline: BigInt(Date.now() + 600000),
709
+ * deadline: BigInt(Math.floor(Date.now() / 1000) + 600),
710
710
  * parents: [],
711
711
  * isIP: true,
712
712
  * appId: "myApp",
@@ -715,7 +715,7 @@ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuy
715
715
  * ];
716
716
  * await origin.bulkMint(mints);
717
717
  * ```
718
- */function et(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMint",[e],{waitForReceipt:!0})}
718
+ */function tt(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMint",[e],{waitForReceipt:!0})}
719
719
  /**
720
720
  * Executes a fault-tolerant bulk mint of multiple IP-NFTs.
721
721
  * Individual mints can fail without reverting the entire transaction.
@@ -729,50 +729,121 @@ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuy
729
729
  * console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
730
730
  * console.log(`Failed tokens: ${result.failedTokenIds}`);
731
731
  * ```
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;
732
+ */function nt(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMintTolerant",[e],{waitForReceipt:!0})}
733
+ /**
734
+ * Save IPFS credentials for large file uploads.
735
+ * Users can configure their own IPFS pinning service (Pinata, Infura, or web3.storage).
736
+ * @param credentials The IPFS credentials to save.
737
+ * @throws {APIError} If saving credentials fails.
738
+ * @example
739
+ * ```typescript
740
+ * // Save Pinata credentials
741
+ * await origin.saveIpfsCredentials({
742
+ * provider: 'pinata',
743
+ * jwt: 'your-pinata-jwt-token'
744
+ * });
745
+ *
746
+ * // Save Infura credentials
747
+ * await origin.saveIpfsCredentials({
748
+ * provider: 'infura',
749
+ * projectId: 'your-project-id',
750
+ * projectSecret: 'your-project-secret'
751
+ * });
752
+ * ```
753
+ */
754
+ function it(e){return m(this,void 0,void 0,(function*(){if(!this.jwt)throw new P("JWT token required for IPFS credentials management");
755
+ // Validate credentials before sending
756
+ !function(e){switch(e.provider){case"pinata":if(!(e.jwt||e.apiKey&&e.apiSecret))throw new S("Pinata requires either 'jwt' or both 'apiKey' and 'apiSecret'");break;case"infura":if(!e.projectId||!e.projectSecret)throw new S("Infura requires both 'projectId' and 'projectSecret'");break;case"web3storage":if(!e.token)throw new S("web3.storage requires 'token'");break;default:throw new S(`Unsupported IPFS provider: ${e.provider}`)}}(e);const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/credentials`,{method:"POST",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){const e=yield t.json().catch((()=>({})));throw new P(e.message||`Failed to save IPFS credentials (HTTP ${t.status})`,t.status)}}))}
757
+ /**
758
+ * Verify that saved IPFS credentials are valid.
759
+ * @returns Object with valid boolean and optional error message.
760
+ * @throws {APIError} If verification request fails.
761
+ */function at(){return m(this,void 0,void 0,(function*(){if(!this.jwt)throw new P("JWT token required for IPFS credentials management");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/credentials/verify`,{method:"POST",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!e.ok){if(404===e.status)return{valid:!1,error:"No IPFS credentials configured"};const t=yield e.json().catch((()=>({})));throw new P(t.message||`Failed to verify IPFS credentials (HTTP ${e.status})`,e.status)}return e.json()}))}
762
+ /**
763
+ * Delete saved IPFS credentials.
764
+ * @throws {APIError} If deletion fails.
765
+ */function st(){return m(this,void 0,void 0,(function*(){if(!this.jwt)throw new P("JWT token required for IPFS credentials management");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/credentials`,{method:"DELETE",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok){const t=yield e.json().catch((()=>({})));throw new P(t.message||`Failed to delete IPFS credentials (HTTP ${e.status})`,e.status)}}))}
766
+ /**
767
+ * Check if user has IPFS credentials configured.
768
+ * @returns True if credentials are configured, false otherwise.
769
+ */function rt(){return m(this,void 0,void 0,(function*(){var e;if(!this.jwt)return!1;try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/credentials`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!t.ok)return!1;return(null===(e=(yield t.json()).data)||void 0===e?void 0:e.hasCredentials)||!1}catch(e){return!1}}))}
770
+ /**
771
+ * Get IPFS upload config for client-side uploads.
772
+ * @returns IPFS config or null if not configured.
773
+ */function ot(){return m(this,void 0,void 0,(function*(){if(!this.jwt)return null;try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/upload-config`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return null;return(yield e.json()).data||null}catch(e){return null}}))}
774
+ /**
775
+ * Upload a file to user's IPFS pinning service.
776
+ * @param file The file to upload.
777
+ * @param config The IPFS upload config.
778
+ * @param progressCallback Optional progress callback with intermediate upload progress.
779
+ * @returns The IPFS CID of the uploaded file.
780
+ */function dt(e,t,n){return m(this,void 0,void 0,(function*(){var i,a,s,r,o,d,p,u,l,y,m,h,T,f,v,w;
781
+ // Validate file input
782
+ if(!(e&&e instanceof File))throw new S("Invalid file: must be a File object");if(0===e.size)throw new S("Cannot upload empty file");null==n||n(0);const I=n?e=>{if(e.total){const t=Math.round(e.loaded/e.total*100);n(t)}}:void 0;let A;switch(t.provider){case"pinata":{const n=new FormData;n.append("file",e);const y={};(null===(i=t.pinata)||void 0===i?void 0:i.jwt)?y.Authorization=`Bearer ${t.pinata.jwt}`:(null===(a=t.pinata)||void 0===a?void 0:a.apiKey)&&(null===(s=t.pinata)||void 0===s?void 0:s.apiSecret)&&(y.pinata_api_key=t.pinata.apiKey,y.pinata_secret_api_key=t.pinata.apiSecret);try{A=(yield c.post("https://api.pinata.cloud/pinning/pinFileToIPFS",n,{headers:y,onUploadProgress:I,timeout:6e5})).data.IpfsHash}catch(e){const t=null===(r=e.response)||void 0===r?void 0:r.status,n=(null===(p=null===(d=null===(o=e.response)||void 0===o?void 0:o.data)||void 0===d?void 0:d.error)||void 0===p?void 0:p.details)||(null===(l=null===(u=e.response)||void 0===u?void 0:u.data)||void 0===l?void 0:l.message)||e.message;throw new P(`Pinata IPFS upload failed: ${n}`,t)}break}case"infura":{if(!t.infura)throw new Error("Infura config missing");const n=new FormData;n.append("file",e);const i=btoa(`${t.infura.projectId}:${t.infura.projectSecret}`);try{A=(yield c.post(`${t.infura.endpoint}/api/v0/add`,n,{headers:{Authorization:`Basic ${i}`},onUploadProgress:I,timeout:6e5})).data.Hash}catch(e){const t=null===(y=e.response)||void 0===y?void 0:y.status,n=(null===(h=null===(m=e.response)||void 0===m?void 0:m.data)||void 0===h?void 0:h.Message)||e.message;throw new P(`Infura IPFS upload failed: ${n}`,t)}break}case"web3storage":if(!(null===(T=t.web3storage)||void 0===T?void 0:T.token))throw new Error("web3.storage config missing");try{A=(yield c.post("https://api.web3.storage/upload",e,{headers:{Authorization:`Bearer ${t.web3storage.token}`,"X-Name":e.name},onUploadProgress:I,timeout:6e5})).data.cid}catch(e){const t=null===(f=e.response)||void 0===f?void 0:f.status,n=(null===(w=null===(v=e.response)||void 0===v?void 0:v.data)||void 0===w?void 0:w.message)||e.message;throw new P(`web3.storage IPFS upload failed: ${n}`,t)}break;default:throw new S(`Unsupported IPFS provider: ${t.provider}. Supported providers: pinata, infura, web3storage`)}if(!A||"string"!=typeof A)throw new P(`IPFS upload to ${t.provider} succeeded but returned no CID`);return null==n||n(100),A}))}
783
+ /**
784
+ * Register an IPFS file with the backend after client-side upload.
785
+ * @param cid The IPFS CID of the uploaded file.
786
+ * @param fileName The original file name.
787
+ * @param fileType The file MIME type.
788
+ * @returns The registered file key.
789
+ */function pt(e,t,n){return m(this,void 0,void 0,(function*(){if(!this.jwt)throw new P("JWT token required for IPFS file registration");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/ipfs/register-file`,{method:"POST",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({cid:e,fileName:t,fileType:n})});if(!i.ok){const e=yield i.json().catch((()=>({})));throw new P(e.message||`Failed to register IPFS file (HTTP ${i.status})`,i.status)}return{fileKey:(yield i.json()).data.fileKey}}))}var ut,lt,yt,ct,mt,ht,Tt,ft,vt,wt,It,At,gt,bt,Ct,Et,Pt,St,_t,kt,Rt,xt;
733
790
  /**
734
791
  * The Origin class
735
792
  * Handles interactions with Origin protocol.
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,
793
+ */class Dt{constructor(e,t,n,i,a){ut.add(this),t?this.jwt=t:console.warn("JWT not provided. Some features may be unavailable."),this.viemClient=n,this.environment="string"==typeof e?G[e]:e||G.DEVELOPMENT,this.baseParentId=i,this.appId=a,
737
794
  // DataNFT methods
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),
795
+ this.mintWithSignature=te.bind(this),this.registerIpNFT=ne.bind(this),this.updateTerms=ie.bind(this),this.finalizeDelete=ae.bind(this),this.getTerms=se.bind(this),this.ownerOf=re.bind(this),this.balanceOf=oe.bind(this),this.tokenURI=de.bind(this),this.dataStatus=pe.bind(this),this.isApprovedForAll=ue.bind(this),this.transferFrom=le.bind(this),this.safeTransferFrom=ye.bind(this),this.approve=ce.bind(this),this.setApprovalForAll=me.bind(this),
739
796
  // Marketplace methods
740
- this.buyAccess=me.bind(this),this.hasAccess=he.bind(this),this.subscriptionExpiry=Te.bind(this),
797
+ this.buyAccess=he.bind(this),this.hasAccess=Te.bind(this),this.subscriptionExpiry=fe.bind(this),
741
798
  // Bulk purchase methods
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),
799
+ this.bulkBuyAccess=Ke.bind(this),this.bulkBuyAccessTolerant=Ge.bind(this),this.bulkBuyAccessSmart=et.bind(this),this.previewBulkCost=Qe.bind(this),this.buildPurchaseParams=Xe.bind(this),this.checkActiveStatus=Ze.bind(this),
743
800
  // Bulk mint methods
744
- this.bulkMint=et.bind(this),this.bulkMintTolerant=tt.bind(this),
801
+ this.bulkMint=tt.bind(this),this.bulkMintTolerant=nt.bind(this),
745
802
  // Dispute module methods
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),
803
+ this.raiseDispute=ve.bind(this),this.raiseDisputeSmart=be.bind(this),this.disputeAssertion=Ce.bind(this),this.disputeAssertionSmart=Ee.bind(this),this.voteOnDispute=Pe.bind(this),this.resolveDispute=Se.bind(this),this.cancelDispute=_e.bind(this),this.tagChildIp=ke.bind(this),this.getDispute=Re.bind(this),this.canVoteOnDispute=Fe.bind(this),this.getDisputeProgress=Oe.bind(this),this.getDisputeRequirements=Ue.bind(this),
747
804
  // Royalty vault module methods
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),
805
+ this.getRoyaltyVault=$e.bind(this),this.getVaultRevenueTokens=He.bind(this),this.claimableRevenue=je.bind(this),this.claimRevenue=Ve.bind(this),this.claimRevenueBatch=Le.bind(this),this.deployVaultForExistingNFT=ze.bind(this),this.getRoyaltyTokenBalance=Je.bind(this),
749
806
  // AppRegistry module methods
750
- this.getAppInfo=Je.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
807
+ this.getAppInfo=Ye.bind(this),
808
+ // IPFS credentials methods
809
+ this.saveIpfsCredentials=it.bind(this),this.verifyIpfsCredentials=at.bind(this),this.deleteIpfsCredentials=st.bind(this),this.hasIpfsCredentials=rt.bind(this),this.getIpfsUploadConfig=ot.bind(this),this.uploadToUserIPFS=dt.bind(this),this.registerIpfsFile=pt.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
751
810
  /**
752
811
  * Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
753
812
  * Waits for the approval transaction to be confirmed before returning.
754
813
  * @param tokenAddress The address of the ERC20 token.
755
814
  * @param spender The address that will be approved to spend the tokens.
756
815
  * @param amount The amount of tokens to approve.
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})}))}
816
+ */approveERC20IfNeeded(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,ut,"m",It).call(this);yield We({walletClient:this.viemClient,publicClient:B(),tokenAddress:e,owner:i,spender:t,amount:n,chain:this.environment.CHAIN})}))}
758
817
  /**
759
818
  * Uploads a JSON object to IPFS and returns the resulting CID.
760
819
  * @param data The JSON object to upload.
761
820
  * @returns The CID of the uploaded JSON.
762
821
  * @throws {APIError} If the upload fails.
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}))}
822
+ */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,ut,"m",ct).call(this,n);if(!i)throw new P("Failed to upload evidence to IPFS");return i}))}
764
823
  /**
765
824
  * Mints a file-based IpNFT.
766
825
  * @param file The file to mint.
767
826
  * @param metadata The metadata associated with the file.
768
827
  * @param license The license terms for the IpNFT.
769
828
  * @param parents Optional parent token IDs for lineage tracking.
770
- * @param options Optional parameters including progress callback, preview image, and use asset as preview flag.
829
+ * @param options Optional parameters including progress callback, preview image, use asset as preview flag, and forceIpfs.
771
830
  * @returns The token ID of the minted IpNFT as a string, or null if minting failed.
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
773
- let d;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{d=yield this.registerIpNFT("file",p,n,t,!0,// isIp
774
- s.key,// fileKey
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()}))}
831
+ */mintFile(e,t,n,i,a){return m(this,void 0,void 0,(function*(){let s=null;try{s=yield h(this,ut,"m",ft).call(this)}catch(t){throw new k(`Cannot mint file "${e.name}": wallet not connected. Please connect a wallet first.`)}
832
+ // Check if we should use IPFS for this file
833
+ let r;if((null==a?void 0:a.forceIpfs)||e.size>z){
834
+ // Large file - use user's IPFS pinning service
835
+ const t=yield this.getIpfsUploadConfig();if(!t)throw new P(`File "${e.name}" exceeds 20MB limit. Please configure your IPFS pinning service in Settings to upload large files.`);try{const n=yield this.uploadToUserIPFS(e,t,null==a?void 0:a.progressCallback),{fileKey:i}=yield this.registerIpfsFile(n,e.name,e.type);r={key:i,uploadId:""}}catch(t){throw new P(`Failed to upload file "${e.name}" to IPFS: ${x(t)}`)}}else
836
+ // Normal file - use S3
837
+ try{if(r=yield h(this,ut,"m",mt).call(this,e,a),!r||!r.key)throw new P(`Failed to upload file "${e.name}": no upload info returned from server`)}catch(t){if(t instanceof P||t instanceof k)throw t;throw new P(`Failed to upload file "${e.name}": ${x(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,ut,"m",ct).call(this,a.previewImage):(null==a?void 0:a.useAssetAsPreview)&&e.type.startsWith("image/")&&(o=yield h(this,ut,"m",ct).call(this,e)),o&&(t.image=`ipfs://${o}`);const d=BigInt(Math.floor(Date.now()/1e3)+600);// 10 minutes from now
838
+ let p;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{p=yield this.registerIpNFT("file",d,n,t,!0,// isIp
839
+ r.key,// fileKey
840
+ i,this.appId)}catch(e){
841
+ // Only update S3 status if we have an uploadId (non-IPFS flow)
842
+ throw r.uploadId&&(yield h(this,ut,"m",yt).call(this,r.key,r.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}=p;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(s,u,i||[],!0,y,m,n,d,c,this.appId);if(-1===["0x1","success"].indexOf(e.receipt.status))
843
+ // Only update S3 status if we have an uploadId (non-IPFS flow)
844
+ throw r.uploadId&&(yield h(this,ut,"m",yt).call(this,r.key,r.uploadId,[])),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){
845
+ // Only update S3 status if we have an uploadId (non-IPFS flow)
846
+ throw r.uploadId&&(yield h(this,ut,"m",yt).call(this,r.key,r.uploadId,[])),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return u.toString()}))}
776
847
  /**
777
848
  * Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
778
849
  * Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
@@ -792,33 +863,33 @@ i,this.appId)}catch(e){throw yield h(this,nt,"m",at).call(this,s.key,s.uploadId,
792
863
  * // Tolerant mode - continue even if some mints fail
793
864
  * const result = await origin.bulkMintFile(entries, { tolerant: true });
794
865
  * ```
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;
866
+ */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,ut,"m",ft).call(this)}catch(e){throw new k("Cannot bulk mint files: wallet not connected. Please connect a wallet first.")}const s=[],r=[],o=[];for(let d=0;d<e.length;d++){const p=e[d],{file:u,metadata:l,license:y}=p;let{parents:c}=p;
796
867
  // Upload file
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),
868
+ let m;if((null==t?void 0:t.forceIpfs)||u.size>z){const n=yield this.getIpfsUploadConfig();if(!n)throw new P(`File "${u.name}" exceeds 20MB limit. Please configure your IPFS pinning service in Settings to upload large files.`);try{const i=yield this.uploadToUserIPFS(u,n,(n=>{var i;null===(i=null==t?void 0:t.progressCallback)||void 0===i||i.call(t,{fileIndex:d,fileCount:e.length,stage:"uploading",percent:n})})),{fileKey:a}=yield this.registerIpfsFile(i,u.name,u.type);m={key:a,uploadId:""}}catch(e){if(e instanceof P)throw e;throw new P(`Failed to upload file "${u.name}" to IPFS: ${x(e)}`)}}else try{if(m=yield h(this,ut,"m",mt).call(this,u,{progressCallback:n=>{var i;null===(i=null==t?void 0:t.progressCallback)||void 0===i||i.call(t,{fileIndex:d,fileCount:e.length,stage:"uploading",percent:n})}}),!m||!m.key)throw new P(`Failed to upload file "${u.name}": no upload info returned from server`)}catch(e){if(e instanceof P||e instanceof k)throw e;throw new P(`Failed to upload file "${u.name}": ${x(e)}`)}o.push(m),
798
869
  // Set mimetype
799
870
  u.type&&(l.mimetype=u.type);
800
871
  // Handle preview image
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
872
+ let T=null;p.previewImage&&p.previewImage.type.startsWith("image/")?T=yield h(this,ut,"m",ct).call(this,p.previewImage):p.useAssetAsPreview&&u.type.startsWith("image/")&&(T=yield h(this,ut,"m",ct).call(this,u)),T&&(l.image=`ipfs://${T}`);const f=BigInt(Math.floor(Date.now()/1e3)+600);// 10 minutes from now
802
873
  // Prepare parents
803
- let v;this.baseParentId&&(m||(m=[]),m=[this.baseParentId,...m]),
874
+ let v;this.baseParentId&&(c||(c=[]),c=[this.baseParentId,...c]),
804
875
  // Register IpNFT to get signature
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
806
- c.key,// fileKey
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})}
876
+ null===(n=null==t?void 0:t.progressCallback)||void 0===n||n.call(t,{fileIndex:d,fileCount:e.length,stage:"registering",percent:100});try{v=yield this.registerIpNFT("file",f,y,l,!0,// isIp
877
+ m.key,// fileKey
878
+ c,this.appId)}catch(e){throw m.uploadId&&(yield h(this,ut,"m",yt).call(this,m.key,m.uploadId,[])),new Error(`Failed to register IpNFT for file "${u.name}": ${e instanceof Error?e.message:String(e)}`)}const{tokenId:w,creatorContentHash:I,signature:A,uri:g}=v;if(!w||!I||void 0===A||!g)throw m.uploadId&&(yield h(this,ut,"m",yt).call(this,m.key,m.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:I,uri:g,licenseTerms:y,deadline:f,parents:c||[],isIP:!0,appId:null!==(i=this.appId)&&void 0!==i?i:"",signature:A})}
808
879
  // Execute bulk mint
809
880
  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){
810
- // Mark all uploads as failed
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)}`)}}))}
881
+ // Mark all S3 uploads as failed (skip IPFS entries with no uploadId)
882
+ for(const e of o)if(e.uploadId)try{yield h(this,ut,"m",yt).call(this,e.key,e.uploadId,[])}catch(e){}throw new Error(`Bulk mint transaction failed: ${e instanceof Error?e.message:String(e)}`)}}))}
812
883
  /**
813
884
  * Mints a social IpNFT.
814
885
  * @param source The social media source (spotify, twitter, tiktok).
815
886
  * @param metadata The metadata associated with the social media content.
816
887
  * @param license The license terms for the IpNFT.
817
888
  * @return The token ID of the minted IpNFT as a string, or null if minting failed.
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
889
+ */mintSocial(e,t,n){return m(this,void 0,void 0,(function*(){let i=null;try{i=yield h(this,ut,"m",ft).call(this)}catch(t){throw new k(`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
819
890
  let s,r=this.baseParentId?[this.baseParentId]:[];try{s=yield this.registerIpNFT(e,a,n,t,!0,// isIp
820
891
  void 0,// fileKey
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()}))}
892
+ r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:o,signerAddress:d,creatorContentHash:p,signature:u,uri:l}=s;if(!(o&&d&&p&&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,p,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()}))}
822
893
  /**
823
894
  * Call a contract method.
824
895
  * @param {string} contractAddress The contract address.
@@ -828,9 +899,9 @@ r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e ins
828
899
  * @param {CallOptions} [options] The call options.
829
900
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
830
901
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
831
- */callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s,r;let p=null;try{p=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const d=o({abi:t,name:n});if(d&&"stateMutability"in d&&("view"===d.stateMutability||"pure"===d.stateMutability)){const a=B();return null!==(s=yield a.readContract({address:e,abi:t,functionName:n,args:i}))&&void 0!==s?s:null}yield h(this,nt,"m",pt).call(this,this.environment.CHAIN);const u=B(),{result:l,request:y}=yield u.simulateContract({account:p,address:e,abi:t,functionName:n,args:i,value:a.value});
902
+ */callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s,o;let d=null;try{d=yield h(this,ut,"m",ft).call(this)}catch(t){throw new k(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const p=r({abi:t,name:n});if(p&&"stateMutability"in p&&("view"===p.stateMutability||"pure"===p.stateMutability)){const a=B();return null!==(s=yield a.readContract({address:e,abi:t,functionName:n,args:i}))&&void 0!==s?s:null}yield h(this,ut,"m",Tt).call(this,this.environment.CHAIN);const u=B(),{result:l,request:y}=yield u.simulateContract({account:d,address:e,abi:t,functionName:n,args:i,value:a.value});
832
903
  // simulate
833
- if(a.simulate)return l;try{const t=yield null===(r=this.viemClient)||void 0===r?void 0:r.writeContract(y);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:l};return{txHash:t,receipt:yield h(this,nt,"m",ot).call(this,t),simulatedResult:l}}catch(t){if(t instanceof x||t instanceof R)throw t;throw new x(`Transaction for "${n}" failed: ${k(t)}`,{contractName:e,methodName:n})}}))}
904
+ if(a.simulate)return l;try{const t=yield null===(o=this.viemClient)||void 0===o?void 0:o.writeContract(y);if("string"!=typeof t)throw new R(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:l};return{txHash:t,receipt:yield h(this,ut,"m",ht).call(this,t),simulatedResult:l}}catch(t){if(t instanceof R||t instanceof k)throw t;throw new R(`Transaction for "${n}" failed: ${x(t)}`,{contractName:e,methodName:n})}}))}
834
905
  /**
835
906
  * Gets comprehensive token information in a single call.
836
907
  * Combines owner, status, terms, URI, and access information.
@@ -850,11 +921,11 @@ if(a.simulate)return l;try{const t=yield null===(r=this.viemClient)||void 0===r?
850
921
  // Resolve the address to check access for
851
922
  let i;if(t)i=t;else if(null===(n=this.viemClient)||void 0===n?void 0:n.account)i=this.viemClient.account.address;else if(this.viemClient)try{const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});i=e&&e.length>0?e[0]:"0x0000000000000000000000000000000000000000"}catch(e){i="0x0000000000000000000000000000000000000000"}else i="0x0000000000000000000000000000000000000000";
852
923
  // Fetch all information in parallel
853
- const[a,s,r,o,p]=yield Promise.all([this.ownerOf(e),this.tokenURI(e),this.dataStatus(e),this.getTerms(e),this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenInfo",[e]).catch((()=>({appId:""})))]);
924
+ const[a,s,r,o,d]=yield Promise.all([this.ownerOf(e),this.tokenURI(e),this.dataStatus(e),this.getTerms(e),this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenInfo",[e]).catch((()=>({appId:""})))]);
854
925
  // Get access info if we have a valid address
855
- let d=!1,u=null;if("0x0000000000000000000000000000000000000000"!==i)try{[d,u]=yield Promise.all([this.hasAccess(i,e),this.subscriptionExpiry(e,i)])}catch(e){
926
+ let p=!1,u=null;if("0x0000000000000000000000000000000000000000"!==i)try{[p,u]=yield Promise.all([this.hasAccess(i,e),this.subscriptionExpiry(e,i)])}catch(e){
856
927
  // Access check failed, defaults are fine
857
- }return{tokenId:e,owner:a,uri:s,status:r,terms:o,hasAccess:d,accessExpiry:u,appId:(null==p?void 0:p.appId)||""}}))}
928
+ }return{tokenId:e,owner:a,uri:s,status:r,terms:o,hasAccess:p,accessExpiry:u,appId:(null==d?void 0:d.appId)||""}}))}
858
929
  /**
859
930
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
860
931
  * Automatically fetches protocol and app fees from the contracts.
@@ -872,13 +943,13 @@ let d=!1,u=null;if("0x0000000000000000000000000000000000000000"!==i)try{[d,u]=yi
872
943
  * console.log("Access purchased:", result.txHash);
873
944
  * }
874
945
  * ```
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.`)}
946
+ */buyAccessSmart(e){return m(this,void 0,void 0,(function*(){let t=null;try{t=yield h(this,ut,"m",ft).call(this)}catch(t){throw new k(`Cannot buy access to token ${e}: wallet not connected. Please connect a wallet first.`)}
876
947
  // Check if user already has access
877
948
  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`);
878
949
  // Fetch protocol fee from marketplace
879
- const o=yield h(this,nt,"m",ut).call(this),p=yield h(this,nt,"m",lt).call(this,e),d=i;
950
+ const o=yield h(this,ut,"m",vt).call(this),d=yield h(this,ut,"m",wt).call(this,e),p=i;
880
951
  // Fetch app fee from token's appId
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))}))}
952
+ return s===a?this.buyAccess(t,e,p,r,s,o,d,p):(yield We({walletClient:this.viemClient,publicClient:B(),tokenAddress:s,owner:t,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:p,chain:this.environment.CHAIN}),this.buyAccess(t,e,p,r,s,o,d))}))}
882
953
  /**
883
954
  * Fetch the underlying data associated with a specific token ID.
884
955
  * @param {bigint} tokenId - The token ID to fetch data for.
@@ -912,7 +983,7 @@ return s===a?this.buyAccess(t,e,d,r,s,o,p,d):(yield Ye({walletClient:this.viemCl
912
983
  * ```
913
984
  */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){
914
985
  // erc20 (wrapped camp)
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)}`)}}))}
986
+ 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=o(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)}`)}}))}
916
987
  /**
917
988
  * Claim royalties from a token's Token Bound Account (TBA).
918
989
  * @param {bigint} tokenId - The token ID to claim royalties from.
@@ -928,25 +999,30 @@ const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
928
999
  * // Claim ERC20 token royalties to a specific address
929
1000
  * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
930
1001
  * ```
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;
1002
+ */claimRoyalties(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,ut,"m",It).call(this,t),s=yield this.getTokenBoundAccount(e),r=(yield this.getRoyalties(e,n)).balance;if(r===BigInt(0))throw new Error("No royalties available to claim");let o,d,u;
932
1003
  // Call execute on the TBA
933
1004
  return n&&n!==a?(
934
1005
  // ERC20 token transfer
935
- p=n,d=BigInt(0),
1006
+ o=n,d=BigInt(0),
936
1007
  // Encode ERC20 transfer call: transfer(address to, uint256 amount)
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]})):(
1008
+ u=p({abi:[{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],functionName:"transfer",args:[i,r]})):(
938
1009
  // Native token transfer
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){
1010
+ o=i,d=r,u="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[o,d,u,0],// operation: 0 = CALL
1011
+ {waitForReceipt:!0,value:BigInt(0)})}))}
1012
+ /**
1013
+ * Get the connected wallet address.
1014
+ * @returns {Promise<Address>} The connected wallet address.
1015
+ * @throws {WalletError} Throws if no wallet is connected.
1016
+ */getWalletAddress(){return m(this,void 0,void 0,(function*(){return h(this,ut,"m",It).call(this)}))}}ut=new WeakSet,lt=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}}))},yt=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}}))},ct=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 d=yield fetch(s,{method:"POST",body:o});if(!d.ok){const e=yield d.text().catch((()=>d.statusText));throw new Error(`Failed to upload preview image to IPFS (HTTP ${d.status}): ${e}`)}const p=yield d.json();if(!p||!p.data)throw new Error("Invalid response from IPFS upload: Missing data field");return null===(t=p.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}`)}}))},mt=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,ut,"m",lt).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 ee(i,n.urls,(null==t?void 0:t.progressCallback)||(()=>{}))}catch(e){try{yield h(this,ut,"m",yt).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,ut,"m",yt).call(this,n.key,n.uploadId,a)}catch(e){console.error("Failed to update status to success:",e)}return n}))},ht=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,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,p=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield s.waitForTransactionReceipt({hash:r,confirmations:o,timeout:d,pollingInterval:p,onReplaced:e=>{r=e.transaction.hash}})}catch(e){
941
1017
  // fallback
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
1018
+ const t=Date.now();for(;Date.now()-t<d;){try{const e=yield s.getTransactionReceipt({hash:r});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,p)))}throw e}}))},Tt=function(e){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new k(`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
943
1019
  (e);try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
944
1020
  // Unrecognized chain
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.");
1021
+ 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)}]})}}}))},ft=function(){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new k("No wallet connected. Please connect a wallet to perform this action.");
946
1022
  // If account is already set on the client, return it directly
947
1023
  if(this.viemClient.account)return this.viemClient.account.address;
948
1024
  // Otherwise request accounts (browser wallet flow)
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{
1025
+ const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new k("No accounts found in connected wallet. Please unlock your wallet or add an account.");return e[0]}))},vt=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}}))},wt=function(e){return m(this,void 0,void 0,(function*(){try{
950
1026
  // First, get the token info to find its appId
951
1027
  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;
952
1028
  // Check if app registry is configured
@@ -954,17 +1030,17 @@ if(!this.environment.APP_REGISTRY_CONTRACT_ADDRESS||!this.environment.APP_REGIST
954
1030
  // Fetch app info from registry
955
1031
  const i=yield this.callContractMethod(this.environment.APP_REGISTRY_CONTRACT_ADDRESS,this.environment.APP_REGISTRY_ABI,"getAppInfo",[n]);
956
1032
  // Only return fee if app is active
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.");
1033
+ 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}}))},It=function(e){return m(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new k("No wallet address provided and no wallet connected. Please provide an address or connect a wallet.");
958
1034
  // If account is already set on the client, return it directly
959
1035
  if(this.viemClient.account)return this.viemClient.account.address;
960
1036
  // Otherwise request accounts (browser wallet flow)
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]}))};
1037
+ const t=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!t||0===t.length)throw new k("No accounts found in connected wallet. Please unlock your wallet or add an account.");return t[0]}))};
962
1038
  /**
963
1039
  * The Auth class.
964
1040
  * @class
965
1041
  * @classdesc The Auth class is used to authenticate the user.
966
1042
  */
967
- class Et{
1043
+ class Nt{
968
1044
  /**
969
1045
  * Constructor for the Auth class.
970
1046
  * @param {object} options The options object.
@@ -974,13 +1050,13 @@ class Et{
974
1050
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
975
1051
  * @throws {APIError} - Throws an error if the clientId is not provided.
976
1052
  */
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");
1053
+ constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(At.add(this),gt.set(this,void 0),bt.set(this,void 0),Ct.set(this,void 0),Et.set(this,void 0),!e)throw new S("clientId is required");
978
1054
  // if (!appId) {
979
1055
  // throw new ValidationError("appId is required");
980
1056
  // }
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"),
1057
+ if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new S(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,bt,"undefined"==typeof window,"f"),T(this,Et,s||(h(this,bt,"f")?new g:new A),"f"),this.viem=null,this.environment=G[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,gt,{},"f"),
982
1058
  // only subscribe to providers in browser environment
983
- h(this,ht,"f")||X((e=>{h(this,ct,"m",vt).call(this,"providers",e)})),h(this,ct,"m",wt).call(this)}
1059
+ h(this,bt,"f")||Z((e=>{h(this,At,"m",Pt).call(this,"providers",e)})),h(this,At,"m",St).call(this)}
984
1060
  /**
985
1061
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
986
1062
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
@@ -990,26 +1066,26 @@ h(this,ht,"f")||X((e=>{h(this,ct,"m",vt).call(this,"providers",e)})),h(this,ct,"
990
1066
  * auth.on("state", (state) => {
991
1067
  * console.log(state);
992
1068
  * });
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())}
1069
+ */on(e,t){h(this,gt,"f")[e]||(h(this,gt,"f")[e]=[]),h(this,gt,"f")[e].push(t),"providers"===e&&t(X())}
994
1070
  /**
995
1071
  * Unsubscribe from an event. Possible events are "state", "provider", "providers", and "viem".
996
1072
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
997
1073
  * @param {function} callback The callback function.
998
1074
  * @returns {void}
999
- */off(e,t){h(this,mt,"f")[e]&&(h(this,mt,"f")[e]=h(this,mt,"f")[e].filter((e=>e!==t)))}
1075
+ */off(e,t){h(this,gt,"f")[e]&&(h(this,gt,"f")[e]=h(this,gt,"f")[e].filter((e=>e!==t)))}
1000
1076
  /**
1001
1077
  * Set the loading state.
1002
1078
  * @param {boolean} loading The loading state.
1003
1079
  * @returns {void}
1004
- */setLoading(e){h(this,ct,"m",vt).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
1080
+ */setLoading(e){h(this,At,"m",Pt).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
1005
1081
  /**
1006
1082
  * 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.
1007
1083
  * @param {object} options The options object. Includes the provider and the provider info.
1008
1084
  * @returns {void}
1009
1085
  * @throws {APIError} - Throws an error if the provider is not provided.
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),
1086
+ */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 d=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)!==d.id){const a={chain:d,transport:n(t,{name:i})};s&&(a.account=l(s)),D=e(a),M=d,N&&(null===(o=N.chain)||void 0===o?void 0:o.id)!==d.id&&(N=null)}return D})(t,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
1011
1087
  // TODO: only use one of these
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))}
1088
+ h(this,At,"m",Pt).call(this,"viem",this.viem),h(this,At,"m",Pt).call(this,"provider",{provider:t,info:i}),h(this,Et,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
1013
1089
  /**
1014
1090
  * 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.
1015
1091
  * @param {string} walletAddress The wallet address.
@@ -1018,7 +1094,7 @@ h(this,ct,"m",vt).call(this,"viem",this.viem),h(this,ct,"m",vt).call(this,"provi
1018
1094
  /**
1019
1095
  * Recover the provider from local storage.
1020
1096
  * @returns {Promise<void>}
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:[];
1097
+ */recoverProvider(){return m(this,void 0,void 0,(function*(){var e,t,n,i,a,s,r,o,d,p,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,Et,"f").getItem("camp-sdk:provider");if(!c)return;const m=JSON.parse(c);let T;const f=null!==(e=X())&&void 0!==e?e:[];
1022
1098
  // first pass: try to find provider by UUID/name and check if it has the right address
1023
1099
  // without prompting (using eth_accounts)
1024
1100
  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,19 +1104,19 @@ const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null==
1028
1104
  // but still avoid prompting
1029
1105
  if(!T)for(const e of f)try{
1030
1106
  // skip providers we already checked in the first pass
1031
- if(m.uuid&&(null===(s=e.info)||void 0===s?void 0:s.uuid)===m.uuid||m.name&&(null===(r=e.info)||void 0===r?void 0:r.name)===m.name)continue;const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(o=t[0])||void 0===o?void 0:o.toLowerCase())===(null===(p=this.walletAddress)||void 0===p?void 0:p.toLowerCase())){T=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
1107
+ if(m.uuid&&(null===(s=e.info)||void 0===s?void 0:s.uuid)===m.uuid||m.name&&(null===(r=e.info)||void 0===r?void 0:r.name)===m.name)continue;const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(o=t[0])||void 0===o?void 0:o.toLowerCase())===(null===(d=this.walletAddress)||void 0===d?void 0:d.toLowerCase())){T=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
1032
1108
  // third pass: if still no provider found and we have UUID/name info,
1033
1109
  // try prompting the user (only for the stored provider)
1034
- if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void 0===d?void 0:d.uuid)===m.uuid||m.name&&(null===(u=e.info)||void 0===u?void 0:u.name)===m.name){const t=yield e.provider.request({method:"eth_requestAccounts"});if(t.length>0&&(null===(l=t[0])||void 0===l?void 0:l.toLowerCase())===(null===(y=this.walletAddress)||void 0===y?void 0:y.toLowerCase())){T=e;break}}}catch(e){console.warn("Failed to reconnect to stored provider:",e)}T?this.setProvider({provider:T.provider,info:T.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
1110
+ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(p=e.info)||void 0===p?void 0:p.uuid)===m.uuid||m.name&&(null===(u=e.info)||void 0===u?void 0:u.name)===m.name){const t=yield e.provider.request({method:"eth_requestAccounts"});if(t.length>0&&(null===(l=t[0])||void 0===l?void 0:l.toLowerCase())===(null===(y=this.walletAddress)||void 0===y?void 0:y.toLowerCase())){T=e;break}}}catch(e){console.warn("Failed to reconnect to stored provider:",e)}T?this.setProvider({provider:T.provider,info:T.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
1035
1111
  /**
1036
1112
  * Disconnect the user.
1037
1113
  * @returns {Promise<void>}
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"))}))}
1114
+ */disconnect(){return m(this,void 0,void 0,(function*(){this.isAuthenticated&&(h(this,At,"m",Pt).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,T(this,Ct,void 0,"f"),yield h(this,Et,"f").removeItem("camp-sdk:wallet-address"),yield h(this,Et,"f").removeItem("camp-sdk:user-id"),yield h(this,Et,"f").removeItem("camp-sdk:jwt"),yield h(this,Et,"f").removeItem("camp-sdk:environment"))}))}
1039
1115
  /**
1040
1116
  * Connect the user's wallet and sign the message.
1041
1117
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
1042
1118
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
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)}`)}}))}
1119
+ */connect(){return m(this,void 0,void 0,(function*(){h(this,At,"m",Pt).call(this,"state","loading");try{this.walletAddress||(yield h(this,At,"m",_t).call(this)),this.walletAddress=u(this.walletAddress);const e=yield h(this,At,"m",kt).call(this),t=h(this,At,"m",xt).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield h(this,At,"m",Rt).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new Dt(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,Et,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,Et,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,Et,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,Et,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,At,"m",Pt).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,At,"m",Pt).call(this,"state","unauthenticated"),new P("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,h(this,At,"m",Pt).call(this,"state","unauthenticated"),e instanceof P||e instanceof k)throw e;throw new P(`Failed to authenticate: ${x(e)}`)}}))}
1044
1120
  /**
1045
1121
  * Connect with a custom signer (for Node.js or custom wallet implementations).
1046
1122
  * This method bypasses browser wallet interactions and uses the provided signer directly.
@@ -1059,9 +1135,9 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
1059
1135
  * const account = privateKeyToAccount('0x...');
1060
1136
  * const client = createWalletClient({ account, chain: mainnet, transport: http() });
1061
1137
  * await auth.connectWithSigner(client);
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()),
1138
+ */connectWithSigner(e,t){return m(this,void 0,void 0,(function*(){h(this,At,"m",Pt).call(this,"state","loading");try{T(this,Ct,I(e),"f"),this.walletAddress=u(yield h(this,Ct,"f").getAddress()),
1063
1139
  // store the signer as viem client if it's a viem client, otherwise keep adapter
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)}`)}}))}
1140
+ "viem"===h(this,Ct,"f").type&&(this.viem=e);const n=yield h(this,At,"m",kt).call(this),i=h(this,At,"m",xt).call(this,n,null==t?void 0:t.domain,null==t?void 0:t.uri),a=yield h(this,Ct,"f").signMessage(i),s=yield h(this,At,"m",Rt).call(this,i,a);if(s.success)return this.isAuthenticated=!0,this.userId=s.userId,this.jwt=s.token,this.origin=new Dt(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,Et,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,Et,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,Et,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,Et,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,At,"m",Pt).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,At,"m",Pt).call(this,"state","unauthenticated"),new P("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,T(this,Ct,void 0,"f"),h(this,At,"m",Pt).call(this,"state","unauthenticated"),e instanceof P||e instanceof k)throw e;throw new P(`Failed to authenticate: ${x(e)}`)}}))}
1065
1141
  /**
1066
1142
  * Get the user's linked social accounts.
1067
1143
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
@@ -1075,17 +1151,17 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
1075
1151
  * Link the user's Twitter account.
1076
1152
  * @returns {Promise<void>}
1077
1153
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
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}`}))}
1154
+ */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,bt,"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}`}))}
1079
1155
  /**
1080
1156
  * Link the user's Discord account.
1081
1157
  * @returns {Promise<void>}
1082
1158
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
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}`}))}
1159
+ */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,bt,"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}`}))}
1084
1160
  /**
1085
1161
  * Link the user's Spotify account.
1086
1162
  * @returns {Promise<void>}
1087
1163
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
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}`}))}
1164
+ */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,bt,"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}`}))}
1089
1165
  /**
1090
1166
  * Link the user's TikTok account.
1091
1167
  * @param {string} handle The user's TikTok handle.
@@ -1135,4 +1211,4 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(d=e.info)||void
1135
1211
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1136
1212
  * @throws {Error} - Throws an error if the user is not authenticated.
1137
1213
  * @throws {APIError} - Throws an error if the request fails.
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};
1214
+ */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}))}}gt=new WeakMap,bt=new WeakMap,Ct=new WeakMap,Et=new WeakMap,At=new WeakSet,Pt=function(e,t){h(this,gt,"f")[e]&&h(this,gt,"f")[e].forEach((e=>e(t)))},St=function(e){return m(this,void 0,void 0,(function*(){const t=yield h(this,Et,"f").getItem("camp-sdk:wallet-address"),n=yield h(this,Et,"f").getItem("camp-sdk:user-id"),i=yield h(this,Et,"f").getItem("camp-sdk:jwt"),a=yield h(this,Et,"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 Dt(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,bt,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},_t=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 k(`Failed to connect wallet: ${x(e)}`)}}))},kt=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: ${x(e)}`)}}))},Rt=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: ${x(e)}`)}}))},xt=function(e,t,n){return y({domain:t||(h(this,bt,"f")?"localhost":window.location.host),address:this.walletAddress,statement:L,uri:n||(h(this,bt,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})};export{Nt as Auth,A as BrowserStorage,w as CustomSignerAdapter,De as DataStatus,Ne as DisputeStatus,v as EthersSignerAdapter,xe as LicenseType,g as MemoryStorage,Dt as Origin,f as ViemSignerAdapter,E as campMainnet,C as campTestnet,Me as createLicenseTerms,b as createNodeWalletClient,I as createSignerAdapter,ge as decodeCidFromBytes32,Ae as encodeCidToBytes32};