@campnetwork/origin 1.2.0-1 → 1.2.0-3

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
@@ -14,7 +14,7 @@ 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 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"==typeof SuppressedError&&SuppressedError;class s extends Error{constructor(e,t){super(e),this.name="APIError",this.statusCode=t||500,Error.captureStackTrace(this,this.constructor)}toJSON(){return{error:this.name,message:this.message,statusCode:this.statusCode||500}}}const o={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/"}}};var d=[{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:[]}],u=[{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:[]}],p=[{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"}]}],l=[{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"}],y="Connect with Camp Network";const c={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:o,IPNFT_ABI:d,MARKETPLACE_ABI:u,ROYALTY_VAULT_ABI:p,TBA_ABI:l},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:{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/"}}},IPNFT_ABI:d,MARKETPLACE_ABI:u,ROYALTY_VAULT_ABI:p,TBA_ABI:l}};
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
18
  /**
19
19
  * Makes a GET request to the given URL with the provided headers.
20
20
  *
@@ -22,7 +22,7 @@ function a(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{
22
22
  * @param {object} headers - The headers to include in the request.
23
23
  * @returns {Promise<object>} - The response data.
24
24
  * @throws {APIError} - Throws an error if the request fails.
25
- */function m(t){return a(this,arguments,void 0,(function*(t,n={}){try{return(yield e.get(t,{headers:n})).data}catch(e){if(e.response)throw new s(e.response.data.message||"API request failed",e.response.status);throw new s("Network error or server is unavailable",500)}}))}
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
26
  /**
27
27
  * Constructs a query string from an object of query parameters.
28
28
  *
@@ -36,9 +36,9 @@ function a(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{
36
36
  * @param {object} params - An object representing query parameters.
37
37
  * @returns {string} - The complete URL with query string.
38
38
  */
39
- function h(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 T="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",f="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";
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";
40
40
  // @ts-ignore
41
- let v=null,w=null,A=null;const I=e=>{var n;const i=A||o;return w&&(null===(n=w.chain)||void 0===n?void 0:n.id)===i.id||(w=t.createPublicClient({chain:i,transport:t.http()})),w};let b=[];const g=()=>b,E=e=>{function t(t){b.some((e=>e.info.uuid===t.detail.info.uuid))||(b=[...b,t.detail],e(b))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
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)};
42
42
  /**
43
43
  * Mints a Data NFT with a signature.
44
44
  * @param to The address to mint the NFT to.
@@ -50,62 +50,62 @@ let v=null,w=null,A=null;const I=e=>{var n;const i=A||o;return w&&(null===(n=w.c
50
50
  * @param deadline The deadline for the minting operation.
51
51
  * @param signature The signature for the minting operation.
52
52
  * @returns A promise that resolves when the minting is complete.
53
- */function _(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})}))}
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})}))}
54
54
  /**
55
55
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
56
56
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
57
57
  * @param deadline The deadline for the registration operation.
58
58
  * @param fileKey Optional file key for file uploads.
59
59
  * @return A promise that resolves with the registration data.
60
- */function C(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||[]};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}))}
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}))}
61
61
  /**
62
62
  * Updates the license terms of a specified IPNFT.
63
63
  * @param tokenId The ID of the IPNFT to update.
64
64
  * @param newTerms The new license terms to set.
65
65
  * @returns A promise that resolves when the transaction is complete.
66
- */function S(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
66
+ */function U(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
67
67
  /**
68
68
  * Sets the IPNFT as deleted
69
69
  * @param tokenId The token ID to set as deleted.
70
70
  * @returns A promise that resolves when the transaction is complete.
71
- */function k(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
71
+ */function B(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
72
72
  /**
73
73
  * Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
74
74
  * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
75
75
  * @param simulateOnly If true, simulates the transaction without executing it.
76
76
  * @returns The address of the royalty vault associated with the specified token owner.
77
- */function x(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}))}
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}))}
78
78
  /**
79
79
  * Returns the license terms associated with a specific token ID.
80
80
  * @param tokenId The token ID to query.
81
81
  * @returns The license terms of the token ID.
82
- */function P(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
82
+ */function F(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
83
83
  /**
84
84
  * Returns the owner of the specified IPNFT.
85
85
  * @param tokenId The ID of the IPNFT to query.
86
86
  * @returns The address of the owner of the IPNFT.
87
- */function N(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
87
+ */function R(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
88
88
  /**
89
89
  * Returns the number of IPNFTs owned by the given address.
90
90
  * @param owner The address to query.
91
91
  * @returns The number of IPNFTs owned by the address.
92
- */function U(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
92
+ */function $(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
93
93
  /**
94
94
  * Returns the metadata URI associated with a specific token ID.
95
95
  * @param tokenId The token ID to query.
96
96
  * @returns The metadata URI of the token ID.
97
- */function D(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
97
+ */function H(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
98
98
  /**
99
99
  * Returns the data status of the given token ID.
100
100
  * @param tokenId The token ID to query.
101
101
  * @returns The data status of the token ID.
102
- */function M(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
102
+ */function j(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
103
103
  /**
104
104
  * Checks if an operator is approved to manage all assets of a given owner.
105
105
  * @param owner The address of the asset owner.
106
106
  * @param operator The address of the operator to check.
107
107
  * @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
108
- */function B(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function F(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function O(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 R(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function $(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
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])}
109
109
  /**
110
110
  * Buys access to a data NFT for a specified duration.
111
111
  * @param buyer The address of the buyer.
@@ -115,38 +115,45 @@ let v=null,w=null,A=null;const I=e=>{var n;const i=A||o;return w&&(null===(n=w.c
115
115
  * @param expectedPaymentToken The address of the payment token (use zero address for native token).
116
116
  * @param value The amount of native token to send (only required if paying with native token).
117
117
  * @returns A promise that resolves when the transaction is confirmed.
118
- */function H(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})}
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})}
119
119
  /**
120
120
  * Checks if a user has access to a specific token based on subscription expiry.
121
121
  * @param user - The address of the user.
122
122
  * @param tokenId - The ID of the token.
123
123
  * @returns A promise that resolves to a boolean indicating if the user has access.
124
- */function j(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 z(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
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])}
125
125
  /**
126
126
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
127
127
  * If the current allowance is less than the specified amount, it will perform the approval.
128
128
  * @param {ApproveParams} params - The parameters for the approval.
129
- */var L,W,q,J,K,V,G,Y,X,Z,Q,ee,te,ne,ie;
129
+ */var Y;
130
+ /**
131
+ * Enum representing the status of data in the system.
132
+ * * - ACTIVE: The data is currently active and available.
133
+ * * - PENDING_DELETE: The data is scheduled for deletion but not yet removed.
134
+ * * - DELETED: The data has been deleted and is no longer available.
135
+ */
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;
130
137
  /**
131
138
  * The Origin class
132
139
  * Handles the upload of files to Origin, as well as querying the user's stats
133
- */class ae{constructor(e,t,n){L.add(this),this.jwt=e,this.viemClient=n,this.environment=t,
140
+ */class me{constructor(e,t,n){X.add(this),this.jwt=e,this.viemClient=n,this.environment=t,
134
141
  // DataNFT methods
135
- this.mintWithSignature=_.bind(this),this.registerIpNFT=C.bind(this),this.updateTerms=S.bind(this),this.finalizeDelete=k.bind(this),this.getOrCreateRoyaltyVault=x.bind(this),this.getTerms=P.bind(this),this.ownerOf=N.bind(this),this.balanceOf=U.bind(this),this.tokenURI=D.bind(this),this.dataStatus=M.bind(this),this.isApprovedForAll=B.bind(this),this.transferFrom=F.bind(this),this.safeTransferFrom=O.bind(this),this.approve=R.bind(this),this.setApprovalForAll=$.bind(this),
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),
136
143
  // Marketplace methods
137
- this.buyAccess=H.bind(this),this.hasAccess=j.bind(this),this.subscriptionExpiry=z.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return a(this,void 0,void 0,(function*(){let i;try{i=yield r(this,L,"m",W).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(((a,r)=>{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=>{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)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield r(this,L,"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 r(this,L,"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 a(this,void 0,void 0,(function*(){let a,o=null;try{o=yield r(this,L,"m",V).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
138
- let u;try{u=yield this.registerIpNFT("file",d,n,t,a.key,i)}catch(e){throw yield r(this,L,"m",q).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,L,"m",q).call(this,a.key,"failed"),new Error(`Minting failed with status: ${e.receipt.status}`)}catch(e){throw yield r(this,L,"m",q).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,L,"m",V).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
139
- let s;try{s=yield this.registerIpNFT(e,a,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,a,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 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}))}
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}))}
140
147
  /**
141
148
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
142
149
  * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
143
- */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 s(e.message||"Failed to fetch Origin usage")}))}
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")}))}
144
151
  /**
145
152
  * Set the user's consent for Origin usage.
146
153
  * @param {boolean} consent The user's consent.
147
154
  * @returns {Promise<void>}
148
155
  * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
149
- */setOriginConsent(e){return a(this,void 0,void 0,(function*(){if(void 0===e)throw new s("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 s(t.message||"Failed to set Origin consent")}))}
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")}))}
150
157
  /**
151
158
  * Call a contract method.
152
159
  * @param {string} contractAddress The contract address.
@@ -156,14 +163,14 @@ let s;try{s=yield this.registerIpNFT(e,a,n,t)}catch(e){throw new Error(`Failed t
156
163
  * @param {CallOptions} [options] The call options.
157
164
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
158
165
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
159
- */callContractMethod(e,n,i,s){return a(this,arguments,void 0,(function*(e,n,i,a,s={}){var o;let d=null;try{d=yield r(this,L,"m",V).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=I();return(yield t.readContract({address:e,abi:n,functionName:i,args:a}))||null}yield r(this,L,"m",K).call(this,this.environment.CHAIN);const p=I(),{result:l,request:y}=yield p.simulateContract({account:d,address:e,abi:n,functionName:i,args:a,value:s.value});
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});
160
167
  // simulate
161
- 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,L,"m",J).call(this,e),simulatedResult:l}}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}))}
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)}}))}
162
169
  /**
163
170
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
164
171
  * @param {bigint} tokenId The token ID of the asset.
165
172
  * @returns {Promise<any>} The result of the buyAccess call.
166
- */buyAccessSmart(e){return a(this,void 0,void 0,(function*(){let n=null;try{n=yield r(this,L,"m",V).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:d,duration:u}=i;if(void 0===s||void 0===d||void 0===u)throw new Error("Terms missing price, paymentToken, or duration");const p=s;return d===t.zeroAddress?this.buyAccess(n,e,p,u,d,p):(yield function(e){return a(this,arguments,void 0,(function*({walletClient:e,publicClient:n,tokenAddress:i,owner:a,spender:r,amount:s}){(yield n.readContract({address:i,abi:t.erc20Abi,functionName:"allowance",args:[a,r]}))<s&&(yield e.writeContract({address:i,account:a,abi:t.erc20Abi,functionName:"approve",args:[r,s],chain:o}))}))}({walletClient:this.viemClient,publicClient:I(),tokenAddress:d,owner:n,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:p}),this.buyAccess(n,e,p,u,d))}))}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()}))}
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()}))}
167
174
  /**
168
175
  * Get the Token Bound Account (TBA) address for a specific token ID.
169
176
  * @param {bigint} tokenId - The token ID to get the TBA address for.
@@ -174,7 +181,7 @@ if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?
174
181
  * const tbaAddress = await origin.getTokenBoundAccount(1n);
175
182
  * console.log(`TBA Address: ${tbaAddress}`);
176
183
  * ```
177
- */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)}`)}}))}
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)}`)}}))}
178
185
  /**
179
186
  * Get royalty information for a token ID, including the token bound account address and its balance.
180
187
  * @param {bigint} tokenId - The token ID to check royalties for.
@@ -189,9 +196,9 @@ if(s.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?
189
196
  * // Get ERC20 token royalties for a specific token
190
197
  * const royalties = await origin.getRoyalties(1n, "0x1234...");
191
198
  * ```
192
- */getRoyalties(e,n){return a(this,void 0,void 0,(function*(){try{const i=yield this.getTokenBoundAccount(e),a=I();let r,s;if(n&&n!==t.zeroAddress){
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){
193
200
  // erc20 (wrapped camp)
194
- 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"}];r=yield this.callContractMethod(n,e,"balanceOf",[i]);const a=yield this.callContractMethod(n,e,"decimals",[]);s=t.formatUnits(r,a)}else r=yield a.getBalance({address:i}),s=t.formatEther(r);return{tokenBoundAccount:i,balance:r,balanceFormatted:s}}catch(t){throw new Error(`Failed to retrieve royalties for token ${e}: ${t instanceof Error?t.message:String(t)}`)}}))}
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)}`)}}))}
195
202
  /**
196
203
  * Claim royalties from a token's Token Bound Account (TBA).
197
204
  * @param {bigint} tokenId - The token ID to claim royalties from.
@@ -207,21 +214,60 @@ const e=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
207
214
  * // Claim ERC20 token royalties to a specific address
208
215
  * await origin.claimRoyalties(1n, "0xRecipient...", "0xToken...");
209
216
  * ```
210
- */claimRoyalties(e,n,i){return a(this,void 0,void 0,(function*(){const a=yield r(this,L,"m",G).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;
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;
211
218
  // Call execute on the TBA
212
219
  return i&&i!==t.zeroAddress?(
213
220
  // ERC20 token transfer
214
221
  d=i,u=BigInt(0),
215
222
  // Encode ERC20 transfer call: transfer(address to, uint256 amount)
216
- 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:[a,o]})):(
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]})):(
217
224
  // Native token transfer
218
- d=a,u=o,p="0x"),this.callContractMethod(s,this.environment.TBA_ABI,"execute",[d,u,p,0],// operation: 0 = CALL
219
- {waitForReceipt:!0,value:BigInt(0)})}))}}L=new WeakSet,W=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}}))},q=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}}))},J=function(e){return a(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=I();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){
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){
220
227
  // fallback
221
- 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}}))},K=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=>{A=e,w=null})// reset public client to be recreated with new chain
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
222
229
  (e);try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
