@campnetwork/origin 1.3.0-alpha.10 → 1.3.0-alpha.12

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,encodeFunctionData as a,checksumAddress as s,zeroAddress as r,keccak256 as o,toBytes as d,erc20Abi as u,getAbiItem as p,formatEther as l,formatUnits as y}from"viem";import{toAccount as c}from"viem/accounts";import{createSiweMessage as m}from"viem/siwe";import h 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,16 +13,16 @@ 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 T(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 f(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 v(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
  */
20
- class A{constructor(e){this.type="viem",this.signer=e}getAddress(){return T(this,void 0,void 0,(function*(){if(this.signer.account)return this.signer.account.address;const e=yield this.signer.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in viem wallet client");return e[0]}))}signMessage(e){return T(this,void 0,void 0,(function*(){const t=yield this.getAddress();return yield this.signer.signMessage({account:t,message:e})}))}signTypedData(e,t,n){return T(this,void 0,void 0,(function*(){throw new Error("Viem WalletClient does not support signTypedData")}))}getChainId(){return T(this,void 0,void 0,(function*(){var e;return(null===(e=this.signer.chain)||void 0===e?void 0:e.id)||1}))}}
20
+ class f{constructor(e){this.type="viem",this.signer=e}getAddress(){return m(this,void 0,void 0,(function*(){if(this.signer.account)return this.signer.account.address;const e=yield this.signer.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in viem wallet client");return e[0]}))}signMessage(e){return m(this,void 0,void 0,(function*(){const t=yield this.getAddress();return yield this.signer.signMessage({account:t,message:e})}))}signTypedData(e,t,n){return m(this,void 0,void 0,(function*(){throw new Error("Viem WalletClient does not support signTypedData")}))}getChainId(){return m(this,void 0,void 0,(function*(){var e;return(null===(e=this.signer.chain)||void 0===e?void 0:e.id)||1}))}}
21
21
  /**
22
22
  * Adapter for ethers Signer (v5 and v6)
23
- */class w{constructor(e){this.type="ethers",this.signer=e}getAddress(){return T(this,void 0,void 0,(function*(){
23
+ */class v{constructor(e){this.type="ethers",this.signer=e}getAddress(){return m(this,void 0,void 0,(function*(){
24
24
  // Works for both ethers v5 and v6
25
- if("function"==typeof this.signer.getAddress)return yield this.signer.getAddress();if(this.signer.address)return this.signer.address;throw new Error("Unable to get address from ethers signer")}))}signMessage(e){return T(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signMessage)throw new Error("Signer does not support signMessage");return yield this.signer.signMessage(e)}))}signTypedData(e,t,n){return T(this,void 0,void 0,(function*(){if("function"==typeof this.signer._signTypedData)return yield this.signer._signTypedData(e,t,n);if("function"!=typeof this.signer.signTypedData)throw new Error("Signer does not support signTypedData or _signTypedData");return yield this.signer.signTypedData(e,t,n)}))}getChainId(){return T(this,void 0,void 0,(function*(){
25
+ if("function"==typeof this.signer.getAddress)return yield this.signer.getAddress();if(this.signer.address)return this.signer.address;throw new Error("Unable to get address from ethers signer")}))}signMessage(e){return m(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signMessage)throw new Error("Signer does not support signMessage");return yield this.signer.signMessage(e)}))}signTypedData(e,t,n){return m(this,void 0,void 0,(function*(){if("function"==typeof this.signer._signTypedData)return yield this.signer._signTypedData(e,t,n);if("function"!=typeof this.signer.signTypedData)throw new Error("Signer does not support signTypedData or _signTypedData");return yield this.signer.signTypedData(e,t,n)}))}getChainId(){return m(this,void 0,void 0,(function*(){
26
26
  // Try ethers v6 first
27
27
  if(this.signer.provider&&"function"==typeof this.signer.provider.getNetwork){const e=yield this.signer.provider.getNetwork();
28
28
  // ethers v6 returns bigint, v5 returns number
@@ -33,45 +33,45 @@ return"function"==typeof this.signer.getChainId?yield this.signer.getChainId():4
33
33
  }))}}
34
34
  /**
35
35
  * Adapter for custom signer implementations
36
- */class I{constructor(e){this.type="custom",this.signer=e}getAddress(){return T(this,void 0,void 0,(function*(){if("function"==typeof this.signer.getAddress)return yield this.signer.getAddress();if(this.signer.address)return this.signer.address;throw new Error("Custom signer must implement getAddress() or have address property")}))}signMessage(e){return T(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signMessage)throw new Error("Custom signer must implement signMessage()");return yield this.signer.signMessage(e)}))}signTypedData(e,t,n){return T(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signTypedData)throw new Error("Custom signer must implement signTypedData()");return yield this.signer.signTypedData(e,t,n)}))}getChainId(){return T(this,void 0,void 0,(function*(){if("function"==typeof this.signer.getChainId){const e=yield this.signer.getChainId();return"bigint"==typeof e?Number(e):e}return void 0!==this.signer.chainId?"bigint"==typeof this.signer.chainId?Number(this.signer.chainId):this.signer.chainId:484;
36
+ */class w{constructor(e){this.type="custom",this.signer=e}getAddress(){return m(this,void 0,void 0,(function*(){if("function"==typeof this.signer.getAddress)return yield this.signer.getAddress();if(this.signer.address)return this.signer.address;throw new Error("Custom signer must implement getAddress() or have address property")}))}signMessage(e){return m(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signMessage)throw new Error("Custom signer must implement signMessage()");return yield this.signer.signMessage(e)}))}signTypedData(e,t,n){return m(this,void 0,void 0,(function*(){if("function"!=typeof this.signer.signTypedData)throw new Error("Custom signer must implement signTypedData()");return yield this.signer.signTypedData(e,t,n)}))}getChainId(){return m(this,void 0,void 0,(function*(){if("function"==typeof this.signer.getChainId){const e=yield this.signer.getChainId();return"bigint"==typeof e?Number(e):e}return void 0!==this.signer.chainId?"bigint"==typeof this.signer.chainId?Number(this.signer.chainId):this.signer.chainId:484;
37
37
  // Default to mainnet
38
38
  }))}}
39
39
  /**
40
40
  * Factory function to create appropriate adapter based on signer type
41
- */function g(e){
41
+ */function A(e){
42
42
  // Check for viem WalletClient
43
- return e.transport&&e.chain&&"function"==typeof e.signMessage?new A(e):
43
+ return e.transport&&e.chain&&"function"==typeof e.signMessage?new f(e):
44
44
  // Check for ethers signer (v5 or v6)
45
- e._isSigner||e.provider&&"function"==typeof e.signMessage?new w(e):new I(e)}
45
+ e._isSigner||e.provider&&"function"==typeof e.signMessage?new v(e):new w(e)}
46
46
  /**
47
47
  * Browser localStorage adapter
48
- */class b{getItem(e){return T(this,void 0,void 0,(function*(){return"undefined"==typeof localStorage?null:localStorage.getItem(e)}))}setItem(e,t){return T(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}))}removeItem(e){return T(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.removeItem(e)}))}}
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)}))}}
49
49
  /**
50
50
  * In-memory storage adapter for Node.js
51
- */class C{constructor(){this.storage=new Map}getItem(e){return T(this,void 0,void 0,(function*(){return this.storage.get(e)||null}))}setItem(e,t){return T(this,void 0,void 0,(function*(){this.storage.set(e,t)}))}removeItem(e){return T(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 E(n,i,a){return e({account:n,chain:i,transport:t(a)})}const S={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/"}}},P={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 R 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 _ 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 D 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 N 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 S 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 P 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 R 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 N 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 _ 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 D(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 M=null,B=null,F=null;const O=e=>{var n;const a=F||S;return B&&(null===(n=B.chain)||void 0===n?void 0:n.id)===a.id||(B=i({chain:a,transport:t()})),B};var U=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"appRegistry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract AppRegistry"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"dataStatus",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint8",internalType:"enum IIpNFT.DataStatus"}],stateMutability:"view"},{type:"function",name:"disputeModule",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"erc6551Account",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IERC6551Account"}],stateMutability:"view"},{type:"function",name:"erc6551Registry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IERC6551Registry"}],stateMutability:"view"},{type:"function",name:"finalizeDelete",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getAccount",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"account",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getTerms",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"name_",type:"string",internalType:"string"},{name:"symbol_",type:"string",internalType:"string"},{name:"maxTermDuration_",type:"uint256",internalType:"uint256"},{name:"signer_",type:"address",internalType:"address"},{name:"wCAMP_",type:"address",internalType:"address"},{name:"minTermDuration_",type:"uint256",internalType:"uint256"},{name:"minPrice_",type:"uint256",internalType:"uint256"},{name:"maxRoyaltyBps_",type:"uint256",internalType:"uint256"},{name:"registry_",type:"address",internalType:"contract IERC6551Registry"},{name:"implementation_",type:"address",internalType:"contract IERC6551Account"},{name:"appRegistry_",type:"address",internalType:"contract AppRegistry"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"markDisputed",inputs:[{name:"_tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"marketPlace",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IMarketplace"}],stateMutability:"view"},{type:"function",name:"maxRoyaltyBps",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxTermDuration",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"minPrice",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"minTermDuration",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"mintWithSignature",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"creatorContentHash",type:"bytes32",internalType:"bytes32"},{name:"uri",type:"string",internalType:"string"},{name:"licenseTerms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"isIP",type:"bool",internalType:"bool"},{name:"appId",type:"string",internalType:"string"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"pause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"paused",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setAppRegistry",inputs:[{name:"_appRegistry",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setDisputeModule",inputs:[{name:"_disputeModule",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setMarketPlace",inputs:[{name:"_marketPlace",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setSigner",inputs:[{name:"_signer",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"signer",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IIpNFT.TokenInfo",components:[{name:"tokenURI",type:"string",internalType:"string"},{name:"isIP",type:"bool",internalType:"bool"},{name:"contentHash",type:"bytes32",internalType:"bytes32"},{name:"terms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]},{name:"status",type:"uint8",internalType:"enum IIpNFT.DataStatus"},{name:"appId",type:"string",internalType:"string"}]}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"_tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unpause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateTerms",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"newTerms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"wCAMP",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"event",name:"AccessPurchased",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"buyer",type:"address",indexed:!0,internalType:"address"},{name:"periods",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newExpiry",type:"uint256",indexed:!1,internalType:"uint256"},{name:"amountPaid",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AgentRegistered",inputs:[{name:"agentId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"ipNftId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"agentAddress",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"AppRegistryUpdated",inputs:[{name:"appRegistry",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"ChildIpTagged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"childIp",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIp",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DataDeleted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DataMinted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"},{name:"contentHash",type:"bytes32",indexed:!1,internalType:"bytes32"},{name:"parents",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DisputeAssertion",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"counterEvidenceHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"DisputeCancelled",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DisputeJudged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"judgement",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"DisputeModuleUpdated",inputs:[{name:"disputeModule",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DisputeRaised",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"initiator",type:"address",indexed:!0,internalType:"address"},{name:"targetId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"disputeTag",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"MarketPlaceUpdated",inputs:[{name:"marketPlace",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ParentIpsSet",inputs:[{name:"childIpId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"},{name:"totalRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ProtocolFeeUpdated",inputs:[{name:"newFeeBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"RoyaltyPaid",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"royaltyAmount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"creator",type:"address",indexed:!1,internalType:"address"},{name:"protocolAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"SignerUpdated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"StatusUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"status",type:"uint8",indexed:!1,internalType:"enum IIpNFT.DataStatus"}],anonymous:!1},{type:"event",name:"TermsUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"newPrice",type:"uint128",indexed:!1,internalType:"uint128"},{name:"newDuration",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"},{name:"paymentToken",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"TreasuryUpdated",inputs:[{name:"newTreasury",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Unpaused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Voted",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"voter",type:"address",indexed:!0,internalType:"address"},{name:"support",type:"bool",indexed:!1,internalType:"bool"},{name:"weight",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"EnforcedPause",inputs:[]},{type:"error",name:"ExpectedPause",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidDeadline",inputs:[]},{type:"error",name:"InvalidDuration",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidPaymentToken",inputs:[]},{type:"error",name:"InvalidPrice",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotTokenOwner",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"TokenAlreadyExists",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}],$=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"MAX_PARENTS",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"buyAccess",inputs:[{name:"buyer",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"expectedPrice",type:"uint256",internalType:"uint256"},{name:"expectedDuration",type:"uint32",internalType:"uint32"},{name:"expectedPaymentToken",type:"address",internalType:"address"},{name:"expectedProtocolFeeBps",type:"uint16",internalType:"uint16"},{name:"expectedAppFeeBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"payable"},{type:"function",name:"hasParentIp",inputs:[{name:"ipId",type:"uint256",internalType:"uint256"},{name:"parent",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"dataNFT_",type:"address",internalType:"address"},{name:"protocolFeeBps_",type:"uint16",internalType:"uint16"},{name:"treasury_",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"ipToken",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IIpNFT"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"parentRoyaltyPercent",inputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"pause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"paused",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"protocolFeeBps",inputs:[],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"royaltyStack",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"setParentIpsAndRoyaltyPercents",inputs:[{name:"childIpId",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"creator",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"subscriptionExpiry",inputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"treasury",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"unpause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateProtocolFee",inputs:[{name:"newFeeBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateTreasury",inputs:[{name:"newTreasury",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AccessPurchased",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"buyer",type:"address",indexed:!0,internalType:"address"},{name:"periods",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newExpiry",type:"uint256",indexed:!1,internalType:"uint256"},{name:"amountPaid",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AgentRegistered",inputs:[{name:"agentId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"ipNftId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"agentAddress",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"AppRegistryUpdated",inputs:[{name:"appRegistry",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ChildIpTagged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"childIp",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIp",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DataDeleted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DataMinted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"},{name:"contentHash",type:"bytes32",indexed:!1,internalType:"bytes32"},{name:"parents",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DisputeAssertion",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"counterEvidenceHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"DisputeCancelled",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DisputeJudged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"judgement",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"DisputeModuleUpdated",inputs:[{name:"disputeModule",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DisputeRaised",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"initiator",type:"address",indexed:!0,internalType:"address"},{name:"targetId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"disputeTag",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"MarketPlaceUpdated",inputs:[{name:"marketPlace",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ParentIpsSet",inputs:[{name:"childIpId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"},{name:"totalRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ProtocolFeeUpdated",inputs:[{name:"newFeeBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"RoyaltyPaid",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"royaltyAmount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"creator",type:"address",indexed:!1,internalType:"address"},{name:"protocolAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"SignerUpdated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"StatusUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"status",type:"uint8",indexed:!1,internalType:"enum IIpNFT.DataStatus"}],anonymous:!1},{type:"event",name:"TermsUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"newPrice",type:"uint128",indexed:!1,internalType:"uint128"},{name:"newDuration",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"},{name:"paymentToken",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"TreasuryUpdated",inputs:[{name:"newTreasury",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Unpaused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Voted",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"voter",type:"address",indexed:!0,internalType:"address"},{name:"support",type:"bool",indexed:!1,internalType:"bool"},{name:"weight",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"EnforcedPause",inputs:[]},{type:"error",name:"ExpectedPause",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"FeesExceedMaximum",inputs:[]},{type:"error",name:"FeesMismatch",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidLicenseType",inputs:[]},{type:"error",name:"InvalidParentIp",inputs:[]},{type:"error",name:"InvalidPayment",inputs:[]},{type:"error",name:"InvalidPrice",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"MaxParentsExceeded",inputs:[]},{type:"error",name:"MaxRoyaltyExceeded",inputs:[]},{type:"error",name:"NoSubscriptionFound",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"ParentAlreadyExists",inputs:[]},{type:"error",name:"ParentIpAlreadyDeleted",inputs:[]},{type:"error",name:"ParentIpAlreadyDisputed",inputs:[]},{type:"error",name:"SubscriptionNotAllowed",inputs:[]},{type:"error",name:"TermsMismatch",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]},{type:"error",name:"ZeroAddress",inputs:[]}],H=[{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"}],j=[{inputs:[{internalType:"address",name:"_marketplace",type:"address"},{internalType:"address",name:"_ipNFT",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EmptyPurchaseList",type:"error"},{inputs:[],name:"InvalidTotalPayment",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"string",name:"reason",type:"string"}],name:"PurchaseFailed",type:"error"},{inputs:[],name:"RefundFailed",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{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:[{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:"struct IBatchPurchase.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:"struct IBatchPurchase.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 IBatchPurchase.TolerantResult",name:"result",type:"tuple"}],stateMutability:"payable",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:"struct IBatchPurchase.BuyParams[]",name:"purchases",type:"tuple[]"}],stateMutability:"view",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 IBatchPurchase.BulkCostPreview",name:"preview",type:"tuple"}],stateMutability:"view",type:"function"}],L=[{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:"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"}],z=[{type:"constructor",inputs:[{name:"ipNFT_",type:"address",internalType:"contract IIpNFT"},{name:"exchangeRate_",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"exchangeRate",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"fractionalize",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getTokenForNFT",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ipNFT",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IIpNFT"}],stateMutability:"view"},{type:"function",name:"nftToToken",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"contract FractionalToken"}],stateMutability:"view"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"pure"},{type:"function",name:"redeem",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"Fractionalized",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"depositor",type:"address",indexed:!0,internalType:"address"},{name:"token",type:"address",indexed:!1,internalType:"address"},{name:"supply",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Redeemed",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"redeemer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AlreadyFractionalized",inputs:[]},{type:"error",name:"InsufficientFractionalTokens",inputs:[]},{type:"error",name:"InvalidExchangeRate",inputs:[]},{type:"error",name:"NotFractionalized",inputs:[]},{type:"error",name:"NotTokenOwner",inputs:[]},{type:"error",name:"ZeroAddress",inputs:[]}],V=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"appExists",inputs:[{name:"",type:"string",internalType:"string"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"apps",inputs:[{name:"",type:"string",internalType:"string"}],outputs:[{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"},{name:"isActive",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"deactivateApp",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getAppInfo",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[{name:"",type:"tuple",internalType:"struct AppRegistry.AppInfo",components:[{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"},{name:"isActive",type:"bool",internalType:"bool"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"reactivateApp",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"registerApp",inputs:[{name:"appId",type:"string",internalType:"string"},{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateApp",inputs:[{name:"appId",type:"string",internalType:"string"},{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppDeactivated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"}],anonymous:!1},{type:"event",name:"AppReactivated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"},{name:"treasury",type:"address",indexed:!1,internalType:"address"},{name:"revenueShareBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"AppUpdated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"},{name:"treasury",type:"address",indexed:!1,internalType:"address"},{name:"revenueShareBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AppAlreadyActive",inputs:[]},{type:"error",name:"AppAlreadyExists",inputs:[]},{type:"error",name:"AppAlreadyInactive",inputs:[]},{type:"error",name:"AppNotFound",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidAppId",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"ZeroAddress",inputs:[]}],q="Connect with Camp Network",J=2628e3,G=86400,W=1e15,Y=1,Z=1e4;const K={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_PURCHASE_CONTRACT_ADDRESS:"0xaF0cF04DBfeeAcEdC77Dc68A91381AFB967B8518",DISPUTE_CONTRACT_ADDRESS:"0x45719337b1450b0D105cA671972be4263E6A9380",APP_REGISTRY_CONTRACT_ADDRESS:"0x2096eb980Dd590DDF690Cb698572b80552B6F9Bb",
61
- // TODO: Add actual contract addresse when deployed
62
- FRACTIONALIZER_CONTRACT_ADDRESS:"",USDC_CONTRACT_ADDRESS:"0x8a2B28364102Bea189D99A475C494330Ef2bDD0B",CHAIN:S,IPNFT_ABI:U,MARKETPLACE_ABI:$,TBA_ABI:H,BATCH_PURCHASE_ABI:j,DISPUTE_ABI:L,FRACTIONALIZER_ABI:z,APP_REGISTRY_ABI:V},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",BATCH_PURCHASE_CONTRACT_ADDRESS:"0x31885cD2A445322067dF890bACf6CeFE9b233BCC",
60
+ let k=null,x=null,M=null;const O=e=>{var n;const a=M||C;return x&&(null===(n=x.chain)||void 0===n?void 0:n.id)===a.id||(x=i({chain:a,transport:t()})),x};var B=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"appRegistry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract AppRegistry"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"balanceOf",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"dataStatus",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint8",internalType:"enum IIpNFT.DataStatus"}],stateMutability:"view"},{type:"function",name:"disputeModule",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"erc6551Account",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IERC6551Account"}],stateMutability:"view"},{type:"function",name:"erc6551Registry",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IERC6551Registry"}],stateMutability:"view"},{type:"function",name:"finalizeDelete",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getAccount",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"account",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getApproved",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"getTerms",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"name_",type:"string",internalType:"string"},{name:"symbol_",type:"string",internalType:"string"},{name:"maxTermDuration_",type:"uint256",internalType:"uint256"},{name:"signer_",type:"address",internalType:"address"},{name:"wCAMP_",type:"address",internalType:"address"},{name:"minTermDuration_",type:"uint256",internalType:"uint256"},{name:"minPrice_",type:"uint256",internalType:"uint256"},{name:"maxRoyaltyBps_",type:"uint256",internalType:"uint256"},{name:"registry_",type:"address",internalType:"contract IERC6551Registry"},{name:"implementation_",type:"address",internalType:"contract IERC6551Account"},{name:"appRegistry_",type:"address",internalType:"contract AppRegistry"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isApprovedForAll",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"operator",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"markDisputed",inputs:[{name:"_tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"marketPlace",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IMarketplace"}],stateMutability:"view"},{type:"function",name:"maxRoyaltyBps",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxTermDuration",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"minPrice",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"minTermDuration",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"mintWithSignature",inputs:[{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"creatorContentHash",type:"bytes32",internalType:"bytes32"},{name:"uri",type:"string",internalType:"string"},{name:"licenseTerms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"isIP",type:"bool",internalType:"bool"},{name:"appId",type:"string",internalType:"string"},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ownerOf",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"pause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"paused",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"safeTransferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setAppRegistry",inputs:[{name:"_appRegistry",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setApprovalForAll",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"approved",type:"bool",internalType:"bool"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setDisputeModule",inputs:[{name:"_disputeModule",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setMarketPlace",inputs:[{name:"_marketPlace",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setSigner",inputs:[{name:"_signer",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"signer",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"tokenInfo",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"tuple",internalType:"struct IIpNFT.TokenInfo",components:[{name:"tokenURI",type:"string",internalType:"string"},{name:"isIP",type:"bool",internalType:"bool"},{name:"contentHash",type:"bytes32",internalType:"bytes32"},{name:"terms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]},{name:"status",type:"uint8",internalType:"enum IIpNFT.DataStatus"},{name:"appId",type:"string",internalType:"string"}]}],stateMutability:"view"},{type:"function",name:"tokenURI",inputs:[{name:"_tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"unpause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateTerms",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"newTerms",type:"tuple",internalType:"struct IIpNFT.LicenseTerms",components:[{name:"price",type:"uint128",internalType:"uint128"},{name:"duration",type:"uint32",internalType:"uint32"},{name:"royaltyBps",type:"uint16",internalType:"uint16"},{name:"paymentToken",type:"address",internalType:"address"},{name:"licenseType",type:"uint8",internalType:"enum IIpNFT.LicenseType"}]}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"wCAMP",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"event",name:"AccessPurchased",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"buyer",type:"address",indexed:!0,internalType:"address"},{name:"periods",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newExpiry",type:"uint256",indexed:!1,internalType:"uint256"},{name:"amountPaid",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AgentRegistered",inputs:[{name:"agentId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"ipNftId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"agentAddress",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"AppRegistryUpdated",inputs:[{name:"appRegistry",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"ApprovalForAll",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"operator",type:"address",indexed:!0,internalType:"address"},{name:"approved",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"ChildIpTagged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"childIp",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIp",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DataDeleted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DataMinted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"},{name:"contentHash",type:"bytes32",indexed:!1,internalType:"bytes32"},{name:"parents",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DisputeAssertion",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"counterEvidenceHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"DisputeCancelled",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DisputeJudged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"judgement",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"DisputeModuleUpdated",inputs:[{name:"disputeModule",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DisputeRaised",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"initiator",type:"address",indexed:!0,internalType:"address"},{name:"targetId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"disputeTag",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"MarketPlaceUpdated",inputs:[{name:"marketPlace",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ParentIpsSet",inputs:[{name:"childIpId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"},{name:"totalRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ProtocolFeeUpdated",inputs:[{name:"newFeeBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"RoyaltyPaid",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"royaltyAmount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"creator",type:"address",indexed:!1,internalType:"address"},{name:"protocolAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"SignerUpdated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"StatusUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"status",type:"uint8",indexed:!1,internalType:"enum IIpNFT.DataStatus"}],anonymous:!1},{type:"event",name:"TermsUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"newPrice",type:"uint128",indexed:!1,internalType:"uint128"},{name:"newDuration",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"},{name:"paymentToken",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"TreasuryUpdated",inputs:[{name:"newTreasury",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Unpaused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Voted",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"voter",type:"address",indexed:!0,internalType:"address"},{name:"support",type:"bool",indexed:!1,internalType:"bool"},{name:"weight",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC721IncorrectOwner",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InsufficientApproval",inputs:[{name:"operator",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC721InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOperator",inputs:[{name:"operator",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC721InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC721NonexistentToken",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}]},{type:"error",name:"EnforcedPause",inputs:[]},{type:"error",name:"ExpectedPause",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidDeadline",inputs:[]},{type:"error",name:"InvalidDuration",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidPaymentToken",inputs:[]},{type:"error",name:"InvalidPrice",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"NotTokenOwner",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"TokenAlreadyExists",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]}],F=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"MAX_PARENTS",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"buyAccess",inputs:[{name:"buyer",type:"address",internalType:"address"},{name:"tokenId",type:"uint256",internalType:"uint256"},{name:"expectedPrice",type:"uint256",internalType:"uint256"},{name:"expectedDuration",type:"uint32",internalType:"uint32"},{name:"expectedPaymentToken",type:"address",internalType:"address"},{name:"expectedProtocolFeeBps",type:"uint16",internalType:"uint16"},{name:"expectedAppFeeBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"payable"},{type:"function",name:"hasParentIp",inputs:[{name:"ipId",type:"uint256",internalType:"uint256"},{name:"parent",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[{name:"dataNFT_",type:"address",internalType:"address"},{name:"protocolFeeBps_",type:"uint16",internalType:"uint16"},{name:"treasury_",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"ipToken",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IIpNFT"}],stateMutability:"view"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"parentRoyaltyPercent",inputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"pause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"paused",inputs:[],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"protocolFeeBps",inputs:[],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"royaltyStack",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint16",internalType:"uint16"}],stateMutability:"view"},{type:"function",name:"setParentIpsAndRoyaltyPercents",inputs:[{name:"childIpId",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"creator",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"subscriptionExpiry",inputs:[{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"treasury",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"unpause",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateProtocolFee",inputs:[{name:"newFeeBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateTreasury",inputs:[{name:"newTreasury",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AccessPurchased",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"buyer",type:"address",indexed:!0,internalType:"address"},{name:"periods",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newExpiry",type:"uint256",indexed:!1,internalType:"uint256"},{name:"amountPaid",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AgentRegistered",inputs:[{name:"agentId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"ipNftId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"agentAddress",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"AppRegistryUpdated",inputs:[{name:"appRegistry",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ChildIpTagged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"childIp",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIp",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DataDeleted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DataMinted",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"creator",type:"address",indexed:!0,internalType:"address"},{name:"contentHash",type:"bytes32",indexed:!1,internalType:"bytes32"},{name:"parents",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DisputeAssertion",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"counterEvidenceHash",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"DisputeCancelled",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"}],anonymous:!1},{type:"event",name:"DisputeJudged",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"judgement",type:"bool",indexed:!1,internalType:"bool"}],anonymous:!1},{type:"event",name:"DisputeModuleUpdated",inputs:[{name:"disputeModule",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"DisputeRaised",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"initiator",type:"address",indexed:!0,internalType:"address"},{name:"targetId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"disputeTag",type:"bytes32",indexed:!1,internalType:"bytes32"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"MarketPlaceUpdated",inputs:[{name:"marketPlace",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"ParentIpsSet",inputs:[{name:"childIpId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"parentIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"},{name:"totalRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ProtocolFeeUpdated",inputs:[{name:"newFeeBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"RoyaltyPaid",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"royaltyAmount",type:"uint256",indexed:!1,internalType:"uint256"},{name:"creator",type:"address",indexed:!1,internalType:"address"},{name:"protocolAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"SignerUpdated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"StatusUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"status",type:"uint8",indexed:!1,internalType:"enum IIpNFT.DataStatus"}],anonymous:!1},{type:"event",name:"TermsUpdated",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"newPrice",type:"uint128",indexed:!1,internalType:"uint128"},{name:"newDuration",type:"uint32",indexed:!1,internalType:"uint32"},{name:"newRoyaltyBps",type:"uint16",indexed:!1,internalType:"uint16"},{name:"paymentToken",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"TreasuryUpdated",inputs:[{name:"newTreasury",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Unpaused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Voted",inputs:[{name:"id",type:"uint256",indexed:!0,internalType:"uint256"},{name:"voter",type:"address",indexed:!0,internalType:"address"},{name:"support",type:"bool",indexed:!1,internalType:"bool"},{name:"weight",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"EnforcedPause",inputs:[]},{type:"error",name:"ExpectedPause",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"FeesExceedMaximum",inputs:[]},{type:"error",name:"FeesMismatch",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidLicenseType",inputs:[]},{type:"error",name:"InvalidParentIp",inputs:[]},{type:"error",name:"InvalidPayment",inputs:[]},{type:"error",name:"InvalidPrice",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"MaxParentsExceeded",inputs:[]},{type:"error",name:"MaxRoyaltyExceeded",inputs:[]},{type:"error",name:"NoSubscriptionFound",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"ParentAlreadyExists",inputs:[]},{type:"error",name:"ParentIpAlreadyDeleted",inputs:[]},{type:"error",name:"ParentIpAlreadyDisputed",inputs:[]},{type:"error",name:"SubscriptionNotAllowed",inputs:[]},{type:"error",name:"TermsMismatch",inputs:[]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"Unauthorized",inputs:[]},{type:"error",name:"ZeroAddress",inputs:[]}],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:"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=[{type:"constructor",inputs:[{name:"ipNFT_",type:"address",internalType:"contract IIpNFT"},{name:"exchangeRate_",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"exchangeRate",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"fractionalize",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getTokenForNFT",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"ipNFT",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IIpNFT"}],stateMutability:"view"},{type:"function",name:"nftToToken",inputs:[{name:"",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"address",internalType:"contract FractionalToken"}],stateMutability:"view"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"pure"},{type:"function",name:"redeem",inputs:[{name:"tokenId",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"Fractionalized",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"depositor",type:"address",indexed:!0,internalType:"address"},{name:"token",type:"address",indexed:!1,internalType:"address"},{name:"supply",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Redeemed",inputs:[{name:"tokenId",type:"uint256",indexed:!0,internalType:"uint256"},{name:"redeemer",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AlreadyFractionalized",inputs:[]},{type:"error",name:"InsufficientFractionalTokens",inputs:[]},{type:"error",name:"InvalidExchangeRate",inputs:[]},{type:"error",name:"NotFractionalized",inputs:[]},{type:"error",name:"NotTokenOwner",inputs:[]},{type:"error",name:"ZeroAddress",inputs:[]}],L=[{type:"constructor",inputs:[],stateMutability:"nonpayable"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"appExists",inputs:[{name:"",type:"string",internalType:"string"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"apps",inputs:[{name:"",type:"string",internalType:"string"}],outputs:[{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"},{name:"isActive",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"deactivateApp",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"getAppInfo",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[{name:"",type:"tuple",internalType:"struct AppRegistry.AppInfo",components:[{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"},{name:"isActive",type:"bool",internalType:"bool"}]}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"reactivateApp",inputs:[{name:"appId",type:"string",internalType:"string"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"registerApp",inputs:[{name:"appId",type:"string",internalType:"string"},{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"updateApp",inputs:[{name:"appId",type:"string",internalType:"string"},{name:"treasury",type:"address",internalType:"address"},{name:"revenueShareBps",type:"uint16",internalType:"uint16"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AppDeactivated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"}],anonymous:!1},{type:"event",name:"AppReactivated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"}],anonymous:!1},{type:"event",name:"AppRegistered",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"},{name:"treasury",type:"address",indexed:!1,internalType:"address"},{name:"revenueShareBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"AppUpdated",inputs:[{name:"appId",type:"string",indexed:!0,internalType:"string"},{name:"treasury",type:"address",indexed:!1,internalType:"address"},{name:"revenueShareBps",type:"uint16",indexed:!1,internalType:"uint16"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AppAlreadyActive",inputs:[]},{type:"error",name:"AppAlreadyExists",inputs:[]},{type:"error",name:"AppAlreadyInactive",inputs:[]},{type:"error",name:"AppNotFound",inputs:[]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedCall",inputs:[]},{type:"error",name:"InvalidAppId",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidRoyalty",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"ZeroAddress",inputs:[]}],z="Connect with Camp Network",V=2628e3,q=86400,J=1e15,W=1,G=1e4;const Z={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",
63
61
  // TODO: Add actual contract addresses when deployed
64
- DISPUTE_CONTRACT_ADDRESS:"",FRACTIONALIZER_CONTRACT_ADDRESS:"",APP_REGISTRY_CONTRACT_ADDRESS:"",USDC_CONTRACT_ADDRESS:"",CHAIN:P,IPNFT_ABI:U,MARKETPLACE_ABI:$,TBA_ABI:H,BATCH_PURCHASE_ABI:j,DISPUTE_ABI:L,FRACTIONALIZER_ABI:z,APP_REGISTRY_ABI:V}};let X=[];const Q=()=>X,ee=e=>{function t(t){X.some((e=>e.info.uuid===t.detail.info.uuid))||(X=[...X,t.detail],e(X))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)},te=(e,t,n)=>{const i=[];let a=[],s=!1,r=0;const o=e.length;return new Promise(((d,u)=>{function p(){n(r/o*100)}function l(e,t,n){return T(this,arguments,void 0,(function*(e,t,n,i=0){var a;try{const i=null===(a=(yield h.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
+ FRACTIONALIZER_CONTRACT_ADDRESS:"",USDC_CONTRACT_ADDRESS:"0x8a2B28364102Bea189D99A475C494330Ef2bDD0B",CHAIN:C,IPNFT_ABI:B,MARKETPLACE_ABI:F,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,FRACTIONALIZER_ABI:j,APP_REGISTRY_ABI:L},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",BATCH_OPERATIONS_CONTRACT_ADDRESS:"0x31885cD2A445322067dF890bACf6CeFE9b233BCC",
63
+ // TODO: Add actual contract addresses when deployed
64
+ DISPUTE_CONTRACT_ADDRESS:"",FRACTIONALIZER_CONTRACT_ADDRESS:"",APP_REGISTRY_CONTRACT_ADDRESS:"",USDC_CONTRACT_ADDRESS:"",CHAIN:E,IPNFT_ABI:B,MARKETPLACE_ABI:F,TBA_ABI:U,BATCH_OPERATIONS_ABI:$,DISPUTE_ABI:H,FRACTIONALIZER_ABI:j,APP_REGISTRY_ABI:L}};let Y=[];const K=()=>Y,Q=e=>{function t(t){Y.some((e=>e.info.uuid===t.detail.info.uuid))||(Y=[...Y,t.detail],e(Y))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)},X=(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
65
65
  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}`)}}))}
66
66
  // Expose abort method
67
- te.abort=()=>{s=!0,h.isCancel("Upload aborted")},p(),// Initial 0%
68
- function(){return T(this,void 0,void 0,(function*(){const n=[];for(let d=0;d<o&&!s;d++){const s=(()=>T(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++,p()}catch(e){if(console.error(`Part ${d+1} failed:`,e),a.push(d),a.length>.1*o)
67
+ X.abort=()=>{s=!0,c.isCancel("Upload aborted")},u(),// Initial 0%
68
+ 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)
69
69
  // Fail fast if >10% fail
70
70
  throw e}})))();n.push(s),
71
71
  // Limit concurrency
72
72
  n.length>=4&&(yield Promise.race(n),
73
73
  // Remove settled promises to continue
74
- n.splice(0,n.length,...(yield Promise.allSettled(n)).map(((e,t)=>n[t])).filter(Boolean)))}yield Promise.allSettled(n),s?u(new Error("Upload aborted by user")):a.length>0?u(new Error(`Failed to upload ${a.length}/${o} parts: ${a.join(", ")}`)):(i.sort(((e,t)=>e.PartNumber-t.PartNumber)),d(i))}))}().catch(u)}))};
74
+ 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)}))};
75
75
  /**
76
76
  * Uploads chunks to respective presigned URLs with progress tracking.
77
77
  * Falls back to a simple fetch request if XMLHttpRequest is not available.
@@ -94,9 +94,9 @@ n.splice(0,n.length,...(yield Promise.allSettled(n)).map(((e,t)=>n[t])).filter(B
94
94
  * @param appId Optional app ID for the minting operation.
95
95
  * @returns A promise that resolves when the minting is complete.
96
96
  */
97
- function ne(e,t,n,i,a,s,r,o,d,u){return T(this,void 0,void 0,(function*(){var p;
97
+ function ee(e,t,n,i,a,s,r,o,d,p){return m(this,void 0,void 0,(function*(){var u;
98
98
  // use provided appId, else use instance appId, else default to empty string
99
- const l=null!==(p=null!=u?u:this.appId)&&void 0!==p?p:"";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})}))}
99
+ 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})}))}
100
100
  /**
101
101
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
102
102
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
@@ -106,55 +106,55 @@ const l=null!==(p=null!=u?u:this.appId)&&void 0!==p?p:"";return yield this.callC
106
106
  * @param fileKey The file key(s) if the source is "file".
107
107
  * @param parents The IDs of the parent NFTs, if applicable.
108
108
  * @return A promise that resolves with the registration data.
109
- */function ie(e,t,n,i,a,s,r,o){return T(this,void 0,void 0,(function*(){var d;const u=null!==(d=null!=o?o:this.appId)&&void 0!==d?d:"",p={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken,licenseType:n.licenseType},appId:u,isIp:a,metadata:i,parentId:r?r.map((e=>e.toString())):[]};void 0!==s&&(p.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(p)}),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}))}
109
+ */function te(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}))}
110
110
  /**
111
111
  * Updates the license terms of a specified IPNFT.
112
112
  * @param tokenId The ID of the IPNFT to update.
113
113
  * @param newTerms The new license terms to set.
114
114
  * @returns A promise that resolves when the transaction is complete.
115
- */function ae(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
115
+ */function ne(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
116
116
  /**
117
117
  * Sets the IPNFT as deleted
118
118
  * @param tokenId The token ID to set as deleted.
119
119
  * @returns A promise that resolves when the transaction is complete.
120
- */function se(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
120
+ */function ie(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
121
121
  /**
122
122
  * Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
123
123
  * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
124
124
  * @param simulateOnly If true, simulates the transaction without executing it.
125
125
  * @returns The address of the royalty vault associated with the specified token owner.
126
- */function re(e){return T(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return t?n:n.simulatedResult}))}
126
+ */function ae(e){return m(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return t?n:n.simulatedResult}))}
127
127
  /**
128
128
  * Returns the license terms associated with a specific token ID.
129
129
  * @param tokenId The token ID to query.
130
130
  * @returns The license terms of the token ID.
131
- */function oe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
131
+ */function se(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
132
132
  /**
133
133
  * Returns the owner of the specified IPNFT.
134
134
  * @param tokenId The ID of the IPNFT to query.
135
135
  * @returns The address of the owner of the IPNFT.
136
- */function de(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
136
+ */function re(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
137
137
  /**
138
138
  * Returns the number of IPNFTs owned by the given address.
139
139
  * @param owner The address to query.
140
140
  * @returns The number of IPNFTs owned by the address.
141
- */function ue(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
141
+ */function oe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
142
142
  /**
143
143
  * Returns the metadata URI associated with a specific token ID.
144
144
  * @param tokenId The token ID to query.
145
145
  * @returns The metadata URI of the token ID.
146
- */function pe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
146
+ */function de(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
147
147
  /**
148
148
  * Returns the data status of the given token ID.
149
149
  * @param tokenId The token ID to query.
150
150
  * @returns The data status of the token ID.
151
- */function le(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
151
+ */function pe(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
152
152
  /**
153
153
  * Checks if an operator is approved to manage all assets of a given owner.
154
154
  * @param owner The address of the asset owner.
155
155
  * @param operator The address of the operator to check.
156
156
  * @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
157
- */function ye(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function ce(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function me(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 he(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function Te(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
157
+ */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])}
158
158
  /**
159
159
  * Buys access to a data NFT for a specified duration.
160
160
  * @param buyer The address of the buyer.
@@ -166,89 +166,13 @@ const l=null!==(p=null!=u?u:this.appId)&&void 0!==p?p:"";return yield this.callC
166
166
  * @param expectedAppFeeBps The expected app fee in basis points (0-10000). Defaults to 0.
167
167
  * @param value The amount of native token to send (only required if paying with native token).
168
168
  * @returns A promise that resolves when the transaction is confirmed.
169
- */function fe(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})}
169
+ */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})}
170
170
  /**
171
171
  * Checks if a user has access to a specific token based on subscription expiry.
172
172
  * @param user - The address of the user.
173
173
  * @param tokenId - The ID of the token.
174
174
  * @returns A promise that resolves to a boolean indicating if the user has access.
175
- */function ve(e,t){return T(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 Ae(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
176
- /**
177
- * Fetches the protocol fee from the marketplace contract.
178
- */function we(e){return T(this,void 0,void 0,(function*(){try{const t=yield e.callContractMethod(e.environment.MARKETPLACE_CONTRACT_ADDRESS,e.environment.MARKETPLACE_ABI,"protocolFeeBps",[]);return Number(t)}catch(e){return console.warn("Failed to fetch protocol fee, defaulting to 0:",e),0}}))}
179
- /**
180
- * Fetches the app fee for a specific token from the AppRegistry.
181
- */function Ie(e,t){return T(this,void 0,void 0,(function*(){try{const n=yield e.callContractMethod(e.environment.DATANFT_CONTRACT_ADDRESS,e.environment.IPNFT_ABI,"tokenInfo",[t]),i=null==n?void 0:n.appId;if(!i||""===i)return 0;if(!e.environment.APP_REGISTRY_CONTRACT_ADDRESS||!e.environment.APP_REGISTRY_ABI)return 0;const a=yield e.callContractMethod(e.environment.APP_REGISTRY_CONTRACT_ADDRESS,e.environment.APP_REGISTRY_ABI,"getAppInfo",[i]);return(null==a?void 0:a.isActive)?Number(a.revenueShareBps):0}catch(e){return console.warn("Failed to fetch app fee, defaulting to 0:",e),0}}))}
182
- /**
183
- * EXPERIMENTAL METHOD
184
- * Settles a payment intent response by purchasing access if needed.
185
- * This method checks if the user already has access to the item, and if not,
186
- * it calls buyAccess with the parameters from the payment intent response.
187
- * Supports viem WalletClient, ethers Signer, and custom signer implementations.
188
- *
189
- * @param paymentIntentResponse - The response from getDataWithIntent containing payment details.
190
- * @param signer - Optional signer object used to interact with the blockchain. If not provided, uses the connected wallet client.
191
- * @returns A promise that resolves with the transaction hash and receipt, or null if access already exists.
192
- * @throws {Error} If the response doesn't contain marketplace action or if the method is not buyAccess.
193
- */function ge(e,t){return T(this,void 0,void 0,(function*(){if(!e.marketplaceAction)throw new _("Invalid X402 response: no marketplace action found. The response may be malformed or the server returned an error.");const{marketplaceAction:n}=e;if("buyAccess"!==n.method)throw new _(`Unsupported marketplace action method "${n.method}". Only "buyAccess" is currently supported.`);const i=BigInt(n.tokenId),s=n.payer;if(yield this.hasAccess(s,i))return console.log("User already has access to this item"),null;const r=BigInt(n.amount),o=BigInt(n.duration),d=n.asset,u="0x0000000000000000000000000000000000000000"===d,p=u?r:BigInt(0),[l,y]=yield Promise.all([we(this),Ie(this,i)]);if(t){const e=g(t),n=this.environment.MARKETPLACE_CONTRACT_ADDRESS,u=this.environment.MARKETPLACE_ABI,c=a({abi:u,functionName:"buyAccess",args:[s,i,r,o,d,l,y]});if("viem"===e.type){const t=e.signer,i=yield t.sendTransaction({to:n,data:c,value:p,account:yield e.getAddress()});return{txHash:i,receipt:yield t.waitForTransactionReceipt({hash:i})}}if("ethers"===e.type){const t=e.signer,i=yield t.sendTransaction({to:n,data:c,value:p.toString()}),a=yield i.wait();return{txHash:i.hash,receipt:a}}{const t=e.signer;if("function"!=typeof t.sendTransaction)throw new _("Custom signer must implement sendTransaction() method to settle payment intents");const i=yield t.sendTransaction({to:n,data:c,value:p.toString()});if(i.wait&&"function"==typeof i.wait){const e=yield i.wait();return{txHash:i.hash,receipt:e}}return{txHash:i.hash||i}}}if(!this.viemClient)throw new N("Cannot settle payment intent: no signer or wallet connected. Please connect a wallet or provide a signer.");return yield this.buyAccess(s,i,r,o,d,l,y,u?p:void 0)}))}
194
- /**
195
- * Resolves a wallet address from an optional address parameter or connected wallet.
196
- * Checks viemClient.account first, then falls back to eth_requestAccounts.
197
- *
198
- * @param viemClient The viem WalletClient instance.
199
- * @param address Optional address to use directly.
200
- * @returns The resolved wallet address.
201
- * @throws Error if no address provided and no wallet connected or no accounts found.
202
- */function be(e,t){return T(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]}))}
203
- /**
204
- * Enum representing the type of license for an IP NFT.
205
- * - DURATION_BASED: License expires after a set duration (subscription model).
206
- * - SINGLE_PAYMENT: One-time payment for perpetual access.
207
- * - X402: HTTP 402-based micropayment license (no on-chain payments).
208
- */var Ce,Ee,Se;!function(e){e[e.DURATION_BASED=0]="DURATION_BASED",e[e.SINGLE_PAYMENT=1]="SINGLE_PAYMENT",e[e.X402=2]="X402"}(Ce||(Ce={})),function(e){e[e.ACTIVE=0]="ACTIVE",e[e.DELETED=1]="DELETED",e[e.DISPUTED=2]="DISPUTED"}(Ee||(Ee={})),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"}(Se||(Se={}));
209
- /**
210
- * Creates license terms for a digital asset.
211
- * @param price The price of the asset in wei.
212
- * @param duration The duration of the license in seconds (use 0 for SINGLE_PAYMENT and X402).
213
- * @param royaltyBps The royalty percentage in basis points (0-10000).
214
- * @param paymentToken The address of the payment token (ERC20 / address(0) for native currency).
215
- * @param licenseType The type of license (defaults to DURATION_BASED).
216
- * @returns The created license terms.
217
- */
218
- const Pe=(e,t,n,i,a=Ce.DURATION_BASED)=>{if(n<Y||n>Z)throw new Error(`Royalty basis points must be between ${Y} and ${Z}`);if(a===Ce.DURATION_BASED){if(t<G||t>J)throw new Error(`Duration must be between ${G} and ${J} seconds for DURATION_BASED licenses`)}else if((a===Ce.SINGLE_PAYMENT||a===Ce.X402)&&t>0)throw new Error(`Duration must be 0 for ${Ce[a]} licenses`);if(e<W)throw new Error(`Price must be at least ${W} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i,licenseType:a}},Re={X402Intent:[{name:"payer",type:"address"},{name:"asset",type:"address"},{name:"amount",type:"uint256"},{name:"httpMethod",type:"string"},{name:"payTo",type:"address"},{name:"tokenId",type:"uint256"},{name:"duration",type:"uint32"},{name:"expiresAt",type:"uint256"},{name:"nonce",type:"bytes32"}]},_e=(e,t,n)=>T(void 0,void 0,void 0,(function*(){return yield fetch(`${e.environment.AUTH_HUB_BASE_API}/origin/data/${t}`,{method:"GET",headers:Object.assign({"Content-Type":"application/json"},n)})}))
219
- /**
220
- * EXPERIMENTAL METHOD
221
- * Fetch data with X402 payment handling.
222
- * @param {bigint} tokenId The token ID to fetch data for.
223
- * @param {any} [signer] Optional signer object for signing the X402 intent.
224
- * @returns {Promise<any>} A promise that resolves with the fetched data.
225
- * @throws {Error} Throws an error if the data cannot be fetched or if no signer/wallet client is provided.
226
- */;
227
- /**
228
- * Defines the EIP-712 typed data structure for X402 Intent signatures.
229
- */function De(e,t,n){return T(this,void 0,void 0,(function*(){var i;const a=this.viemClient;if(!t&&!a)throw new N(`Cannot fetch data for token ${e}: no signer or wallet client provided. Please connect a wallet or provide a signer.`);const r=yield _e(this,e,{});if(402!==r.status){if(!r.ok){const t=yield r.text().catch((()=>r.statusText));throw new R(`Failed to fetch data for token ${e} (HTTP ${r.status}): ${t}`,r.status)}return r.json()}const o=a||g(t),d=a?yield ke.call(this):yield o.getAddress(),u=yield r.json();if(u.error)throw new R(`Failed to process X402 intent for token ${e}: ${u.error}`);const p=u.accepts[0],l=yield Ne.call(this,p,s(d),o),y=btoa(JSON.stringify(l)),c=yield _e(this,e,{"X-PAYMENT":y});if(402===c.status){
230
- // subscription required
231
- if(n){const i=yield c.json();if(yield n(i.marketplaceAction)){const n=yield this.settlePaymentIntent(i,t||a);if(n&&!n.txHash)throw new R(`Failed to settle X402 payment for token ${e}: no transaction hash returned`);
232
- // retry fetching data after settlement
233
- return yield this.getDataWithIntent(e,t,void 0)}
234
- // user declined to proceed with payment
235
- return{error:"User declined to proceed with payment",data:null}}return c.json()}if(!c.ok){const t=yield c.text().catch((()=>c.statusText));throw new R(`Failed to fetch data for token ${e} after X402 payment (HTTP ${c.status}): ${t}`,c.status)}const m=yield c.json();return{error:null,data:null!==(i=m.data)&&void 0!==i?i:m}}))}
236
- /**
237
- * Build the X402 payment payload.
238
- * @private
239
- */function Ne(e,t,n){return T(this,void 0,void 0,(function*(){const i="native"===e.asset?r:e.asset,a=BigInt(e.maxAmountRequired||0),u=e.extra.duration,p=xe.call(this),l=Re,y=crypto.randomUUID(),c=o(d(y)),m={payer:t,asset:i,amount:a.toString(),httpMethod:"GET",payTo:s(this.environment.MARKETPLACE_CONTRACT_ADDRESS),tokenId:e.extra.tokenId,duration:u,expiresAt:Math.floor(Date.now()/1e3)+e.maxTimeoutSeconds,nonce:c},h=g(n),T=yield h.signTypedData(p,l,m);return{x402Version:1,scheme:"exact",network:e.network,payload:Object.assign(Object.assign({},m),{sigType:"eip712",signature:T,license:{tokenId:e.extra.tokenId,duration:u}})}}))}
240
- /**
241
- * Create the X402 Intent domain for EIP-712 signing.
242
- * @private
243
- */function xe(){return{name:"Origin X402 Intent",version:"1",chainId:this.environment.CHAIN.id,verifyingContract:this.environment.MARKETPLACE_CONTRACT_ADDRESS}}
244
- /**
245
- * Get the current account address.
246
- * @private
247
- */function ke(){return T(this,void 0,void 0,(function*(){const e=this.viemClient;if(!e)throw new N("No wallet connected. Please connect a wallet to perform this action.");
248
- // If account is already set on the client, return it directly
249
- if(e.account)return e.account.address;
250
- // Otherwise request accounts (browser wallet flow)
251
- const t=yield e.request({method:"eth_requestAccounts",params:[]});if(!t||0===t.length)throw new N("No accounts found in connected wallet. Please unlock your wallet or add an account.");return t[0]}))}
175
+ */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])}
252
176
  /**
253
177
  * Raises a dispute against an IP NFT.
254
178
  * Automatically handles token approval for ERC20 bonds or native token value.
@@ -267,20 +191,20 @@ const t=yield e.request({method:"eth_requestAccounts",params:[]});if(!t||0===t.l
267
191
  * "0x0100000000000000000000000000000000000000000000000000000000000000" // dispute tag (bytes32)
268
192
  * );
269
193
  * ```
270
- */function Me(e,t,n){return T(this,void 0,void 0,(function*(){const i=O(),a=this.environment.DISPUTE_CONTRACT_ADDRESS,s=this.environment.DISPUTE_ABI,[o,d,u]=yield Promise.all([i.readContract({address:a,abi:s,functionName:"disputeBond"}),i.readContract({address:a,abi:s,functionName:"protocolDisputeFee"}),i.readContract({address:a,abi:s,functionName:"disputeToken"})]),p=u===r,l=o+d;
194
+ */function ve(e,t,n){return m(this,void 0,void 0,(function*(){const i=O(),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;
271
195
  // Call the raiseDispute contract method
272
196
  // Pass the total (bond + protocol fee) as msg.value if using native token
273
- return p||(yield this.approveERC20IfNeeded(u,a,l)),this.callContractMethod(a,s,"raiseDispute",[e,t,n],{waitForReceipt:!0,value:p?l:void 0})}))}
197
+ return u||(yield this.approveERC20IfNeeded(p,s,l)),this.callContractMethod(s,r,"raiseDispute",[e,t,n],{waitForReceipt:!0,value:u?l:void 0})}))}
274
198
  // base-x encoding / decoding
275
199
  // Copyright (c) 2018 base-x contributors
276
200
  // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
277
201
  // Distributed under the MIT software license, see the accompanying
278
202
  // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
279
- var Be=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;
203
+ 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;
280
204
  // Skip and count leading '1's.
281
205
  for(;e[s]===i;)r++,s++;
282
206
  // Allocate enough space in big-endian base256 representation.
283
- const d=(e.length-s)*a+1>>>0,u=new Uint8Array(d);// log(58) / log(256), rounded up.
207
+ const d=(e.length-s)*a+1>>>0,p=new Uint8Array(d);// log(58) / log(256), rounded up.
284
208
  // Process the characters.
285
209
  for(;s<e.length;){
286
210
  // Find code of next character
@@ -290,51 +214,51 @@ if(i>255)return;
290
214
  // Decode character
291
215
  let a=t[i];
292
216
  // Invalid character
293
- if(255===a)return;let r=0;for(let e=d-1;(0!==a||r<o)&&-1!==e;e--,r++)a+=n*u[e]>>>0,u[e]=a%256>>>0,a=a/256>>>0;if(0!==a)throw new Error("Non-zero carry");o=r,s++}
217
+ 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++}
294
218
  // Skip leading zeroes in b256.
295
- let p=d-o;for(;p!==d&&0===u[p];)p++;const l=new Uint8Array(r+(d-p));let y=r;for(;p!==d;)l[y++]=u[p++];return l}return{encode:// log(256) / log(BASE), rounded up
219
+ 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
296
220
  function(t){if(
297
221
  // eslint-disable-next-line no-empty
298
222
  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"";
299
223
  // Skip & count leading zeroes.
300
224
  let a=0,r=0,o=0;const d=t.length;for(;o!==d&&0===t[o];)o++,a++;
301
225
  // Allocate enough space in big-endian base58 representation.
302
- const u=(d-o)*s+1>>>0,p=new Uint8Array(u);
226
+ const p=(d-o)*s+1>>>0,u=new Uint8Array(p);
303
227
  // Process the bytes.
304
228
  for(;o!==d;){let e=t[o],i=0;
305
229
  // Apply "b58 = b58 * 256 + ch".
306
- for(let t=u-1;(0!==e||i<r)&&-1!==t;t--,i++)e+=256*p[t]>>>0,p[t]=e%n>>>0,e=e/n>>>0;if(0!==e)throw new Error("Non-zero carry");r=i,o++}
230
+ 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++}
307
231
  // Skip leading zeroes in base58 result.
308
- let l=u-r;for(;l!==u&&0===p[l];)l++;
232
+ let l=p-r;for(;l!==p&&0===u[l];)l++;
309
233
  // Translate the result into a string.
310
- let y=i.repeat(a);for(;l<u;++l)y+=e.charAt(p[l]);return y},decodeUnsafe:r,decode:function(e){const t=r(e);if(t)return t;throw new Error("Non-base"+n+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");
234
+ 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");
311
235
  // RFC 4648 base32 alphabet (lowercase)
312
- const Fe="abcdefghijklmnopqrstuvwxyz234567";
236
+ const Ae="abcdefghijklmnopqrstuvwxyz234567";
313
237
  /**
314
238
  * Encode a CID to bytes32 by extracting the 32-byte SHA-256 digest.
315
239
  * Supports both CIDv0 (starts with "Qm") and CIDv1 (starts with "bafy").
316
240
  */
317
- function Oe(e){let t;if(e.startsWith("Qm")){
241
+ function Ie(e){let t;if(e.startsWith("Qm")){
318
242
  // CIDv0: base58-encoded multihash (0x1220 + 32-byte digest)
319
- const n=Be.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'");{
243
+ 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'");{
320
244
  // CIDv1: multibase 'b' prefix + base32-encoded (version + codec + multihash)
321
- const n=function(e){const t={};for(let e=0;e<32;e++)t[Fe[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));
245
+ const n=function(e){const t={};for(let e=0;e<32;e++)t[Ae[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));
322
246
  // CIDv1 structure: version (1 byte) + codec (varint) + multihash
323
247
  // For raw codec with sha2-256: 0x01 + 0x55 + 0x12 + 0x20 + 32-byte digest
324
248
  // For dag-pb with sha2-256: 0x01 + 0x70 + 0x12 + 0x20 + 32-byte digest
325
249
  if(1!==n[0]||36!==n.length)throw new Error("Invalid CIDv1: expected version 1 with 36 bytes");const i=n[1];if(85!==i&&112!==i)throw new Error(`Invalid CIDv1: unsupported codec 0x${i.toString(16)}`);if(18!==n[2]||32!==n[3])throw new Error("Invalid CIDv1: expected SHA-256 hash");t=n.slice(4)}}return`0x${Buffer.from(t).toString("hex")}`}
326
250
  /**
327
- * Decode bytes32 back to CIDv1 format (base32, dag-pb codec).
328
- * Returns a CID starting with "bafybei" that works with Pinata gateways.
329
- */function Ue(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
330
- // Build CIDv1: version (0x01) + dag-pb codec (0x70) + sha2-256 (0x12) + length (0x20) + digest
251
+ * Decode bytes32 back to CIDv1 format (base32, raw codec).
252
+ * Returns a CID starting with "bafkrei" that works with Pinata gateways for raw data uploads.
253
+ */function ge(e){const t=Buffer.from(e.slice(2),"hex");if(32!==t.length)throw new Error("Invalid bytes32: expected 32-byte digest");
254
+ // Build CIDv1: version (0x01) + raw codec (0x55) + sha2-256 (0x12) + length (0x20) + digest
331
255
  const n=new Uint8Array(36);
332
256
  // Encode with base32 and add 'b' multibase prefix
333
257
  return n[0]=1,// CIDv1
334
- n[1]=112,// dag-pb codec (used by Pinata)
258
+ n[1]=85,// raw codec (used by Pinata for raw data uploads like JSON)
335
259
  n[2]=18,// sha2-256 hash function
336
260
  n[3]=32,// 32 byte length
337
- 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+=Fe[i>>n&31];return n>0&&(t+=Fe[i<<5-n&31]),t}(n)}
261
+ 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+=Ae[i>>n&31];return n>0&&(t+=Ae[i<<5-n&31]),t}(n)}
338
262
  /**
339
263
  * Raises a dispute with automatic evidence upload to IPFS.
340
264
  * Uploads evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
@@ -363,7 +287,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
363
287
  * // Fetch evidence via IPFS gateway
364
288
  * // https://ipfs.io/ipfs/{result.evidenceCid}
365
289
  * ```
366
- */function $e(e,t,n){return T(this,void 0,void 0,(function*(){const i=yield this.uploadJSONToIPFS(t),a=Oe(i);return{transactionResult:yield this.raiseDispute(e,a,n),evidenceCid:i,evidenceHash:a}}))}
290
+ */function be(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield this.uploadJSONToIPFS(t),a=Ie(i);return{transactionResult:yield this.raiseDispute(e,a,n),evidenceCid:i,evidenceHash:a}}))}
367
291
  /**
368
292
  * Asserts a dispute as the IP owner with counter-evidence.
369
293
  * Must be called by the owner of the disputed IP within the cooldown period.
@@ -376,7 +300,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
376
300
  * ```typescript
377
301
  * await origin.disputeAssertion(1n, "0x1234..."); // counter-evidence hash
378
302
  * ```
379
- */function He(e,t){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"disputeAssertion",[e,t],{waitForReceipt:!0})}))}
303
+ */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})}))}
380
304
  /**
381
305
  * Asserts a dispute with automatic counter-evidence upload to IPFS.
382
306
  * Uploads counter-evidence JSON to IPFS, encodes the CID to bytes32 for on-chain storage,
@@ -405,7 +329,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
405
329
  * // Fetch counter-evidence via IPFS gateway
406
330
  * // https://ipfs.io/ipfs/{result.counterEvidenceCid}
407
331
  * ```
408
- */function je(e,t){return T(this,void 0,void 0,(function*(){const n=yield this.uploadJSONToIPFS(t),i=Oe(n);return{transactionResult:yield this.disputeAssertion(e,i),counterEvidenceCid:n,counterEvidenceHash:i}}))}
332
+ */function Ee(e,t){return m(this,void 0,void 0,(function*(){const n=yield this.uploadJSONToIPFS(t),i=Ie(n);return{transactionResult:yield this.disputeAssertion(e,i),counterEvidenceCid:n,counterEvidenceHash:i}}))}
409
333
  /**
410
334
  * Votes on a dispute as a CAMP token staker.
411
335
  * Only users who staked before the dispute was raised can vote.
@@ -423,7 +347,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
423
347
  * // Vote against the dispute
424
348
  * await origin.voteOnDispute(1n, false);
425
349
  * ```
426
- */function Le(e,t){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"voteOnDispute",[e,t],{waitForReceipt:!0})}))}
350
+ */function Se(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})}))}
427
351
  /**
428
352
  * Resolves a dispute after the voting period has ended.
429
353
  * Can be called by anyone - resolution is deterministic based on votes and quorum.
@@ -437,7 +361,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
437
361
  * ```typescript
438
362
  * await origin.resolveDispute(1n);
439
363
  * ```
440
- */function ze(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"resolveDispute",[e],{waitForReceipt:!0})}))}
364
+ */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})}))}
441
365
  /**
442
366
  * Cancels a dispute that is still in the raised state.
443
367
  * Can only be called by the dispute initiator during the cooldown period.
@@ -450,7 +374,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
450
374
  * ```typescript
451
375
  * await origin.cancelDispute(1n);
452
376
  * ```
453
- */function Ve(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"cancelDispute",[e],{waitForReceipt:!0})}))}
377
+ */function Re(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})}))}
454
378
  /**
455
379
  * Tags a child IP as disputed if its parent has been successfully disputed.
456
380
  * This propagates the dispute status to derivative IPs.
@@ -464,7 +388,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
464
388
  * // After parent IP (tokenId 1) has been disputed, tag child IP (tokenId 2)
465
389
  * await origin.tagChildIp(2n, 1n); // childIpId, disputeId of parent
466
390
  * ```
467
- */function qe(e,t){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.DISPUTE_CONTRACT_ADDRESS,this.environment.DISPUTE_ABI,"tagChildIp",[e,t],{waitForReceipt:!0})}))}
391
+ */function Ne(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})}))}
468
392
  /**
469
393
  * Gets the details of a dispute by its ID.
470
394
  *
@@ -478,11 +402,35 @@ 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
478
402
  * console.log(`Yes votes: ${dispute.yesVotes}`);
479
403
  * console.log(`No votes: ${dispute.noVotes}`);
480
404
  * ```
481
- */function Je(e){return T(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,u,p,l,y,c]=t;
405
+ */function _e(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;
482
406
  // Contract returns a tuple, map it to the Dispute interface
483
- return{initiator:n,targetId:i,disputeTag:a,disputeEvidenceHash:s,counterEvidenceHash:r,disputeTimestamp:o,assertionTimestamp:d,yesVotes:u,noVotes:p,status:l,bondAmount:y,protocolFeeAmount:c}}))}
407
+ 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}}))}
408
+ /**
409
+ * Resolves a wallet address from an optional address parameter or connected wallet.
410
+ * Checks viemClient.account first, then falls back to eth_requestAccounts.
411
+ *
412
+ * @param viemClient The viem WalletClient instance.
413
+ * @param address Optional address to use directly.
414
+ * @returns The resolved wallet address.
415
+ * @throws Error if no address provided and no wallet connected or no accounts found.
416
+ */function De(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]}))}
417
+ /**
418
+ * Enum representing the type of license for an IP NFT.
419
+ * - DURATION_BASED: License expires after a set duration (subscription model).
420
+ * - SINGLE_PAYMENT: One-time payment for perpetual access.
421
+ * - X402: HTTP 402-based micropayment license (no on-chain payments).
422
+ */var ke,xe,Me;!function(e){e[e.DURATION_BASED=0]="DURATION_BASED",e[e.SINGLE_PAYMENT=1]="SINGLE_PAYMENT",e[e.X402=2]="X402"}(ke||(ke={})),function(e){e[e.ACTIVE=0]="ACTIVE",e[e.DELETED=1]="DELETED",e[e.DISPUTED=2]="DISPUTED"}(xe||(xe={})),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"}(Me||(Me={}));
423
+ /**
424
+ * Creates license terms for a digital asset.
425
+ * @param price The price of the asset in wei.
426
+ * @param duration The duration of the license in seconds (use 0 for SINGLE_PAYMENT and X402).
427
+ * @param royaltyBps The royalty percentage in basis points (0-10000).
428
+ * @param paymentToken The address of the payment token (ERC20 / address(0) for native currency).
429
+ * @param licenseType The type of license (defaults to DURATION_BASED).
430
+ * @returns The created license terms.
431
+ */
432
+ const Oe=(e,t,n,i,a=ke.DURATION_BASED)=>{if(n<W||n>G)throw new Error(`Royalty basis points must be between ${W} and ${G}`);if(a===ke.DURATION_BASED){if(t<q||t>V)throw new Error(`Duration must be between ${q} and ${V} seconds for DURATION_BASED licenses`)}else if((a===ke.SINGLE_PAYMENT||a===ke.X402)&&t>0)throw new Error(`Duration must be 0 for ${ke[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}},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"}];
484
433
  // minimal ABI for staking vault
485
- const Ge=[{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"}];
486
434
  /**
487
435
  * Checks if a user meets the requirements to vote on a dispute.
488
436
  * Returns detailed information about eligibility and reason if ineligible.
@@ -502,15 +450,16 @@ const Ge=[{inputs:[{name:"account",type:"address"}],name:"balanceOf",outputs:[{n
502
450
  * console.log(`Cannot vote: ${eligibility.reason}`);
503
451
  * }
504
452
  * ```
505
- */function We(e,t){return T(this,void 0,void 0,(function*(){const n=yield be(this.viemClient,t),i=O(),a=this.environment.DISPUTE_CONTRACT_ADDRESS,s=this.environment.DISPUTE_ABI,[r,o,d,u,p,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,m=r.assertionTimestamp,[h,T]=yield Promise.all([i.readContract({address:o,abi:Ge,functionName:"userStakeTimestamp",args:[n]}),i.readContract({address:o,abi:Ge,functionName:"balanceOf",args:[n]})]),f=BigInt(Math.floor(Date.now()/1e3));let v,A=!1;y===Se.Asserted?(
453
+ */
454
+ function Fe(e,t){return m(this,void 0,void 0,(function*(){const n=yield De(this.viemClient,t),i=O(),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,m=r.assertionTimestamp,[h,T]=yield Promise.all([i.readContract({address:o,abi:Be,functionName:"userStakeTimestamp",args:[n]}),i.readContract({address:o,abi:Be,functionName:"balanceOf",args:[n]})]),f=BigInt(Math.floor(Date.now()/1e3));let v,w=!1;y===Me.Asserted?(
506
455
  // for asserted disputes, voting period is relative to assertion timestamp
507
- v=m+p,A=f<=v):y===Se.Raised&&(
456
+ v=m+u,w=f<=v):y===Me.Raised&&(
508
457
  // for raised disputes, voting period extends from cooldown through judgement
509
- v=c+u+p,A=f<=v);
458
+ v=c+p+u,w=f<=v);
510
459
  // build base result
511
- const w={canVote:!1,votingWeight:T,stakingThreshold:d,hasAlreadyVoted:l,userStakeTimestamp:h,disputeTimestamp:c,disputeStatus:y,isVotingPeriodActive:A};
460
+ const A={canVote:!1,votingWeight:T,stakingThreshold:d,hasAlreadyVoted:l,userStakeTimestamp:h,disputeTimestamp:c,disputeStatus:y,isVotingPeriodActive:w};
512
461
  // check all requirements
513
- return y!==Se.Raised&&y!==Se.Asserted?Object.assign(Object.assign({},w),{reason:`Dispute is not in a voteable status (current: ${Se[y]})`}):A?l?Object.assign(Object.assign({},w),{reason:"You have already voted on this dispute"}):h===BigInt(0)?Object.assign(Object.assign({},w),{reason:"You have never staked CAMP tokens"}):h>=c?Object.assign(Object.assign({},w),{reason:"You staked after this dispute was raised (vote recycling prevention)"}):T<d?Object.assign(Object.assign({},w),{reason:`Insufficient stake: you have ${T} but need at least ${d}`}):Object.assign(Object.assign({},w),{canVote:!0}):Object.assign(Object.assign({},w),{reason:"Voting period has ended"})}))}
462
+ return y!==Me.Raised&&y!==Me.Asserted?Object.assign(Object.assign({},A),{reason:`Dispute is not in a voteable status (current: ${Me[y]})`}):w?l?Object.assign(Object.assign({},A),{reason:"You have already voted on this dispute"}):h===BigInt(0)?Object.assign(Object.assign({},A),{reason:"You have never staked CAMP tokens"}):h>=c?Object.assign(Object.assign({},A),{reason:"You staked after this dispute was raised (vote recycling prevention)"}):T<d?Object.assign(Object.assign({},A),{reason:`Insufficient stake: you have ${T} but need at least ${d}`}):Object.assign(Object.assign({},A),{canVote:!0}):Object.assign(Object.assign({},A),{reason:"Voting period has ended"})}))}
514
463
  /**
515
464
  * Gets detailed progress and voting statistics for a dispute.
516
465
  * Includes vote counts, percentages, quorum progress, and timeline.
@@ -532,17 +481,17 @@ return y!==Se.Raised&&y!==Se.Asserted?Object.assign(Object.assign({},w),{reason:
532
481
  * console.log(`Can resolve in ${progress.timeline.timeUntilResolution} seconds`);
533
482
  * }
534
483
  * ```
535
- */function Ye(e){return T(this,void 0,void 0,(function*(){var t,n,i,a,s,r,o,d,u;const p=O(),l=this.environment.DISPUTE_CONTRACT_ADDRESS,y=this.environment.DISPUTE_ABI,[c,m,h,T]=yield Promise.all([p.readContract({address:l,abi:y,functionName:"disputes",args:[e]}),p.readContract({address:l,abi:y,functionName:"disputeQuorum",args:[]}),p.readContract({address:l,abi:y,functionName:"disputeCoolDownPeriod",args:[]}),p.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),A=BigInt(null!==(s=null!==(a=c.assertionTimestamp)&&void 0!==a?a:c[6])&&void 0!==s?s:0),w=BigInt(null!==(o=null!==(r=c.yesVotes)&&void 0!==r?r:c[7])&&void 0!==o?o:0),I=BigInt(null!==(u=null!==(d=c.noVotes)&&void 0!==d?d:c[8])&&void 0!==u?u:0),g=w+I;let b=0,C=0;g>BigInt(0)&&(b=Number(w*BigInt(1e4)/g)/100,C=Number(I*BigInt(1e4)/g)/100);
484
+ */function Ue(e){return m(this,void 0,void 0,(function*(){var t,n,i,a,s,r,o,d,p;const u=O(),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!==(p=null!==(d=c.noVotes)&&void 0!==d?d:c[8])&&void 0!==p?p:0),g=A+I;let b=0,C=0;g>BigInt(0)&&(b=Number(A*BigInt(1e4)/g)/100,C=Number(I*BigInt(1e4)/g)/100);
536
485
  // calculate quorum progress
537
486
  let E=0;m>BigInt(0)&&(E=Number(g*BigInt(1e4)/m)/100);const S=g>=m;
538
487
  // determine projected outcome
539
- let P;P=S?w>I?"dispute_succeeds":"dispute_fails":"no_quorum";
488
+ let P;P=S?A>I?"dispute_succeeds":"dispute_fails":"no_quorum";
540
489
  // calculate timeline
541
- const R=BigInt(Math.floor(Date.now()/1e3)),_=new Date(1e3*Number(v)),D=new Date(1e3*Number(v+h));let N,x;f===Se.Asserted?(
490
+ const R=BigInt(Math.floor(Date.now()/1e3)),N=new Date(1e3*Number(v)),_=new Date(1e3*Number(v+h));let D,k;f===Me.Asserted?(
542
491
  // for asserted disputes, voting ends relative to assertion
543
- N=new Date(1e3*Number(A+T)),x=A+T):(
492
+ D=new Date(1e3*Number(w+T)),k=w+T):(
544
493
  // for raised disputes, voting ends after cooldown + judgement
545
- N=new Date(1e3*Number(v+h+T)),x=v+h+T);const k=(f===Se.Raised||f===Se.Asserted)&&R>x,M=k?0:Number(x-R);return{disputeId:e,status:f,yesVotes:w,noVotes:I,totalVotes:g,yesPercentage:b,noPercentage:C,quorum:m,quorumPercentage:E,quorumMet:S,projectedOutcome:P,timeline:{raisedAt:_,cooldownEndsAt:D,votingEndsAt:N,canResolveNow:k,timeUntilResolution:M}}}))}
494
+ D=new Date(1e3*Number(v+h+T)),k=v+h+T);const x=(f===Me.Raised||f===Me.Asserted)&&R>k,M=x?0:Number(k-R);return{disputeId:e,status:f,yesVotes:A,noVotes:I,totalVotes:g,yesPercentage:b,noPercentage:C,quorum:m,quorumPercentage:E,quorumMet:S,projectedOutcome:P,timeline:{raisedAt:N,cooldownEndsAt:_,votingEndsAt:D,canResolveNow:x,timeUntilResolution:M}}}))}
546
495
  /**
547
496
  * Gets the requirements for raising a dispute, including balance check.
548
497
  *
@@ -556,9 +505,9 @@ N=new Date(1e3*Number(v+h+T)),x=v+h+T);const k=(f===Se.Raised||f===Se.Asserted)&
556
505
  * console.log(`Need ${requirements.totalRequired} but only have ${requirements.userBalance}`);
557
506
  * }
558
507
  * ```
559
- */function Ze(e){return T(this,void 0,void 0,(function*(){const t=O(),n=this.environment.DISPUTE_CONTRACT_ADDRESS,i=this.environment.DISPUTE_ABI,[a,s,o]=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=o===r,p=a+s;
508
+ */function $e(e){return m(this,void 0,void 0,(function*(){const t=O(),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;
560
509
  // Get user's balance
561
- let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o,abi:u,functionName:"balanceOf",args:[e]}),{bondAmount:a,protocolFee:s,totalRequired:p,tokenAddress:o,isNativeToken:d,userBalance:l,hasSufficientBalance:l>=p}}))}
510
+ 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}}))}
562
511
  /**
563
512
  * Fractionalizes an IP NFT into fungible ERC20 tokens.
564
513
  * The NFT is transferred to the fractionalizer contract and a new ERC20 token is created.
@@ -575,7 +524,7 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o
575
524
  * // Then fractionalize
576
525
  * const result = await origin.fractionalize(1n);
577
526
  * ```
578
- */function Ke(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"fractionalize",[e],{waitForReceipt:!0})}))}
527
+ */function He(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"fractionalize",[e],{waitForReceipt:!0})}))}
579
528
  /**
580
529
  * Redeems an IP NFT by burning all of its fractional tokens.
581
530
  * The caller must hold the entire supply of the NFT's fractional token.
@@ -589,7 +538,7 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o
589
538
  * // Requires holding 100% of the fractional token supply
590
539
  * await origin.redeem(1n);
591
540
  * ```
592
- */function Xe(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"redeem",[e],{waitForReceipt:!0})}))}
541
+ */function je(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"redeem",[e],{waitForReceipt:!0})}))}
593
542
  /**
594
543
  * Gets the fractional ERC20 token address for a specific IP NFT.
595
544
  * Returns zero address if the NFT has not been fractionalized.
@@ -606,7 +555,7 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o
606
555
  * console.log("NFT has not been fractionalized");
607
556
  * }
608
557
  * ```
609
- */function Qe(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"getTokenForNFT",[e])}))}
558
+ */function Le(e){return m(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"getTokenForNFT",[e])}))}
610
559
  /**
611
560
  * Fractionalizes an IP NFT with automatic approval.
612
561
  * This method first approves the fractionalizer contract to transfer your NFT,
@@ -620,7 +569,7 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o
620
569
  * // Single call handles approval and fractionalization
621
570
  * const result = await origin.fractionalizeWithApproval(1n);
622
571
  * ```
623
- */function et(e){return T(this,void 0,void 0,(function*(){return yield this.approve(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,e),this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"fractionalize",[e],{waitForReceipt:!0})}))}
572
+ */function ze(e){return m(this,void 0,void 0,(function*(){return yield this.approve(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,e),this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"fractionalize",[e],{waitForReceipt:!0})}))}
624
573
  /**
625
574
  * Redeems fractional tokens for the underlying NFT, but only if the caller owns 100% of the supply.
626
575
  * This method checks the caller's balance before attempting to redeem, providing a clear error
@@ -639,17 +588,17 @@ let l;return l=d?yield t.getBalance({address:e}):yield t.readContract({address:o
639
588
  * console.log("You don't own all fractional tokens yet");
640
589
  * }
641
590
  * ```
642
- */function tt(e){return T(this,void 0,void 0,(function*(){
591
+ */function Ve(e){return m(this,void 0,void 0,(function*(){
643
592
  // get the ERC20 token address for this NFT
644
593
  const t=yield this.getTokenForNFT(e);if(!t||"0x0000000000000000000000000000000000000000"===t)throw new Error("This NFT has not been fractionalized");
645
594
  // get current wallet address
646
- const n=yield be(this.viemClient),i=[{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"}],a=O(),[s,r]=yield Promise.all([a.readContract({address:t,abi:i,functionName:"balanceOf",args:[n]}),a.readContract({address:t,abi:i,functionName:"totalSupply",args:[]})]);
595
+ const n=yield De(this.viemClient),i=[{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"}],a=O(),[s,r]=yield Promise.all([a.readContract({address:t,abi:i,functionName:"balanceOf",args:[n]}),a.readContract({address:t,abi:i,functionName:"totalSupply",args:[]})]);
647
596
  // check caller's balance and total supply
648
597
  if(s<r){const e=s*BigInt(1e4)/r;throw new Error(`Cannot redeem: you own ${e/BigInt(100)}.${e%BigInt(100)}% of the fractional tokens (${s}/${r}). You need 100% to redeem.`)}
649
598
  // proceed with redemption
650
599
  return this.callContractMethod(this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,this.environment.FRACTIONALIZER_ABI,"redeem",[e],{waitForReceipt:!0})}))}
651
600
  // minimal ERC20 ABI
652
- const nt=[{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"}];
601
+ 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"}];
653
602
  /**
654
603
  * Gets a user's ownership percentage of a fractionalized NFT.
655
604
  * Returns detailed information about the user's fractional token holdings.
@@ -674,13 +623,13 @@ const nt=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{nam
674
623
  * }
675
624
  * }
676
625
  * ```
677
- */function it(e,t){return T(this,void 0,void 0,(function*(){const n=yield be(this.viemClient,t),i=yield this.getTokenForNFT(e);
626
+ */function Je(e,t){return m(this,void 0,void 0,(function*(){const n=yield De(this.viemClient,t),i=yield this.getTokenForNFT(e);
678
627
  // get the ERC20 token address for this NFT
679
628
  // check if fractionalized
680
- if(!i||i===r)return{tokenId:e,erc20Address:r,isFractionalized:!1,balance:BigInt(0),totalSupply:BigInt(0),ownershipPercentage:0,canRedeem:!1,decimals:18};const a=O(),[s,o,d]=yield Promise.all([a.readContract({address:i,abi:nt,functionName:"balanceOf",args:[n]}),a.readContract({address:i,abi:nt,functionName:"totalSupply",args:[]}),a.readContract({address:i,abi:nt,functionName:"decimals",args:[]})]);
629
+ if(!i||i===a)return{tokenId:e,erc20Address:a,isFractionalized:!1,balance:BigInt(0),totalSupply:BigInt(0),ownershipPercentage:0,canRedeem:!1,decimals:18};const s=O(),[r,o,d]=yield Promise.all([s.readContract({address:i,abi:qe,functionName:"balanceOf",args:[n]}),s.readContract({address:i,abi:qe,functionName:"totalSupply",args:[]}),s.readContract({address:i,abi:qe,functionName:"decimals",args:[]})]);
681
630
  // fetch ERC20 data
682
631
  // calculate ownership percentage
683
- let u=0;o>BigInt(0)&&(u=Number(s*BigInt(1e4)/o)/100);const p=s>=o&&o>BigInt(0);return{tokenId:e,erc20Address:i,isFractionalized:!0,balance:s,totalSupply:o,ownershipPercentage:u,canRedeem:p,decimals:d}}))}
632
+ let p=0;o>BigInt(0)&&(p=Number(r*BigInt(1e4)/o)/100);const u=r>=o&&o>BigInt(0);return{tokenId:e,erc20Address:i,isFractionalized:!0,balance:r,totalSupply:o,ownershipPercentage:p,canRedeem:u,decimals:d}}))}
684
633
  /**
685
634
  * Checks if a user can fractionalize an NFT and why not if they can't.
686
635
  * Returns detailed information about eligibility requirements.
@@ -704,9 +653,9 @@ let u=0;o>BigInt(0)&&(u=Number(s*BigInt(1e4)/o)/100);const p=s>=o&&o>BigInt(0);r
704
653
  * console.log(`Cannot fractionalize: ${eligibility.reason}`);
705
654
  * }
706
655
  * ```
707
- */function at(e,t){return T(this,void 0,void 0,(function*(){const n=yield be(this.viemClient,t),i=O(),a=this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,[s,o,d,u,p]=yield Promise.all([this.ownerOf(e),this.dataStatus(e),this.getTokenForNFT(e),i.readContract({address:this.environment.DATANFT_CONTRACT_ADDRESS,abi:this.environment.IPNFT_ABI,functionName:"getApproved",args:[e]}),i.readContract({address:this.environment.DATANFT_CONTRACT_ADDRESS,abi:this.environment.IPNFT_ABI,functionName:"isApprovedForAll",args:[n,a]})]),l=s.toLowerCase()===n.toLowerCase(),y=d&&d!==r,c=p||u.toLowerCase()===a.toLowerCase(),m={canFractionalize:!1,isOwner:l,currentOwner:s,isAlreadyFractionalized:!!y,existingErc20Address:y?d:void 0,dataStatus:o,isApproved:c,needsApproval:!c};
656
+ */function We(e,t){return m(this,void 0,void 0,(function*(){const n=yield De(this.viemClient,t),i=O(),s=this.environment.FRACTIONALIZER_CONTRACT_ADDRESS,[r,o,d,p,u]=yield Promise.all([this.ownerOf(e),this.dataStatus(e),this.getTokenForNFT(e),i.readContract({address:this.environment.DATANFT_CONTRACT_ADDRESS,abi:this.environment.IPNFT_ABI,functionName:"getApproved",args:[e]}),i.readContract({address:this.environment.DATANFT_CONTRACT_ADDRESS,abi:this.environment.IPNFT_ABI,functionName:"isApprovedForAll",args:[n,s]})]),l=r.toLowerCase()===n.toLowerCase(),y=d&&d!==a,c=u||p.toLowerCase()===s.toLowerCase(),m={canFractionalize:!1,isOwner:l,currentOwner:r,isAlreadyFractionalized:!!y,existingErc20Address:y?d:void 0,dataStatus:o,isApproved:c,needsApproval:!c};
708
657
  // check requirements
709
- return l?y?Object.assign(Object.assign({},m),{reason:`This NFT is already fractionalized. ERC20: ${d}`}):o===Ee.DELETED?Object.assign(Object.assign({},m),{reason:"This NFT has been deleted and cannot be fractionalized"}):o===Ee.DISPUTED?Object.assign(Object.assign({},m),{reason:"This NFT is disputed and cannot be fractionalized"}):Object.assign(Object.assign({},m),{canFractionalize:!0}):Object.assign(Object.assign({},m),{reason:`You don't own this NFT. Current owner: ${s}`})}))}
658
+ return l?y?Object.assign(Object.assign({},m),{reason:`This NFT is already fractionalized. ERC20: ${d}`}):o===xe.DELETED?Object.assign(Object.assign({},m),{reason:"This NFT has been deleted and cannot be fractionalized"}):o===xe.DISPUTED?Object.assign(Object.assign({},m),{reason:"This NFT is disputed and cannot be fractionalized"}):Object.assign(Object.assign({},m),{canFractionalize:!0}):Object.assign(Object.assign({},m),{reason:`You don't own this NFT. Current owner: ${r}`})}))}
710
659
  /**
711
660
  * Gets information about a registered app from the AppRegistry.
712
661
  *
@@ -720,15 +669,15 @@ return l?y?Object.assign(Object.assign({},m),{reason:`This NFT is already fracti
720
669
  * console.log(`Revenue Share: ${appInfo.revenueShareBps / 100}%`);
721
670
  * console.log(`Active: ${appInfo.isActive}`);
722
671
  * ```
723
- */function st(e){return T(this,void 0,void 0,(function*(){return this.callContractMethod(this.environment.APP_REGISTRY_CONTRACT_ADDRESS,this.environment.APP_REGISTRY_ABI,"getAppInfo",[e])}))}
672
+ */function Ge(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])}))}
724
673
  /**
725
674
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
726
675
  * If the current allowance is less than the specified amount, it will perform the approval.
727
676
  * Waits for the approval transaction to be confirmed before returning.
728
677
  * @param {ApproveParams} params - The parameters for the approval.
729
- */function rt(e){return T(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:s,chain:r}){if((yield t.readContract({address:n,abi:u,functionName:"allowance",args:[i,a]}))<s){const o=yield e.writeContract({address:n,account:i,abi:u,functionName:"approve",args:[a,s],chain:r});
678
+ */function Ze(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});
730
679
  // Wait for the approval transaction to be confirmed with extra confirmations
731
- yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e=>setTimeout(e,1e3)))}}))}
680
+ yield t.waitForTransactionReceipt({hash:d,confirmations:2}),yield new Promise((e=>setTimeout(e,1e3)))}}))}
732
681
  /**
733
682
  * Executes an atomic bulk purchase of multiple IP-NFT licenses.
734
683
  * All purchases succeed or all fail together.
@@ -747,7 +696,7 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
747
696
  * const totalValue = 3000000000000000n;
748
697
  * await origin.bulkBuyAccess(buyerAddress, purchases, totalValue);
749
698
  * ```
750
- */function ot(e,t,n){return this.callContractMethod(this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,this.environment.BATCH_PURCHASE_ABI,"bulkBuyAccess",[e,t],{waitForReceipt:!0,value:n})}
699
+ */function Ye(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccess",[e,t],{waitForReceipt:!0,value:n})}
751
700
  /**
752
701
  * Executes a fault-tolerant bulk purchase of multiple IP-NFT licenses.
753
702
  * Individual purchases can fail without reverting the entire transaction.
@@ -764,7 +713,7 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
764
713
  * console.log(`Purchased ${result.successCount} of ${purchases.length} IPs`);
765
714
  * console.log(`Failed tokens: ${result.failedTokenIds}`);
766
715
  * ```
767
- */function dt(e,t,n){return this.callContractMethod(this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,this.environment.BATCH_PURCHASE_ABI,"bulkBuyAccessTolerant",[e,t],{waitForReceipt:!0,value:n})}
716
+ */function Ke(e,t,n){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkBuyAccessTolerant",[e,t],{waitForReceipt:!0,value:n})}
768
717
  /**
769
718
  * Previews the total cost of purchasing multiple IP-NFT licenses.
770
719
  * This is a view function that doesn't require a transaction.
@@ -778,7 +727,7 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
778
727
  * console.log(`Total cost: ${preview.totalNativeCost} wei`);
779
728
  * console.log(`Valid tokens: ${preview.validCount}`);
780
729
  * ```
781
- */function ut(e){return this.callContractMethod(this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,this.environment.BATCH_PURCHASE_ABI,"previewBulkCost",[e])}
730
+ */function Qe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"previewBulkCost",[e])}
782
731
  /**
783
732
  * Builds purchase parameters for multiple tokens by fetching their current license terms.
784
733
  * This is a view function that doesn't require a transaction.
@@ -791,7 +740,7 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
791
740
  * const params = await origin.buildPurchaseParams([1n, 2n, 3n]);
792
741
  * await origin.bulkBuyAccess(buyer, params, totalValue);
793
742
  * ```
794
- */function pt(e){return this.callContractMethod(this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,this.environment.BATCH_PURCHASE_ABI,"buildPurchaseParams",[e])}
743
+ */function Xe(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"buildPurchaseParams",[e])}
795
744
  /**
796
745
  * Checks the active status of multiple tokens.
797
746
  *
@@ -803,7 +752,7 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
803
752
  * const activeFlags = await origin.checkActiveStatus([1n, 2n, 3n]);
804
753
  * const activeTokens = tokenIds.filter((_, i) => activeFlags[i]);
805
754
  * ```
806
- */function lt(e){return this.callContractMethod(this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,this.environment.BATCH_PURCHASE_ABI,"checkActiveStatus",[e])}
755
+ */function et(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"checkActiveStatus",[e])}
807
756
  /**
808
757
  * Smart bulk purchase that automatically fetches terms and handles the entire purchase flow.
809
758
  * This is the recommended method for most use cases.
@@ -820,48 +769,90 @@ yield t.waitForTransactionReceipt({hash:o,confirmations:2}),yield new Promise((e
820
769
  * // Tolerant purchase - continue even if some fail
821
770
  * const result = await origin.bulkBuyAccessSmart([1n, 2n, 3n], { tolerant: true });
822
771
  * ```
823
- */function yt(e,t){return T(this,void 0,void 0,(function*(){if(!e||0===e.length)throw new _("No token IDs provided for bulk purchase. Please provide at least one token ID.");
772
+ */function tt(e,t){return m(this,void 0,void 0,(function*(){if(!e||0===e.length)throw new P("No token IDs provided for bulk purchase. Please provide at least one token ID.");
824
773
  // Get the buyer's wallet address
825
774
  const n=this.viemClient;if(!n)throw new N("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 N("No accounts found in connected wallet. Please unlock your wallet or add an account.");i=e[0]}
826
775
  // Build purchase params from on-chain data
827
- const a=yield this.buildPurchaseParams(e);
776
+ const s=yield this.buildPurchaseParams(e);
828
777
  // Calculate total native token cost
829
- let s=BigInt(0);const o=[];for(const e of a)if(e.expectedPaymentToken===r)s+=e.expectedPrice;else{
778
+ let r=BigInt(0);const o=[];for(const e of s)if(e.expectedPaymentToken===a)r+=e.expectedPrice;else{
830
779
  // Group ERC20 purchases by token
831
780
  const t=o.find((t=>t.token===e.expectedPaymentToken));t?t.amount+=e.expectedPrice:o.push({token:e.expectedPaymentToken,amount:e.expectedPrice})}
832
781
  // Approve ERC20 tokens if needed
833
- const d=O();for(const e of o)yield rt({walletClient:n,publicClient:d,tokenAddress:e.token,owner:i,spender:this.environment.BATCH_PURCHASE_CONTRACT_ADDRESS,amount:e.amount,chain:this.environment.CHAIN});
782
+ const d=O();for(const e of o)yield Ze({walletClient:n,publicClient:d,tokenAddress:e.token,owner:i,spender:this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,amount:e.amount,chain:this.environment.CHAIN});
834
783
  // Execute the purchase
835
- return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,a,s):this.bulkBuyAccess(i,a,s)}))}var ct,mt,ht,Tt,ft,vt,At,wt,It,gt,bt,Ct,Et,St,Pt,Rt,_t,Dt,Nt,xt,kt,Mt;
784
+ return(null==t?void 0:t.tolerant)?this.bulkBuyAccessTolerant(i,s,r):this.bulkBuyAccess(i,s,r)}))}
785
+ /**
786
+ * Executes an atomic bulk mint of multiple IP-NFTs.
787
+ * All mints succeed or all fail together.
788
+ *
789
+ * @param mints Array of mint parameters for each token.
790
+ * @returns A promise that resolves with the transaction result.
791
+ *
792
+ * @example
793
+ * ```typescript
794
+ * const mints = [
795
+ * {
796
+ * to: "0x...",
797
+ * tokenId: 1n,
798
+ * creatorContentHash: "0x...",
799
+ * uri: "ipfs://...",
800
+ * licenseTerms: { price: 1000n, duration: 86400, royaltyBps: 500, paymentToken: zeroAddress, licenseType: 0 },
801
+ * deadline: BigInt(Date.now() + 600000),
802
+ * parents: [],
803
+ * isIP: true,
804
+ * appId: "myApp",
805
+ * signature: "0x...",
806
+ * },
807
+ * ];
808
+ * await origin.bulkMint(mints);
809
+ * ```
810
+ */function nt(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMint",[e],{waitForReceipt:!0})}
811
+ /**
812
+ * Executes a fault-tolerant bulk mint of multiple IP-NFTs.
813
+ * Individual mints can fail without reverting the entire transaction.
814
+ *
815
+ * @param mints Array of mint parameters for each token.
816
+ * @returns A promise that resolves with the tolerant mint result including success/failure counts.
817
+ *
818
+ * @example
819
+ * ```typescript
820
+ * const result = await origin.bulkMintTolerant(mints);
821
+ * console.log(`Minted ${result.successCount} of ${mints.length} tokens`);
822
+ * console.log(`Failed tokens: ${result.failedTokenIds}`);
823
+ * ```
824
+ */function it(e){return this.callContractMethod(this.environment.BATCH_OPERATIONS_CONTRACT_ADDRESS,this.environment.BATCH_OPERATIONS_ABI,"bulkMintTolerant",[e],{waitForReceipt:!0})}var at,st,rt,ot,dt,pt,ut,lt,yt,ct,mt,ht,Tt,ft,vt,wt,At,It,gt,bt,Ct,Et;
836
825
  /**
837
826
  * The Origin class
838
827
  * Handles interactions with Origin protocol.
839
- */class Bt{constructor(e,t,n,i,a){ct.add(this),t?this.jwt=t:console.warn("JWT not provided. Some features may be unavailable."),this.viemClient=n,this.environment="string"==typeof e?K[e]:e||K.DEVELOPMENT,this.environment.AUTH_HUB_BASE_API+="PRODUCTION"===e?"/auth-mainnet":"",this.baseParentId=i,this.appId=a,
828
+ */class St{constructor(e,t,n,i,a){at.add(this),t?this.jwt=t:console.warn("JWT not provided. Some features may be unavailable."),this.viemClient=n,this.environment="string"==typeof e?Z[e]:e||Z.DEVELOPMENT,this.environment.AUTH_HUB_BASE_API+="PRODUCTION"===e?"/auth-mainnet":"",this.baseParentId=i,this.appId=a,
840
829
  // DataNFT methods
841
- this.mintWithSignature=ne.bind(this),this.registerIpNFT=ie.bind(this),this.updateTerms=ae.bind(this),this.finalizeDelete=se.bind(this),this.getOrCreateRoyaltyVault=re.bind(this),this.getTerms=oe.bind(this),this.ownerOf=de.bind(this),this.balanceOf=ue.bind(this),this.tokenURI=pe.bind(this),this.dataStatus=le.bind(this),this.isApprovedForAll=ye.bind(this),this.transferFrom=ce.bind(this),this.safeTransferFrom=me.bind(this),this.approve=he.bind(this),this.setApprovalForAll=Te.bind(this),
830
+ this.mintWithSignature=ee.bind(this),this.registerIpNFT=te.bind(this),this.updateTerms=ne.bind(this),this.finalizeDelete=ie.bind(this),this.getOrCreateRoyaltyVault=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),
842
831
  // Marketplace methods
843
- this.buyAccess=fe.bind(this),this.hasAccess=ve.bind(this),this.subscriptionExpiry=Ae.bind(this),this.settlePaymentIntent=ge.bind(this),this.getDataWithIntent=De.bind(this),
832
+ this.buyAccess=he.bind(this),this.hasAccess=Te.bind(this),this.subscriptionExpiry=fe.bind(this),
844
833
  // Bulk purchase methods
845
- this.bulkBuyAccess=ot.bind(this),this.bulkBuyAccessTolerant=dt.bind(this),this.bulkBuyAccessSmart=yt.bind(this),this.previewBulkCost=ut.bind(this),this.buildPurchaseParams=pt.bind(this),this.checkActiveStatus=lt.bind(this),
834
+ this.bulkBuyAccess=Ye.bind(this),this.bulkBuyAccessTolerant=Ke.bind(this),this.bulkBuyAccessSmart=tt.bind(this),this.previewBulkCost=Qe.bind(this),this.buildPurchaseParams=Xe.bind(this),this.checkActiveStatus=et.bind(this),
835
+ // Bulk mint methods
836
+ this.bulkMint=nt.bind(this),this.bulkMintTolerant=it.bind(this),
846
837
  // Dispute module methods
847
- this.raiseDispute=Me.bind(this),this.raiseDisputeSmart=$e.bind(this),this.disputeAssertion=He.bind(this),this.disputeAssertionSmart=je.bind(this),this.voteOnDispute=Le.bind(this),this.resolveDispute=ze.bind(this),this.cancelDispute=Ve.bind(this),this.tagChildIp=qe.bind(this),this.getDispute=Je.bind(this),this.canVoteOnDispute=We.bind(this),this.getDisputeProgress=Ye.bind(this),this.getDisputeRequirements=Ze.bind(this),
838
+ this.raiseDispute=ve.bind(this),this.raiseDisputeSmart=be.bind(this),this.disputeAssertion=Ce.bind(this),this.disputeAssertionSmart=Ee.bind(this),this.voteOnDispute=Se.bind(this),this.resolveDispute=Pe.bind(this),this.cancelDispute=Re.bind(this),this.tagChildIp=Ne.bind(this),this.getDispute=_e.bind(this),this.canVoteOnDispute=Fe.bind(this),this.getDisputeProgress=Ue.bind(this),this.getDisputeRequirements=$e.bind(this),
848
839
  // Fractionalizer module methods
849
- this.fractionalize=Ke.bind(this),this.redeem=Xe.bind(this),this.getTokenForNFT=Qe.bind(this),this.fractionalizeWithApproval=et.bind(this),this.redeemIfComplete=tt.bind(this),this.getFractionOwnership=it.bind(this),this.canFractionalize=at.bind(this),
840
+ this.fractionalize=He.bind(this),this.redeem=je.bind(this),this.getTokenForNFT=Le.bind(this),this.fractionalizeWithApproval=ze.bind(this),this.redeemIfComplete=Ve.bind(this),this.getFractionOwnership=Je.bind(this),this.canFractionalize=We.bind(this),
850
841
  // AppRegistry module methods
851
- this.getAppInfo=st.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
842
+ this.getAppInfo=Ge.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
852
843
  /**
853
844
  * Approves an ERC20 token for spending by a spender address if the current allowance is insufficient.
854
845
  * Waits for the approval transaction to be confirmed before returning.
855
846
  * @param tokenAddress The address of the ERC20 token.
856
847
  * @param spender The address that will be approved to spend the tokens.
857
848
  * @param amount The amount of tokens to approve.
858
- */approveERC20IfNeeded(e,t,n){return T(this,void 0,void 0,(function*(){const i=yield f(this,ct,"m",bt).call(this);yield rt({walletClient:this.viemClient,publicClient:O(),tokenAddress:e,owner:i,spender:t,amount:n,chain:this.environment.CHAIN})}))}
849
+ */approveERC20IfNeeded(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,at,"m",mt).call(this);yield Ze({walletClient:this.viemClient,publicClient:O(),tokenAddress:e,owner:i,spender:t,amount:n,chain:this.environment.CHAIN})}))}
859
850
  /**
860
851
  * Uploads a JSON object to IPFS and returns the resulting CID.
861
852
  * @param data The JSON object to upload.
862
853
  * @returns The CID of the uploaded JSON.
863
854
  * @throws {APIError} If the upload fails.
864
- */uploadJSONToIPFS(e){return T(this,void 0,void 0,(function*(){const t=JSON.stringify(e),n=new File([t],"evidence.json",{type:"application/json"}),i=yield f(this,ct,"m",Tt).call(this,n);if(!i)throw new R("Failed to upload evidence to IPFS");return i}))}
855
+ */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,at,"m",ot).call(this,n);if(!i)throw new S("Failed to upload evidence to IPFS");return i}))}
865
856
  /**
866
857
  * Mints a file-based IpNFT.
867
858
  * @param file The file to mint.
@@ -870,20 +861,56 @@ this.getAppInfo=st.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.vie
870
861
  * @param parents Optional parent token IDs for lineage tracking.
871
862
  * @param options Optional parameters including progress callback, preview image, and use asset as preview flag.
872
863
  * @returns The token ID of the minted IpNFT as a string, or null if minting failed.
873
- */mintFile(e,t,n,i,a){return T(this,void 0,void 0,(function*(){let s,r=null;try{r=yield f(this,ct,"m",wt).call(this)}catch(t){throw new N(`Cannot mint file "${e.name}": wallet not connected. Please connect a wallet first.`)}try{if(s=yield f(this,ct,"m",ft).call(this,e,a),!s||!s.key)throw new R(`Failed to upload file "${e.name}": no upload info returned from server`)}catch(t){if(t instanceof R||t instanceof N)throw t;throw new R(`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 f(this,ct,"m",Tt).call(this,a.previewImage):(null==a?void 0:a.useAssetAsPreview)&&e.type.startsWith("image/")&&(o=yield f(this,ct,"m",Tt).call(this,e)),o&&(t.image=`ipfs://${o}`);const d=BigInt(Date.now()+6e5);// 10 minutes from now
874
- let u;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{u=yield this.registerIpNFT("file",d,n,t,!0,// isIp
864
+ */mintFile(e,t,n,i,a){return m(this,void 0,void 0,(function*(){let s,r=null;try{r=yield h(this,at,"m",lt).call(this)}catch(t){throw new N(`Cannot mint file "${e.name}": wallet not connected. Please connect a wallet first.`)}try{if(s=yield h(this,at,"m",dt).call(this,e,a),!s||!s.key)throw new S(`Failed to upload file "${e.name}": no upload info returned from server`)}catch(t){if(t instanceof S||t instanceof N)throw t;throw new S(`Failed to upload file "${e.name}": ${D(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,at,"m",ot).call(this,a.previewImage):(null==a?void 0:a.useAssetAsPreview)&&e.type.startsWith("image/")&&(o=yield h(this,at,"m",ot).call(this,e)),o&&(t.image=`ipfs://${o}`);const d=BigInt(Date.now()+6e5);// 10 minutes from now
865
+ let p;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{p=yield this.registerIpNFT("file",d,n,t,!0,// isIp
875
866
  s.key,// fileKey
876
- i,this.appId)}catch(e){throw yield f(this,ct,"m",ht).call(this,s.key,s.uploadId,[]),new Error(`Failed to register IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:p,signerAddress:l,creatorContentHash:y,signature:c,uri:m}=u;if(!(p&&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,p,i||[],!0,y,m,n,d,c,this.appId);if(-1===["0x1","success"].indexOf(e.receipt.status))throw yield f(this,ct,"m",ht).call(this,s.key,s.uploadId,[]),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield f(this,ct,"m",ht).call(this,s.key,s.uploadId,[]),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return p.toString()}))}
867
+ i,this.appId)}catch(e){throw yield h(this,at,"m",rt).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}=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(r,u,i||[],!0,y,m,n,d,c,this.appId);if(-1===["0x1","success"].indexOf(e.receipt.status))throw yield h(this,at,"m",rt).call(this,s.key,s.uploadId,[]),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield h(this,at,"m",rt).call(this,s.key,s.uploadId,[]),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return u.toString()}))}
868
+ /**
869
+ * Mints multiple file-based IpNFTs in a single transaction using the BatchOperations contract.
870
+ * Each file is uploaded and registered individually, then all mints are batched into one on-chain call.
871
+ *
872
+ * @param entries Array of file entries to mint, each containing a file, metadata, license terms, and optional parents/preview.
873
+ * @param options Optional configuration including tolerant mode and progress callback.
874
+ * @returns A promise that resolves with an array of token ID strings for each entry, and the transaction result.
875
+ *
876
+ * @example
877
+ * ```typescript
878
+ * const result = await origin.bulkMintFile([
879
+ * { file: file1, metadata: { name: "Asset 1" }, license: myLicense },
880
+ * { file: file2, metadata: { name: "Asset 2" }, license: myLicense },
881
+ * ]);
882
+ * console.log(`Minted token IDs: ${result.tokenIds}`);
883
+ *
884
+ * // Tolerant mode - continue even if some mints fail
885
+ * const result = await origin.bulkMintFile(entries, { tolerant: true });
886
+ * ```
887
+ */bulkMintFile(e,t){return m(this,void 0,void 0,(function*(){var n,i;if(!e||0===e.length)throw new P("No file entries provided for bulk mint. Please provide at least one entry.");let a=null;try{a=yield h(this,at,"m",lt).call(this)}catch(e){throw new N("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 c,{parents:m}=p;
888
+ // Upload file
889
+ try{if(c=yield h(this,at,"m",dt).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})}}),!c||!c.key)throw new S(`Failed to upload file "${u.name}": no upload info returned from server`)}catch(e){if(e instanceof S||e instanceof N)throw e;throw new S(`Failed to upload file "${u.name}": ${D(e)}`)}o.push(c),
890
+ // Set mimetype
891
+ u.type&&(l.mimetype=u.type);
892
+ // Handle preview image
893
+ let T=null;p.previewImage&&p.previewImage.type.startsWith("image/")?T=yield h(this,at,"m",ot).call(this,p.previewImage):p.useAssetAsPreview&&u.type.startsWith("image/")&&(T=yield h(this,at,"m",ot).call(this,u)),T&&(l.image=`ipfs://${T}`);const f=BigInt(Date.now()+6e5);// 10 minutes from now
894
+ // Prepare parents
895
+ let v;this.baseParentId&&(m||(m=[]),m=[this.baseParentId,...m]),
896
+ // Register IpNFT to get signature
897
+ 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
898
+ c.key,// fileKey
899
+ m,this.appId)}catch(e){throw yield h(this,at,"m",rt).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:g}=v;if(!w||!A||void 0===I||!g)throw yield h(this,at,"m",rt).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:g,licenseTerms:y,deadline:f,parents:m||[],isIP:!0,appId:null!==(i=this.appId)&&void 0!==i?i:"",signature:I})}
900
+ // Execute bulk mint
901
+ 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){
902
+ // Mark all uploads as failed
903
+ for(const e of o)try{yield h(this,at,"m",rt).call(this,e.key,e.uploadId,[])}catch(e){}throw new Error(`Bulk mint transaction failed: ${e instanceof Error?e.message:String(e)}`)}}))}
877
904
  /**
878
905
  * Mints a social IpNFT.
879
906
  * @param source The social media source (spotify, twitter, tiktok).
880
907
  * @param metadata The metadata associated with the social media content.
881
908
  * @param license The license terms for the IpNFT.
882
909
  * @return The token ID of the minted IpNFT as a string, or null if minting failed.
883
- */mintSocial(e,t,n){return T(this,void 0,void 0,(function*(){let i=null;try{i=yield f(this,ct,"m",wt).call(this)}catch(t){throw new N(`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
910
+ */mintSocial(e,t,n){return m(this,void 0,void 0,(function*(){let i=null;try{i=yield h(this,at,"m",lt).call(this)}catch(t){throw new N(`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
884
911
  let s,r=this.baseParentId?[this.baseParentId]:[];try{s=yield this.registerIpNFT(e,a,n,t,!0,// isIp
885
912
  void 0,// fileKey
886
- 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:u,signature:p,uri:l}=s;if(!(o&&d&&u&&void 0!==p&&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,u,l,n,a,p,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()}))}
913
+ 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()}))}
887
914
  /**
888
915
  * Call a contract method.
889
916
  * @param {string} contractAddress The contract address.
@@ -893,9 +920,9 @@ r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e ins
893
920
  * @param {CallOptions} [options] The call options.
894
921
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
895
922
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
896
- */callContractMethod(e,t,n,i){return T(this,arguments,void 0,(function*(e,t,n,i,a={}){var s;let r=null;try{r=yield f(this,ct,"m",wt).call(this)}catch(t){throw new N(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const o=p({abi:t,name:n});if(o&&"stateMutability"in o&&("view"===o.stateMutability||"pure"===o.stateMutability)){const a=O();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}yield f(this,ct,"m",At).call(this,this.environment.CHAIN);const d=O(),{result:u,request:l}=yield d.simulateContract({account:r,address:e,abi:t,functionName:n,args:i,value:a.value});
923
+ */callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s;let o=null;try{o=yield h(this,at,"m",lt).call(this)}catch(t){throw new N(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const d=r({abi:t,name:n});if(d&&"stateMutability"in d&&("view"===d.stateMutability||"pure"===d.stateMutability)){const a=O();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}yield h(this,at,"m",ut).call(this,this.environment.CHAIN);const p=O(),{result:u,request:l}=yield p.simulateContract({account:o,address:e,abi:t,functionName:n,args:i,value:a.value});
897
924
  // simulate
898
- if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?void 0:s.writeContract(l);if("string"!=typeof t)throw new x(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:u};return{txHash:t,receipt:yield f(this,ct,"m",vt).call(this,t),simulatedResult:u}}catch(t){if(t instanceof x||t instanceof N)throw t;throw new x(`Transaction for "${n}" failed: ${k(t)}`,{contractName:e,methodName:n})}}))}
925
+ if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?void 0:s.writeContract(l);if("string"!=typeof t)throw new _(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:u};return{txHash:t,receipt:yield h(this,at,"m",pt).call(this,t),simulatedResult:u}}catch(t){if(t instanceof _||t instanceof N)throw t;throw new _(`Transaction for "${n}" failed: ${D(t)}`,{contractName:e,methodName:n})}}))}
899
926
  /**
900
927
  * Gets comprehensive token information in a single call.
901
928
  * Combines owner, status, terms, URI, and access information.
@@ -911,15 +938,15 @@ if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?
911
938
  * console.log(`Price: ${info.terms.price}`);
912
939
  * console.log(`Has access: ${info.hasAccess}`);
913
940
  * ```
914
- */getTokenInfoSmart(e,t){return T(this,void 0,void 0,(function*(){var n;
941
+ */getTokenInfoSmart(e,t){return m(this,void 0,void 0,(function*(){var n;
915
942
  // Resolve the address to check access for
916
943
  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";
917
944
  // Fetch all information in parallel
918
945
  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:""})))]);
919
946
  // Get access info if we have a valid address
920
- let u=!1,p=null;if("0x0000000000000000000000000000000000000000"!==i)try{[u,p]=yield Promise.all([this.hasAccess(i,e),this.subscriptionExpiry(e,i)])}catch(e){
947
+ let p=!1,u=null;if("0x0000000000000000000000000000000000000000"!==i)try{[p,u]=yield Promise.all([this.hasAccess(i,e),this.subscriptionExpiry(e,i)])}catch(e){
921
948
  // Access check failed, defaults are fine
922
- }return{tokenId:e,owner:a,uri:s,status:r,terms:o,hasAccess:u,accessExpiry:p,appId:(null==d?void 0:d.appId)||""}}))}
949
+ }return{tokenId:e,owner:a,uri:s,status:r,terms:o,hasAccess:p,accessExpiry:u,appId:(null==d?void 0:d.appId)||""}}))}
923
950
  /**
924
951
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
925
952
  * Automatically fetches protocol and app fees from the contracts.
@@ -937,19 +964,19 @@ let u=!1,p=null;if("0x0000000000000000000000000000000000000000"!==i)try{[u,p]=yi
937
964
  * console.log("Access purchased:", result.txHash);
938
965
  * }
939
966
  * ```
940
- */buyAccessSmart(e){return T(this,void 0,void 0,(function*(){let t=null;try{t=yield f(this,ct,"m",wt).call(this)}catch(t){throw new N(`Cannot buy access to token ${e}: wallet not connected. Please connect a wallet first.`)}
967
+ */buyAccessSmart(e){return m(this,void 0,void 0,(function*(){let t=null;try{t=yield h(this,at,"m",lt).call(this)}catch(t){throw new N(`Cannot buy access to token ${e}: wallet not connected. Please connect a wallet first.`)}
941
968
  // Check if user already has access
942
- 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 R(`Failed to fetch license terms for token ${e}: no terms returned`);const{price:i,paymentToken:a,duration:s}=n;if(void 0===i||void 0===a||void 0===s)throw new R(`Invalid license terms for token ${e}: missing price, paymentToken, or duration`);
969
+ 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 S(`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 S(`Invalid license terms for token ${e}: missing price, paymentToken, or duration`);
943
970
  // Fetch protocol fee from marketplace
944
- const o=yield f(this,ct,"m",It).call(this),d=yield f(this,ct,"m",gt).call(this,e),u=i;
971
+ const o=yield h(this,at,"m",yt).call(this),d=yield h(this,at,"m",ct).call(this,e),p=i;
945
972
  // Fetch app fee from token's appId
946
- return a===r?this.buyAccess(t,e,u,s,a,o,d,u):(yield rt({walletClient:this.viemClient,publicClient:O(),tokenAddress:a,owner:t,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:u,chain:this.environment.CHAIN}),this.buyAccess(t,e,u,s,a,o,d))}))}
973
+ return s===a?this.buyAccess(t,e,p,r,s,o,d,p):(yield Ze({walletClient:this.viemClient,publicClient:O(),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))}))}
947
974
  /**
948
975
  * Fetch the underlying data associated with a specific token ID.
949
976
  * @param {bigint} tokenId - The token ID to fetch data for.
950
977
  * @returns {Promise<any>} A promise that resolves with the fetched data.
951
978
  * @throws {Error} Throws an error if the data cannot be fetched.
952
- */getData(e){return T(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok){const n=yield t.text().catch((()=>t.statusText));throw new R(`Failed to fetch data for token ${e} (HTTP ${t.status}): ${n}`,t.status)}return t.json()}))}
979
+ */getData(e){return m(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok){const n=yield t.text().catch((()=>t.statusText));throw new S(`Failed to fetch data for token ${e} (HTTP ${t.status}): ${n}`,t.status)}return t.json()}))}
953
980
  /**
954
981
  * Get the Token Bound Account (TBA) address for a specific token ID.
955
982
  * @param {bigint} tokenId - The token ID to get the TBA address for.
@@ -960,7 +987,7 @@ return a===r?this.buyAccess(t,e,u,s,a,o,d,u):(yield rt({walletClient:this.viemCl
960
987
  * const tbaAddress = await origin.getTokenBoundAccount(1n);
961
988
  * console.log(`TBA Address: ${tbaAddress}`);
962
989
  * ```
963
- */getTokenBoundAccount(e){return T(this,void 0,void 0,(function*(){try{return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getAccount",[e],{simulate:!0})}catch(t){throw new Error(`Failed to get Token Bound Account for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
990
+ */getTokenBoundAccount(e){return m(this,void 0,void 0,(function*(){try{return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getAccount",[e],{simulate:!0})}catch(t){throw new Error(`Failed to get Token Bound Account for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
964
991
  /**
965
992
  * Get royalty information for a token ID, including the token bound account address and its balance.
966
993
  * @param {bigint} tokenId - The token ID to check royalties for.
@@ -975,9 +1002,9 @@ return a===r?this.buyAccess(t,e,u,s,a,o,d,u):(yield rt({walletClient:this.viemCl
975
1002
  * // Get ERC20 token royalties for a specific token
976
1003
  * const royalties = await origin.getRoyalties(1n, "0x1234...");
977
1004
  * ```
978
- */getRoyalties(e,t){return T(this,void 0,void 0,(function*(){try{const n=yield this.getTokenBoundAccount(e),i=O();let a,s;if(t&&t!==r){
1005
+ */getRoyalties(e,t){return m(this,void 0,void 0,(function*(){try{const n=yield this.getTokenBoundAccount(e),i=O();let s,r;if(t&&t!==a){
979
1006
  // erc20 (wrapped camp)
980
- 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"}];a=yield this.callContractMethod(t,e,"balanceOf",[n]);const i=yield this.callContractMethod(t,e,"decimals",[]);s=y(a,i)}else a=yield i.getBalance({address:n}),s=l(a);return{tokenBoundAccount:n,balance:a,balanceFormatted:s}}catch(t){throw new Error(`Failed to retrieve royalties for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
1007
+ 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)}`)}}))}
981
1008
  /**
982
1009
  * Claim royalties from a token's Token Bound Account (TBA).
983
1010
  * @param {bigint} tokenId - The token ID to claim royalties from.
@@ -993,25 +1020,25 @@ const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
993
1020
  * // Claim ERC20 token royalties to a specific address
994
1021
  * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
995
1022
  * ```
996
- */claimRoyalties(e,t,n){return T(this,void 0,void 0,(function*(){const i=yield f(this,ct,"m",bt).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 d,u,p;
1023
+ */claimRoyalties(e,t,n){return m(this,void 0,void 0,(function*(){const i=yield h(this,at,"m",mt).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;
997
1024
  // Call execute on the TBA
998
- return n&&n!==r?(
1025
+ return n&&n!==a?(
999
1026
  // ERC20 token transfer
1000
- d=n,u=BigInt(0),
1027
+ o=n,d=BigInt(0),
1001
1028
  // Encode ERC20 transfer call: transfer(address to, uint256 amount)
1002
- p=a({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]})):(
1029
+ 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]})):(
1003
1030
  // Native token transfer
1004
- d=i,u=o,p="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[d,u,p,0],// operation: 0 = CALL
1005
- {waitForReceipt:!0,value:BigInt(0)})}))}}ct=new WeakSet,mt=function(e,t){return T(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}}))},ht=function(e,t,n){return T(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}}))},Tt=function(e){return T(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 u=yield d.json();if(!u||!u.data)throw new Error("Invalid response from IPFS upload: Missing data field");return null===(t=u.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}`)}}))},ft=function(e,t){return T(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 f(this,ct,"m",mt).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 te(i,n.urls,(null==t?void 0:t.progressCallback)||(()=>{}))}catch(e){try{yield f(this,ct,"m",ht).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 f(this,ct,"m",ht).call(this,n.key,n.uploadId,a)}catch(e){console.error("Failed to update status to success:",e)}return n}))},vt=function(e){return T(this,arguments,void 0,(function*(e,t={}){var n,i,a;const s=O();let r=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield s.waitForTransactionReceipt({hash:r,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{r=e.transaction.hash}})}catch(e){
1031
+ o=i,d=r,u="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[o,d,u,0],// operation: 0 = CALL
1032
+ {waitForReceipt:!0,value:BigInt(0)})}))}}at=new WeakSet,st=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}}))},rt=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}}))},ot=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}`)}}))},dt=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,at,"m",st).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 X(i,n.urls,(null==t?void 0:t.progressCallback)||(()=>{}))}catch(e){try{yield h(this,at,"m",rt).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,at,"m",rt).call(this,n.key,n.uploadId,a)}catch(e){console.error("Failed to update status to success:",e)}return n}))},pt=function(e){return m(this,arguments,void 0,(function*(e,t={}){var n,i,a;const s=O();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){
1006
1033
  // fallback
1007
- 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,u)))}throw e}}))},At=function(e){return T(this,void 0,void 0,(function*(){if(!this.viemClient)throw new N(`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=>{F=e,B=null})// reset public client to be recreated with new chain
1034
+ 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}}))},ut=function(e){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new N(`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,x=null})// reset public client to be recreated with new chain
1008
1035
  (e);try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
1009
1036
  // Unrecognized chain
1010
- 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)}]})}}}))},wt=function(){return T(this,void 0,void 0,(function*(){if(!this.viemClient)throw new N("No wallet connected. Please connect a wallet to perform this action.");
1037
+ 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)}]})}}}))},lt=function(){return m(this,void 0,void 0,(function*(){if(!this.viemClient)throw new N("No wallet connected. Please connect a wallet to perform this action.");
1011
1038
  // If account is already set on the client, return it directly
1012
1039
  if(this.viemClient.account)return this.viemClient.account.address;
1013
1040
  // Otherwise request accounts (browser wallet flow)
1014
- const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new N("No accounts found in connected wallet. Please unlock your wallet or add an account.");return e[0]}))},It=function(){return T(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}}))},gt=function(e){return T(this,void 0,void 0,(function*(){try{
1041
+ const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new N("No accounts found in connected wallet. Please unlock your wallet or add an account.");return e[0]}))},yt=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}}))},ct=function(e){return m(this,void 0,void 0,(function*(){try{
1015
1042
  // First, get the token info to find its appId
1016
1043
  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;
1017
1044
  // Check if app registry is configured
@@ -1019,7 +1046,7 @@ if(!this.environment.APP_REGISTRY_CONTRACT_ADDRESS||!this.environment.APP_REGIST
1019
1046
  // Fetch app info from registry
1020
1047
  const i=yield this.callContractMethod(this.environment.APP_REGISTRY_CONTRACT_ADDRESS,this.environment.APP_REGISTRY_ABI,"getAppInfo",[n]);
1021
1048
  // Only return fee if app is active
1022
- 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}}))},bt=function(e){return T(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new N("No wallet address provided and no wallet connected. Please provide an address or connect a wallet.");
1049
+ 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}}))},mt=function(e){return m(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new N("No wallet address provided and no wallet connected. Please provide an address or connect a wallet.");
1023
1050
  // If account is already set on the client, return it directly
1024
1051
  if(this.viemClient.account)return this.viemClient.account.address;
1025
1052
  // Otherwise request accounts (browser wallet flow)
@@ -1029,7 +1056,7 @@ const t=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});
1029
1056
  * @class
