@campnetwork/origin 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -56,7 +56,7 @@ let y=null,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.h
56
56
  * @param deadline The deadline for the registration operation.
57
57
  * @param fileKey Optional file key for file uploads.
58
58
  * @return A promise that resolves with the registration data.
59
- */function E(e,t,n,i){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==i&&(a.fileKey=i);const r=yield fetch(`${w}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(a)});if(!r.ok)throw new Error(`Failed to get signature: ${r.statusText}`);const s=yield r.json();if(s.isError)throw new Error(`Failed to get signature: ${s.message}`);return s.data}))}function x(e,t){return this.callContractMethod(T,k,"updateTerms",[e,t],{waitForReceipt:!0})}function M(e){return this.callContractMethod(T,k,"requestDelete",[e])}function S(e){return this.callContractMethod(T,k,"getTerms",[e])}function O(e){return this.callContractMethod(T,k,"ownerOf",[e])}function $(e){return this.callContractMethod(T,k,"balanceOf",[e])}function F(e){return this.callContractMethod(T,k,"contentHash",[e])}function P(e){return this.callContractMethod(T,k,"tokenURI",[e])}function j(e){return this.callContractMethod(T,k,"dataStatus",[e])}function U(e,t){return a(this,void 0,void 0,(function*(){return this.callContractMethod(T,k,"royaltyInfo",[e,t])}))}function N(e){return this.callContractMethod(T,k,"getApproved",[e])}function B(e,t){return this.callContractMethod(T,k,"isApprovedForAll",[e,t])}function D(e,t,n){return this.callContractMethod(T,k,"transferFrom",[e,t,n])}function _(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(T,k,"safeTransferFrom",a)}function W(e,t){return this.callContractMethod(T,k,"approve",[e,t])}function R(e,t){return this.callContractMethod(T,k,"setApprovalForAll",[e,t])}var q,z,L,K,J,H,G,V,Z,Y,Q,X,ee,te,ne,ie=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function ae(e,t,n){return this.callContractMethod(b,ie,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function re(e,t,n,i){return this.callContractMethod(b,ie,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function se(e,t){return this.callContractMethod(b,ie,"hasAccess",[e,t])}function oe(e,t){return this.callContractMethod(b,ie,"subscriptionExpiry",[e,t])}
59
+ */function E(e,t,n,i){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==i&&(a.fileKey=i);const r=yield fetch(`${w}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(a)});if(!r.ok)throw new Error(`Failed to get signature: ${r.statusText}`);const s=yield r.json();if(s.isError)throw new Error(`Failed to get signature: ${s.message}`);return s.data}))}function x(e,t){return this.callContractMethod(T,k,"updateTerms",[e,t],{waitForReceipt:!0})}function M(e){return this.callContractMethod(T,k,"requestDelete",[e])}function S(e){return this.callContractMethod(T,k,"getTerms",[e])}function O(e){return this.callContractMethod(T,k,"ownerOf",[e])}function $(e){return this.callContractMethod(T,k,"balanceOf",[e])}function F(e){return this.callContractMethod(T,k,"contentHash",[e])}function j(e){return this.callContractMethod(T,k,"tokenURI",[e])}function P(e){return this.callContractMethod(T,k,"dataStatus",[e])}function U(e,t){return a(this,void 0,void 0,(function*(){return this.callContractMethod(T,k,"royaltyInfo",[e,t])}))}function N(e){return this.callContractMethod(T,k,"getApproved",[e])}function B(e,t){return this.callContractMethod(T,k,"isApprovedForAll",[e,t])}function D(e,t,n){return this.callContractMethod(T,k,"transferFrom",[e,t,n])}function _(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(T,k,"safeTransferFrom",a)}function W(e,t){return this.callContractMethod(T,k,"approve",[e,t])}function R(e,t){return this.callContractMethod(T,k,"setApprovalForAll",[e,t])}var q,z,L,K,J,H,G,V,Z,Y,Q,X,ee,te,ne,ie=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function ae(e,t,n){return this.callContractMethod(b,ie,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function re(e,t,n,i){return this.callContractMethod(b,ie,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function se(e,t){return this.callContractMethod(b,ie,"hasAccess",[e,t])}function oe(e,t){return this.callContractMethod(b,ie,"subscriptionExpiry",[e,t])}
60
60
  /**
61
61
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
62
62
  * If the current allowance is less than the specified amount, it will perform the approval.
@@ -80,7 +80,7 @@ throw new Error("Failed to register Social IpNFT");return i.tokenId.toString();
80
80
  // }
81
81
  })),this.getOriginUploads=()=>a(this,void 0,void 0,(function*(){const e=yield fetch(`${w}/auth/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})),this.jwt=t,this.viemClient=n,
82
82
  // DataNFT methods
83
- this.mintWithSignature=C.bind(this),this.registerIpNFT=E.bind(this),this.updateTerms=x.bind(this),this.requestDelete=M.bind(this),this.getTerms=S.bind(this),this.ownerOf=O.bind(this),this.balanceOf=$.bind(this),this.contentHash=F.bind(this),this.tokenURI=P.bind(this),this.dataStatus=j.bind(this),this.royaltyInfo=U.bind(this),this.getApproved=N.bind(this),this.isApprovedForAll=B.bind(this),this.transferFrom=D.bind(this),this.safeTransferFrom=_.bind(this),this.approve=W.bind(this),this.setApprovalForAll=R.bind(this),
83
+ this.mintWithSignature=C.bind(this),this.registerIpNFT=E.bind(this),this.updateTerms=x.bind(this),this.requestDelete=M.bind(this),this.getTerms=S.bind(this),this.ownerOf=O.bind(this),this.balanceOf=$.bind(this),this.contentHash=F.bind(this),this.tokenURI=j.bind(this),this.dataStatus=P.bind(this),this.royaltyInfo=U.bind(this),this.getApproved=N.bind(this),this.isApprovedForAll=B.bind(this),this.transferFrom=D.bind(this),this.safeTransferFrom=_.bind(this),this.approve=W.bind(this),this.setApprovalForAll=R.bind(this),
84
84
  // Marketplace methods
85
85
  this.buyAccess=ae.bind(this),this.renewAccess=re.bind(this),this.hasAccess=se.bind(this),this.subscriptionExpiry=oe.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
86
86
  /**
@@ -145,7 +145,7 @@ if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthere
145
145
  }
146
146
  }
147
147
  */
148
- e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},Q=function(){return a(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=e,e}catch(e){throw new o(e)}}))},X=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${w}/auth/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)}}))},ee=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${w}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new o(e)}}))},te=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:f,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ne=function(e,t){return a(this,arguments,void 0,(function*(e,t,n=1){
148
+ e&&this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t})):this.isAuthenticated=!1}))},Q=function(){return a(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=t.checksumAddress(e),this.walletAddress}catch(e){throw new o(e)}}))},X=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${w}/auth/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)}}))},ee=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${w}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new o(e)}}))},te=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:f,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ne=function(e,t){return a(this,arguments,void 0,(function*(e,t,n=1){
149
149
  // if (this.#ackeeInstance)
150
150
  // await sendAnalyticsEvent(this.#ackeeInstance, event, message, count);
151
151
  // else return;
@@ -206,7 +206,7 @@ r(this,H,"m",Z).call(this,"viem",this.viem),r(this,H,"m",Z).call(this,"provider"
206
206
  * Connect the user's wallet and sign the message.
207
207
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
208
208
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
209
- */connect(){return a(this,void 0,void 0,(function*(){r(this,H,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,H,"m",Q).call(this));const e=yield r(this,H,"m",X).call(this),t=r(this,H,"m",te).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield r(this,H,"m",ee).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new de(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),r(this,H,"m",Z).call(this,"state","authenticated"),yield r(this,H,"m",ne).call(this,v.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o(e)}}))}
209
+ */connect(){return a(this,void 0,void 0,(function*(){r(this,H,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,H,"m",Q).call(this)),this.walletAddress=t.checksumAddress(this.walletAddress);const e=yield r(this,H,"m",X).call(this),n=r(this,H,"m",te).call(this,e),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),a=yield r(this,H,"m",ee).call(this,n,i);if(a.success)return this.isAuthenticated=!0,this.userId=a.userId,this.jwt=a.token,this.origin=new de(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),r(this,H,"m",Z).call(this,"state","authenticated"),yield r(this,H,"m",ne).call(this,v.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o(e)}}))}
210
210
  /**
211
211
  * Get the user's linked social accounts.
212
212
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
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 r,getAbiItem as s,encodeFunctionData as o,zeroAddress as d}from"viem";import{toAccount as u}from"viem/accounts";import{createSiweMessage as l}from"viem/siwe";
1
+ import e from"axios";import{custom as t,createWalletClient as n,createPublicClient as i,http as a,erc20Abi as r,getAbiItem as s,encodeFunctionData as o,zeroAddress as d,checksumAddress as u}from"viem";import{toAccount as l}from"viem/accounts";import{createSiweMessage as p}from"viem/siwe";
2
2
  /******************************************************************************
3
3
  Copyright (c) Microsoft Corporation.
4
4
 
@@ -13,7 +13,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
13
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
14
  PERFORMANCE OF THIS SOFTWARE.
15
15
  ***************************************************************************** */
16
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */function p(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function o(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}d((i=i.apply(e,t||[])).next())}))}function c(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 y(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 h 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}}}
16
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */function c(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{d(i.next(e))}catch(e){r(e)}}function o(e){try{d(i.throw(e))}catch(e){r(e)}}function d(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,o)}d((i=i.apply(e,t||[])).next())}))}function y(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 h(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 m 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}}}
17
17
  /**
18
18
  * Makes a GET request to the given URL with the provided headers.
19
19
  *
@@ -21,7 +21,7 @@ PERFORMANCE OF THIS SOFTWARE.
21
21
  * @param {object} headers - The headers to include in the request.
22
22
  * @returns {Promise<object>} - The response data.
23
23
  * @throws {APIError} - Throws an error if the request fails.
24
- */function m(t){return p(this,arguments,void 0,(function*(t,n={}){try{return(yield e.get(t,{headers:n})).data}catch(e){if(e.response)throw new h(e.response.data.message||"API request failed",e.response.status);throw new h("Network error or server is unavailable",500)}}))}
24
+ */function f(t){return c(this,arguments,void 0,(function*(t,n={}){try{return(yield e.get(t,{headers:n})).data}catch(e){if(e.response)throw new m(e.response.data.message||"API request failed",e.response.status);throw new m("Network error or server is unavailable",500)}}))}
25
25
  /**
26
26
  * Constructs a query string from an object of query parameters.
27
27
  *
@@ -35,13 +35,13 @@ PERFORMANCE OF THIS SOFTWARE.
35
35
  * @param {object} params - An object representing query parameters.
36
36
  * @returns {string} - The complete URL with query string.
37
37
  */
