@campnetwork/origin 1.2.0-4 → 1.2.1

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