223
230
  // Unrecognized chain
224
- 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)}]})}}}))},V=function(){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected. Please connect a wallet.");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]}))},G=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)}`)}}))};X=new WeakMap,Y=new WeakSet,Z=function(e,t){r(this,X,"f")[e]&&r(this,X,"f")[e].forEach((e=>e(t)))},Q=function(e){return a(this,void 0,void 0,(function*(){if("undefined"==typeof localStorage)return;const t=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:wallet-address"),n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:user-id"),i=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:jwt"),a=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:environment");t&&n&&i&&(a===this.environment.NAME||!a)?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new ae(this.jwt,this.environment),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},ee=function(){return a(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 s(e)}}))},te=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)}}))},ne=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 s(e)}}))},ie=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:y,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},exports.Auth=
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.");
232
+ // If account is already set on the client, return it directly
233
+ if(this.viemClient.account)return this.viemClient.account.address;
234
+ // 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)}`)}}))};
236
+ /**
237
+ * Adapter for viem WalletClient
238
+ */
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}))}}
240
+ /**
241
+ * 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*(){
243
+ // 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*(){
245
+ // Try ethers v6 first
246
+ if(this.signer.provider&&"function"==typeof this.signer.provider.getNetwork){const e=yield this.signer.provider.getNetwork();
247
+ // ethers v6 returns bigint, v5 returns number
248
+ return"bigint"==typeof e.chainId?Number(e.chainId):e.chainId}
249
+ // Fallback for ethers v5
250
+ return"function"==typeof this.signer.getChainId?yield this.signer.getChainId():484;
251
+ // Default to mainnet if we can't determine
252
+ }))}}
253
+ /**
254
+ * 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;
256
+ // Default to mainnet
257
+ }))}}
258
+ /**
259
+ * Factory function to create appropriate adapter based on signer type
260
+ */function we(e){
261
+ // Check for viem WalletClient
262
+ return e.transport&&e.chain&&"function"==typeof e.signMessage?new fe(e):
263
+ // Check for ethers signer (v5 or v6)
264
+ e._isSigner||e.provider&&"function"==typeof e.signMessage?new Te(e):new ve(e)}
265
+ /**
266
+ * 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)}))}}
268
+ /**
269
+ * 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=
225
271
  /**
226
272
  * The Auth class.
227
273
  * @class
@@ -234,9 +280,12 @@ class{
234
280
  * @param {string} options.clientId The client ID.
235
281
  * @param {string|object} options.redirectUri The redirect URI used for oauth. Leave empty if you want to use the current URL. If you want different redirect URIs for different socials, pass an object with the socials as keys and the redirect URIs as values.
236
282
  * @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
283
+ * @param {StorageAdapter} [options.storage] Custom storage adapter. Defaults to localStorage in browser, memory storage in Node.js.
237
284
  * @throws {APIError} - Throws an error if the clientId is not provided.
238
285
  */
