@campnetwork/origin 1.2.0-3 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("axios"),t=require("viem"),n=require("viem/accounts"),i=require("viem/siwe");
1
+ "use strict";var e=require("viem"),t=require("viem/accounts"),n=require("viem/siwe"),i=require("axios");
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -14,98 +14,89 @@ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
16
  /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
17
- function r(e,t,n,i){return new(n||(n=Promise))((function(r,a){function s(e){try{d(i.next(e))}catch(e){a(e)}}function o(e){try{d(i.throw(e))}catch(e){a(e)}}function d(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}d((i=i.apply(e,t||[])).next())}))}function a(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 s(e,t,n,i,r){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?r.call(e,n):r?r.value=n:t.set(e,n),n}"function"==typeof SuppressedError&&SuppressedError;class o 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}}}const d={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/"}}},u={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/"}}};var p=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],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:"nonpayable"},{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"}]}],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"}],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:"deadline",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"isIP",type:"bool",internalType:"bool"},{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:"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:"status",type:"uint8",internalType:"enum IIpNFT.DataStatus"}]}],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"}]}],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:"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:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],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:"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:"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:[]}],l=[{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"}],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:"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:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],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:"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:"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:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParentIp",inputs:[]},{type:"error",name:"InvalidPayment",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:[]}],y=[{type:"constructor",inputs:[{name:"_owner",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"claimRoyalty",inputs:[{name:"token",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]}],c=[{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"}],h="Connect with Camp Network",m=2628e3,f=86400,T=1e15,v=1,w=1e4;const A={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0xB53F5723Dd4E46da32e1769Bd36A5aD880e707A5",MARKETPLACE_CONTRACT_ADDRESS:"0x97b0A18B2888e904940fFd19E480a28aeec3F055",CHAIN:d,IPNFT_ABI:p,MARKETPLACE_ABI:l,ROYALTY_VAULT_ABI:y,TBA_ABI:c},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",CHAIN:u,IPNFT_ABI:p,MARKETPLACE_ABI:l,ROYALTY_VAULT_ABI:y,TBA_ABI:c}};
18
- /**
19
- * Makes a GET request to the given URL with the provided headers.
20
- *
21
- * @param {string} url - The URL to send the GET request to.
22
- * @param {object} headers - The headers to include in the request.
23
- * @returns {Promise<object>} - The response data.
24
- * @throws {APIError} - Throws an error if the request fails.
25
- */function g(t){return r(this,arguments,void 0,(function*(t,n={}){try{return(yield e.get(t,{headers:n})).data}catch(e){if(e.response)throw new o(e.response.data.message||"API request failed",e.response.status);throw new o("Network error or server is unavailable",500)}}))}
26
- /**
27
- * Constructs a query string from an object of query parameters.
28
- *
29
- * @param {object} params - An object representing query parameters.
30
- * @returns {string} - The encoded query string.
31
- */
32
- /**
33
- * Builds a complete URL with query parameters.
34
- *
35
- * @param {string} baseURL - The base URL of the endpoint.
36
- * @param {object} params - An object representing query parameters.
37
- * @returns {string} - The complete URL with query string.
38
- */
39
- function I(e,t={}){const n=function(e={}){return Object.keys(e).map((t=>`${encodeURIComponent(t)}=${encodeURIComponent(e[t])}`)).join("&")}(t);return n?`${e}?${n}`:e}const b="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",E="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";
17
+ function a(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function o(e){try{d(i.throw(e))}catch(e){r(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(s,o)}d((i=i.apply(e,t||[])).next())}))}function r(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 s(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;class o 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}}}const d={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/"}}},u={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/"}}};
40
18
  // @ts-ignore