1030
1057
  * @classdesc The Auth class is used to authenticate the user.
1031
1058
  */
1032
- class Ft{
1059
+ class Pt{
1033
1060
  /**
1034
1061
  * Constructor for the Auth class.
1035
1062
  * @param {object} options The options object.
@@ -1039,9 +1066,9 @@ class Ft{
1039
1066
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
1040
1067
  * @throws {APIError} - Throws an error if the clientId is not provided.
1041
1068
  */
1042
- constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(Ct.add(this),Et.set(this,void 0),St.set(this,void 0),Pt.set(this,void 0),Rt.set(this,void 0),!e)throw new _("clientId is required");if(!t)throw new _("appId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new _(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);v(this,St,"undefined"==typeof window,"f"),v(this,Rt,s||(f(this,St,"f")?new C:new b),"f"),this.viem=null,this.environment=K[i],this.environment.AUTH_HUB_BASE_API+="PRODUCTION"===i?"/auth-mainnet":"",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,v(this,Et,{},"f"),
1069
+ constructor({clientId:e,appId:t,redirectUri:n,environment:i="DEVELOPMENT",baseParentId:a,storage:s}){if(ht.add(this),Tt.set(this,void 0),ft.set(this,void 0),vt.set(this,void 0),wt.set(this,void 0),!e)throw new P("clientId is required");if(!t)throw new P("appId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(i))throw new P(`Invalid environment "${i}". Must be "DEVELOPMENT" or "PRODUCTION"`);T(this,ft,"undefined"==typeof window,"f"),T(this,wt,s||(h(this,ft,"f")?new g:new I),"f"),this.viem=null,this.environment=Z[i],this.environment.AUTH_HUB_BASE_API+="PRODUCTION"===i?"/auth-mainnet":"",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,Tt,{},"f"),
1043
1070
  // only subscribe to providers in browser environment
1044
- f(this,St,"f")||ee((e=>{f(this,Ct,"m",_t).call(this,"providers",e)})),f(this,Ct,"m",Dt).call(this)}
1071
+ h(this,ft,"f")||Q((e=>{h(this,ht,"m",At).call(this,"providers",e)})),h(this,ht,"m",It).call(this)}
1045
1072
  /**
1046
1073
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
1047
1074
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
@@ -1051,26 +1078,26 @@ f(this,St,"f")||ee((e=>{f(this,Ct,"m",_t).call(this,"providers",e)})),f(this,Ct,
1051
1078
  * auth.on("state", (state) => {
1052
1079
  * console.log(state);
1053
1080
  * });
1054
- */on(e,t){f(this,Et,"f")[e]||(f(this,Et,"f")[e]=[]),f(this,Et,"f")[e].push(t),"providers"===e&&t(Q())}
1081
+ */on(e,t){h(this,Tt,"f")[e]||(h(this,Tt,"f")[e]=[]),h(this,Tt,"f")[e].push(t),"providers"===e&&t(K())}
1055
1082
  /**
1056
1083
  * Unsubscribe from an event. Possible events are "state", "provider", "providers", and "viem".
1057
1084
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
1058
1085
  * @param {function} callback The callback function.
1059
1086
  * @returns {void}
1060
- */off(e,t){f(this,Et,"f")[e]&&(f(this,Et,"f")[e]=f(this,Et,"f")[e].filter((e=>e!==t)))}
1087
+ */off(e,t){h(this,Tt,"f")[e]&&(h(this,Tt,"f")[e]=h(this,Tt,"f")[e].filter((e=>e!==t)))}
1061
1088
  /**
1062
1089
  * Set the loading state.
1063
1090
  * @param {boolean} loading The loading state.
1064
1091
  * @returns {void}
1065
- */setLoading(e){f(this,Ct,"m",_t).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
1092
+ */setLoading(e){h(this,ht,"m",At).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
1066
1093
  /**
1067
1094
  * 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.
1068
1095
  * @param {object} options The options object. Includes the provider and the provider info.
1069
1096
  * @returns {void}
1070
1097
  * @throws {APIError} - Throws an error if the provider is not provided.
1071
- */setProvider({provider:t,info:i,address:a}){if(!t)throw new R("provider is required");this.viem=((t,i="window.ethereum",a,s)=>{var r,o;if(!t&&!M)return console.warn("Provider is required to create a client."),null;const d=a||S;if(!M||M.transport.name!==i&&t||s!==(null===(r=M.account)||void 0===r?void 0:r.address)&&t||(null==F?void 0:F.id)!==d.id){const a={chain:d,transport:n(t,{name:i})};s&&(a.account=c(s)),M=e(a),F=d,B&&(null===(o=B.chain)||void 0===o?void 0:o.id)!==d.id&&(B=null)}return M})(t,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
1098
+ */setProvider({provider:t,info:i,address:a}){if(!t)throw new S("provider is required");this.viem=((t,i="window.ethereum",a,s)=>{var r,o;if(!t&&!k)return console.warn("Provider is required to create a client."),null;const d=a||C;if(!k||k.transport.name!==i&&t||s!==(null===(r=k.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)),k=e(a),M=d,x&&(null===(o=x.chain)||void 0===o?void 0:o.id)!==d.id&&(x=null)}return k})(t,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
1072
1099
  // TODO: only use one of these
1073
- f(this,Ct,"m",_t).call(this,"viem",this.viem),f(this,Ct,"m",_t).call(this,"provider",{provider:t,info:i}),f(this,Rt,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
1100
+ h(this,ht,"m",At).call(this,"viem",this.viem),h(this,ht,"m",At).call(this,"provider",{provider:t,info:i}),h(this,wt,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
1074
1101
  /**
1075
1102
  * 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.
1076
1103
  * @param {string} walletAddress The wallet address.
@@ -1079,29 +1106,29 @@ f(this,Ct,"m",_t).call(this,"viem",this.viem),f(this,Ct,"m",_t).call(this,"provi
1079
1106
  /**
1080
1107
  * Recover the provider from local storage.
1081
1108
  * @returns {Promise<void>}
1082
- */recoverProvider(){return T(this,void 0,void 0,(function*(){var e,t,n,i,a,s,r,o,d,u,p,l,y;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const c=yield f(this,Rt,"f").getItem("camp-sdk:provider");if(!c)return;const m=JSON.parse(c);let h;const T=null!==(e=Q())&&void 0!==e?e:[];
1109
+ */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,wt,"f").getItem("camp-sdk:provider");if(!c)return;const m=JSON.parse(c);let T;const f=null!==(e=K())&&void 0!==e?e:[];
1083
1110
  // first pass: try to find provider by UUID/name and check if it has the right address
1084
1111
  // without prompting (using eth_accounts)
1085
- for(const e of T)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){
1112
+ 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){
1086
1113
  // silently check if the wallet address matches first
1087
- const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(i=t[0])||void 0===i?void 0:i.toLowerCase())===(null===(a=this.walletAddress)||void 0===a?void 0:a.toLowerCase())){h=e;break}}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
1114
+ const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(i=t[0])||void 0===i?void 0:i.toLowerCase())===(null===(a=this.walletAddress)||void 0===a?void 0:a.toLowerCase())){T=e;break}}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
1088
1115
  // second pass: if no provider found by UUID/name match, try to find by address only
1089
1116
  // but still avoid prompting
1090
- if(!h)for(const e of T)try{
1117
+ if(!T)for(const e of f)try{
1091
1118
  // skip providers we already checked in the first pass
1092
- 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())){h=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
1119
+ 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)}
1093
1120
  // third pass: if still no provider found and we have UUID/name info,
1094
1121
  // try prompting the user (only for the stored provider)
1095
- if(!h&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(u=e.info)||void 0===u?void 0:u.uuid)===m.uuid||m.name&&(null===(p=e.info)||void 0===p?void 0:p.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())){h=e;break}}}catch(e){console.warn("Failed to reconnect to stored provider:",e)}h?this.setProvider({provider:h.provider,info:h.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
1122
+ 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.")}))}
1096
1123
  /**
1097
1124
  * Disconnect the user.
1098
1125
  * @returns {Promise<void>}
1099
- */disconnect(){return T(this,void 0,void 0,(function*(){this.isAuthenticated&&(f(this,Ct,"m",_t).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,v(this,Pt,void 0,"f"),yield f(this,Rt,"f").removeItem("camp-sdk:wallet-address"),yield f(this,Rt,"f").removeItem("camp-sdk:user-id"),yield f(this,Rt,"f").removeItem("camp-sdk:jwt"),yield f(this,Rt,"f").removeItem("camp-sdk:environment"))}))}
1126
+ */disconnect(){return m(this,void 0,void 0,(function*(){this.isAuthenticated&&(h(this,ht,"m",At).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,T(this,vt,void 0,"f"),yield h(this,wt,"f").removeItem("camp-sdk:wallet-address"),yield h(this,wt,"f").removeItem("camp-sdk:user-id"),yield h(this,wt,"f").removeItem("camp-sdk:jwt"),yield h(this,wt,"f").removeItem("camp-sdk:environment"))}))}
1100
1127
  /**
1101
1128
  * Connect the user's wallet and sign the message.
1102
1129
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
1103
1130
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
1104
- */connect(){return T(this,void 0,void 0,(function*(){f(this,Ct,"m",_t).call(this,"state","loading");try{this.walletAddress||(yield f(this,Ct,"m",Nt).call(this)),this.walletAddress=s(this.walletAddress);const e=yield f(this,Ct,"m",xt).call(this),t=f(this,Ct,"m",Mt).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield f(this,Ct,"m",kt).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new Bt(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield f(this,Rt,"f").setItem("camp-sdk:jwt",this.jwt),yield f(this,Rt,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield f(this,Rt,"f").setItem("camp-sdk:user-id",this.userId),yield f(this,Rt,"f").setItem("camp-sdk:environment",this.environment.NAME),f(this,Ct,"m",_t).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,f(this,Ct,"m",_t).call(this,"state","unauthenticated"),new R("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,f(this,Ct,"m",_t).call(this,"state","unauthenticated"),e instanceof R||e instanceof N)throw e;throw new R(`Failed to authenticate: ${k(e)}`)}}))}
1131
+ */connect(){return m(this,void 0,void 0,(function*(){h(this,ht,"m",At).call(this,"state","loading");try{this.walletAddress||(yield h(this,ht,"m",gt).call(this)),this.walletAddress=u(this.walletAddress);const e=yield h(this,ht,"m",bt).call(this),t=h(this,ht,"m",Et).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield h(this,ht,"m",Ct).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new St(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,wt,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,wt,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,wt,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,wt,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,ht,"m",At).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,ht,"m",At).call(this,"state","unauthenticated"),new S("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,h(this,ht,"m",At).call(this,"state","unauthenticated"),e instanceof S||e instanceof N)throw e;throw new S(`Failed to authenticate: ${D(e)}`)}}))}
1105
1132
  /**
1106
1133
  * Connect with a custom signer (for Node.js or custom wallet implementations).
1107
1134
  * This method bypasses browser wallet interactions and uses the provided signer directly.
@@ -1120,9 +1147,9 @@ if(!h&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(u=e.info)||void
1120
1147
  * const account = privateKeyToAccount('0x...');
1121
1148
  * const client = createWalletClient({ account, chain: mainnet, transport: http() });
1122
1149
  * await auth.connectWithSigner(client);
1123
- */connectWithSigner(e,t){return T(this,void 0,void 0,(function*(){f(this,Ct,"m",_t).call(this,"state","loading");try{v(this,Pt,g(e),"f"),this.walletAddress=s(yield f(this,Pt,"f").getAddress()),
1150
+ */connectWithSigner(e,t){return m(this,void 0,void 0,(function*(){h(this,ht,"m",At).call(this,"state","loading");try{T(this,vt,A(e),"f"),this.walletAddress=u(yield h(this,vt,"f").getAddress()),
1124
1151
  // store the signer as viem client if it's a viem client, otherwise keep adapter
1125
- "viem"===f(this,Pt,"f").type&&(this.viem=e);const n=yield f(this,Ct,"m",xt).call(this),i=f(this,Ct,"m",Mt).call(this,n,null==t?void 0:t.domain,null==t?void 0:t.uri),a=yield f(this,Pt,"f").signMessage(i),r=yield f(this,Ct,"m",kt).call(this,i,a);if(r.success)return this.isAuthenticated=!0,this.userId=r.userId,this.jwt=r.token,this.origin=new Bt(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield f(this,Rt,"f").setItem("camp-sdk:jwt",this.jwt),yield f(this,Rt,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield f(this,Rt,"f").setItem("camp-sdk:user-id",this.userId),yield f(this,Rt,"f").setItem("camp-sdk:environment",this.environment.NAME),f(this,Ct,"m",_t).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,f(this,Ct,"m",_t).call(this,"state","unauthenticated"),new R("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,v(this,Pt,void 0,"f"),f(this,Ct,"m",_t).call(this,"state","unauthenticated"),e instanceof R||e instanceof N)throw e;throw new R(`Failed to authenticate: ${k(e)}`)}}))}
1152
+ "viem"===h(this,vt,"f").type&&(this.viem=e);const n=yield h(this,ht,"m",bt).call(this),i=h(this,ht,"m",Et).call(this,n,null==t?void 0:t.domain,null==t?void 0:t.uri),a=yield h(this,vt,"f").signMessage(i),s=yield h(this,ht,"m",Ct).call(this,i,a);if(s.success)return this.isAuthenticated=!0,this.userId=s.userId,this.jwt=s.token,this.origin=new St(this.environment,this.jwt,this.viem,this.baseParentId,this.appId),yield h(this,wt,"f").setItem("camp-sdk:jwt",this.jwt),yield h(this,wt,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield h(this,wt,"f").setItem("camp-sdk:user-id",this.userId),yield h(this,wt,"f").setItem("camp-sdk:environment",this.environment.NAME),h(this,ht,"m",At).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,h(this,ht,"m",At).call(this,"state","unauthenticated"),new S("Failed to authenticate: signature verification failed")}catch(e){if(this.isAuthenticated=!1,T(this,vt,void 0,"f"),h(this,ht,"m",At).call(this,"state","unauthenticated"),e instanceof S||e instanceof N)throw e;throw new S(`Failed to authenticate: ${D(e)}`)}}))}
1126
1153
  /**
1127
1154
  * Get the user's linked social accounts.
1128
1155
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
@@ -1131,34 +1158,34 @@ if(!h&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(u=e.info)||void
1131
1158
  * const auth = new Auth({ clientId: "your-client-id" });
1132
1159
  * const socials = await auth.getLinkedSocials();
1133
1160
  * console.log(socials);
1134
- */getLinkedSocials(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to get linked social accounts");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/client-user/connections-sdk`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"}}).then((e=>e.json()));if(e.isError)throw new R(e.message||"Failed to fetch connections");{const t={};return Object.keys(e.data.data).forEach((n=>{t[n.split("User")[0]]=e.data.data[n]})),t}}))}
1161
+ */getLinkedSocials(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to get linked social accounts");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/client-user/connections-sdk`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"}}).then((e=>e.json()));if(e.isError)throw new S(e.message||"Failed to fetch connections");{const t={};return Object.keys(e.data.data).forEach((n=>{t[n.split("User")[0]]=e.data.data[n]})),t}}))}
1135
1162
  /**
1136
1163
  * Link the user's Twitter account.
1137
1164
  * @returns {Promise<void>}
1138
1165
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
1139
- */linkTwitter(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to link Twitter account");if(f(this,St,"f"))throw new R("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}`}))}
1166
+ */linkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to link Twitter account");if(h(this,ft,"f"))throw new S("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}`}))}
1140
1167
  /**
1141
1168
  * Link the user's Discord account.
1142
1169
  * @returns {Promise<void>}
1143
1170
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
1144
- */linkDiscord(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to link Discord account");if(f(this,St,"f"))throw new R("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}`}))}
1171
+ */linkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to link Discord account");if(h(this,ft,"f"))throw new S("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}`}))}
1145
1172
  /**
1146
1173
  * Link the user's Spotify account.
1147
1174
  * @returns {Promise<void>}
1148
1175
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
1149
- */linkSpotify(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to link Spotify account");if(f(this,St,"f"))throw new R("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}`}))}
1176
+ */linkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to link Spotify account");if(h(this,ft,"f"))throw new S("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}`}))}
1150
1177
  /**
1151
1178
  * Link the user's TikTok account.
1152
1179
  * @param {string} handle The user's TikTok handle.
1153
1180
  * @returns {Promise<any>} A promise that resolves with the TikTok account data.
1154
1181
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
1155
- */linkTikTok(e){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to link TikTok account");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new R("TikTok service is currently unavailable, try again later"):new R(t.message||"Failed to link TikTok account");return t.data}))}
1182
+ */linkTikTok(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to link TikTok account");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new S("TikTok service is currently unavailable, try again later"):new S(t.message||"Failed to link TikTok account");return t.data}))}
1156
1183
  /**
1157
1184
  * Send an OTP to the user's Telegram account.
1158
1185
  * @param {string} phoneNumber The user's phone number.
1159
1186
  * @returns {Promise<any>} A promise that resolves with the OTP data.
1160
1187
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
1161
- */sendTelegramOTP(e){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to send Telegram OTP");if(!e)throw new _("Phone number is required to send Telegram OTP");yield this.unlinkTelegram();const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/sendOTP-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e})}).then((e=>e.json()));if(t.isError)throw new R(t.message||"Failed to send Telegram OTP");return t.data}))}
1188
+ */sendTelegramOTP(e){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to send Telegram OTP");if(!e)throw new P("Phone number is required to send Telegram OTP");yield this.unlinkTelegram();const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/sendOTP-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e})}).then((e=>e.json()));if(t.isError)throw new S(t.message||"Failed to send Telegram OTP");return t.data}))}
1162
1189
  /**
1163
1190
  * Link the user's Telegram account.
1164
1191
  * @param {string} phoneNumber The user's phone number.
@@ -1166,34 +1193,34 @@ if(!h&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(u=e.info)||void
1166
1193
  * @param {string} phoneCodeHash The phone code hash.
1167
1194
  * @returns {Promise<object>} A promise that resolves with the Telegram account data.
1168
1195
  * @throws {APIError|Error} - Throws an error if the user is not authenticated. Also throws an error if the phone number, OTP, and phone code hash are not provided.
1169
- */linkTelegram(e,t,n){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to link Telegram account");if(!e||!t||!n)throw new _("Phone number, OTP, and phone code hash are all required to link Telegram");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new R(i.message||"Failed to link Telegram account");return i.data}))}
1196
+ */linkTelegram(e,t,n){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to link Telegram account");if(!e||!t||!n)throw new P("Phone number, OTP, and phone code hash are all required to link Telegram");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new S(i.message||"Failed to link Telegram account");return i.data}))}
1170
1197
  /**
1171
1198
  * Unlink the user's Twitter account.
1172
1199
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1173
1200
  * @throws {Error} - Throws an error if the user is not authenticated.
1174
1201
  * @throws {APIError} - Throws an error if the request fails.
1175
- */unlinkTwitter(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to unlink Twitter account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/twitter/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new R(e.message||"Failed to unlink Twitter account");return e.data}))}
1202
+ */unlinkTwitter(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to unlink Twitter account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/twitter/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new S(e.message||"Failed to unlink Twitter account");return e.data}))}
1176
1203
  /**
1177
1204
  * Unlink the user's Discord account.
1178
1205
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1179
1206
  * @throws {Error} - Throws an error if the user is not authenticated.
1180
1207
  * @throws {APIError} - Throws an error if the request fails.
1181
- */unlinkDiscord(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to unlink Discord account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/discord/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new R(e.message||"Failed to unlink Discord account");return e.data}))}
1208
+ */unlinkDiscord(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to unlink Discord account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/discord/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new S(e.message||"Failed to unlink Discord account");return e.data}))}
1182
1209
  /**
1183
1210
  * Unlink the user's Spotify account.
1184
1211
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1185
1212
  * @throws {Error} - Throws an error if the user is not authenticated.
1186
1213
  * @throws {APIError} - Throws an error if the request fails.
1187
- */unlinkSpotify(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to unlink Spotify account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/spotify/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new R(e.message||"Failed to unlink Spotify account");return e.data}))}
1214
+ */unlinkSpotify(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to unlink Spotify account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/spotify/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({id:this.userId})}).then((e=>e.json()));if(e.isError)throw new S(e.message||"Failed to unlink Spotify account");return e.data}))}
1188
1215
  /**
1189
1216
  * Unlink the user's TikTok account.
1190
1217
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1191
1218
  * @throws {Error} - Throws an error if the user is not authenticated.
1192
1219
  * @throws {APIError} - Throws an error if the request fails.
1193
- */unlinkTikTok(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("User must be authenticated to unlink TikTok account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new R(e.message||"Failed to unlink TikTok account");return e.data}))}
1220
+ */unlinkTikTok(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("User must be authenticated to unlink TikTok account");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/disconnect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userId:this.userId})}).then((e=>e.json()));if(e.isError)throw new S(e.message||"Failed to unlink TikTok account");return e.data}))}
1194
1221
  /**
1195
1222
  * Unlink the user's Telegram account.
1196
1223
  * @returns {Promise<any>} A promise that resolves with the unlink result.
1197
1224
  * @throws {Error} - Throws an error if the user is not authenticated.
1198
1225
  * @throws {APIError} - Throws an error if the request fails.
1199
- */unlinkTelegram(){return T(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new D("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 R(e.message||"Failed to unlink Telegram account");return e.data}))}}Et=new WeakMap,St=new WeakMap,Pt=new WeakMap,Rt=new WeakMap,Ct=new WeakSet,_t=function(e,t){f(this,Et,"f")[e]&&f(this,Et,"f")[e].forEach((e=>e(t)))},Dt=function(e){return T(this,void 0,void 0,(function*(){const t=yield f(this,Rt,"f").getItem("camp-sdk:wallet-address"),n=yield f(this,Rt,"f").getItem("camp-sdk:user-id"),i=yield f(this,Rt,"f").getItem("camp-sdk:jwt"),a=yield f(this,Rt,"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 Bt(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}):f(this,St,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},Nt=function(){return T(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=s(e),this.walletAddress}catch(e){throw new N(`Failed to connect wallet: ${k(e)}`)}}))},xt=function(){return T(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 R(t.message||`Failed to fetch nonce (HTTP ${e.status})`,e.status);return t.data}catch(e){if(e instanceof R)throw e;throw new R(`Failed to fetch nonce: ${k(e)}`)}}))},kt=function(e,t){return T(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 R(`Failed to verify signature: ${k(e)}`)}}))},Mt=function(e,t,n){return m({domain:t||(f(this,St,"f")?"localhost":window.location.host),address:this.walletAddress,statement:q,uri:n||(f(this,St,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})};export{Ft as Auth,b as BrowserStorage,I as CustomSignerAdapter,Ee as DataStatus,Se as DisputeStatus,w as EthersSignerAdapter,Ce as LicenseType,C as MemoryStorage,Bt as Origin,A as ViemSignerAdapter,P as campMainnet,S as campTestnet,Pe as createLicenseTerms,E as createNodeWalletClient,g as createSignerAdapter,Ue as decodeCidFromBytes32,Oe as encodeCidToBytes32};
1226
+ */unlinkTelegram(){return m(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new R("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 S(e.message||"Failed to unlink Telegram account");return e.data}))}}Tt=new WeakMap,ft=new WeakMap,vt=new WeakMap,wt=new WeakMap,ht=new WeakSet,At=function(e,t){h(this,Tt,"f")[e]&&h(this,Tt,"f")[e].forEach((e=>e(t)))},It=function(e){return m(this,void 0,void 0,(function*(){const t=yield h(this,wt,"f").getItem("camp-sdk:wallet-address"),n=yield h(this,wt,"f").getItem("camp-sdk:user-id"),i=yield h(this,wt,"f").getItem("camp-sdk:jwt"),a=yield h(this,wt,"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 St(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,ft,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},gt=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 N(`Failed to connect wallet: ${D(e)}`)}}))},bt=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 S(t.message||`Failed to fetch nonce (HTTP ${e.status})`,e.status);return t.data}catch(e){if(e instanceof S)throw e;throw new S(`Failed to fetch nonce: ${D(e)}`)}}))},Ct=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 S(`Failed to verify signature: ${D(e)}`)}}))},Et=function(e,t,n){return y({domain:t||(h(this,ft,"f")?"localhost":window.location.host),address:this.walletAddress,statement:z,uri:n||(h(this,ft,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})};export{Pt as Auth,I as BrowserStorage,w as CustomSignerAdapter,xe as DataStatus,Me as DisputeStatus,v as EthersSignerAdapter,ke as LicenseType,g as MemoryStorage,St as Origin,f as ViemSignerAdapter,E as campMainnet,C as campTestnet,Oe as createLicenseTerms,b as createNodeWalletClient,A as createSignerAdapter,ge as decodeCidFromBytes32,Ie as encodeCidToBytes32};