239
- constructor({clientId:e,redirectUri:t,environment:n="DEVELOPMENT"}){if(Y.add(this),X.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");this.viem=null,this.environment=c[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,function(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");"a"===i?a.call(e,n):a?a.value=n:t.set(e,n)}(this,X,{},"f"),E((e=>{r(this,Y,"m",Z).call(this,"providers",e)})),r(this,Y,"m",Q).call(this)}
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"),
287
+ // 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)}
240
289
  /**
241
290
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
242
291
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
@@ -246,26 +295,26 @@ constructor({clientId:e,redirectUri:t,environment:n="DEVELOPMENT"}){if(Y.add(thi
246
295
  * auth.on("state", (state) => {
247
296
  * console.log(state);
248
297
  * });
249
- */on(e,t){r(this,X,"f")[e]||(r(this,X,"f")[e]=[]),r(this,X,"f")[e].push(t),"providers"===e&&t(g())}
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())}
250
299
  /**
251
300
  * Unsubscribe from an event. Possible events are "state", "provider", "providers", and "viem".
252
301
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
253
302
  * @param {function} callback The callback function.
254
303
  * @returns {void}
255
- */off(e,t){r(this,X,"f")[e]&&(r(this,X,"f")[e]=r(this,X,"f")[e].filter((e=>e!==t)))}
304
+ */off(e,t){a(this,ae,"f")[e]&&(a(this,ae,"f")[e]=a(this,ae,"f")[e].filter((e=>e!==t)))}
256
305
  /**
257
306
  * Set the loading state.
258
307
  * @param {boolean} loading The loading state.
259
308
  * @returns {void}
260
- */setLoading(e){r(this,Y,"m",Z).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
309
+ */setLoading(e){a(this,re,"m",ue).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
261
310
  /**
262
311
  * 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.
263
312
  * @param {object} options The options object. Includes the provider and the provider info.
264
313
  * @returns {void}
265
314
  * @throws {APIError} - Throws an error if the provider is not provided.
266
- */setProvider({provider:e,info:i,address:a}){if(!e)throw new s("provider is required");this.viem=((e,i="window.ethereum",a,r)=>{var s,d;if(!e&&!v)return console.warn("Provider is required to create a client."),null;const u=a||o;if(!v||v.transport.name!==i&&e||r!==(null===(s=v.account)||void 0===s?void 0:s.address)&&e||(null==A?void 0:A.id)!==u.id){const a={chain:u,transport:t.custom(e,{name:i})};r&&(a.account=n.toAccount(r)),v=t.createWalletClient(a),A=u,w&&(null===(d=w.chain)||void 0===d?void 0:d.id)!==u.id&&(w=null)}return v})(e,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
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),
267
316
  // TODO: only use one of these
268
- r(this,Y,"m",Z).call(this,"viem",this.viem),r(this,Y,"m",Z).call(this,"provider",{provider:e,info:i}),localStorage.setItem("camp-sdk:provider",JSON.stringify(i))}
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))}
269
318
  /**
270
319
  * 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.
271
320
  * @param {string} walletAddress The wallet address.
@@ -274,29 +323,50 @@ r(this,Y,"m",Z).call(this,"viem",this.viem),r(this,Y,"m",Z).call(this,"provider"
274
323
  /**
275
324
  * Recover the provider from local storage.
276
325
  * @returns {Promise<void>}
277
- */recoverProvider(){return a(this,void 0,void 0,(function*(){var e,t,n,i,a,r,s,o,d,u,p,l,y;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const c=JSON.parse(localStorage.getItem("camp-sdk:provider")||"{}");let m;const h=null!==(e=g())&&void 0!==e?e:[];
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:[];
278
327
  // first pass: try to find provider by UUID/name and check if it has the right address
279
328
  // without prompting (using eth_accounts)
280
- for(const e of h)try{if(c.uuid&&(null===(t=e.info)||void 0===t?void 0:t.uuid)===c.uuid||c.name&&(null===(n=e.info)||void 0===n?void 0:n.name)===c.name){
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){
281
330
  // silently check if the wallet address matches first
282
- 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())){m=e;break}}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
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)}
283
332
  // second pass: if no provider found by UUID/name match, try to find by address only
284
333
  // but still avoid prompting
285
- if(!m)for(const e of h)try{
334
+ if(!f)for(const e of T)try{
286
335
  // skip providers we already checked in the first pass
287
- if(c.uuid&&(null===(r=e.info)||void 0===r?void 0:r.uuid)===c.uuid||c.name&&(null===(s=e.info)||void 0===s?void 0:s.name)===c.name)continue;const t=yield e.provider.request({method:"eth_accounts"});if(t.length>0&&(null===(o=t[0])||void 0===o?void 0:o.toLowerCase())===(null===(d=this.walletAddress)||void 0===d?void 0:d.toLowerCase())){m=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}
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)}
288
337
  // third pass: if still no provider found and we have UUID/name info,
289
338
  // try prompting the user (only for the stored provider)
290
- if(!m&&(c.uuid||c.name))for(const e of h)try{if(c.uuid&&(null===(u=e.info)||void 0===u?void 0:u.uuid)===c.uuid||c.name&&(null===(p=e.info)||void 0===p?void 0:p.name)===c.name){const t=yield e.provider.request({method:"eth_requestAccounts"});if(t.length>0&&(null===(l=t[0])||void 0===l?void 0:l.toLowerCase())===(null===(y=this.walletAddress)||void 0===y?void 0:y.toLowerCase())){m=e;break}}}catch(e){console.warn("Failed to reconnect to stored provider:",e)}m?this.setProvider({provider:m.provider,info:m.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
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.")}))}
291
340
  /**
292
341
  * Disconnect the user.
293
342
  * @returns {Promise<void>}
294
- */disconnect(){return a(this,void 0,void 0,(function*(){this.isAuthenticated&&(r(this,Y,"m",Z).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,localStorage.removeItem("camp-sdk:wallet-address"),localStorage.removeItem("camp-sdk:user-id"),localStorage.removeItem("camp-sdk:jwt"),localStorage.removeItem("camp-sdk:environment"))}))}
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"))}))}
295
344
  /**
296
345
  * Connect the user's wallet and sign the message.
297
346
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
298
347
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
299
- */connect(){return a(this,void 0,void 0,(function*(){r(this,Y,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,Y,"m",ee).call(this)),this.walletAddress=t.checksumAddress(this.walletAddress);const e=yield r(this,Y,"m",te).call(this),n=r(this,Y,"m",ie).call(this,e),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),a=yield r(this,Y,"m",ne).call(this,n,i);if(a.success)return this.isAuthenticated=!0,this.userId=a.userId,this.jwt=a.token,this.origin=new ae(this.jwt,this.environment,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),localStorage.setItem("camp-sdk:environment",this.environment.NAME),r(this,Y,"m",Z).call(this,"state","authenticated"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,Y,"m",Z).call(this,"state","unauthenticated"),new s("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,Y,"m",Z).call(this,"state","unauthenticated"),new s(e)}}))}
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)}}))}
349
+ /**
350
+ * Connect with a custom signer (for Node.js or custom wallet implementations).
351
+ * This method bypasses browser wallet interactions and uses the provided signer directly.
352
+ * @param {any} signer The signer instance (viem WalletClient, ethers Signer, or custom signer).
353
+ * @param {object} [options] Optional configuration.
354
+ * @param {string} [options.domain] The domain to use in SIWE message (defaults to 'localhost').
355
+ * @param {string} [options.uri] The URI to use in SIWE message (defaults to 'http://localhost').
356
+ * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
357
+ * @throws {APIError} - Throws an error if authentication fails.
358
+ * @example
359
+ * // Using with ethers
360
+ * const signer = new ethers.Wallet(privateKey, provider);
361
+ * await auth.connectWithSigner(signer, { domain: 'myapp.com', uri: 'https://myapp.com' });
362
+ *
363
+ * // Using with viem
364
+ * const account = privateKeyToAccount('0x...');
365
+ * const client = createWalletClient({ account, chain: mainnet, transport: http() });
366
+ * 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()),
368
+ // 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)}}))}
300
370
  /**
301
371
  * Get the user's linked social accounts.
302
372
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
@@ -305,34 +375,34 @@ if(!m&&(c.uuid||c.name))for(const e of h)try{if(c.uuid&&(null===(u=e.info)||void
305
375
  * const auth = new Auth({ clientId: "your-client-id" });
306
376
  * const socials = await auth.getLinkedSocials();
307
377
  * console.log(socials);
308
- */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 s(e.message||"Failed to fetch connections");{const t={};return Object.keys(e.data.data).forEach((n=>{t[n.split("User")[0]]=e.data.data[n]})),t}}))}
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}}))}
309
379
  /**
310
380
  * Link the user's Twitter account.
311
381
  * @returns {Promise<void>}
312
- * @throws {Error} - Throws an error if the user is not authenticated.
313
- */linkTwitter(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
382
+ * @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}`}))}
314
384
  /**
315
385
  * Link the user's Discord account.
316
386
  * @returns {Promise<void>}
317
- * @throws {Error} - Throws an error if the user is not authenticated.
318
- */linkDiscord(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
387
+ * @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}`}))}
319
389
  /**
320
390
  * Link the user's Spotify account.
321
391
  * @returns {Promise<void>}
322
- * @throws {Error} - Throws an error if the user is not authenticated.
323
- */linkSpotify(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");window.location.href=`${this.environment.AUTH_HUB_BASE_API}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
392
+ * @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}`}))}
324
394
  /**
325
395
  * Link the user's TikTok account.
326
396
  * @param {string} handle The user's TikTok handle.
327
397
  * @returns {Promise<any>} A promise that resolves with the TikTok account data.
328
398
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
329
- */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 s("TikTok service is currently unavailable, try again later"):new s(t.message||"Failed to link TikTok account");return t.data}))}
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}))}
330
400
  /**
331
401
  * Send an OTP to the user's Telegram account.
332
402
  * @param {string} phoneNumber The user's phone number.
333
403
  * @returns {Promise<any>} A promise that resolves with the OTP data.
334
404
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
335
- */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 s("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 s(t.message||"Failed to send Telegram OTP");return t.data}))}
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}))}
336
406
  /**
337
407
  * Link the user's Telegram account.
338
408
  * @param {string} phoneNumber The user's phone number.
@@ -340,37 +410,37 @@ if(!m&&(c.uuid||c.name))for(const e of h)try{if(c.uuid&&(null===(u=e.info)||void
340
410
  * @param {string} phoneCodeHash The phone code hash.
341
411
  * @returns {Promise<object>} A promise that resolves with the Telegram account data.
342
412
  * @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.
343
- */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 s("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 s(i.message||"Failed to link Telegram account");return i.data}))}
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}))}
344
414
  /**
345
415
  * Unlink the user's Twitter account.
346
416
  * @returns {Promise<any>} A promise that resolves with the unlink result.
347
417
  * @throws {Error} - Throws an error if the user is not authenticated.
348
418
  * @throws {APIError} - Throws an error if the request fails.
349
- */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 s(e.message||"Failed to unlink Twitter account");return e.data}))}
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}))}
350
420
  /**
351
421
  * Unlink the user's Discord account.
352
422
  * @returns {Promise<any>} A promise that resolves with the unlink result.
353
423
  * @throws {Error} - Throws an error if the user is not authenticated.
354
424
  * @throws {APIError} - Throws an error if the request fails.
355
- */unlinkDiscord(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new s("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 s(e.message||"Failed to unlink Discord account");return e.data}))}
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}))}
356
426
  /**
357
427
  * Unlink the user's Spotify account.
358
428
  * @returns {Promise<any>} A promise that resolves with the unlink result.
359
429
  * @throws {Error} - Throws an error if the user is not authenticated.
360
430
  * @throws {APIError} - Throws an error if the request fails.
361
- */unlinkSpotify(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new s("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 s(e.message||"Failed to unlink Spotify account");return e.data}))}
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}))}
362
432
  /**
363
433
  * Unlink the user's TikTok account.
364
434
  * @returns {Promise<any>} A promise that resolves with the unlink result.
365
435
  * @throws {Error} - Throws an error if the user is not authenticated.
366
436
  * @throws {APIError} - Throws an error if the request fails.
367
- */unlinkTikTok(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new s("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 s(e.message||"Failed to unlink TikTok account");return e.data}))}
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}))}
368
438
  /**
369
439
  * Unlink the user's Telegram account.
370
440
  * @returns {Promise<any>} A promise that resolves with the unlink result.
371
441
  * @throws {Error} - Throws an error if the user is not authenticated.
372
442
  * @throws {APIError} - Throws an error if the request fails.
373
- */unlinkTelegram(){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new s("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 s(e.message||"Failed to unlink Telegram account");return e.data}))}},exports.SpotifyAPI=
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=
374
444
  /**
375
445
  * The SpotifyAPI class.
376
446
  * @class
@@ -389,51 +459,51 @@ constructor(e){this.apiKey=e.apiKey}
389
459
  * @param {string} spotifyId - The user's Spotify ID.
390
460
  * @returns {Promise<object>} - The saved tracks.
391
461
  * @throws {APIError} - Throws an error if the request fails.
392
- */fetchSavedTracksById(e){return a(this,void 0,void 0,(function*(){const t=h(`${f}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
462
+ */fetchSavedTracksById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
393
463
  /**
394
464
  * Fetch the played tracks of a user by Spotify ID.
395
465
  * @param {string} spotifyId - The user's Spotify ID.
396
466
  * @returns {Promise<object>} - The played tracks.
397
467
  * @throws {APIError} - Throws an error if the request fails.
398
- */fetchPlayedTracksById(e){return a(this,void 0,void 0,(function*(){const t=h(`${f}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
468
+ */fetchPlayedTracksById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
399
469
  /**
400
470
  * Fetch the user's saved albums by Spotify user ID.
401
471
  * @param {string} spotifyId - The user's Spotify ID.
402
472
  * @returns {Promise<object>} - The saved albums.
403
473
  * @throws {APIError} - Throws an error if the request fails.
404
- */fetchSavedAlbumsById(e){return a(this,void 0,void 0,(function*(){const t=h(`${f}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
474
+ */fetchSavedAlbumsById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
405
475
  /**
406
476
  * Fetch the user's saved playlists by Spotify user ID.
407
477
  * @param {string} spotifyId - The user's Spotify ID.
408
478
  * @returns {Promise<object>} - The saved playlists.
409
479
  * @throws {APIError} - Throws an error if the request fails.
410
- */fetchSavedPlaylistsById(e){return a(this,void 0,void 0,(function*(){const t=h(`${f}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
480
+ */fetchSavedPlaylistsById(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
411
481
  /**
412
482
  * Fetch the tracks of an album by album ID.
413
483
  * @param {string} spotifyId - The Spotify ID of the user.
414
484
  * @param {string} albumId - The album ID.
415
485
  * @returns {Promise<object>} - The tracks in the album.
416
486
  * @throws {APIError} - Throws an error if the request fails.
417
- */fetchTracksInAlbum(e,t){return a(this,void 0,void 0,(function*(){const n=h(`${f}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
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)}))}
418
488
  /**
419
489
  * Fetch the tracks in a playlist by playlist ID.
420
490
  * @param {string} spotifyId - The Spotify ID of the user.
421
491
  * @param {string} playlistId - The playlist ID.
422
492
  * @returns {Promise<object>} - The tracks in the playlist.
423
493
  * @throws {APIError} - Throws an error if the request fails.
424
- */fetchTracksInPlaylist(e,t){return a(this,void 0,void 0,(function*(){const n=h(`${f}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
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)}))}
425
495
  /**
426
496
  * Fetch the user's Spotify data by wallet address.
427
497
  * @param {string} walletAddress - The wallet address.
428
498
  * @returns {Promise<object>} - The user's Spotify data.
429
499
  * @throws {APIError} - Throws an error if the request fails.
430
- */fetchUserByWalletAddress(e){return a(this,void 0,void 0,(function*(){const t=h(`${f}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
500
+ */fetchUserByWalletAddress(e){return r(this,void 0,void 0,(function*(){const t=I(`${E}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
431
501
  /**
432
502
  * Private method to fetch data with authorization header.
433
503
  * @param {string} url - The URL to fetch.
434
504
  * @returns {Promise<object>} - The response data.
435
505
  * @throws {APIError} - Throws an error if the request fails.
436
- */_fetchDataWithAuth(e){return a(this,void 0,void 0,(function*(){if(!this.apiKey)throw new s("API key is required for fetching data",401);try{return yield m(e,{"x-api-key":this.apiKey})}catch(e){throw new s(e.message,e.statusCode)}}))}},exports.TwitterAPI=
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=
437
507
  /**
438
508
  * The TwitterAPI class.
439
509
  * @class
@@ -451,7 +521,7 @@ constructor({apiKey:e}){this.apiKey=e}
451
521
  * @param {string} twitterUserName - The Twitter username.
452
522
  * @returns {Promise<object>} - The user details.
453
523
  * @throws {APIError} - Throws an error if the request fails.
454
- */fetchUserByUsername(e){return a(this,void 0,void 0,(function*(){const t=h(`${T}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
524
+ */fetchUserByUsername(e){return r(this,void 0,void 0,(function*(){const t=I(`${b}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
455
525
  /**
456
526
  * Fetch tweets by Twitter username.
457
527
  * @param {string} twitterUserName - The Twitter username.
@@ -459,7 +529,7 @@ constructor({apiKey:e}){this.apiKey=e}
459
529
  * @param {number} limit - The number of items per page.
460
530
  * @returns {Promise<object>} - The tweets.
461
531
  * @throws {APIError} - Throws an error if the request fails.
462
- */fetchTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
463
533
  /**
464
534
  * Fetch followers by Twitter username.
465
535
  * @param {string} twitterUserName - The Twitter username.
@@ -467,7 +537,7 @@ constructor({apiKey:e}){this.apiKey=e}
467
537
  * @param {number} limit - The number of items per page.
468
538
  * @returns {Promise<object>} - The followers.
469
539
  * @throws {APIError} - Throws an error if the request fails.
470
- */fetchFollowersByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
471
541
  /**
472
542
  * Fetch following by Twitter username.
473
543
  * @param {string} twitterUserName - The Twitter username.
@@ -475,13 +545,13 @@ constructor({apiKey:e}){this.apiKey=e}
475
545
  * @param {number} limit - The number of items per page.
476
546
  * @returns {Promise<object>} - The following.
477
547
  * @throws {APIError} - Throws an error if the request fails.
478
- */fetchFollowingByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
479
549
  /**
480
550
  * Fetch tweet by tweet ID.
481
551
  * @param {string} tweetId - The tweet ID.
482
552
  * @returns {Promise<object>} - The tweet.
483
553
  * @throws {APIError} - Throws an error if the request fails.
484
- */fetchTweetById(e){return a(this,void 0,void 0,(function*(){const t=h(`${T}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
554
+ */fetchTweetById(e){return r(this,void 0,void 0,(function*(){const t=I(`${b}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
485
555
  /**
486
556
  * Fetch user by wallet address.
487
557
  * @param {string} walletAddress - The wallet address.
@@ -489,7 +559,7 @@ constructor({apiKey:e}){this.apiKey=e}
489
559
  * @param {number} limit - The number of items per page.
490
560
  * @returns {Promise<object>} - The user data.
491
561
  * @throws {APIError} - Throws an error if the request fails.
492
- */fetchUserByWalletAddress(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
493
563
  /**
494
564
  * Fetch reposted tweets by Twitter username.
495
565
  * @param {string} twitterUserName - The Twitter username.
@@ -497,7 +567,7 @@ constructor({apiKey:e}){this.apiKey=e}
497
567
  * @param {number} limit - The number of items per page.
498
568
  * @returns {Promise<object>} - The reposted tweets.
499
569
  * @throws {APIError} - Throws an error if the request fails.
500
- */fetchRepostedByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
501
571
  /**
502
572
  * Fetch replies by Twitter username.
503
573
  * @param {string} twitterUserName - The Twitter username.
@@ -505,7 +575,7 @@ constructor({apiKey:e}){this.apiKey=e}
505
575
  * @param {number} limit - The number of items per page.
506
576
  * @returns {Promise<object>} - The replies.
507
577
  * @throws {APIError} - Throws an error if the request fails.
508
- */fetchRepliesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
509
579
  /**
510
580
  * Fetch likes by Twitter username.
511
581
  * @param {string} twitterUserName - The Twitter username.
@@ -513,7 +583,7 @@ constructor({apiKey:e}){this.apiKey=e}
513
583
  * @param {number} limit - The number of items per page.
514
584
  * @returns {Promise<object>} - The likes.
515
585
  * @throws {APIError} - Throws an error if the request fails.
516
- */fetchLikesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
517
587
  /**
518
588
  * Fetch follows by Twitter username.
519
589
  * @param {string} twitterUserName - The Twitter username.
@@ -521,7 +591,7 @@ constructor({apiKey:e}){this.apiKey=e}
521
591
  * @param {number} limit - The number of items per page.
522
592
  * @returns {Promise<object>} - The follows.
523
593
  * @throws {APIError} - Throws an error if the request fails.
524
- */fetchFollowsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
525
595
  /**
526
596
  * Fetch viewed tweets by Twitter username.
527
597
  * @param {string} twitterUserName - The Twitter username.
@@ -529,10 +599,18 @@ constructor({apiKey:e}){this.apiKey=e}
529
599
  * @param {number} limit - The number of items per page.
530
600
  * @returns {Promise<object>} - The viewed tweets.
531
601
  * @throws {APIError} - Throws an error if the request fails.
532
- */fetchViewedTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=h(`${T}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
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)}))}
533
603
  /**
534
604
  * Private method to fetch data with authorization header.
535
605
  * @param {string} url - The URL to fetch.
536
606
  * @returns {Promise<object>} - The response data.
537
607
  * @throws {APIError} - Throws an error if the request fails.
538
- */_fetchDataWithAuth(e){return a(this,void 0,void 0,(function*(){if(!this.apiKey)throw new s("API key is required for fetching data",401);try{return yield m(e,{"x-api-key":this.apiKey})}catch(e){throw new s(e.message,e.statusCode)}}))}};
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=
609
+ /**
610
+ * Create a wallet client for Node.js environment
611
+ * @param account The viem account
612
+ * @param chain The chain to use
613
+ * @param rpcUrl Optional RPC URL (defaults to chain's default RPC)
614
+ * @returns WalletClient
615
+ */
616
+ function(e,n,i){return t.createWalletClient({account:e,chain:n,transport:t.http(i)})},exports.createSignerAdapter=we;