41
- let C=null,_=null,k=null;const x=e=>{var n;const i=k||d;return _&&(null===(n=_.chain)||void 0===n?void 0:n.id)===i.id||(_=t.createPublicClient({chain:i,transport:t.http()})),_};let N=[];const S=()=>N,P=e=>{function t(t){N.some((e=>e.info.uuid===t.detail.info.uuid))||(N=[...N,t.detail],e(N))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
19
+ let p=null,l=null,y=null;const c=t=>{var n;const i=y||d;return l&&(null===(n=l.chain)||void 0===n?void 0:n.id)===i.id||(l=e.createPublicClient({chain:i,transport:e.http()})),l};var m=[{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],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:"nonpayable"},{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"}]}],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"}],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:"deadline",type:"uint256",internalType:"uint256"},{name:"parents",type:"uint256[]",internalType:"uint256[]"},{name:"isIP",type:"bool",internalType:"bool"},{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:"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:"status",type:"uint8",internalType:"enum IIpNFT.DataStatus"}]}],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"}]}],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:"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:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],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:"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:"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:[]}],h=[{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"}],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:"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:"Paused",inputs:[{name:"account",type:"address",indexed:!1,internalType:"address"}],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:"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:"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:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidParentIp",inputs:[]},{type:"error",name:"InvalidPayment",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:[]}],T=[{type:"constructor",inputs:[{name:"_owner",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"claimRoyalty",inputs:[{name:"token",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]}],f=[{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"}],v="Connect with Camp Network",w=2628e3,A=86400,g=1e15,I=1,b=1e4;const E={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0xB53F5723Dd4E46da32e1769Bd36A5aD880e707A5",MARKETPLACE_CONTRACT_ADDRESS:"0x97b0A18B2888e904940fFd19E480a28aeec3F055",CHAIN:d,IPNFT_ABI:m,MARKETPLACE_ABI:h,ROYALTY_VAULT_ABI:T,TBA_ABI:f},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x39EeE1C3989f0dD543Dee60f8582F7F81F522C38",MARKETPLACE_CONTRACT_ADDRESS:"0xc69BAa987757d054455fC0f2d9797684E9FB8b9C",CHAIN:u,IPNFT_ABI:m,MARKETPLACE_ABI:h,ROYALTY_VAULT_ABI:T,TBA_ABI:f}};let C=[];const _=()=>C,x=e=>{function t(t){C.some((e=>e.info.uuid===t.detail.info.uuid))||(C=[...C,t.detail],e(C))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
20
+ /**
21
+ * Uploads a file to a specified URL with progress tracking.
22
+ * Falls back to a simple fetch request if XMLHttpRequest is not available.
23
+ * @param {File} file - The file to upload.
24
+ * @param {string} url - The URL to upload the file to.
25
+ * @param {UploadProgressCallback} onProgress - A callback function to track upload progress.
26
+ * @returns {Promise<string>} - A promise that resolves with the response from the server.
27
+ */
42
28
  /**
43
29
  * Mints a Data NFT with a signature.
44
30
  * @param to The address to mint the NFT to.
45
31
  * @param tokenId The ID of the token to mint.
46
32
  * @param parents The IDs of the parent NFTs, if applicable.
33
+ * @param isIp Whether the NFT is an IP NFT.
47
34
  * @param hash The hash of the data associated with the NFT.
48
35
  * @param uri The URI of the NFT metadata.
49
36
  * @param licenseTerms The terms of the license for the NFT.
50
37
  * @param deadline The deadline for the minting operation.
51
38
  * @param signature The signature for the minting operation.
52
39
  * @returns A promise that resolves when the minting is complete.
53
- */function M(e,t,n,i,a,s,o,d,u){return r(this,void 0,void 0,(function*(){return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,a,s,o,d,n,i,u],{waitForReceipt:!0})}))}
40
+ */
41
+ function k(e,t,n,i,r,s,o,d,u){return a(this,void 0,void 0,(function*(){return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,r,s,o,d,n,i,u],{waitForReceipt:!0})}))}
54
42
  /**
55
43
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
56
44
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
57
45
  * @param deadline The deadline for the registration operation.
58
- * @param fileKey Optional file key for file uploads.
46
+ * @param licenseTerms The terms of the license for the NFT.
47
+ * @param metadata The metadata associated with the NFT.
48
+ * @param fileKey The file key(s) if the source is "file".
49
+ * @param parents The IDs of the parent NFTs, if applicable.
59
50
  * @return A promise that resolves with the registration data.
60
- */function D(e,t,n,i,a,s){return r(this,void 0,void 0,(function*(){const r={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken},metadata:i,parentId:s?s.map((e=>e.toString())):[]};void 0!==a&&(r.fileKey=a);const o=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Failed to get signature: ${o.statusText}`);const d=yield o.json();if(d.isError)throw new Error(`Failed to get signature: ${d.message}`);return d.data}))}
51
+ */function P(e,t,n,i,r,s){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken},metadata:i,parentId:s?s.map((e=>e.toString())):[]};void 0!==r&&(a.fileKey=r);const o=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error(`Failed to get signature: ${o.statusText}`);const d=yield o.json();if(d.isError)throw new Error(`Failed to get signature: ${d.message}`);return d.data}))}
61
52
  /**
62
53
  * Updates the license terms of a specified IPNFT.
63
54
  * @param tokenId The ID of the IPNFT to update.
64
55
  * @param newTerms The new license terms to set.
65
56
  * @returns A promise that resolves when the transaction is complete.
66
- */function U(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
57
+ */function S(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
67
58
  /**
68
59
  * Sets the IPNFT as deleted
69
60
  * @param tokenId The token ID to set as deleted.
70
61
  * @returns A promise that resolves when the transaction is complete.
71
- */function B(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
62
+ */function N(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
72
63
  /**
73
64
  * Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
74
65
  * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
75
66
  * @param simulateOnly If true, simulates the transaction without executing it.
76
67
  * @returns The address of the royalty vault associated with the specified token owner.
77
- */function O(e){return r(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}))}
68
+ */function M(e){return a(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}))}
78
69
  /**
79
70
  * Returns the license terms associated with a specific token ID.
80
71
  * @param tokenId The token ID to query.
81
72
  * @returns The license terms of the token ID.
82
- */function F(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
73
+ */function D(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
83
74
  /**
84
75
  * Returns the owner of the specified IPNFT.
85
76
  * @param tokenId The ID of the IPNFT to query.
86
77
  * @returns The address of the owner of the IPNFT.
87
- */function R(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
78
+ */function U(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
88
79
  /**
89
80
  * Returns the number of IPNFTs owned by the given address.
90
81
  * @param owner The address to query.
91
82
  * @returns The number of IPNFTs owned by the address.
92
- */function $(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
83
+ */function O(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
93
84
  /**
94
85
  * Returns the metadata URI associated with a specific token ID.
95
86
  * @param tokenId The token ID to query.
96
87
  * @returns The metadata URI of the token ID.
97
- */function H(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
88
+ */function F(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
98
89
  /**
99
90
  * Returns the data status of the given token ID.
100
91
  * @param tokenId The token ID to query.
101
92
  * @returns The data status of the token ID.
102
- */function j(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
93
+ */function R(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
103
94
  /**
104
95
  * Checks if an operator is approved to manage all assets of a given owner.
105
96
  * @param owner The address of the asset owner.
106
97
  * @param operator The address of the operator to check.
107
98
  * @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
108
- */function z(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function W(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function L(e,t,n,i){const r=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"safeTransferFrom",r)}function q(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function J(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
99
+ */function B(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function $(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function H(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 j(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function z(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
109
100
  /**
110
101
  * Buys access to a data NFT for a specified duration.
111
102
  * @param buyer The address of the buyer.
@@ -115,45 +106,45 @@ let C=null,_=null,k=null;const x=e=>{var n;const i=k||d;return _&&(null===(n=_.c
115
106
  * @param expectedPaymentToken The address of the payment token (use zero address for native token).
116
107
  * @param value The amount of native token to send (only required if paying with native token).
117
108
  * @returns A promise that resolves when the transaction is confirmed.
118
- */function V(e,t,n,i,r,a){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,r],{waitForReceipt:!0,value:a})}
109
+ */function L(e,t,n,i,a,r){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,a],{waitForReceipt:!0,value:r})}
119
110
  /**
120
111
  * Checks if a user has access to a specific token based on subscription expiry.
121
112
  * @param user - The address of the user.
122
113
  * @param tokenId - The ID of the token.
123
114
  * @returns A promise that resolves to a boolean indicating if the user has access.
124
- */function K(e,t){return r(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 G(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
115
+ */function q(e,t){return a(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 J(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
125
116
  /**
126
117
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
127
118
  * If the current allowance is less than the specified amount, it will perform the approval.
128
119
  * @param {ApproveParams} params - The parameters for the approval.
129
- */var Y;
120
+ */var W;
130
121
  /**
131
122
  * Enum representing the status of data in the system.
132
123
  * * - ACTIVE: The data is currently active and available.
133
124
  * * - PENDING_DELETE: The data is scheduled for deletion but not yet removed.
134
125
  * * - DELETED: The data has been deleted and is no longer available.
135
126
  */
136
- exports.DataStatus=void 0,(Y=exports.DataStatus||(exports.DataStatus={}))[Y.ACTIVE=0]="ACTIVE",Y[Y.PENDING_DELETE=1]="PENDING_DELETE",Y[Y.DELETED=2]="DELETED";var X,Z,Q,ee,te,ne,ie,re,ae,se,oe,de,ue,pe,le,ye,ce,he;
127
+ exports.DataStatus=void 0,(W=exports.DataStatus||(exports.DataStatus={}))[W.ACTIVE=0]="ACTIVE",W[W.PENDING_DELETE=1]="PENDING_DELETE",W[W.DELETED=2]="DELETED";var V,K,G,Y,X,Z,Q,ee,te,ne,ie,ae,re,se,oe,de,ue,pe;
137
128
  /**
138
129
  * The Origin class
139
130
  * Handles the upload of files to Origin, as well as querying the user's stats
140
- */class me{constructor(e,t,n){X.add(this),this.jwt=e,this.viemClient=n,this.environment=t,
131
+ */class le{constructor(e,t,n,i){V.add(this),this.jwt=e,this.viemClient=n,this.environment=t,this.baseParentId=i,
141
132
  // DataNFT methods
142
- this.mintWithSignature=M.bind(this),this.registerIpNFT=D.bind(this),this.updateTerms=U.bind(this),this.finalizeDelete=B.bind(this),this.getOrCreateRoyaltyVault=O.bind(this),this.getTerms=F.bind(this),this.ownerOf=R.bind(this),this.balanceOf=$.bind(this),this.tokenURI=H.bind(this),this.dataStatus=j.bind(this),this.isApprovedForAll=z.bind(this),this.transferFrom=W.bind(this),this.safeTransferFrom=L.bind(this),this.approve=q.bind(this),this.setApprovalForAll=J.bind(this),
133
+ this.mintWithSignature=k.bind(this),this.registerIpNFT=P.bind(this),this.updateTerms=S.bind(this),this.finalizeDelete=N.bind(this),this.getOrCreateRoyaltyVault=M.bind(this),this.getTerms=D.bind(this),this.ownerOf=U.bind(this),this.balanceOf=O.bind(this),this.tokenURI=F.bind(this),this.dataStatus=R.bind(this),this.isApprovedForAll=B.bind(this),this.transferFrom=$.bind(this),this.safeTransferFrom=H.bind(this),this.approve=j.bind(this),this.setApprovalForAll=z.bind(this),
143
134
  // Marketplace methods
144
- this.buyAccess=V.bind(this),this.hasAccess=K.bind(this),this.subscriptionExpiry=G.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return r(this,void 0,void 0,(function*(){let i;try{i=yield a(this,X,"m",Z).call(this,t)}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(!i)throw new Error("Failed to generate upload URL: No upload info returned");try{yield((t,n,i)=>new Promise(((r,a)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{r(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";a(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield a(this,X,"m",Q).call(this,i.key,"failed")}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 a(this,X,"m",Q).call(this,i.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return i}))}mintFile(e,t,n,i,s){return r(this,void 0,void 0,(function*(){let r,o=null;try{o=yield a(this,X,"m",ne).call(this)}catch(e){throw new Error("Failed to mint file IP. Wallet not connected.")}try{if(r=yield this.uploadFile(e,s),!r||!r.key)throw new Error("Failed to upload file or get upload info.")}catch(e){throw new Error(`File upload failed: ${e instanceof Error?e.message:String(e)}`)}e.type&&(t.mimetype=e.type);const d=BigInt(Date.now()+6e5);// 10 minutes from now
145
- let u;try{u=yield this.registerIpNFT("file",d,n,t,r.key,i)}catch(e){throw yield a(this,X,"m",Q).call(this,r.key,"failed"),new Error(`Failed to register IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:p,signerAddress:l,creatorContentHash:y,signature:c,uri:h}=u;if(!(p&&l&&y&&void 0!==c&&h))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");try{const e=yield this.mintWithSignature(o,p,i||[],!0,y,h,n,d,c);if(-1===["0x1","success"].indexOf(e.receipt.status))throw yield a(this,X,"m",Q).call(this,r.key,"failed"),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield a(this,X,"m",Q).call(this,r.key,"failed"),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return p.toString()}))}mintSocial(e,t,n){return r(this,void 0,void 0,(function*(){let i=null;try{i=yield a(this,X,"m",ne).call(this)}catch(e){throw new Error("Failed to mint social IP. Wallet not connected.")}t.mimetype=`social/${e}`;const r=BigInt(Math.floor(Date.now()/1e3)+600);// 10 minutes from now
146
- let s;try{s=yield this.registerIpNFT(e,r,n,t)}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,[],!0,u,l,n,r,p);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()}))}getOriginUploads(){return r(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
135
+ this.buyAccess=L.bind(this),this.hasAccess=q.bind(this),this.subscriptionExpiry=J.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(e,t){return a(this,void 0,void 0,(function*(){let n;try{n=yield r(this,V,"m",K).call(this,e)}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");try{yield((e,t,n)=>new Promise(((a,r)=>{i.put(t,e,Object.assign({headers:{"Content-Type":e.type}},"undefined"!=typeof window&&"function"==typeof n?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;n(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(e,n.url,(null==t?void 0:t.progressCallback)||(()=>{}))}catch(e){try{yield r(this,V,"m",G).call(this,n.key,"failed")}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 r(this,V,"m",G).call(this,n.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return n}))}mintFile(e,t,n,i,s){return a(this,void 0,void 0,(function*(){let a,o=null;try{o=yield r(this,V,"m",Z).call(this)}catch(e){throw new Error("Failed to mint file IP. Wallet not connected.")}try{if(a=yield this.uploadFile(e,s),!a||!a.key)throw new Error("Failed to upload file or get upload info.")}catch(e){throw new Error(`File upload failed: ${e instanceof Error?e.message:String(e)}`)}e.type&&(t.mimetype=e.type);const d=BigInt(Date.now()+6e5);// 10 minutes from now
136
+ let u;this.baseParentId&&(i||(i=[]),i.unshift(this.baseParentId));try{u=yield this.registerIpNFT("file",d,n,t,a.key,i)}catch(e){throw yield r(this,V,"m",G).call(this,a.key,"failed"),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(o,p,i||[],!0,y,m,n,d,c);if(-1===["0x1","success"].indexOf(e.receipt.status))throw yield r(this,V,"m",G).call(this,a.key,"failed"),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield r(this,V,"m",G).call(this,a.key,"failed"),new Error(`Minting transaction failed: ${e instanceof Error?e.message:String(e)}`)}return p.toString()}))}mintSocial(e,t,n){return a(this,void 0,void 0,(function*(){let i=null;try{i=yield r(this,V,"m",Z).call(this)}catch(e){throw new Error("Failed to mint social IP. Wallet not connected.")}t.mimetype=`social/${e}`;const a=BigInt(Math.floor(Date.now()/1e3)+600);// 10 minutes from now
137
+ let s,o=this.baseParentId?[this.baseParentId]:[];try{s=yield this.registerIpNFT(e,a,n,t,void 0,o)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e instanceof Error?e.message:String(e)}`)}const{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:y}=s;if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");try{const e=yield this.mintWithSignature(i,d,o,!0,p,y,n,a,l);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 d.toString()}))}getOriginUploads(){return a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
147
138
  /**
148
139
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
149
140
  * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
150
- */getOriginUsage(){return r(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/usage`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}}).then((e=>e.json()));if(!e.isError&&e.data.user)return e;throw new o(e.message||"Failed to fetch Origin usage")}))}
141
+ */getOriginUsage(){return a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/usage`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}}).then((e=>e.json()));if(!e.isError&&e.data.user)return e;throw new o(e.message||"Failed to fetch Origin usage")}))}
151
142
  /**
152
143
  * Set the user's consent for Origin usage.
153
144
  * @param {boolean} consent The user's consent.
154
145
  * @returns {Promise<void>}
155
146
  * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
156
- */setOriginConsent(e){return r(this,void 0,void 0,(function*(){if(void 0===e)throw new o("Consent is required");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/status`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({active:e})}).then((e=>e.json()));if(t.isError)throw new o(t.message||"Failed to set Origin consent")}))}
147
+ */setOriginConsent(e){return a(this,void 0,void 0,(function*(){if(void 0===e)throw new o("Consent is required");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/status`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"},body:JSON.stringify({active:e})}).then((e=>e.json()));if(t.isError)throw new o(t.message||"Failed to set Origin consent")}))}
157
148
  /**
158
149
  * Call a contract method.
159
150
  * @param {string} contractAddress The contract address.
@@ -163,14 +154,14 @@ let s;try{s=yield this.registerIpNFT(e,r,n,t)}catch(e){throw new Error(`Failed t
163
154
  * @param {CallOptions} [options] The call options.
164
155
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
165
156
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
166
- */callContractMethod(e,n,i,s){return r(this,arguments,void 0,(function*(e,n,i,r,s={}){var o;let d=null;try{d=yield a(this,X,"m",ne).call(this)}catch(e){throw new Error("Failed to call contract method. Wallet not connected.")}const u=t.getAbiItem({abi:n,name:i});if(u&&"stateMutability"in u&&("view"===u.stateMutability||"pure"===u.stateMutability)){const t=x();return(yield t.readContract({address:e,abi:n,functionName:i,args:r}))||null}yield a(this,X,"m",te).call(this,this.environment.CHAIN);const p=x(),{result:l,request:y}=yield p.simulateContract({account:d,address:e,abi:n,functionName:i,args:r,value:s.value});
157
+ */callContractMethod(t,n,i,s){return a(this,arguments,void 0,(function*(t,n,i,a,s={}){var o;let d=null;try{d=yield r(this,V,"m",Z).call(this)}catch(e){throw new Error("Failed to call contract method. Wallet not connected.")}const u=e.getAbiItem({abi:n,name:i});if(u&&"stateMutability"in u&&("view"===u.stateMutability||"pure"===u.stateMutability)){const e=c();return(yield e.readContract({address:t,abi:n,functionName:i,args:a}))||null}yield r(this,V,"m",X).call(this,this.environment.CHAIN);const p=c(),{result:l,request:y}=yield p.simulateContract({account:d,address:t,abi:n,functionName:i,args:a,value:s.value});
167
158
  // simulate
168
- if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?void 0:o.writeContract(y);if("string"!=typeof e)throw new Error("Transaction failed to send.");if(!s.waitForReceipt)return{txHash:e,simulatedResult:l};return{txHash:e,receipt:yield a(this,X,"m",ee).call(this,e),simulatedResult:l}}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}))}
159
+ if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?void 0:o.writeContract(y);if("string"!=typeof e)throw new Error("Transaction failed to send.");if(!s.waitForReceipt)return{txHash:e,simulatedResult:l};return{txHash:e,receipt:yield r(this,V,"m",Y).call(this,e),simulatedResult:l}}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}))}
169
160
  /**
170
161
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
171
162
  * @param {bigint} tokenId The token ID of the asset.
172
163
  * @returns {Promise<any>} The result of the buyAccess call.
173
- */buyAccessSmart(e){return r(this,void 0,void 0,(function*(){let n=null;try{n=yield a(this,X,"m",ne).call(this)}catch(e){throw new Error("Failed to buy access. Wallet not connected.")}const i=yield this.getTerms(e);if(!i)throw new Error("Failed to fetch terms for asset");const{price:s,paymentToken:o,duration:u}=i;if(void 0===s||void 0===o||void 0===u)throw new Error("Terms missing price, paymentToken, or duration");const p=s;return o===t.zeroAddress?this.buyAccess(n,e,p,u,o,p):(yield function(e){return r(this,arguments,void 0,(function*({walletClient:e,publicClient:n,tokenAddress:i,owner:r,spender:a,amount:s}){(yield n.readContract({address:i,abi:t.erc20Abi,functionName:"allowance",args:[r,a]}))<s&&(yield e.writeContract({address:i,account:r,abi:t.erc20Abi,functionName:"approve",args:[a,s],chain:d}))}))}({walletClient:this.viemClient,publicClient:x(),tokenAddress:o,owner:n,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:p}),this.buyAccess(n,e,p,u,o))}))}getData(e){return r(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
164
+ */buyAccessSmart(t){return a(this,void 0,void 0,(function*(){let n=null;try{n=yield r(this,V,"m",Z).call(this)}catch(e){throw new Error("Failed to buy access. Wallet not connected.")}const i=yield this.getTerms(t);if(!i)throw new Error("Failed to fetch terms for asset");const{price:s,paymentToken:o,duration:u}=i;if(void 0===s||void 0===o||void 0===u)throw new Error("Terms missing price, paymentToken, or duration");const p=s;return o===e.zeroAddress?this.buyAccess(n,t,p,u,o,p):(yield function(t){return a(this,arguments,void 0,(function*({walletClient:t,publicClient:n,tokenAddress:i,owner:a,spender:r,amount:s}){(yield n.readContract({address:i,abi:e.erc20Abi,functionName:"allowance",args:[a,r]}))<s&&(yield t.writeContract({address:i,account:a,abi:e.erc20Abi,functionName:"approve",args:[r,s],chain:d}))}))}({walletClient:this.viemClient,publicClient:c(),tokenAddress:o,owner:n,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:p}),this.buyAccess(n,t,p,u,o))}))}getData(e){return a(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
174
165
  /**
175
166
  * Get the Token Bound Account (TBA) address for a specific token ID.
176
167
  * @param {bigint} tokenId - The token ID to get the TBA address for.
@@ -181,7 +172,7 @@ if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?
181
172
  * const tbaAddress = await origin.getTokenBoundAccount(1n);
182
173
  * console.log(`TBA Address: ${tbaAddress}`);
183
174
  * ```
184
- */getTokenBoundAccount(e){return r(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)}`)}}))}
175
+ */getTokenBoundAccount(e){return a(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)}`)}}))}
185
176
  /**
186
177
  * Get royalty information for a token ID, including the token bound account address and its balance.
187
178
  * @param {bigint} tokenId - The token ID to check royalties for.
@@ -196,9 +187,9 @@ if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?
196
187
  * // Get ERC20 token royalties for a specific token
197
188
  * const royalties = await origin.getRoyalties(1n, "0x1234...");
198
189
  * ```
199
- */getRoyalties(e,n){return r(this,void 0,void 0,(function*(){try{const i=yield this.getTokenBoundAccount(e),r=x();let a,s;if(n&&n!==t.zeroAddress){
190
+ */getRoyalties(t,n){return a(this,void 0,void 0,(function*(){try{const i=yield this.getTokenBoundAccount(t),a=c();let r,s;if(n&&n!==e.zeroAddress){
200
191
  // erc20 (wrapped camp)
201
- 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(n,e,"balanceOf",[i]);const r=yield this.callContractMethod(n,e,"decimals",[]);s=t.formatUnits(a,r)}else a=yield r.getBalance({address:i}),s=t.formatEther(a);return{tokenBoundAccount:i,balance:a,balanceFormatted:s}}catch(t){throw new Error(`Failed to retrieve royalties for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
192
+ const t=[{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"}];r=yield this.callContractMethod(n,t,"balanceOf",[i]);const a=yield this.callContractMethod(n,t,"decimals",[]);s=e.formatUnits(r,a)}else r=yield a.getBalance({address:i}),s=e.formatEther(r);return{tokenBoundAccount:i,balance:r,balanceFormatted:s}}catch(e){throw new Error(`Failed to retrieve royalties for token ${t}: ${e instanceof Error?e.message:String(e)}`)}}))}
202
193
  /**
203
194
  * Claim royalties from a token's Token Bound Account (TBA).
204
195
  * @param {bigint} tokenId - The token ID to claim royalties from.
@@ -214,34 +205,34 @@ const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
214
205
  * // Claim ERC20 token royalties to a specific address
215
206
  * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
216
207
  * ```
217
- */claimRoyalties(e,n,i){return r(this,void 0,void 0,(function*(){const r=yield a(this,X,"m",ie).call(this,n),s=yield this.getTokenBoundAccount(e),o=(yield this.getRoyalties(e,i)).balance;if(o===BigInt(0))throw new Error("No royalties available to claim");let d,u,p;
208
+ */claimRoyalties(t,n,i){return a(this,void 0,void 0,(function*(){const a=yield r(this,V,"m",Q).call(this,n),s=yield this.getTokenBoundAccount(t),o=(yield this.getRoyalties(t,i)).balance;if(o===BigInt(0))throw new Error("No royalties available to claim");let d,u,p;
218
209
  // Call execute on the TBA
219
- return i&&i!==t.zeroAddress?(
210
+ return i&&i!==e.zeroAddress?(
220
211
  // ERC20 token transfer
221
212
  d=i,u=BigInt(0),
222
213
  // Encode ERC20 transfer call: transfer(address to, uint256 amount)
223
- p=t.encodeFunctionData({abi:[{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],functionName:"transfer",args:[r,o]})):(
214
+ p=e.encodeFunctionData({abi:[{inputs:[{name:"to",type:"address"},{name:"amount",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"}],functionName:"transfer",args:[a,o]})):(
224
215
  // Native token transfer
225
- d=r,u=o,p="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[d,u,p,0],// operation: 0 = CALL
226
- {waitForReceipt:!0,value:BigInt(0)})}))}}X=new WeakSet,Z=function(e){return r(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},Q=function(e,t){return r(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},ee=function(e){return r(this,arguments,void 0,(function*(e,t={}){var n,i,r;const a=x();let s=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(r=t.pollingIntervalMs)&&void 0!==r?r:1500;try{return yield a.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
216
+ d=a,u=o,p="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[d,u,p,0],// operation: 0 = CALL
217
+ {waitForReceipt:!0,value:BigInt(0)})}))}}V=new WeakSet,K=function(e){return a(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},G=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},Y=function(e){return a(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=c();let s=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 r.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
227
218
  // fallback
228
- const t=Date.now();for(;Date.now()-t<d;){try{const e=yield a.getTransactionReceipt({hash:s});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,u)))}throw e}}))},te=function(e){return r(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected. Could not ensure chain ID.");let t=yield this.viemClient.request({method:"eth_chainId",params:[]});if("string"==typeof t&&(t=parseInt(t,16)),t!==e.id){(e=>{k=e,_=null})// reset public client to be recreated with new chain
219
+ const t=Date.now();for(;Date.now()-t<d;){try{const e=yield r.getTransactionReceipt({hash:s});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,u)))}throw e}}))},X=function(e){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected. Could not ensure chain ID.");let t=yield this.viemClient.request({method:"eth_chainId",params:[]});if("string"==typeof t&&(t=parseInt(t,16)),t!==e.id){(e=>{y=e,l=null})// reset public client to be recreated with new chain
229
220
  (e);try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
230
221
  // Unrecognized chain
231
- 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)}]})}}}))},ne=function(){return r(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected. Please connect a wallet.");
222
+ 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)}]})}}}))},Z=function(){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected. Please connect a wallet.");
232
223
  // If account is already set on the client, return it directly
233
224
  if(this.viemClient.account)return this.viemClient.account.address;
234
225
  // Otherwise request accounts (browser wallet flow)
235
- const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}))},ie=function(e){return r(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new Error("No wallet address provided and no wallet client connected. Please provide an owner address or connect a wallet.");try{const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}catch(e){throw new Error(`Failed to get wallet address: ${e instanceof Error?e.message:String(e)}`)}}))};
226
+ const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}))},Q=function(e){return a(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new Error("No wallet address provided and no wallet client connected. Please provide an owner address or connect a wallet.");try{const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}catch(e){throw new Error(`Failed to get wallet address: ${e instanceof Error?e.message:String(e)}`)}}))};
236
227
  /**
237
228
  * Adapter for viem WalletClient
238
229
  */