38
- function f(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 w="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",v="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";
38
+ function w(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 v="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",T="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";
39
39
  /**
40
40
  * The TwitterAPI class.
41
41
  * @class
42
42
  * @classdesc The TwitterAPI class is used to interact with the Twitter API.
43
43
  */
44
- class T{
44
+ class b{
45
45
  /**
46
46
  * Constructor for the TwitterAPI class.
47
47
  * @param {object} options - The options object.
@@ -53,7 +53,7 @@ constructor({apiKey:e}){this.apiKey=e}
53
53
  * @param {string} twitterUserName - The Twitter username.
54
54
  * @returns {Promise<object>} - The user details.
55
55
  * @throws {APIError} - Throws an error if the request fails.
56
- */fetchUserByUsername(e){return p(this,void 0,void 0,(function*(){const t=f(`${w}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
56
+ */fetchUserByUsername(e){return c(this,void 0,void 0,(function*(){const t=w(`${v}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
57
57
  /**
58
58
  * Fetch tweets by Twitter username.
59
59
  * @param {string} twitterUserName - The Twitter username.
@@ -61,7 +61,7 @@ constructor({apiKey:e}){this.apiKey=e}
61
61
  * @param {number} limit - The number of items per page.
62
62
  * @returns {Promise<object>} - The tweets.
63
63
  * @throws {APIError} - Throws an error if the request fails.
64
- */fetchTweetsByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
64
+ */fetchTweetsByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
65
65
  /**
66
66
  * Fetch followers by Twitter username.
67
67
  * @param {string} twitterUserName - The Twitter username.
@@ -69,7 +69,7 @@ constructor({apiKey:e}){this.apiKey=e}
69
69
  * @param {number} limit - The number of items per page.
70
70
  * @returns {Promise<object>} - The followers.
71
71
  * @throws {APIError} - Throws an error if the request fails.
72
- */fetchFollowersByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
72
+ */fetchFollowersByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
73
73
  /**
74
74
  * Fetch following by Twitter username.
75
75
  * @param {string} twitterUserName - The Twitter username.
@@ -77,13 +77,13 @@ constructor({apiKey:e}){this.apiKey=e}
77
77
  * @param {number} limit - The number of items per page.
78
78
  * @returns {Promise<object>} - The following.
79
79
  * @throws {APIError} - Throws an error if the request fails.
80
- */fetchFollowingByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
80
+ */fetchFollowingByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
81
81
  /**
82
82
  * Fetch tweet by tweet ID.
83
83
  * @param {string} tweetId - The tweet ID.
84
84
  * @returns {Promise<object>} - The tweet.
85
85
  * @throws {APIError} - Throws an error if the request fails.
86
- */fetchTweetById(e){return p(this,void 0,void 0,(function*(){const t=f(`${w}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
86
+ */fetchTweetById(e){return c(this,void 0,void 0,(function*(){const t=w(`${v}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
87
87
  /**
88
88
  * Fetch user by wallet address.
89
89
  * @param {string} walletAddress - The wallet address.
@@ -91,7 +91,7 @@ constructor({apiKey:e}){this.apiKey=e}
91
91
  * @param {number} limit - The number of items per page.
92
92
  * @returns {Promise<object>} - The user data.
93
93
  * @throws {APIError} - Throws an error if the request fails.
94
- */fetchUserByWalletAddress(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
94
+ */fetchUserByWalletAddress(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
95
95
  /**
96
96
  * Fetch reposted tweets by Twitter username.
97
97
  * @param {string} twitterUserName - The Twitter username.
@@ -99,7 +99,7 @@ constructor({apiKey:e}){this.apiKey=e}
99
99
  * @param {number} limit - The number of items per page.
100
100
  * @returns {Promise<object>} - The reposted tweets.
101
101
  * @throws {APIError} - Throws an error if the request fails.
102
- */fetchRepostedByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
102
+ */fetchRepostedByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
103
103
  /**
104
104
  * Fetch replies by Twitter username.
105
105
  * @param {string} twitterUserName - The Twitter username.
@@ -107,7 +107,7 @@ constructor({apiKey:e}){this.apiKey=e}
107
107
  * @param {number} limit - The number of items per page.
108
108
  * @returns {Promise<object>} - The replies.
109
109
  * @throws {APIError} - Throws an error if the request fails.
110
- */fetchRepliesByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
110
+ */fetchRepliesByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
111
111
  /**
112
112
  * Fetch likes by Twitter username.
113
113
  * @param {string} twitterUserName - The Twitter username.
@@ -115,7 +115,7 @@ constructor({apiKey:e}){this.apiKey=e}
115
115
  * @param {number} limit - The number of items per page.
116
116
  * @returns {Promise<object>} - The likes.
117
117
  * @throws {APIError} - Throws an error if the request fails.
118
- */fetchLikesByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
118
+ */fetchLikesByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
119
119
  /**
120
120
  * Fetch follows by Twitter username.
121
121
  * @param {string} twitterUserName - The Twitter username.
@@ -123,7 +123,7 @@ constructor({apiKey:e}){this.apiKey=e}
123
123
  * @param {number} limit - The number of items per page.
124
124
  * @returns {Promise<object>} - The follows.
125
125
  * @throws {APIError} - Throws an error if the request fails.
126
- */fetchFollowsByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
126
+ */fetchFollowsByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
127
127
  /**
128
128
  * Fetch viewed tweets by Twitter username.
129
129
  * @param {string} twitterUserName - The Twitter username.
@@ -131,17 +131,17 @@ constructor({apiKey:e}){this.apiKey=e}
131
131
  * @param {number} limit - The number of items per page.
132
132
  * @returns {Promise<object>} - The viewed tweets.
133
133
  * @throws {APIError} - Throws an error if the request fails.
134
- */fetchViewedTweetsByUsername(e){return p(this,arguments,void 0,(function*(e,t=1,n=10){const i=f(`${w}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
134
+ */fetchViewedTweetsByUsername(e){return c(this,arguments,void 0,(function*(e,t=1,n=10){const i=w(`${v}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
135
135
  /**
136
136
  * Private method to fetch data with authorization header.
137
137
  * @param {string} url - The URL to fetch.
138
138
  * @returns {Promise<object>} - The response data.
139
139
  * @throws {APIError} - Throws an error if the request fails.
140
- */_fetchDataWithAuth(e){return p(this,void 0,void 0,(function*(){if(!this.apiKey)throw new h("API key is required for fetching data",401);try{return yield m(e,{"x-api-key":this.apiKey})}catch(e){throw new h(e.message,e.statusCode)}}))}}
140
+ */_fetchDataWithAuth(e){return c(this,void 0,void 0,(function*(){if(!this.apiKey)throw new m("API key is required for fetching data",401);try{return yield f(e,{"x-api-key":this.apiKey})}catch(e){throw new m(e.message,e.statusCode)}}))}}
141
141
  /**
142
142
  * The SpotifyAPI class.
143
143
  * @class
144
- */class b{
144
+ */class g{
145
145
  /**
146
146
  * Constructor for the SpotifyAPI class.
147
147
  * @constructor
@@ -155,53 +155,53 @@ constructor(e){this.apiKey=e.apiKey}
155
155
  * @param {string} spotifyId - The user's Spotify ID.
156
156
  * @returns {Promise<object>} - The saved tracks.
157
157
  * @throws {APIError} - Throws an error if the request fails.
158
- */fetchSavedTracksById(e){return p(this,void 0,void 0,(function*(){const t=f(`${v}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
158
+ */fetchSavedTracksById(e){return c(this,void 0,void 0,(function*(){const t=w(`${T}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
159
159
  /**
160
160
  * Fetch the played tracks of a user by Spotify ID.
161
161
  * @param {string} spotifyId - The user's Spotify ID.
162
162
  * @returns {Promise<object>} - The played tracks.
163
163
  * @throws {APIError} - Throws an error if the request fails.
164
- */fetchPlayedTracksById(e){return p(this,void 0,void 0,(function*(){const t=f(`${v}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
164
+ */fetchPlayedTracksById(e){return c(this,void 0,void 0,(function*(){const t=w(`${T}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
165
165
  /**
166
166
  * Fetch the user's saved albums by Spotify user ID.
167
167
  * @param {string} spotifyId - The user's Spotify ID.
168
168
  * @returns {Promise<object>} - The saved albums.
169
169
  * @throws {APIError} - Throws an error if the request fails.
170
- */fetchSavedAlbumsById(e){return p(this,void 0,void 0,(function*(){const t=f(`${v}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
170
+ */fetchSavedAlbumsById(e){return c(this,void 0,void 0,(function*(){const t=w(`${T}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
171
171
  /**
172
172
  * Fetch the user's saved playlists by Spotify user ID.
173
173
  * @param {string} spotifyId - The user's Spotify ID.
174
174
  * @returns {Promise<object>} - The saved playlists.
175
175
  * @throws {APIError} - Throws an error if the request fails.
176
- */fetchSavedPlaylistsById(e){return p(this,void 0,void 0,(function*(){const t=f(`${v}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
176
+ */fetchSavedPlaylistsById(e){return c(this,void 0,void 0,(function*(){const t=w(`${T}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
177
177
  /**
178
178
  * Fetch the tracks of an album by album ID.
179
179
  * @param {string} spotifyId - The Spotify ID of the user.
180
180
  * @param {string} albumId - The album ID.
181
181
  * @returns {Promise<object>} - The tracks in the album.
182
182
  * @throws {APIError} - Throws an error if the request fails.
183
- */fetchTracksInAlbum(e,t){return p(this,void 0,void 0,(function*(){const n=f(`${v}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
183
+ */fetchTracksInAlbum(e,t){return c(this,void 0,void 0,(function*(){const n=w(`${T}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
184
184
  /**
185
185
  * Fetch the tracks in a playlist by playlist ID.
186
186
  * @param {string} spotifyId - The Spotify ID of the user.
187
187
  * @param {string} playlistId - The playlist ID.
188
188
  * @returns {Promise<object>} - The tracks in the playlist.
189
189
  * @throws {APIError} - Throws an error if the request fails.
190
- */fetchTracksInPlaylist(e,t){return p(this,void 0,void 0,(function*(){const n=f(`${v}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
190
+ */fetchTracksInPlaylist(e,t){return c(this,void 0,void 0,(function*(){const n=w(`${T}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
191
191
  /**
192
192
  * Fetch the user's Spotify data by wallet address.
193
193
  * @param {string} walletAddress - The wallet address.
194
194
  * @returns {Promise<object>} - The user's Spotify data.
195
195
  * @throws {APIError} - Throws an error if the request fails.
196
- */fetchUserByWalletAddress(e){return p(this,void 0,void 0,(function*(){const t=f(`${v}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
196
+ */fetchUserByWalletAddress(e){return c(this,void 0,void 0,(function*(){const t=w(`${T}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
197
197
  /**
198
198
  * Private method to fetch data with authorization header.
199
199
  * @param {string} url - The URL to fetch.
200
200
  * @returns {Promise<object>} - The response data.
201
201
  * @throws {APIError} - Throws an error if the request fails.
202
- */_fetchDataWithAuth(e){return p(this,void 0,void 0,(function*(){if(!this.apiKey)throw new h("API key is required for fetching data",401);try{return yield m(e,{"x-api-key":this.apiKey})}catch(e){throw new h(e.message,e.statusCode)}}))}}const g={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/"}}};
202
+ */_fetchDataWithAuth(e){return c(this,void 0,void 0,(function*(){if(!this.apiKey)throw new m("API key is required for fetching data",401);try{return yield f(e,{"x-api-key":this.apiKey})}catch(e){throw new m(e.message,e.statusCode)}}))}}const I={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/"}}};
203
203
  // @ts-ignore
204
- let I=null,k=null;const A=()=>(k||(k=i({chain:g,transport:a()})),k);var C="Connect with Camp Network",E="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",x={USER_CONNECTED:"ed42542d-b676-4112-b6d9-6db98048b2e0",USER_DISCONNECTED:"20af31ac-e602-442e-9e0e-b589f4dd4016",TWITTER_LINKED:"7fbea086-90ef-4679-ba69-f47f9255b34c",DISCORD_LINKED:"d73f5ae3-a8e8-48f2-8532-85e0c7780d6a",SPOTIFY_LINKED:"fc1788b4-c984-42c8-96f4-c87f6bb0b8f7",TIKTOK_LINKED:"4a2ffdd3-f0e9-4784-8b49-ff76ec1c0a6a",TELEGRAM_LINKED:"9006bc5d-bcc9-4d01-a860-4f1a201e8e47"},M="0xb55066f2793773B3784f8c57c415a8b5932B33Cd",S="0x977fdEF62CE095Ae8750Fd3496730F24F60dea7a";let O=[];const $=()=>O,F=e=>{function t(t){O.some((e=>e.info.uuid===t.detail.info.uuid))||(O=[...O,t.detail],e(O))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};var j=[{inputs:[{internalType:"string",name:"_name",type:"string"},{internalType:"string",name:"_symbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DurationZero",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"SignatureAlreadyUsed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"contentHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"royaltyAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyPercentages",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyReceivers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"terms",outputs:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"_royaltyReceiver",type:"address"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"usedNonces",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];
204
+ let k=null,A=null;const C=()=>(A||(A=i({chain:I,transport:a()})),A);var E="Connect with Camp Network",x="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",M={USER_CONNECTED:"ed42542d-b676-4112-b6d9-6db98048b2e0",USER_DISCONNECTED:"20af31ac-e602-442e-9e0e-b589f4dd4016",TWITTER_LINKED:"7fbea086-90ef-4679-ba69-f47f9255b34c",DISCORD_LINKED:"d73f5ae3-a8e8-48f2-8532-85e0c7780d6a",SPOTIFY_LINKED:"fc1788b4-c984-42c8-96f4-c87f6bb0b8f7",TIKTOK_LINKED:"4a2ffdd3-f0e9-4784-8b49-ff76ec1c0a6a",TELEGRAM_LINKED:"9006bc5d-bcc9-4d01-a860-4f1a201e8e47"},S="0xb55066f2793773B3784f8c57c415a8b5932B33Cd",O="0x977fdEF62CE095Ae8750Fd3496730F24F60dea7a";let $=[];const F=()=>$,j=e=>{function t(t){$.some((e=>e.info.uuid===t.detail.info.uuid))||($=[...$,t.detail],e($))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};var P=[{inputs:[{internalType:"string",name:"_name",type:"string"},{internalType:"string",name:"_symbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DurationZero",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"SignatureAlreadyUsed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"contentHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"royaltyAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyPercentages",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyReceivers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"terms",outputs:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"_royaltyReceiver",type:"address"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"usedNonces",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];
205
205
  /**
206
206
  * Mints a Data NFT with a signature.
207
207
  * @param to The address to mint the NFT to.
@@ -212,14 +212,14 @@ let I=null,k=null;const A=()=>(k||(k=i({chain:g,transport:a()})),k);var C="Conne
212
212
  * @param deadline The deadline for the minting operation.
213
213
  * @param signature The signature for the minting operation.
214
214
  * @returns A promise that resolves when the minting is complete.
215
- */function P(e,t,n,i,a,r,s){return p(this,void 0,void 0,(function*(){return yield this.callContractMethod(M,j,"mintWithSignature",[e,t,n,i,a,r,s],{waitForReceipt:!0})}))}
215
+ */function U(e,t,n,i,a,r,s){return c(this,void 0,void 0,(function*(){return yield this.callContractMethod(S,P,"mintWithSignature",[e,t,n,i,a,r,s],{waitForReceipt:!0})}))}
216
216
  /**
217
217
  * Registers a Data NFT with the Origin service in order to obtain a signature for minting.
218
218
  * @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
219
219
  * @param deadline The deadline for the registration operation.
220
220
  * @param fileKey Optional file key for file uploads.
221
221
  * @return A promise that resolves with the registration data.
222
- */function U(e,t,n,i){return p(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==i&&(a.fileKey=i);const r=yield fetch(`${E}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(a)});if(!r.ok)throw new Error(`Failed to get signature: ${r.statusText}`);const s=yield r.json();if(s.isError)throw new Error(`Failed to get signature: ${s.message}`);return s.data}))}function N(e,t){return this.callContractMethod(M,j,"updateTerms",[e,t],{waitForReceipt:!0})}function B(e){return this.callContractMethod(M,j,"requestDelete",[e])}function D(e){return this.callContractMethod(M,j,"getTerms",[e])}function _(e){return this.callContractMethod(M,j,"ownerOf",[e])}function W(e){return this.callContractMethod(M,j,"balanceOf",[e])}function R(e){return this.callContractMethod(M,j,"contentHash",[e])}function q(e){return this.callContractMethod(M,j,"tokenURI",[e])}function z(e){return this.callContractMethod(M,j,"dataStatus",[e])}function L(e,t){return p(this,void 0,void 0,(function*(){return this.callContractMethod(M,j,"royaltyInfo",[e,t])}))}function K(e){return this.callContractMethod(M,j,"getApproved",[e])}function J(e,t){return this.callContractMethod(M,j,"isApprovedForAll",[e,t])}function H(e,t,n){return this.callContractMethod(M,j,"transferFrom",[e,t,n])}function G(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(M,j,"safeTransferFrom",a)}function V(e,t){return this.callContractMethod(M,j,"approve",[e,t])}function Z(e,t){return this.callContractMethod(M,j,"setApprovalForAll",[e,t])}var Y,Q,X,ee,te,ne,ie,ae,re,se,oe,de,ue,le,pe,ce=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function ye(e,t,n){return this.callContractMethod(S,ce,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function he(e,t,n,i){return this.callContractMethod(S,ce,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function me(e,t){return this.callContractMethod(S,ce,"hasAccess",[e,t])}function fe(e,t){return this.callContractMethod(S,ce,"subscriptionExpiry",[e,t])}
222
+ */function N(e,t,n,i){return c(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==i&&(a.fileKey=i);const r=yield fetch(`${x}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(a)});if(!r.ok)throw new Error(`Failed to get signature: ${r.statusText}`);const s=yield r.json();if(s.isError)throw new Error(`Failed to get signature: ${s.message}`);return s.data}))}function B(e,t){return this.callContractMethod(S,P,"updateTerms",[e,t],{waitForReceipt:!0})}function D(e){return this.callContractMethod(S,P,"requestDelete",[e])}function _(e){return this.callContractMethod(S,P,"getTerms",[e])}function W(e){return this.callContractMethod(S,P,"ownerOf",[e])}function R(e){return this.callContractMethod(S,P,"balanceOf",[e])}function q(e){return this.callContractMethod(S,P,"contentHash",[e])}function z(e){return this.callContractMethod(S,P,"tokenURI",[e])}function L(e){return this.callContractMethod(S,P,"dataStatus",[e])}function K(e,t){return c(this,void 0,void 0,(function*(){return this.callContractMethod(S,P,"royaltyInfo",[e,t])}))}function J(e){return this.callContractMethod(S,P,"getApproved",[e])}function H(e,t){return this.callContractMethod(S,P,"isApprovedForAll",[e,t])}function G(e,t,n){return this.callContractMethod(S,P,"transferFrom",[e,t,n])}function V(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(S,P,"safeTransferFrom",a)}function Z(e,t){return this.callContractMethod(S,P,"approve",[e,t])}function Y(e,t){return this.callContractMethod(S,P,"setApprovalForAll",[e,t])}var Q,X,ee,te,ne,ie,ae,re,se,oe,de,ue,le,pe,ce,ye=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function he(e,t,n){return this.callContractMethod(O,ye,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function me(e,t,n,i){return this.callContractMethod(O,ye,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function fe(e,t){return this.callContractMethod(O,ye,"hasAccess",[e,t])}function we(e,t){return this.callContractMethod(O,ye,"subscriptionExpiry",[e,t])}
223
223
  /**
224
224
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
225
225
  * If the current allowance is less than the specified amount, it will perform the approval.
@@ -229,8 +229,8 @@ let I=null,k=null;const A=()=>(k||(k=i({chain:g,transport:a()})),k);var C="Conne
229
229
  * The Origin class
230
230
  * Handles the upload of files to Origin, as well as querying the user's stats
231
231
  */
232
- class we{constructor(t,n){Y.add(this),Q.set(this,(e=>p(this,void 0,void 0,(function*(){const t=yield fetch(`${E}/auth/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`}}),n=yield t.json();return n.isError?n.message:n.data})))),X.set(this,((e,t)=>p(this,void 0,void 0,(function*(){(yield fetch(`${E}/auth/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}})).ok||console.error("Failed to update origin status")})))),this.uploadFile=(t,n)=>p(this,void 0,void 0,(function*(){const i=yield c(this,Q,"f").call(this,t);if(i){try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){throw yield c(this,X,"f").call(this,i.key,"failed"),new Error("Failed to upload file: "+e)}return yield c(this,X,"f").call(this,i.key,"success"),i}console.error("Failed to generate upload URL")})),this.mintFile=(e,t,n)=>p(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=yield this.uploadFile(e,n);if(!i||!i.key)throw new Error("Failed to upload file or get upload info.");const a=BigInt(Math.floor(Date.now())+600),r=yield this.registerIpNFT("file",a,t,i.key),{tokenId:s,signerAddress:o,creatorContentHash:d,signature:u,uri:l}=r;// 10 minutes from now
233
- if(!(s&&o&&d&&void 0!==u&&l))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),c=yield this.mintWithSignature(p,s,d,l,t,a,u);if("0x1"!==c.status)throw new Error(`Minting failed with status: ${c.status}`);return s.toString()})),this.mintSocial=(e,t)=>p(this,void 0,void 0,(function*(){
232
+ class ve{constructor(t,n){Q.add(this),X.set(this,(e=>c(this,void 0,void 0,(function*(){const t=yield fetch(`${x}/auth/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`}}),n=yield t.json();return n.isError?n.message:n.data})))),ee.set(this,((e,t)=>c(this,void 0,void 0,(function*(){(yield fetch(`${x}/auth/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}})).ok||console.error("Failed to update origin status")})))),this.uploadFile=(t,n)=>c(this,void 0,void 0,(function*(){const i=yield y(this,X,"f").call(this,t);if(i){try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){throw yield y(this,ee,"f").call(this,i.key,"failed"),new Error("Failed to upload file: "+e)}return yield y(this,ee,"f").call(this,i.key,"success"),i}console.error("Failed to generate upload URL")})),this.mintFile=(e,t,n)=>c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=yield this.uploadFile(e,n);if(!i||!i.key)throw new Error("Failed to upload file or get upload info.");const a=BigInt(Math.floor(Date.now())+600),r=yield this.registerIpNFT("file",a,t,i.key),{tokenId:s,signerAddress:o,creatorContentHash:d,signature:u,uri:l}=r;// 10 minutes from now
233
+ if(!(s&&o&&d&&void 0!==u&&l))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),c=yield this.mintWithSignature(p,s,d,l,t,a,u);if("0x1"!==c.status)throw new Error(`Minting failed with status: ${c.status}`);return s.toString()})),this.mintSocial=(e,t)=>c(this,void 0,void 0,(function*(){
234
234
  // try {
235
235
  const n=BigInt(Math.floor(Date.now())+600),i=yield this.registerIpNFT(e,n,t);// 10 minutes from now (temp)
236
236
  if(!i)
@@ -241,33 +241,33 @@ throw new Error("Failed to register Social IpNFT");return i.tokenId.toString();
241
241
  // console.error("Failed to mint social IpNFT:", error);
242
242
  // return null;
243
243
  // }
244
- })),this.getOriginUploads=()=>p(this,void 0,void 0,(function*(){const e=yield fetch(`${E}/auth/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})),this.jwt=t,this.viemClient=n,
244
+ })),this.getOriginUploads=()=>c(this,void 0,void 0,(function*(){const e=yield fetch(`${x}/auth/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})),this.jwt=t,this.viemClient=n,
245
245
  // DataNFT methods
246
- this.mintWithSignature=P.bind(this),this.registerIpNFT=U.bind(this),this.updateTerms=N.bind(this),this.requestDelete=B.bind(this),this.getTerms=D.bind(this),this.ownerOf=_.bind(this),this.balanceOf=W.bind(this),this.contentHash=R.bind(this),this.tokenURI=q.bind(this),this.dataStatus=z.bind(this),this.royaltyInfo=L.bind(this),this.getApproved=K.bind(this),this.isApprovedForAll=J.bind(this),this.transferFrom=H.bind(this),this.safeTransferFrom=G.bind(this),this.approve=V.bind(this),this.setApprovalForAll=Z.bind(this),
246
+ this.mintWithSignature=U.bind(this),this.registerIpNFT=N.bind(this),this.updateTerms=B.bind(this),this.requestDelete=D.bind(this),this.getTerms=_.bind(this),this.ownerOf=W.bind(this),this.balanceOf=R.bind(this),this.contentHash=q.bind(this),this.tokenURI=z.bind(this),this.dataStatus=L.bind(this),this.royaltyInfo=K.bind(this),this.getApproved=J.bind(this),this.isApprovedForAll=H.bind(this),this.transferFrom=G.bind(this),this.safeTransferFrom=V.bind(this),this.approve=Z.bind(this),this.setApprovalForAll=Y.bind(this),
247
247
  // Marketplace methods
248
- this.buyAccess=ye.bind(this),this.renewAccess=he.bind(this),this.hasAccess=me.bind(this),this.subscriptionExpiry=fe.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
248
+ this.buyAccess=he.bind(this),this.renewAccess=me.bind(this),this.hasAccess=fe.bind(this),this.subscriptionExpiry=we.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
249
249
  /**
250
250
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
251
251
  * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
252
- */getOriginUsage(){return p(this,void 0,void 0,(function*(){const e=yield fetch(`${E}/auth/origin/usage`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,
252
+ */getOriginUsage(){return c(this,void 0,void 0,(function*(){const e=yield fetch(`${x}/auth/origin/usage`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,
253
253
  // "x-client-id": this.clientId,
254
- "Content-Type":"application/json"}}).then((e=>e.json()));if(!e.isError&&e.data.user)return e;throw new h(e.message||"Failed to fetch Origin usage")}))}
254
+ "Content-Type":"application/json"}}).then((e=>e.json()));if(!e.isError&&e.data.user)return e;throw new m(e.message||"Failed to fetch Origin usage")}))}
255
255
  /**
256
256
  * Set the user's consent for Origin usage.
257
257
  * @param {boolean} consent The user's consent.
258
258
  * @returns {Promise<void>}
259
259
  * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the consent is not provided.
260
- */setOriginConsent(e){return p(this,void 0,void 0,(function*(){if(void 0===e)throw new h("Consent is required");const t=yield fetch(`${E}/auth/origin/status`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,
260
+ */setOriginConsent(e){return c(this,void 0,void 0,(function*(){if(void 0===e)throw new m("Consent is required");const t=yield fetch(`${x}/auth/origin/status`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,
261
261
  // "x-client-id": this.clientId,
262
- "Content-Type":"application/json"},body:JSON.stringify({active:e})}).then((e=>e.json()));if(t.isError)throw new h(t.message||"Failed to set Origin consent")}))}
262
+ "Content-Type":"application/json"},body:JSON.stringify({active:e})}).then((e=>e.json()));if(t.isError)throw new m(t.message||"Failed to set Origin consent")}))}
263
263
  /**
264
264
  * Set the user's Origin multiplier.
265
265
  * @param {number} multiplier The user's Origin multiplier.
266
266
  * @returns {Promise<void>}
267
267
  * @throws {Error|APIError} - Throws an error if the user is not authenticated. Also throws an error if the multiplier is not provided.
268
- */setOriginMultiplier(e){return p(this,void 0,void 0,(function*(){if(void 0===e)throw new h("Multiplier is required");const t=yield fetch(`${E}/auth/origin/multiplier`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,
268
+ */setOriginMultiplier(e){return c(this,void 0,void 0,(function*(){if(void 0===e)throw new m("Multiplier is required");const t=yield fetch(`${x}/auth/origin/multiplier`,{method:"PATCH",headers:{Authorization:`Bearer ${this.jwt}`,
269
269
  // "x-client-id": this.clientId,
270
- "Content-Type":"application/json"},body:JSON.stringify({multiplier:e})}).then((e=>e.json()));if(t.isError)throw new h(t.message||"Failed to set Origin multiplier")}))}
270
+ "Content-Type":"application/json"},body:JSON.stringify({multiplier:e})}).then((e=>e.json()));if(t.isError)throw new m(t.message||"Failed to set Origin multiplier")}))}
271
271
  /**
272
272
  * Call a contract method.
273
273
  * @param {string} contractAddress The contract address.
@@ -277,13 +277,13 @@ this.buyAccess=ye.bind(this),this.renewAccess=he.bind(this),this.hasAccess=me.bi
277
277
  * @param {CallOptions} [options] The call options.
278
278
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
279
279
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
280
- */callContractMethod(e,t,n,i){return p(this,arguments,void 0,(function*(e,t,n,i,a={}){const r=s({abi:t,name:n}),d=r&&"stateMutability"in r&&("view"===r.stateMutability||"pure"===r.stateMutability);if(!d&&!this.viemClient)throw new Error("WalletClient not connected.");if(d){const a=A();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}{const[r]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),s=o({abi:t,functionName:n,args:i});yield c(this,Y,"m",te).call(this,g);try{const t=yield this.viemClient.sendTransaction({to:e,data:s,account:r,value:a.value,gas:a.gas});if("string"!=typeof t)throw new Error("Transaction failed to send.");if(!a.waitForReceipt)return t;return yield c(this,Y,"m",ee).call(this,t)}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}}))}
280
+ */callContractMethod(e,t,n,i){return c(this,arguments,void 0,(function*(e,t,n,i,a={}){const r=s({abi:t,name:n}),d=r&&"stateMutability"in r&&("view"===r.stateMutability||"pure"===r.stateMutability);if(!d&&!this.viemClient)throw new Error("WalletClient not connected.");if(d){const a=C();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}{const[r]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),s=o({abi:t,functionName:n,args:i});yield y(this,Q,"m",ne).call(this,I);try{const t=yield this.viemClient.sendTransaction({to:e,data:s,account:r,value:a.value,gas:a.gas});if("string"!=typeof t)throw new Error("Transaction failed to send.");if(!a.waitForReceipt)return t;return yield y(this,Q,"m",te).call(this,t)}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}}))}
281
281
  /**
282
282
  * Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
283
283
  * @param {bigint} tokenId The token ID of the asset.
284
284
  * @param {number} periods The number of periods to buy access for.
285
285
  * @returns {Promise<any>} The result of the buyAccess call.
286
- */buyAccessSmart(e,t){return p(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const n=yield this.getTerms(e);if(!n)throw new Error("Failed to fetch terms for asset");const{price:i,paymentToken:a}=n;if(void 0===i||void 0===a)throw new Error("Terms missing price or paymentToken");const s=i*BigInt(t);if(a===d)return this.buyAccess(e,t,s);const o=yield this.viemClient.getAddress();return yield function(e){return p(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:s}){(yield t.readContract({address:n,abi:r,functionName:"allowance",args:[i,a]}))<s&&(yield e.writeContract({address:n,account:i,abi:r,functionName:"approve",args:[a,s],chain:g}))}))}({walletClient:this.viemClient,publicClient:A(),tokenAddress:a,owner:o,spender:S,amount:s}),this.buyAccess(e,t)}))}getData(e){return p(this,void 0,void 0,(function*(){const t=yield fetch(`${E}/auth/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()}))}}Q=new WeakMap,X=new WeakMap,Y=new WeakSet,ee=function(e){return p(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");for(;;){const t=yield this.viemClient.request({method:"eth_getTransactionReceipt",params:[e]});if(t&&t.blockNumber)return t;yield new Promise((e=>setTimeout(e,1e3)))}}))},te=function(e){return p(this,void 0,void 0,(function*(){
286
+ */buyAccessSmart(e,t){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const n=yield this.getTerms(e);if(!n)throw new Error("Failed to fetch terms for asset");const{price:i,paymentToken:a}=n;if(void 0===i||void 0===a)throw new Error("Terms missing price or paymentToken");const s=i*BigInt(t);if(a===d)return this.buyAccess(e,t,s);const o=yield this.viemClient.getAddress();return yield function(e){return c(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:s}){(yield t.readContract({address:n,abi:r,functionName:"allowance",args:[i,a]}))<s&&(yield e.writeContract({address:n,account:i,abi:r,functionName:"approve",args:[a,s],chain:I}))}))}({walletClient:this.viemClient,publicClient:C(),tokenAddress:a,owner:o,spender:O,amount:s}),this.buyAccess(e,t)}))}getData(e){return c(this,void 0,void 0,(function*(){const t=yield fetch(`${x}/auth/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()}))}}X=new WeakMap,ee=new WeakMap,Q=new WeakSet,te=function(e){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");for(;;){const t=yield this.viemClient.request({method:"eth_getTransactionReceipt",params:[e]});if(t&&t.blockNumber)return t;yield new Promise((e=>setTimeout(e,1e3)))}}))},ne=function(e){return c(this,void 0,void 0,(function*(){
287
287
  // return;
288
288
  if(!this.viemClient)throw new Error("WalletClient not connected.");let t=yield this.viemClient.request({method:"eth_chainId",params:[]});if("string"==typeof t&&(t=parseInt(t,16)),t!==e.id)try{yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}catch(t){
289
289
  // Unrecognized chain
@@ -293,7 +293,7 @@ if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthere
293
293
  * @class
294
294
  * @classdesc The Auth class is used to authenticate the user.
295
295
  */
296
- class ve{
296
+ class Te{
297
297
  /**
298
298
  * Constructor for the Auth class.
299
299
  * @param {object} options The options object.
@@ -303,11 +303,11 @@ class ve{
303
303
  * @param {object} [options.ackeeInstance] The Ackee instance.
304
304
  * @throws {APIError} - Throws an error if the clientId is not provided.
305
305
  */
306
- constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i}){if(ne.add(this),ie.set(this,void 0),ae.set(this,void 0),!e)throw new Error("clientId is required");this.viem=null,
306
+ constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i}){if(ie.add(this),ae.set(this,void 0),re.set(this,void 0),!e)throw new Error("clientId is required");this.viem=null,
307
307
  // if (typeof window !== "undefined") {
308
308
  // if (window.ethereum) this.viem = getClient(window.ethereum);
309
309
  // }
310
- this.redirectUri=(e=>{const t=["twitter","discord","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),i&&y(this,ae,i,"f"),n&&c(this,ae,"f"),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,y(this,ie,{},"f"),F((e=>{c(this,ne,"m",re).call(this,"providers",e)})),c(this,ne,"m",se).call(this)}
310
+ this.redirectUri=(e=>{const t=["twitter","discord","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),i&&h(this,re,i,"f"),n&&y(this,re,"f"),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,h(this,ae,{},"f"),j((e=>{y(this,ie,"m",se).call(this,"providers",e)})),y(this,ie,"m",oe).call(this)}
311
311
  /**
312
312
  * Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
313
313
  * @param {("state"|"provider"|"providers"|"viem")} event The event.
@@ -317,34 +317,34 @@ this.redirectUri=(e=>{const t=["twitter","discord","spotify"];return"object"==ty
317
317
  * auth.on("state", (state) => {
318
318
  * console.log(state);
319
319
  * });
320
- */on(e,t){c(this,ie,"f")[e]||(c(this,ie,"f")[e]=[]),c(this,ie,"f")[e].push(t),"providers"===e&&t($())}
320
+ */on(e,t){y(this,ae,"f")[e]||(y(this,ae,"f")[e]=[]),y(this,ae,"f")[e].push(t),"providers"===e&&t(F())}
321
321
  /**
322
322
  * Set the loading state.
323
323
  * @param {boolean} loading The loading state.
324
324
  * @returns {void}
325
- */setLoading(e){c(this,ne,"m",re).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
325
+ */setLoading(e){y(this,ie,"m",se).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
326
326
  /**
327
327
  * 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.
328
328
  * @param {object} options The options object. Includes the provider and the provider info.
329
329
  * @returns {void}
330
330
  * @throws {APIError} - Throws an error if the provider is not provided.
331
- */setProvider({provider:e,info:i,address:a}){if(!e)throw new h("provider is required");this.viem=((e,i="window.ethereum",a)=>{var r;if(!e&&!I)return console.warn("Provider is required to create a client."),null;if(!I||I.transport.name!==i&&e||a!==(null===(r=I.account)||void 0===r?void 0:r.address)&&e){const r={chain:g,transport:t(e,{name:i})};a&&(r.account=u(a)),I=n(r)}return I})(e,i.name,a),this.origin&&this.origin.setViemClient(this.viem),
331
+ */setProvider({provider:e,info:i,address:a}){if(!e)throw new m("provider is required");this.viem=((e,i="window.ethereum",a)=>{var r;if(!e&&!k)return console.warn("Provider is required to create a client."),null;if(!k||k.transport.name!==i&&e||a!==(null===(r=k.account)||void 0===r?void 0:r.address)&&e){const r={chain:I,transport:t(e,{name:i})};a&&(r.account=l(a)),k=n(r)}return k})(e,i.name,a),this.origin&&this.origin.setViemClient(this.viem),
332
332
  // TODO: only use one of these
333
- c(this,ne,"m",re).call(this,"viem",this.viem),c(this,ne,"m",re).call(this,"provider",{provider:e,info:i})}
333
+ y(this,ie,"m",se).call(this,"viem",this.viem),y(this,ie,"m",se).call(this,"provider",{provider:e,info:i})}
334
334
  /**
335
335
  * 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.
336
336
  * @param {string} walletAddress The wallet address.
337
337
  * @returns {void}
338
- */setWalletAddress(e){this.walletAddress=e}recoverProvider(){return p(this,void 0,void 0,(function*(){var e,t,n;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");let i;const a=null!==(e=$())&&void 0!==e?e:[];for(const e of a)try{if((null===(t=(yield e.provider.request({method:"eth_requestAccounts"}))[0])||void 0===t?void 0:t.toLowerCase())===(null===(n=this.walletAddress)||void 0===n?void 0:n.toLowerCase())){i=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}i?this.setProvider({provider:i.provider,info:i.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
338
+ */setWalletAddress(e){this.walletAddress=e}recoverProvider(){return c(this,void 0,void 0,(function*(){var e,t,n;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");let i;const a=null!==(e=F())&&void 0!==e?e:[];for(const e of a)try{if((null===(t=(yield e.provider.request({method:"eth_requestAccounts"}))[0])||void 0===t?void 0:t.toLowerCase())===(null===(n=this.walletAddress)||void 0===n?void 0:n.toLowerCase())){i=e;break}}catch(e){console.warn("Failed to fetch accounts from provider:",e)}i?this.setProvider({provider:i.provider,info:i.info||{name:"Unknown"},address:this.walletAddress}):console.warn("No matching provider found for the stored wallet address. Please connect your wallet again.")}))}
339
339
  /**
340
340
  * Disconnect the user.
341
341
  * @returns {Promise<void>}
342
- */disconnect(){return p(this,void 0,void 0,(function*(){this.isAuthenticated&&(c(this,ne,"m",re).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,localStorage.removeItem("camp-sdk:wallet-address"),localStorage.removeItem("camp-sdk:user-id"),localStorage.removeItem("camp-sdk:jwt"))}))}
342
+ */disconnect(){return c(this,void 0,void 0,(function*(){this.isAuthenticated&&(y(this,ie,"m",se).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,localStorage.removeItem("camp-sdk:wallet-address"),localStorage.removeItem("camp-sdk:user-id"),localStorage.removeItem("camp-sdk:jwt"))}))}
343
343
  /**
344
344
  * Connect the user's wallet and sign the message.
345
345
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
346
346
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
347
- */connect(){return p(this,void 0,void 0,(function*(){c(this,ne,"m",re).call(this,"state","loading");try{this.walletAddress||(yield c(this,ne,"m",oe).call(this));const e=yield c(this,ne,"m",de).call(this),t=c(this,ne,"m",le).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield c(this,ne,"m",ue).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new we(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),c(this,ne,"m",re).call(this,"state","authenticated"),yield c(this,ne,"m",pe).call(this,x.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,c(this,ne,"m",re).call(this,"state","unauthenticated"),new h("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,c(this,ne,"m",re).call(this,"state","unauthenticated"),new h(e)}}))}
347
+ */connect(){return c(this,void 0,void 0,(function*(){y(this,ie,"m",se).call(this,"state","loading");try{this.walletAddress||(yield y(this,ie,"m",de).call(this)),this.walletAddress=u(this.walletAddress);const e=yield y(this,ie,"m",ue).call(this),t=y(this,ie,"m",pe).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield y(this,ie,"m",le).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new ve(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),y(this,ie,"m",se).call(this,"state","authenticated"),yield y(this,ie,"m",ce).call(this,M.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,y(this,ie,"m",se).call(this,"state","unauthenticated"),new m("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,y(this,ie,"m",se).call(this,"state","unauthenticated"),new m(e)}}))}
348
348
  /**
349
349
  * Get the user's linked social accounts.
350
350
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
@@ -353,49 +353,49 @@ c(this,ne,"m",re).call(this,"viem",this.viem),c(this,ne,"m",re).call(this,"provi
353
353
  * const auth = new Auth({ clientId: "your-client-id" });
354
354
  * const socials = await auth.getLinkedSocials();
355
355
  * console.log(socials);
356
- */getLinkedSocials(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${E}/auth/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 h(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}}))}
356
+ */getLinkedSocials(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${x}/auth/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 m(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}}))}
357
357
  /**
358
358
  * Link the user's Twitter account.
359
359
  * @returns {Promise<void>}
360
360
  * @throws {Error} - Throws an error if the user is not authenticated.
361
- */linkTwitter(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
361
+ */linkTwitter(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
362
362
  // await this.#sendAnalyticsEvent(
363
363
  // constants.ACKEE_EVENTS.TWITTER_LINKED,
364
364
  // "Twitter Linked"
365
365
  // );
366
- window.location.href=`${E}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
366
+ window.location.href=`${x}/twitter/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.twitter}`}))}
367
367
  /**
368
368
  * Link the user's Discord account.
369
369
  * @returns {Promise<void>}
370
370
  * @throws {Error} - Throws an error if the user is not authenticated.
371
- */linkDiscord(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
371
+ */linkDiscord(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
372
372
  // await this.#sendAnalyticsEvent(
373
373
  // constants.ACKEE_EVENTS.DISCORD_LINKED,
374
374
  // "Discord Linked"
375
375
  // );
376
- window.location.href=`${E}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
376
+ window.location.href=`${x}/discord/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.discord}`}))}
377
377
  /**
378
378
  * Link the user's Spotify account.
379
379
  * @returns {Promise<void>}
380
380
  * @throws {Error} - Throws an error if the user is not authenticated.
381
- */linkSpotify(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
381
+ */linkSpotify(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");
382
382
  // await this.#sendAnalyticsEvent(
383
383
  // constants.ACKEE_EVENTS.SPOTIFY_LINKED,
384
384
  // "Spotify Linked"
385
385
  // );
386
- window.location.href=`${E}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
386
+ window.location.href=`${x}/spotify/connect?clientId=${this.clientId}&userId=${this.userId}&redirect_url=${this.redirectUri.spotify}`}))}
387
387
  /**
388
388
  * Link the user's TikTok account.
389
389
  * @param {string} handle The user's TikTok handle.
390
390
  * @returns {Promise<any>} A promise that resolves with the TikTok account data.
391
391
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
392
- */linkTikTok(e){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const t=yield fetch(`${E}/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 h("TikTok service is currently unavailable, try again later"):new h(t.message||"Failed to link TikTok account");return c(this,ne,"m",pe).call(this,x.TIKTOK_LINKED,"TikTok Linked"),t.data}))}
392
+ */linkTikTok(e){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const t=yield fetch(`${x}/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 m("TikTok service is currently unavailable, try again later"):new m(t.message||"Failed to link TikTok account");return y(this,ie,"m",ce).call(this,M.TIKTOK_LINKED,"TikTok Linked"),t.data}))}
393
393
  /**
394
394
  * Send an OTP to the user's Telegram account.
395
395
  * @param {string} phoneNumber The user's phone number.
396
396
  * @returns {Promise<any>} A promise that resolves with the OTP data.
397
397
  * @throws {Error|APIError} - Throws an error if the user is not authenticated.
398
- */sendTelegramOTP(e){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e)throw new h("Phone number is required");yield this.unlinkTelegram();const t=yield fetch(`${E}/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 h(t.message||"Failed to send Telegram OTP");return t.data}))}
398
+ */sendTelegramOTP(e){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e)throw new m("Phone number is required");yield this.unlinkTelegram();const t=yield fetch(`${x}/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 m(t.message||"Failed to send Telegram OTP");return t.data}))}
399
399
  /**
400
400
  * Link the user's Telegram account.
401
401
  * @param {string} phoneNumber The user's phone number.
@@ -403,37 +403,37 @@ window.location.href=`${E}/spotify/connect?clientId=${this.clientId}&userId=${th
403
403
  * @param {string} phoneCodeHash The phone code hash.
404
404
  * @returns {Promise<object>} A promise that resolves with the Telegram account data.
405
405
  * @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.
406
- */linkTelegram(e,t,n){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new h("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${E}/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 h(i.message||"Failed to link Telegram account");return c(this,ne,"m",pe).call(this,x.TELEGRAM_LINKED,"Telegram Linked"),i.data}))}
406
+ */linkTelegram(e,t,n){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new m("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${x}/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 m(i.message||"Failed to link Telegram account");return y(this,ie,"m",ce).call(this,M.TELEGRAM_LINKED,"Telegram Linked"),i.data}))}
407
407
  /**
408
408
  * Unlink the user's Twitter account.
409
409
  * @returns {Promise<any>} A promise that resolves with the unlink result.
410
410
  * @throws {Error} - Throws an error if the user is not authenticated.
411
411
  * @throws {APIError} - Throws an error if the request fails.
412
- */unlinkTwitter(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${E}/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 h(e.message||"Failed to unlink Twitter account");return e.data}))}
412
+ */unlinkTwitter(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const e=yield fetch(`${x}/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 m(e.message||"Failed to unlink Twitter account");return e.data}))}
413
413
  /**
414
414
  * Unlink the user's Discord account.
415
415
  * @returns {Promise<any>} A promise that resolves with the unlink result.
416
416
  * @throws {Error} - Throws an error if the user is not authenticated.
417
417
  * @throws {APIError} - Throws an error if the request fails.
418
- */unlinkDiscord(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new h("User needs to be authenticated");const e=yield fetch(`${E}/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 h(e.message||"Failed to unlink Discord account");return e.data}))}
418
+ */unlinkDiscord(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new m("User needs to be authenticated");const e=yield fetch(`${x}/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 m(e.message||"Failed to unlink Discord account");return e.data}))}
419
419
  /**
420
420
  * Unlink the user's Spotify account.
421
421
  * @returns {Promise<any>} A promise that resolves with the unlink result.
422
422
  * @throws {Error} - Throws an error if the user is not authenticated.
423
423
  * @throws {APIError} - Throws an error if the request fails.
424
- */unlinkSpotify(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new h("User needs to be authenticated");const e=yield fetch(`${E}/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 h(e.message||"Failed to unlink Spotify account");return e.data}))}
424
+ */unlinkSpotify(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new m("User needs to be authenticated");const e=yield fetch(`${x}/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 m(e.message||"Failed to unlink Spotify account");return e.data}))}
425
425
  /**
426
426
  * Unlink the user's TikTok account.
427
427
  * @returns {Promise<any>} A promise that resolves with the unlink result.
428
428
  * @throws {Error} - Throws an error if the user is not authenticated.
429
429
  * @throws {APIError} - Throws an error if the request fails.
430
- */unlinkTikTok(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new h("User needs to be authenticated");const e=yield fetch(`${E}/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 h(e.message||"Failed to unlink TikTok account");return e.data}))}
430
+ */unlinkTikTok(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new m("User needs to be authenticated");const e=yield fetch(`${x}/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 m(e.message||"Failed to unlink TikTok account");return e.data}))}
431
431
  /**
432
432
  * Unlink the user's Telegram account.
433
433
  * @returns {Promise<any>} A promise that resolves with the unlink result.
434
434
  * @throws {Error} - Throws an error if the user is not authenticated.
435
435
  * @throws {APIError} - Throws an error if the request fails.
436
- */unlinkTelegram(){return p(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new h("User needs to be authenticated");const e=yield fetch(`${E}/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 h(e.message||"Failed to unlink Telegram account");return e.data}))}}ie=new WeakMap,ae=new WeakMap,ne=new WeakSet,re=function(e,t){c(this,ie,"f")[e]&&c(this,ie,"f")[e].forEach((e=>e(t)))},se=function(e){return p(this,void 0,void 0,(function*(){if("undefined"==typeof localStorage)return;const t=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:wallet-address"),n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:user-id"),i=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:jwt");t&&n&&i?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new we(this.jwt),this.isAuthenticated=!0,
436
+ */unlinkTelegram(){return c(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new m("User needs to be authenticated");const e=yield fetch(`${x}/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 m(e.message||"Failed to unlink Telegram account");return e.data}))}}ae=new WeakMap,re=new WeakMap,ie=new WeakSet,se=function(e,t){y(this,ae,"f")[e]&&y(this,ae,"f")[e].forEach((e=>e(t)))},oe=function(e){return c(this,void 0,void 0,(function*(){if("undefined"==typeof localStorage)return;const t=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:wallet-address"),n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:user-id"),i=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:jwt");t&&n&&i?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new ve(this.jwt),this.isAuthenticated=!0,
437
437
  /*
438
438
  let selectedProvider = provider;
439
439
 
@@ -454,8 +454,8 @@ window.location.href=`${E}/spotify/connect?clientId=${this.clientId}&userId=${th
454
454
  }
455
455
  }
456
456
  */
457
- e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},oe=function(){return p(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=e,e}catch(e){throw new h(e)}}))},de=function(){return p(this,void 0,void 0,(function*(){try{const e=yield fetch(`${E}/auth/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ue=function(e,t){return p(this,void 0,void 0,(function*(){try{const n=yield fetch(`${E}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new h(e)}}))},le=function(e){return l({domain:window.location.host,address:this.walletAddress,statement:C,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},pe=function(e,t){return p(this,arguments,void 0,(function*(e,t,n=1){
457
+ e&&this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t})):this.isAuthenticated=!1}))},de=function(){return c(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=u(e),this.walletAddress}catch(e){throw new m(e)}}))},ue=function(){return c(this,void 0,void 0,(function*(){try{const e=yield fetch(`${x}/auth/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)}}))},le=function(e,t){return c(this,void 0,void 0,(function*(){try{const n=yield fetch(`${x}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new m(e)}}))},pe=function(e){return p({domain:window.location.host,address:this.walletAddress,statement:E,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ce=function(e,t){return c(this,arguments,void 0,(function*(e,t,n=1){
458
458
  // if (this.#ackeeInstance)
459
459
  // await sendAnalyticsEvent(this.#ackeeInstance, event, message, count);
460
460
  // else return;
461
- }))};export{ve as Auth,b as SpotifyAPI,T as TwitterAPI};
461
+ }))};export{Te as Auth,g as SpotifyAPI,b as TwitterAPI};
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
  import React, { createContext, useState, useContext, useEffect, useLayoutEffect, useRef, useSyncExternalStore } from 'react';
3
- import { custom, createWalletClient, createPublicClient, http, erc20Abi, getAbiItem, encodeFunctionData, zeroAddress } from 'viem';
3
+ import { custom, createWalletClient, createPublicClient, http, erc20Abi, getAbiItem, encodeFunctionData, zeroAddress, checksumAddress } from 'viem';
4
4
  import { toAccount } from 'viem/accounts';
5
5
  import { createSiweMessage } from 'viem/siwe';
6
6
  import axios from 'axios';
@@ -2734,6 +2734,7 @@ class Auth {
2734
2734
  if (!this.walletAddress) {
2735
2735
  yield __classPrivateFieldGet(this, _Auth_instances, "m", _Auth_requestAccount).call(this);
2736
2736
  }
2737
+ this.walletAddress = checksumAddress(this.walletAddress);
2737
2738
  const nonce = yield __classPrivateFieldGet(this, _Auth_instances, "m", _Auth_fetchNonce).call(this);
2738
2739
  const message = __classPrivateFieldGet(this, _Auth_instances, "m", _Auth_createMessage).call(this, nonce);
2739
2740
  const signature = yield this.viem.signMessage({
@@ -3168,10 +3169,6 @@ _Auth_triggers = new WeakMap(), _Auth_ackeeInstance = new WeakMap(), _Auth_insta
3168
3169
  address: walletAddress,
3169
3170
  });
3170
3171
  }
3171
- else {
3172
- console.warn("No matching provider was given for the stored wallet address. Trying to recover provider.");
3173
- yield this.recoverProvider();
3174
- }
3175
3172
  }
3176
3173
  else {
3177
3174
  this.isAuthenticated = false;
@@ -3181,8 +3178,8 @@ _Auth_triggers = new WeakMap(), _Auth_ackeeInstance = new WeakMap(), _Auth_insta
3181
3178
  return __awaiter(this, void 0, void 0, function* () {
3182
3179
  try {
3183
3180
  const [account] = yield this.viem.requestAddresses();
3184
- this.walletAddress = account;
3185
- return account;
3181
+ this.walletAddress = checksumAddress(account);
3182
+ return this.walletAddress;
3186
3183
  }
3187
3184
  catch (e) {
3188
3185
  throw new APIError(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campnetwork/origin",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "main": "dist/core.cjs",
5
5
  "exports": {
6
6
  ".": {