239
- class fe{constructor(e){this.type="viem",this.signer=e}getAddress(){return r(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 r(this,void 0,void 0,(function*(){const t=yield this.getAddress();return yield this.signer.signMessage({account:t,message:e})}))}getChainId(){return r(this,void 0,void 0,(function*(){var e;return(null===(e=this.signer.chain)||void 0===e?void 0:e.id)||1}))}}
230
+ class ye{constructor(e){this.type="viem",this.signer=e}getAddress(){return a(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 a(this,void 0,void 0,(function*(){const t=yield this.getAddress();return yield this.signer.signMessage({account:t,message:e})}))}getChainId(){return a(this,void 0,void 0,(function*(){var e;return(null===(e=this.signer.chain)||void 0===e?void 0:e.id)||1}))}}
240
231
  /**
241
232
  * Adapter for ethers Signer (v5 and v6)
242
- */class Te{constructor(e){this.type="ethers",this.signer=e}getAddress(){return r(this,void 0,void 0,(function*(){
233
+ */class ce{constructor(e){this.type="ethers",this.signer=e}getAddress(){return a(this,void 0,void 0,(function*(){
243
234
  // Works for both ethers v5 and v6
244
- 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 r(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)}))}getChainId(){return r(this,void 0,void 0,(function*(){
235
+ 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 a(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)}))}getChainId(){return a(this,void 0,void 0,(function*(){
245
236
  // Try ethers v6 first
246
237
  if(this.signer.provider&&"function"==typeof this.signer.provider.getNetwork){const e=yield this.signer.provider.getNetwork();
247
238
  // ethers v6 returns bigint, v5 returns number
@@ -252,22 +243,22 @@ return"function"==typeof this.signer.getChainId?yield this.signer.getChainId():4
252
243
  }))}}
253
244
  /**
254
245
  * Adapter for custom signer implementations
255
- */class ve{constructor(e){this.type="custom",this.signer=e}getAddress(){return r(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 r(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)}))}getChainId(){return r(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;
246
+ */class me{constructor(e){this.type="custom",this.signer=e}getAddress(){return a(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 a(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)}))}getChainId(){return a(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;
256
247
  // Default to mainnet
257
248
  }))}}
258
249
  /**
259
250
  * Factory function to create appropriate adapter based on signer type
260
- */function we(e){
251
+ */function he(e){
261
252
  // Check for viem WalletClient
262
- return e.transport&&e.chain&&"function"==typeof e.signMessage?new fe(e):
253
+ return e.transport&&e.chain&&"function"==typeof e.signMessage?new ye(e):
263
254
  // Check for ethers signer (v5 or v6)
264
- e._isSigner||e.provider&&"function"==typeof e.signMessage?new Te(e):new ve(e)}
255
+ e._isSigner||e.provider&&"function"==typeof e.signMessage?new ce(e):new me(e)}
265
256
  /**
266
257
  * Browser localStorage adapter
267
- */class Ae{getItem(e){return r(this,void 0,void 0,(function*(){return"undefined"==typeof localStorage?null:localStorage.getItem(e)}))}setItem(e,t){return r(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}))}removeItem(e){return r(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.removeItem(e)}))}}
258
+ */class Te{getItem(e){return a(this,void 0,void 0,(function*(){return"undefined"==typeof localStorage?null:localStorage.getItem(e)}))}setItem(e,t){return a(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.setItem(e,t)}))}removeItem(e){return a(this,void 0,void 0,(function*(){"undefined"!=typeof localStorage&&localStorage.removeItem(e)}))}}
268
259
  /**
269
260
  * In-memory storage adapter for Node.js
270
- */class ge{constructor(){this.storage=new Map}getItem(e){return r(this,void 0,void 0,(function*(){return this.storage.get(e)||null}))}setItem(e,t){return r(this,void 0,void 0,(function*(){this.storage.set(e,t)}))}removeItem(e){return r(this,void 0,void 0,(function*(){this.storage.delete(e)}))}clear(){this.storage.clear()}}ae=new WeakMap,se=new WeakMap,oe=new WeakMap,de=new WeakMap,re=new WeakSet,ue=function(e,t){a(this,ae,"f")[e]&&a(this,ae,"f")[e].forEach((e=>e(t)))},pe=function(e){return r(this,void 0,void 0,(function*(){const t=yield a(this,de,"f").getItem("camp-sdk:wallet-address"),n=yield a(this,de,"f").getItem("camp-sdk:user-id"),i=yield a(this,de,"f").getItem("camp-sdk:jwt"),r=yield a(this,de,"f").getItem("camp-sdk:environment");t&&n&&i&&(r===this.environment.NAME||!r)?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new me(this.jwt,this.environment),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):a(this,se,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},le=function(){return r(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=t.checksumAddress(e),this.walletAddress}catch(e){throw new o(e)}}))},ye=function(){return r(this,void 0,void 0,(function*(){try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ce=function(e,t){return r(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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(),r=i.data.split(".")[1],a=JSON.parse(atob(r));return{success:!i.isError,userId:a.id,token:i.data}}catch(e){throw new o(e)}}))},he=function(e,t,n){return i.createSiweMessage({domain:t||(a(this,se,"f")?"localhost":window.location.host),address:this.walletAddress,statement:h,uri:n||(a(this,se,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})},exports.Auth=
261
+ */class fe{constructor(){this.storage=new Map}getItem(e){return a(this,void 0,void 0,(function*(){return this.storage.get(e)||null}))}setItem(e,t){return a(this,void 0,void 0,(function*(){this.storage.set(e,t)}))}removeItem(e){return a(this,void 0,void 0,(function*(){this.storage.delete(e)}))}clear(){this.storage.clear()}}te=new WeakMap,ne=new WeakMap,ie=new WeakMap,ae=new WeakMap,ee=new WeakSet,re=function(e,t){r(this,te,"f")[e]&&r(this,te,"f")[e].forEach((e=>e(t)))},se=function(e){return a(this,void 0,void 0,(function*(){const t=yield r(this,ae,"f").getItem("camp-sdk:wallet-address"),n=yield r(this,ae,"f").getItem("camp-sdk:user-id"),i=yield r(this,ae,"f").getItem("camp-sdk:jwt"),a=yield r(this,ae,"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 le(this.jwt,this.environment,this.viem,this.baseParentId),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):r(this,ne,"f")||(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},oe=function(){return a(this,void 0,void 0,(function*(){try{const[t]=yield this.viem.requestAddresses();return this.walletAddress=e.checksumAddress(t),this.walletAddress}catch(e){throw new o(e)}}))},de=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ue=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new o(e)}}))},pe=function(e,t,i){return n.createSiweMessage({domain:t||(r(this,ne,"f")?"localhost":window.location.host),address:this.walletAddress,statement:v,uri:i||(r(this,ne,"f")?"http://localhost":window.location.origin),version:"1",chainId:this.environment.CHAIN.id,nonce:e})},exports.Auth=
271
262
  /**
272
263
  * The Auth class.
273
264
  * @class
@@ -283,9 +274,9 @@ class{
283
274
  * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
284
275
  * @throws {APIError} - Throws an error if the clientId is not provided.
285
276
  */
286
- constructor({clientId:e,redirectUri:t,environment:n="DEVELOPMENT",storage:i}){if(re.add(this),ae.set(this,void 0),se.set(this,void 0),oe.set(this,void 0),de.set(this,void 0),!e)throw new Error("clientId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(n))throw new Error("Invalid environment, must be DEVELOPMENT or PRODUCTION");s(this,se,"undefined"==typeof window,"f"),s(this,de,i||(a(this,se,"f")?new ge:new Ae),"f"),this.viem=null,this.environment=A[n],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)),{})})(t),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,s(this,ae,{},"f"),
277
+ constructor({clientId:e,redirectUri:t,environment:n="DEVELOPMENT",baseParentId:i,storage:a}){if(ee.add(this),te.set(this,void 0),ne.set(this,void 0),ie.set(this,void 0),ae.set(this,void 0),!e)throw new Error("clientId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(n))throw new Error("Invalid environment, must be DEVELOPMENT or PRODUCTION");s(this,ne,"undefined"==typeof window,"f"),s(this,ae,a||(r(this,ne,"f")?new fe:new Te),"f"),this.viem=null,this.environment=E[n],this.baseParentId=i,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)),{})})(t),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,s(this,te,{},"f"),
287
278
  // only subscribe to providers in browser environment
288
- a(this,se,"f")||P((e=>{a(this,re,"m",ue).call(this,"providers",e)})),a(this,re,"m",pe).call(this)}
279
+ r(this,ne,"f")||x((e=>{r(this,ee,"m",re).call(this,"providers",e)})),r(this,ee,"m",se).call(this)}
289
280
  /**
290
281
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
291
282
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
@@ -295,26 +286,26 @@ a(this,se,"f")||P((e=>{a(this,re,"m",ue).call(this,"providers",e)})),a(this,re,"
295
286
  * auth.on("state", (state) => {
296
287
  * console.log(state);
297
288
  * });
298
- */on(e,t){a(this,ae,"f")[e]||(a(this,ae,"f")[e]=[]),a(this,ae,"f")[e].push(t),"providers"===e&&t(S())}
289
+ */on(e,t){r(this,te,"f")[e]||(r(this,te,"f")[e]=[]),r(this,te,"f")[e].push(t),"providers"===e&&t(_())}
299
290
  /**
300
291
  * Unsubscribe from an event. Possible events are "state", "provider", "providers", and "viem".
301
292
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
302
293
  * @param {function} callback The callback function.
303
294
  * @returns {void}
304
- */off(e,t){a(this,ae,"f")[e]&&(a(this,ae,"f")[e]=a(this,ae,"f")[e].filter((e=>e!==t)))}
295
+ */off(e,t){r(this,te,"f")[e]&&(r(this,te,"f")[e]=r(this,te,"f")[e].filter((e=>e!==t)))}
305
296
  /**
306
297
  * Set the loading state.
307
298
  * @param {boolean} loading The loading state.
308
299
  * @returns {void}
309
- */setLoading(e){a(this,re,"m",ue).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
300
+ */setLoading(e){r(this,ee,"m",re).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
310
301
  /**
311
302
  * 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.
312
303
  * @param {object} options The options object. Includes the provider and the provider info.
313
304
  * @returns {void}
314
305
  * @throws {APIError} - Throws an error if the provider is not provided.
315
- */setProvider({provider:e,info:i,address:r}){if(!e)throw new o("provider is required");this.viem=((e,i="window.ethereum",r,a)=>{var s,o;if(!e&&!C)return console.warn("Provider is required to create a client."),null;const u=r||d;if(!C||C.transport.name!==i&&e||a!==(null===(s=C.account)||void 0===s?void 0:s.address)&&e||(null==k?void 0:k.id)!==u.id){const r={chain:u,transport:t.custom(e,{name:i})};a&&(r.account=n.toAccount(a)),C=t.createWalletClient(r),k=u,_&&(null===(o=_.chain)||void 0===o?void 0:o.id)!==u.id&&(_=null)}return C})(e,i.name,this.environment.CHAIN,r),this.origin&&this.origin.setViemClient(this.viem),
306
+ */setProvider({provider:n,info:i,address:a}){if(!n)throw new o("provider is required");this.viem=((n,i="window.ethereum",a,r)=>{var s,o;if(!n&&!p)return console.warn("Provider is required to create a client."),null;const u=a||d;if(!p||p.transport.name!==i&&n||r!==(null===(s=p.account)||void 0===s?void 0:s.address)&&n||(null==y?void 0:y.id)!==u.id){const a={chain:u,transport:e.custom(n,{name:i})};r&&(a.account=t.toAccount(r)),p=e.createWalletClient(a),y=u,l&&(null===(o=l.chain)||void 0===o?void 0:o.id)!==u.id&&(l=null)}return p})(n,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
316
307
  // TODO: only use one of these
317
- a(this,re,"m",ue).call(this,"viem",this.viem),a(this,re,"m",ue).call(this,"provider",{provider:e,info:i}),a(this,de,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
308
+ r(this,ee,"m",re).call(this,"viem",this.viem),r(this,ee,"m",re).call(this,"provider",{provider:n,info:i}),r(this,ae,"f").setItem("camp-sdk:provider",JSON.stringify(i))}
318
309
  /**
319
310
  * 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.
320
311
  * @param {string} walletAddress The wallet address.
@@ -323,29 +314,29 @@ a(this,re,"m",ue).call(this,"viem",this.viem),a(this,re,"m",ue).call(this,"provi
323
314
  /**
324
315
  * Recover the provider from local storage.
325
316
  * @returns {Promise<void>}
326
- */recoverProvider(){return r(this,void 0,void 0,(function*(){var e,t,n,i,r,s,o,d,u,p,l,y,c;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const h=yield a(this,de,"f").getItem("camp-sdk:provider");if(!h)return;const m=JSON.parse(h);let f;const T=null!==(e=S())&&void 0!==e?e:[];
317
+ */recoverProvider(){return a(this,void 0,void 0,(function*(){var e,t,n,i,a,s,o,d,u,p,l,y,c;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const m=yield r(this,ae,"f").getItem("camp-sdk:provider");if(!m)return;const h=JSON.parse(m);let T;const f=null!==(e=_())&&void 0!==e?e:[];
327
318
  // first pass: try to find provider by UUID/name and check if it has the right address
328
319
  // without prompting (using eth_accounts)
329
- 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){
320
+ for(const e of f)try{if(h.uuid&&(null===(t=e.info)||void 0===t?void 0:t.uuid)===h.uuid||h.name&&(null===(n=e.info)||void 0===n?void 0:n.name)===h.name){
330
321
  // silently check if the wallet address matches first
331
- 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===(r=this.walletAddress)||void 0===r?void 0:r.toLowerCase())){f=e;break}}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
322
+ 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)}
332
323
  // second pass: if no provider found by UUID/name match, try to find by address only
333
324
  // but still avoid prompting
334
- if(!f)for(const e of T)try{
325
+ if(!T)for(const e of f)try{
335
326
  // skip providers we already checked in the first pass
336
- if(m.uuid&&(null===(s=e.info)||void 0===s?void 0:s.uuid)===m.uuid||m.name&&(null===(o=e.info)||void 0===o?void 0:o.name)===m.name)continue;const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(d=t[0])||void 0===d?void 0:d.toLowerCase())===(null===(u=this.walletAddress)||void 0===u?void 0:u.toLowerCase())){f=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
327
+ if(h.uuid&&(null===(s=e.info)||void 0===s?void 0:s.uuid)===h.uuid||h.name&&(null===(o=e.info)||void 0===o?void 0:o.name)===h.name)continue;const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(d=t[0])||void 0===d?void 0:d.toLowerCase())===(null===(u=this.walletAddress)||void 0===u?void 0:u.toLowerCase())){T=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
337
328
  // third pass: if still no provider found and we have UUID/name info,
338
329
  // try prompting the user (only for the stored provider)
339
- if(!f&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(p=e.info)||void 0===p?void 0:p.uuid)===m.uuid||m.name&&(null===(l=e.info)||void 0===l?void 0:l.name)===m.name){const t=yield e.provider.request({method:"eth_requestAccounts"});if(t.length>0&&(null===(y=t[0])||void 0===y?void 0:y.toLowerCase())===(null===(c=this.walletAddress)||void 0===c?void 0:c.toLowerCase())){f=e;break}}}catch(e){console.warn("Failed to reconnect to stored provider:",e)}f?this.setProvider({provider:f.provider,info:f.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
330
+ if(!T&&(h.uuid||h.name))for(const e of f)try{if(h.uuid&&(null===(p=e.info)||void 0===p?void 0:p.uuid)===h.uuid||h.name&&(null===(l=e.info)||void 0===l?void 0:l.name)===h.name){const t=yield e.provider.request({method:"eth_requestAccounts"});if(t.length>0&&(null===(y=t[0])||void 0===y?void 0:y.toLowerCase())===(null===(c=this.walletAddress)||void 0===c?void 0:c.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.")}))}
340
331
  /**
341
332
  * Disconnect the user.
342
333
  * @returns {Promise<void>}
343
- */disconnect(){return r(this,void 0,void 0,(function*(){this.isAuthenticated&&(a(this,re,"m",ue).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,s(this,oe,void 0,"f"),yield a(this,de,"f").removeItem("camp-sdk:wallet-address"),yield a(this,de,"f").removeItem("camp-sdk:user-id"),yield a(this,de,"f").removeItem("camp-sdk:jwt"),yield a(this,de,"f").removeItem("camp-sdk:environment"))}))}
334
+ */disconnect(){return a(this,void 0,void 0,(function*(){this.isAuthenticated&&(r(this,ee,"m",re).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,s(this,ie,void 0,"f"),yield r(this,ae,"f").removeItem("camp-sdk:wallet-address"),yield r(this,ae,"f").removeItem("camp-sdk:user-id"),yield r(this,ae,"f").removeItem("camp-sdk:jwt"),yield r(this,ae,"f").removeItem("camp-sdk:environment"))}))}
344
335
  /**
345
336
  * Connect the user's wallet and sign the message.
346
337
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
347
338
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
348
- */connect(){return r(this,void 0,void 0,(function*(){a(this,re,"m",ue).call(this,"state","loading");try{this.walletAddress||(yield a(this,re,"m",le).call(this)),this.walletAddress=t.checksumAddress(this.walletAddress);const e=yield a(this,re,"m",ye).call(this),n=a(this,re,"m",he).call(this,e),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),r=yield a(this,re,"m",ce).call(this,n,i);if(r.success)return this.isAuthenticated=!0,this.userId=r.userId,this.jwt=r.token,this.origin=new me(this.jwt,this.environment,this.viem),yield a(this,de,"f").setItem("camp-sdk:jwt",this.jwt),yield a(this,de,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield a(this,de,"f").setItem("camp-sdk:user-id",this.userId),yield a(this,de,"f").setItem("camp-sdk:environment",this.environment.NAME),a(this,re,"m",ue).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,a(this,re,"m",ue).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,a(this,re,"m",ue).call(this,"state","unauthenticated"),new o(e)}}))}
339
+ */connect(){return a(this,void 0,void 0,(function*(){r(this,ee,"m",re).call(this,"state","loading");try{this.walletAddress||(yield r(this,ee,"m",oe).call(this)),this.walletAddress=e.checksumAddress(this.walletAddress);const t=yield r(this,ee,"m",de).call(this),n=r(this,ee,"m",pe).call(this,t),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),a=yield r(this,ee,"m",ue).call(this,n,i);if(a.success)return this.isAuthenticated=!0,this.userId=a.userId,this.jwt=a.token,this.origin=new le(this.jwt,this.environment,this.viem,this.baseParentId),yield r(this,ae,"f").setItem("camp-sdk:jwt",this.jwt),yield r(this,ae,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield r(this,ae,"f").setItem("camp-sdk:user-id",this.userId),yield r(this,ae,"f").setItem("camp-sdk:environment",this.environment.NAME),r(this,ee,"m",re).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,ee,"m",re).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,ee,"m",re).call(this,"state","unauthenticated"),new o(e)}}))}
349
340
  /**
350
341
  * Connect with a custom signer (for Node.js or custom wallet implementations).
351
342
  * This method bypasses browser wallet interactions and uses the provided signer directly.
@@ -364,9 +355,9 @@ if(!f&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(p=e.info)||void
364
355
  * const account = privateKeyToAccount('0x...');
365
356
  * const client = createWalletClient({ account, chain: mainnet, transport: http() });
366
357
  * await auth.connectWithSigner(client);
367
- */connectWithSigner(e,n){return r(this,void 0,void 0,(function*(){a(this,re,"m",ue).call(this,"state","loading");try{s(this,oe,we(e),"f"),this.walletAddress=t.checksumAddress(yield a(this,oe,"f").getAddress()),
358
+ */connectWithSigner(t,n){return a(this,void 0,void 0,(function*(){r(this,ee,"m",re).call(this,"state","loading");try{s(this,ie,he(t),"f"),this.walletAddress=e.checksumAddress(yield r(this,ie,"f").getAddress()),
368
359
  // store the signer as viem client if it's a viem client, otherwise keep adapter
369
- "viem"===a(this,oe,"f").type&&(this.viem=e);const i=yield a(this,re,"m",ye).call(this),r=a(this,re,"m",he).call(this,i,null==n?void 0:n.domain,null==n?void 0:n.uri),d=yield a(this,oe,"f").signMessage(r),u=yield a(this,re,"m",ce).call(this,r,d);if(u.success)return this.isAuthenticated=!0,this.userId=u.userId,this.jwt=u.token,this.origin=new me(this.jwt,this.environment,this.viem),yield a(this,de,"f").setItem("camp-sdk:jwt",this.jwt),yield a(this,de,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield a(this,de,"f").setItem("camp-sdk:user-id",this.userId),yield a(this,de,"f").setItem("camp-sdk:environment",this.environment.NAME),a(this,re,"m",ue).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,a(this,re,"m",ue).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,s(this,oe,void 0,"f"),a(this,re,"m",ue).call(this,"state","unauthenticated"),new o(e)}}))}
360
+ "viem"===r(this,ie,"f").type&&(this.viem=t);const i=yield r(this,ee,"m",de).call(this),a=r(this,ee,"m",pe).call(this,i,null==n?void 0:n.domain,null==n?void 0:n.uri),d=yield r(this,ie,"f").signMessage(a),u=yield r(this,ee,"m",ue).call(this,a,d);if(u.success)return this.isAuthenticated=!0,this.userId=u.userId,this.jwt=u.token,this.origin=new le(this.jwt,this.environment,this.viem,this.baseParentId),yield r(this,ae,"f").setItem("camp-sdk:jwt",this.jwt),yield r(this,ae,"f").setItem("camp-sdk:wallet-address",this.walletAddress),yield r(this,ae,"f").setItem("camp-sdk:user-id",this.userId),yield r(this,ae,"f").setItem("camp-sdk:environment",this.environment.NAME),r(this,ee,"m",re).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,ee,"m",re).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,s(this,ie,void 0,"f"),r(this,ee,"m",re).call(this,"state","unauthenticated"),new o(e)}}))}
370
361
  /**
371
362
  * Get the user's linked social accounts.
372
363
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
@@ -375,34 +366,34 @@ if(!f&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(p=e.info)||void
375
366
  * const auth = new Auth({ clientId: "your-client-id" });
376
367
  * const socials = await auth.getLinkedSocials();
377
368
  * console.log(socials);
378
- */getLinkedSocials(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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 o(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}}))}
369
+ */getLinkedSocials(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/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 o(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}}))}
379
370
  /**
380
371
  * Link the user's Twitter account.
381
372
  * @returns {Promise<void>}
382
373
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
383
- */linkTwitter(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(a(this,se,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
374
+ */linkTwitter(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(r(this,ne,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
384
375
  /**
385
376
  * Link the user's Discord account.
386
377
  * @returns {Promise<void>}
387
378
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
388
- */linkDiscord(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(a(this,se,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
379
+ */linkDiscord(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(r(this,ne,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
389
380
  /**
390
381
  * Link the user's Spotify account.
391
382
  * @returns {Promise<void>}
392
383
  * @throws {Error} - Throws an error if the user is not authenticated or in Node.js environment.
393
- */linkSpotify(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(a(this,se,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
384
+ */linkSpotify(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(r(this,ne,"f"))throw new Error("Social linking requires browser environment for OAuth flow");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
394
385
  /**
395
386
  * Link the user's TikTok account.
396
387
  * @param {string} handle The user's TikTok handle.
397
388
  * @returns {Promise<any>} A promise that resolves with the TikTok account data.
398
389
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
399
- */linkTikTok(e){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");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 o("TikTok service is currently unavailable, try again later"):new o(t.message||"Failed to link TikTok account");return t.data}))}
390
+ */linkTikTok(e){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");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 o("TikTok service is currently unavailable, try again later"):new o(t.message||"Failed to link TikTok account");return t.data}))}
400
391
  /**
401
392
  * Send an OTP to the user's Telegram account.
402
393
  * @param {string} phoneNumber The user's phone number.
403
394
  * @returns {Promise<any>} A promise that resolves with the OTP data.
404
395
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
405
- */sendTelegramOTP(e){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e)throw new o("Phone number is required");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 o(t.message||"Failed to send Telegram OTP");return t.data}))}
396
+ */sendTelegramOTP(e){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e)throw new o("Phone number is required");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 o(t.message||"Failed to send Telegram OTP");return t.data}))}
406
397
  /**
407
398
  * Link the user's Telegram account.
408
399
  * @param {string} phoneNumber The user's phone number.
@@ -410,202 +401,37 @@ if(!f&&(m.uuid||m.name))for(const e of T)try{if(m.uuid&&(null===(p=e.info)||void
410
401
  * @param {string} phoneCodeHash The phone code hash.
411
402
  * @returns {Promise<object>} A promise that resolves with the Telegram account data.
412
403
  * @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.
413
- */linkTelegram(e,t,n){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new o("Phone number, OTP, and phone code hash are required");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 o(i.message||"Failed to link Telegram account");return i.data}))}
404
+ */linkTelegram(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new o("Phone number, OTP, and phone code hash are required");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 o(i.message||"Failed to link Telegram account");return i.data}))}
414
405
  /**
415
406
  * Unlink the user's Twitter account.
416
407
  * @returns {Promise<any>} A promise that resolves with the unlink result.
417
408
  * @throws {Error} - Throws an error if the user is not authenticated.
418
409
  * @throws {APIError} - Throws an error if the request fails.
419
- */unlinkTwitter(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");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 o(e.message||"Failed to unlink Twitter account");return e.data}))}
410
+ */unlinkTwitter(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");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 o(e.message||"Failed to unlink Twitter account");return e.data}))}
420
411
  /**
421
412
  * Unlink the user's Discord account.
422
413
  * @returns {Promise<any>} A promise that resolves with the unlink result.
423
414
  * @throws {Error} - Throws an error if the user is not authenticated.
424
415
  * @throws {APIError} - Throws an error if the request fails.
425
- */unlinkDiscord(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Discord account");return e.data}))}
416
+ */unlinkDiscord(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Discord account");return e.data}))}
426
417
  /**
427
418
  * Unlink the user's Spotify account.
428
419
  * @returns {Promise<any>} A promise that resolves with the unlink result.
429
420
  * @throws {Error} - Throws an error if the user is not authenticated.
430
421
  * @throws {APIError} - Throws an error if the request fails.
431
- */unlinkSpotify(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Spotify account");return e.data}))}
422
+ */unlinkSpotify(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Spotify account");return e.data}))}
432
423
  /**
433
424
  * Unlink the user's TikTok account.
434
425
  * @returns {Promise<any>} A promise that resolves with the unlink result.
435
426
  * @throws {Error} - Throws an error if the user is not authenticated.
436
427
  * @throws {APIError} - Throws an error if the request fails.
437
- */unlinkTikTok(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink TikTok account");return e.data}))}
428
+ */unlinkTikTok(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink TikTok account");return e.data}))}
438
429
  /**
439
430
  * Unlink the user's Telegram account.
440
431
  * @returns {Promise<any>} A promise that resolves with the unlink result.
441
432
  * @throws {Error} - Throws an error if the user is not authenticated.
442
433
  * @throws {APIError} - Throws an error if the request fails.
443
- */unlinkTelegram(){return r(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Telegram account");return e.data}))}},exports.BrowserStorage=Ae,exports.CustomSignerAdapter=ve,exports.EthersSignerAdapter=Te,exports.MemoryStorage=ge,exports.SpotifyAPI=
444
- /**
445
- * The SpotifyAPI class.
446
- * @class
447
- */
448
- class{
449
- /**
450
- * Constructor for the SpotifyAPI class.
451
- * @constructor
452
- * @param {SpotifyAPIOptions} options - The Spotify API options.
453
- * @param {string} options.apiKey - The Spotify API key.
454
- * @throws {Error} - Throws an error if the API key is not provided.
455
- */
456
- constructor(e){this.apiKey=e.apiKey}
457
- /**
458
- * Fetch the user's saved tracks by Spotify user ID.
459
- * @param {string} spotifyId - The user's Spotify ID.
460
- * @returns {Promise<object>} - The saved tracks.
461
- * @throws {APIError} - Throws an error if the request fails.
462
- */fetchSavedTracksById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
463
- /**
464
- * Fetch the played tracks of a user by Spotify ID.
465
- * @param {string} spotifyId - The user's Spotify ID.
466
- * @returns {Promise<object>} - The played tracks.
467
- * @throws {APIError} - Throws an error if the request fails.
468
- */fetchPlayedTracksById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
469
- /**
470
- * Fetch the user's saved albums by Spotify user ID.
471
- * @param {string} spotifyId - The user's Spotify ID.
472
- * @returns {Promise<object>} - The saved albums.
473
- * @throws {APIError} - Throws an error if the request fails.
474
- */fetchSavedAlbumsById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
475
- /**
476
- * Fetch the user's saved playlists by Spotify user ID.
477
- * @param {string} spotifyId - The user's Spotify ID.
478
- * @returns {Promise<object>} - The saved playlists.
479
- * @throws {APIError} - Throws an error if the request fails.
480
- */fetchSavedPlaylistsById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
481
- /**
482
- * Fetch the tracks of an album by album ID.
483
- * @param {string} spotifyId - The Spotify ID of the user.
484
- * @param {string} albumId - The album ID.
485
- * @returns {Promise<object>} - The tracks in the album.
486
- * @throws {APIError} - Throws an error if the request fails.
487
- */fetchTracksInAlbum(e,t){return r(this,void 0,void 0,(function*(){const n=I(`${E}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
488
- /**
489
- * Fetch the tracks in a playlist by playlist ID.
490
- * @param {string} spotifyId - The Spotify ID of the user.
491
- * @param {string} playlistId - The playlist ID.
492
- * @returns {Promise<object>} - The tracks in the playlist.
493
- * @throws {APIError} - Throws an error if the request fails.
494
- */fetchTracksInPlaylist(e,t){return r(this,void 0,void 0,(function*(){const n=I(`${E}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
495
- /**
496
- * Fetch the user's Spotify data by wallet address.
497
- * @param {string} walletAddress - The wallet address.
498
- * @returns {Promise<object>} - The user's Spotify data.
499
- * @throws {APIError} - Throws an error if the request fails.
500
- */fetchUserByWalletAddress(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
501
- /**
502
- * Private method to fetch data with authorization header.
503
- * @param {string} url - The URL to fetch.
504
- * @returns {Promise<object>} - The response data.
505
- * @throws {APIError} - Throws an error if the request fails.
506
- */_fetchDataWithAuth(e){return r(this,void 0,void 0,(function*(){if(!this.apiKey)throw new o("API key is required for fetching data",401);try{return yield g(e,{"x-api-key":this.apiKey})}catch(e){throw new o(e.message,e.statusCode)}}))}},exports.TwitterAPI=
507
- /**
508
- * The TwitterAPI class.
509
- * @class
510
- * @classdesc The TwitterAPI class is used to interact with the Twitter API.
511
- */
512
- class{
513
- /**
514
- * Constructor for the TwitterAPI class.
515
- * @param {object} options - The options object.
516
- * @param {string} options.apiKey - The API key. (Needed for data fetching)
517
- */
518
- constructor({apiKey:e}){this.apiKey=e}
519
- /**
520
- * Fetch Twitter user details by username.
521
- * @param {string} twitterUserName - The Twitter username.
522
- * @returns {Promise<object>} - The user details.
523
- * @throws {APIError} - Throws an error if the request fails.
524
- */fetchUserByUsername(e){return r(this,void 0,void 0,(function*(){const t=I(`${b}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
525
- /**
526
- * Fetch tweets by Twitter username.
527
- * @param {string} twitterUserName - The Twitter username.
528
- * @param {number} page - The page number.
529
- * @param {number} limit - The number of items per page.
530
- * @returns {Promise<object>} - The tweets.
531
- * @throws {APIError} - Throws an error if the request fails.
532
- */fetchTweetsByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
533
- /**
534
- * Fetch followers by Twitter username.
535
- * @param {string} twitterUserName - The Twitter username.
536
- * @param {number} page - The page number.
537
- * @param {number} limit - The number of items per page.
538
- * @returns {Promise<object>} - The followers.
539
- * @throws {APIError} - Throws an error if the request fails.
540
- */fetchFollowersByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
541
- /**
542
- * Fetch following by Twitter username.
543
- * @param {string} twitterUserName - The Twitter username.
544
- * @param {number} page - The page number.
545
- * @param {number} limit - The number of items per page.
546
- * @returns {Promise<object>} - The following.
547
- * @throws {APIError} - Throws an error if the request fails.
548
- */fetchFollowingByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
549
- /**
550
- * Fetch tweet by tweet ID.
551
- * @param {string} tweetId - The tweet ID.
552
- * @returns {Promise<object>} - The tweet.
553
- * @throws {APIError} - Throws an error if the request fails.
554
- */fetchTweetById(e){return r(this,void 0,void 0,(function*(){const t=I(`${b}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
555
- /**
556
- * Fetch user by wallet address.
557
- * @param {string} walletAddress - The wallet address.
558
- * @param {number} page - The page number.
559
- * @param {number} limit - The number of items per page.
560
- * @returns {Promise<object>} - The user data.
561
- * @throws {APIError} - Throws an error if the request fails.
562
- */fetchUserByWalletAddress(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
563
- /**
564
- * Fetch reposted tweets by Twitter username.
565
- * @param {string} twitterUserName - The Twitter username.
566
- * @param {number} page - The page number.
567
- * @param {number} limit - The number of items per page.
568
- * @returns {Promise<object>} - The reposted tweets.
569
- * @throws {APIError} - Throws an error if the request fails.
570
- */fetchRepostedByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
571
- /**
572
- * Fetch replies by Twitter username.
573
- * @param {string} twitterUserName - The Twitter username.
574
- * @param {number} page - The page number.
575
- * @param {number} limit - The number of items per page.
576
- * @returns {Promise<object>} - The replies.
577
- * @throws {APIError} - Throws an error if the request fails.
578
- */fetchRepliesByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
579
- /**
580
- * Fetch likes by Twitter username.
581
- * @param {string} twitterUserName - The Twitter username.
582
- * @param {number} page - The page number.
583
- * @param {number} limit - The number of items per page.
584
- * @returns {Promise<object>} - The likes.
585
- * @throws {APIError} - Throws an error if the request fails.
586
- */fetchLikesByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
587
- /**
588
- * Fetch follows by Twitter username.
589
- * @param {string} twitterUserName - The Twitter username.
590
- * @param {number} page - The page number.
591
- * @param {number} limit - The number of items per page.
592
- * @returns {Promise<object>} - The follows.
593
- * @throws {APIError} - Throws an error if the request fails.
594
- */fetchFollowsByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
595
- /**
596
- * Fetch viewed tweets by Twitter username.
597
- * @param {string} twitterUserName - The Twitter username.
598
- * @param {number} page - The page number.
599
- * @param {number} limit - The number of items per page.
600
- * @returns {Promise<object>} - The viewed tweets.
601
- * @throws {APIError} - Throws an error if the request fails.
602
- */fetchViewedTweetsByUsername(e){return r(this,arguments,void 0,(function*(e,t=1,n=10){const i=I(`${b}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
603
- /**
604
- * Private method to fetch data with authorization header.
605
- * @param {string} url - The URL to fetch.
606
- * @returns {Promise<object>} - The response data.
607
- * @throws {APIError} - Throws an error if the request fails.
608
- */_fetchDataWithAuth(e){return r(this,void 0,void 0,(function*(){if(!this.apiKey)throw new o("API key is required for fetching data",401);try{return yield g(e,{"x-api-key":this.apiKey})}catch(e){throw new o(e.message,e.statusCode)}}))}},exports.ViemSignerAdapter=fe,exports.campMainnet=u,exports.campTestnet=d,exports.createLicenseTerms=(e,t,n,i)=>{if(n<v||n>w)throw new Error(`Royalty basis points must be between ${v} and ${w}`);if(t<f||t>m)throw new Error(`Duration must be between ${f} and ${m} seconds`);if(e<T)throw new Error(`Price must be at least ${T} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i}},exports.createNodeWalletClient=
434
+ */unlinkTelegram(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new o("User needs to be authenticated");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 o(e.message||"Failed to unlink Telegram account");return e.data}))}},exports.BrowserStorage=Te,exports.CustomSignerAdapter=me,exports.EthersSignerAdapter=ce,exports.MemoryStorage=fe,exports.ViemSignerAdapter=ye,exports.campMainnet=u,exports.campTestnet=d,exports.createLicenseTerms=(e,t,n,i)=>{if(n<I||n>b)throw new Error(`Royalty basis points must be between ${I} and ${b}`);if(t<A||t>w)throw new Error(`Duration must be between ${A} and ${w} seconds`);if(e<g)throw new Error(`Price must be at least ${g} wei`);return{price:e,duration:t,royaltyBps:n,paymentToken:i}},exports.createNodeWalletClient=
609
435
  /**
610
436
  * Create a wallet client for Node.js environment
611
437
  * @param account The viem account
@@ -613,4 +439,4 @@ constructor({apiKey:e}){this.apiKey=e}
613
439
  * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
614
440
  * @returns WalletClient
615
441
  */
616
- function(e,n,i){return t.createWalletClient({account:e,chain:n,transport:t.http(i)})},exports.createSignerAdapter=we;
442
+ function(t,n,i){return e.createWalletClient({account:t,chain:n,transport:e.http(i)})},exports.createSignerAdapter=he;