@campnetwork/origin 1.0.0-alpha.2 → 1.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs +59 -31
- package/dist/core.d.ts +43 -6
- package/dist/core.esm.d.ts +43 -6
- package/dist/core.esm.js +102 -74
- package/dist/react/index.esm.d.ts +43 -6
- package/dist/react/index.esm.js +330 -92
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -38,7 +38,7 @@ function a(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{
|
|
|
38
38
|
*/
|
|
39
39
|
function d(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 u="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",p="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";const l={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/"}}};
|
|
40
40
|
// @ts-ignore
|
|
41
|
-
let y=null,c=null;const h=()=>(c||(c=t.createPublicClient({chain:l,transport:t.http()})),c);var m=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{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:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"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:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!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:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"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:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],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:"address",name:"tokenOwner",type:"address"}],name:"getOrCreateRoyaltyVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",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 IIpNFT.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:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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 IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",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:"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:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",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:"tokenInfo",outputs:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{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 IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],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"},{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 IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],T=[{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:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",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:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"TermsMismatch",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:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!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:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],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:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",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"}],f="Connect with Camp Network",v={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"};const w={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x8EB0E8C3bA99c04F05ab01A5BED34F00c6c3BE4D",MARKETPLACE_CONTRACT_ADDRESS:"0x2947eE8a352158fda08F2cf5c0AE8e5b1DFCfDc9",CHAIN:l,IPNFT_ABI:m,MARKETPLACE_ABI:T},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x54d8490f034e3A4D07CD220a7Dc88D9B91B82c25",MARKETPLACE_CONTRACT_ADDRESS:"0x5D2be63c94931f82B602Ecd1538064ab4196F8e7",CHAIN:{id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}},IPNFT_ABI:m,MARKETPLACE_ABI:T}};let A=[];const I=()=>A,b=e=>{function t(t){A.some((e=>e.info.uuid===t.detail.info.uuid))||(A=[...A,t.detail],e(A))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
|
|
41
|
+
let y=null,c=null;const h=()=>(c||(c=t.createPublicClient({chain:l,transport:t.http()})),c);var m=[{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"},{internalType:"address",name:"wCAMP_",type:"address"},{internalType:"uint256",name:"minTermDuration_",type:"uint256"},{internalType:"uint256",name:"minPrice_",type:"uint256"},{internalType:"uint256",name:"maxRoyaltyBps_",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{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:[],name:"InvalidDuration",type:"error"},{inputs:[],name:"InvalidPaymentToken",type:"error"},{inputs:[],name:"InvalidPrice",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"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:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"},{indexed:!1,internalType:"uint256[]",name:"parents",type:"uint256[]"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!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:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"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:"tokenId",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IIpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"disputeModule",outputs:[{internalType:"address",name:"",type:"address"}],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:"address",name:"tokenOwner",type:"address"}],name:"getOrCreateRoyaltyVault",outputs:[{internalType:"address",name:"vault",type:"address"}],stateMutability:"nonpayable",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 IIpNFT.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:"uint256",name:"_tokenId",type:"uint256"}],name:"markDisputed",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"marketPlace",outputs:[{internalType:"contract IMarketplace",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxRoyaltyBps",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minPrice",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"minTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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 IIpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256[]",name:"parents",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:"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:"address",name:"_disputeModule",type:"address"}],name:"setDisputeModule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_marketPlace",type:"address"}],name:"setMarketPlace",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"_signer",type:"address"}],name:"setSigner",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"signer",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",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:"tokenInfo",outputs:[{internalType:"string",name:"tokenURI",type:"string"},{internalType:"bytes32",name:"contentHash",type:"bytes32"},{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 IIpNFT.LicenseTerms",name:"terms",type:"tuple"},{internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],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"},{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 IIpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"wCAMP",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"}],T=[{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:[],name:"InvalidParentIp",type:"error"},{inputs:[],name:"InvalidPayment",type:"error"},{inputs:[],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"MaxParentsExceeded",type:"error"},{inputs:[],name:"MaxRoyaltyExceeded",type:"error"},{inputs:[],name:"NoSubscriptionFound",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:"ParentAlreadyExists",type:"error"},{inputs:[],name:"ParentIpAlreadyDeleted",type:"error"},{inputs:[],name:"ParentIpAlreadyDisputed",type:"error"},{inputs:[],name:"TermsMismatch",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:"id",type:"uint256"},{indexed:!0,internalType:"uint256",name:"childIp",type:"uint256"},{indexed:!1,internalType:"uint256",name:"parentIp",type:"uint256"}],name:"ChildIpTagged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"counterEvidenceHash",type:"bytes32"}],name:"DisputeAssertion",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"}],name:"DisputeCancelled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!1,internalType:"bool",name:"judgement",type:"bool"}],name:"DisputeJudged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"disputeModule",type:"address"}],name:"DisputeModuleUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"id",type:"uint256"},{indexed:!0,internalType:"address",name:"initiator",type:"address"},{indexed:!0,internalType:"uint256",name:"targetId",type:"uint256"},{indexed:!1,internalType:"bytes32",name:"disputeTag",type:"bytes32"}],name:"DisputeRaised",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"marketPlace",type:"address"}],name:"MarketPlaceUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!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:"address",name:"signer",type:"address"}],name:"SignerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"enum IIpNFT.DataStatus",name:"status",type:"uint8"}],name:"StatusUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[],name:"MAX_PARENTS",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"expectedPrice",type:"uint256"},{internalType:"uint32",name:"expectedDuration",type:"uint32"},{internalType:"address",name:"expectedPaymentToken",type:"address"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"uint256",name:"ipId",type:"uint256"},{internalType:"uint256",name:"parent",type:"uint256"}],name:"hasParentIp",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"ipToken",outputs:[{internalType:"contract IIpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"uint256",name:"",type:"uint256"}],name:"parentRoyaltyPercent",outputs:[{internalType:"uint16",name:"",type:"uint16"}],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:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyStack",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"childIpId",type:"uint256"},{internalType:"uint256[]",name:"parents",type:"uint256[]"},{internalType:"address",name:"creator",type:"address"}],name:"setParentIpsAndRoyaltyPercents",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"}],f=[{type:"constructor",inputs:[{name:"_owner",type:"address",internalType:"address"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"claimRoyalty",inputs:[{name:"token",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"owner",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"renounceOwnership",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferOwnership",inputs:[{name:"newOwner",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"event",name:"OwnershipTransferred",inputs:[{name:"previousOwner",type:"address",indexed:!0,internalType:"address"},{name:"newOwner",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"OwnableInvalidOwner",inputs:[{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"OwnableUnauthorizedAccount",inputs:[{name:"account",type:"address",internalType:"address"}]}],v="Connect with Camp Network",w={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"};const A={DEVELOPMENT:{NAME:"DEVELOPMENT",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-testnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x8EB0E8C3bA99c04F05ab01A5BED34F00c6c3BE4D",MARKETPLACE_CONTRACT_ADDRESS:"0x2947eE8a352158fda08F2cf5c0AE8e5b1DFCfDc9",CHAIN:l,IPNFT_ABI:m,MARKETPLACE_ABI:T,ROYALTY_VAULT_ABI:f},PRODUCTION:{NAME:"PRODUCTION",AUTH_HUB_BASE_API:"https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",AUTH_ENDPOINT:"auth-mainnet",ORIGIN_DASHBOARD:"https://origin.campnetwork.xyz",DATANFT_CONTRACT_ADDRESS:"0x54d8490f034e3A4D07CD220a7Dc88D9B91B82c25",MARKETPLACE_CONTRACT_ADDRESS:"0x5D2be63c94931f82B602Ecd1538064ab4196F8e7",CHAIN:{id:484,name:"Camp Network",nativeCurrency:{decimals:18,name:"Camp",symbol:"CAMP"},rpcUrls:{default:{http:["https://rpc.camp.raas.gelato.cloud/"]}},blockExplorers:{default:{name:"Explorer",url:"https://camp.cloud.blockscout.com/"}}},IPNFT_ABI:m,MARKETPLACE_ABI:T,ROYALTY_VAULT_ABI:f}};let I=[];const b=()=>I,g=e=>{function t(t){I.some((e=>e.info.uuid===t.detail.info.uuid))||(I=[...I,t.detail],e(I))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};
|
|
42
42
|
/**
|
|
43
43
|
* Mints a Data NFT with a signature.
|
|
44
44
|
* @param to The address to mint the NFT to.
|
|
@@ -50,56 +50,61 @@ let y=null,c=null;const h=()=>(c||(c=t.createPublicClient({chain:l,transport:t.h
|
|
|
50
50
|
* @param deadline The deadline for the minting operation.
|
|
51
51
|
* @param signature The signature for the minting operation.
|
|
52
52
|
* @returns A promise that resolves when the minting is complete.
|
|
53
|
-
*/function
|
|
53
|
+
*/function E(e,t,n,i,r,s,o,d){return a(this,void 0,void 0,(function*(){return yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"mintWithSignature",[e,t,i,r,s,o,n,d],{waitForReceipt:!0})}))}
|
|
54
54
|
/**
|
|
55
55
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
56
56
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
57
57
|
* @param deadline The deadline for the registration operation.
|
|
58
58
|
* @param fileKey Optional file key for file uploads.
|
|
59
59
|
* @return A promise that resolves with the registration data.
|
|
60
|
-
*/function
|
|
60
|
+
*/function _(e,t,n,i,r,s){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken},metadata:i,parentId:s||[]};void 0!==r&&(a.fileKey=r);const o=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`,"Content-Type":"application/json"},body:JSON.stringify(a)});if(!o.ok)throw new Error(`Failed to get signature: ${o.statusText}`);const d=yield o.json();if(d.isError)throw new Error(`Failed to get signature: ${d.message}`);return d.data}))}
|
|
61
61
|
/**
|
|
62
62
|
* Updates the license terms of a specified IPNFT.
|
|
63
63
|
* @param tokenId The ID of the IPNFT to update.
|
|
64
64
|
* @param newTerms The new license terms to set.
|
|
65
65
|
* @returns A promise that resolves when the transaction is complete.
|
|
66
|
-
*/function
|
|
66
|
+
*/function C(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"updateTerms",[e,t],{waitForReceipt:!0})}
|
|
67
67
|
/**
|
|
68
68
|
* Sets the IPNFT as deleted
|
|
69
69
|
* @param tokenId The token ID to set as deleted.
|
|
70
70
|
* @returns A promise that resolves when the transaction is complete.
|
|
71
|
-
*/function
|
|
71
|
+
*/function k(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"finalizeDelete",[e])}
|
|
72
|
+
/**
|
|
73
|
+
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
74
|
+
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
75
|
+
* @returns The address of the royalty vault associated with the specified token owner.
|
|
76
|
+
*/function S(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e])}
|
|
72
77
|
/**
|
|
73
78
|
* Returns the license terms associated with a specific token ID.
|
|
74
79
|
* @param tokenId The token ID to query.
|
|
75
80
|
* @returns The license terms of the token ID.
|
|
76
|
-
*/function
|
|
81
|
+
*/function D(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getTerms",[e])}
|
|
77
82
|
/**
|
|
78
83
|
* Returns the owner of the specified IPNFT.
|
|
79
84
|
* @param tokenId The ID of the IPNFT to query.
|
|
80
85
|
* @returns The address of the owner of the IPNFT.
|
|
81
|
-
*/function
|
|
86
|
+
*/function N(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"ownerOf",[e])}
|
|
82
87
|
/**
|
|
83
88
|
* Returns the number of IPNFTs owned by the given address.
|
|
84
89
|
* @param owner The address to query.
|
|
85
90
|
* @returns The number of IPNFTs owned by the address.
|
|
86
|
-
*/function
|
|
91
|
+
*/function P(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"balanceOf",[e])}
|
|
87
92
|
/**
|
|
88
93
|
* Returns the metadata URI associated with a specific token ID.
|
|
89
94
|
* @param tokenId The token ID to query.
|
|
90
95
|
* @returns The metadata URI of the token ID.
|
|
91
|
-
*/function
|
|
96
|
+
*/function x(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"tokenURI",[e])}
|
|
92
97
|
/**
|
|
93
98
|
* Returns the data status of the given token ID.
|
|
94
99
|
* @param tokenId The token ID to query.
|
|
95
100
|
* @returns The data status of the token ID.
|
|
96
|
-
*/function
|
|
101
|
+
*/function O(e){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"dataStatus",[e])}
|
|
97
102
|
/**
|
|
98
103
|
* Checks if an operator is approved to manage all assets of a given owner.
|
|
99
104
|
* @param owner The address of the asset owner.
|
|
100
105
|
* @param operator The address of the operator to check.
|
|
101
106
|
* @return A promise that resolves to a boolean indicating if the operator is approved for all assets of the owner.
|
|
102
|
-
*/function
|
|
107
|
+
*/function U(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"isApprovedForAll",[e,t])}function M(e,t,n){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"transferFrom",[e,t,n])}function B(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"safeTransferFrom",a)}function F(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"approve",[e,t])}function R(e,t){return this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"setApprovalForAll",[e,t])}
|
|
103
108
|
/**
|
|
104
109
|
* Buys access to a data NFT for a specified duration.
|
|
105
110
|
* @param buyer The address of the buyer.
|
|
@@ -109,28 +114,28 @@ let y=null,c=null;const h=()=>(c||(c=t.createPublicClient({chain:l,transport:t.h
|
|
|
109
114
|
* @param expectedPaymentToken The address of the payment token (use zero address for native token).
|
|
110
115
|
* @param value The amount of native token to send (only required if paying with native token).
|
|
111
116
|
* @returns A promise that resolves when the transaction is confirmed.
|
|
112
|
-
*/function
|
|
117
|
+
*/function $(e,t,n,i,a,r){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"buyAccess",[e,t,n,i,a],{waitForReceipt:!0,value:r})}
|
|
113
118
|
/**
|
|
114
119
|
* Checks if a user has access to a specific token based on subscription expiry.
|
|
115
120
|
* @param user - The address of the user.
|
|
116
121
|
* @param tokenId - The ID of the token.
|
|
117
122
|
* @returns A promise that resolves to a boolean indicating if the user has access.
|
|
118
|
-
*/function
|
|
123
|
+
*/function H(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield this.subscriptionExpiry(t,e);return n>BigInt(Math.floor(Date.now()/1e3))}catch(e){return!1}}))}function j(e,t){return this.callContractMethod(this.environment.MARKETPLACE_CONTRACT_ADDRESS,this.environment.MARKETPLACE_ABI,"subscriptionExpiry",[e,t])}
|
|
119
124
|
/**
|
|
120
125
|
* Approves a spender to spend a specified amount of tokens on behalf of the owner.
|
|
121
126
|
* If the current allowance is less than the specified amount, it will perform the approval.
|
|
122
127
|
* @param {ApproveParams} params - The parameters for the approval.
|
|
123
|
-
*/var
|
|
128
|
+
*/var L,q,W,z,K,J,V,G,Y,X,Z,Q,ee,te,ne,ie;
|
|
124
129
|
/**
|
|
125
130
|
* The Origin class
|
|
126
131
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
127
|
-
*/class
|
|
128
|
-
if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[c]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()})),this.mintSocial=(e,t,n)=>a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
|
|
129
|
-
if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()})),this.getOriginUploads=()=>a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data})),this.jwt=t,this.viemClient=i,this.environment=n,
|
|
132
|
+
*/class ae{constructor(e,t,n){L.add(this),this.jwt=e,this.viemClient=n,this.environment=t,
|
|
130
133
|
// DataNFT methods
|
|
131
|
-
this.mintWithSignature=
|
|
134
|
+
this.mintWithSignature=E.bind(this),this.registerIpNFT=_.bind(this),this.updateTerms=C.bind(this),this.finalizeDelete=k.bind(this),this.getOrCreateRoyaltyVault=S.bind(this),this.getTerms=D.bind(this),this.ownerOf=N.bind(this),this.balanceOf=P.bind(this),this.tokenURI=x.bind(this),this.dataStatus=O.bind(this),this.isApprovedForAll=U.bind(this),this.transferFrom=M.bind(this),this.safeTransferFrom=B.bind(this),this.approve=F.bind(this),this.setApprovalForAll=R.bind(this),
|
|
132
135
|
// Marketplace methods
|
|
133
|
-
this.buyAccess
|
|
136
|
+
this.buyAccess=$.bind(this),this.hasAccess=H.bind(this),this.subscriptionExpiry=j.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return a(this,void 0,void 0,(function*(){let i;try{i=yield r(this,L,"m",q).call(this,t)}catch(e){throw console.error("Failed to generate upload URL:",e),new Error(`Failed to generate upload URL: ${e instanceof Error?e.message:String(e)}`)}if(!i)throw new Error("Failed to generate upload URL: No upload info returned");try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield r(this,L,"m",W).call(this,i.key,"failed")}catch(e){console.error("Failed to update status to failed:",e)}const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to upload file: ${t}`)}try{yield r(this,L,"m",W).call(this,i.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return i}))}mintFile(e,t,n,i,r){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const a=yield this.uploadFile(e,r);if(!a||!a.key)throw new Error("Failed to upload file or get upload info.");const s=BigInt(Date.now()+6e5),o=yield this.registerIpNFT("file",s,n,t,a.key,i),{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:y}=o;// 10 minutes from now
|
|
137
|
+
if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[c]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()}))}mintSocial(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
|
|
138
|
+
if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
|
|
134
139
|
/**
|
|
135
140
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
136
141
|
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
@@ -150,16 +155,39 @@ this.buyAccess=F.bind(this),this.hasAccess=R.bind(this),this.subscriptionExpiry=
|
|
|
150
155
|
* @param {CallOptions} [options] The call options.
|
|
151
156
|
* @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
|
|
152
157
|
* @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
|
|
153
|
-
*/callContractMethod(e,n,i,s){return a(this,arguments,void 0,(function*(e,n,i,a,s={}){const o=t.getAbiItem({abi:n,name:i}),d=o&&"stateMutability"in o&&("view"===o.stateMutability||"pure"===o.stateMutability);if(!d&&!this.viemClient)throw new Error("WalletClient not connected.");if(d){const t=h();return(yield t.readContract({address:e,abi:n,functionName:i,args:a}))||null}{const[o]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),d=t.encodeFunctionData({abi:n,functionName:i,args:a});yield r(this,
|
|
158
|
+
*/callContractMethod(e,n,i,s){return a(this,arguments,void 0,(function*(e,n,i,a,s={}){const o=t.getAbiItem({abi:n,name:i}),d=o&&"stateMutability"in o&&("view"===o.stateMutability||"pure"===o.stateMutability);if(!d&&!this.viemClient)throw new Error("WalletClient not connected.");if(d){const t=h();return(yield t.readContract({address:e,abi:n,functionName:i,args:a}))||null}{const[o]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),d=t.encodeFunctionData({abi:n,functionName:i,args:a});yield r(this,L,"m",K).call(this,this.environment.CHAIN);try{const t=yield this.viemClient.sendTransaction({to:e,data:d,account:o,value:s.value,gas:s.gas});if("string"!=typeof t)throw new Error("Transaction failed to send.");if(!s.waitForReceipt)return t;return yield r(this,L,"m",z).call(this,t)}catch(e){throw console.error("Transaction failed:",e),new Error("Transaction failed: "+e)}}}))}
|
|
154
159
|
/**
|
|
155
160
|
* Buy access to an asset by first checking its price via getTerms, then calling buyAccess.
|
|
156
161
|
* @param {bigint} tokenId The token ID of the asset.
|
|
157
162
|
* @returns {Promise<any>} The result of the buyAccess call.
|
|
158
|
-
*/buyAccessSmart(e){return a(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:r,duration:s}=n;if(void 0===i||void 0===r||void 0===s)throw new Error("Terms missing price, paymentToken, or duration");const[o]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),d=i;return r===t.zeroAddress?this.buyAccess(o,e,d,s,r,d):(yield function(e){return a(this,arguments,void 0,(function*({walletClient:e,publicClient:n,tokenAddress:i,owner:a,spender:r,amount:s}){(yield n.readContract({address:i,abi:t.erc20Abi,functionName:"allowance",args:[a,r]}))<s&&(yield e.writeContract({address:i,account:a,abi:t.erc20Abi,functionName:"approve",args:[r,s],chain:l}))}))}({walletClient:this.viemClient,publicClient:h(),tokenAddress:r,owner:o,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:d}),this.buyAccess(o,e,d,s,r))}))}getData(e){return a(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
|
|
163
|
+
*/buyAccessSmart(e){return a(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:r,duration:s}=n;if(void 0===i||void 0===r||void 0===s)throw new Error("Terms missing price, paymentToken, or duration");const[o]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),d=i;return r===t.zeroAddress?this.buyAccess(o,e,d,s,r,d):(yield function(e){return a(this,arguments,void 0,(function*({walletClient:e,publicClient:n,tokenAddress:i,owner:a,spender:r,amount:s}){(yield n.readContract({address:i,abi:t.erc20Abi,functionName:"allowance",args:[a,r]}))<s&&(yield e.writeContract({address:i,account:a,abi:t.erc20Abi,functionName:"approve",args:[r,s],chain:l}))}))}({walletClient:this.viemClient,publicClient:h(),tokenAddress:r,owner:o,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:d}),this.buyAccess(o,e,d,s,r))}))}getData(e){return a(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
|
|
164
|
+
/**
|
|
165
|
+
* Get royalty information for a wallet address, including the royalty vault address and its balance.
|
|
166
|
+
* @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
|
|
167
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
|
|
168
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
169
|
+
* @example
|
|
170
|
+
* ```typescript
|
|
171
|
+
* // Get royalties for connected wallet
|
|
172
|
+
* const royalties = await origin.getRoyalties();
|
|
173
|
+
*
|
|
174
|
+
* // Get royalties for specific address
|
|
175
|
+
* const royalties = await origin.getRoyalties("0x1234...");
|
|
176
|
+
* ```
|
|
177
|
+
*/getRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,L,"m",J).call(this,n);try{const n=yield this.getOrCreateRoyaltyVault(i),a=h();let r,s;if(e&&e!==t.zeroAddress){
|
|
178
|
+
// erc20 (wrapped camp)
|
|
179
|
+
const i=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];r=yield this.callContractMethod(e,i,"balanceOf",[n]);const a=yield this.callContractMethod(e,i,"decimals",[]);s=t.formatUnits(r,a)}else r=yield a.getBalance({address:n}),s=t.formatEther(r);return{royaltyVault:n,balance:r,balanceFormatted:s}}catch(e){throw new Error(`Failed to retrieve royalties for address ${i}: ${e instanceof Error?e.message:String(e)}`)}}))}
|
|
180
|
+
/**
|
|
181
|
+
* Claim royalties from the royalty vault.
|
|
182
|
+
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
183
|
+
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
184
|
+
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
185
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
186
|
+
*/claimRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,L,"m",J).call(this,n),a=yield this.getOrCreateRoyaltyVault(i);return this.callContractMethod(a,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:t.zeroAddress],{waitForReceipt:!0})}))}}L=new WeakSet,q=function(e){return a(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},W=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},z=function(e){return a(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)))}}))},K=function(e){return a(this,void 0,void 0,(function*(){
|
|
159
187
|
// return;
|
|
160
188
|
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){
|
|
161
189
|
// Unrecognized chain
|
|
162
|
-
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}))};
|
|
190
|
+
if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16),chainName:e.name,rpcUrls:e.rpcUrls.default.http,nativeCurrency:e.nativeCurrency}]}),yield this.viemClient.request({method:"wallet_switchEthereumChain",params:[{chainId:"0x"+BigInt(e.id).toString(16)}]})}}))},J=function(e){return a(this,void 0,void 0,(function*(){if(e)return e;if(!this.viemClient)throw new Error("No wallet address provided and no wallet client connected. Please provide an owner address or connect a wallet.");try{const e=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});if(!e||0===e.length)throw new Error("No accounts found in connected wallet.");return e[0]}catch(e){throw new Error(`Failed to get wallet address: ${e instanceof Error?e.message:String(e)}`)}}))};G=new WeakMap,Y=new WeakMap,V=new WeakSet,X=function(e,t){r(this,G,"f")[e]&&r(this,G,"f")[e].forEach((e=>e(t)))},Z=function(e){return a(this,void 0,void 0,(function*(){if("undefined"==typeof localStorage)return;const t=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:wallet-address"),n=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:user-id"),i=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:jwt"),a=null===localStorage||void 0===localStorage?void 0:localStorage.getItem("camp-sdk:environment");t&&n&&i&&(a===this.environment.NAME||!a)?(this.walletAddress=t,this.userId=n,this.jwt=i,this.origin=new ae(this.jwt,this.environment),this.isAuthenticated=!0,e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},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 s(e)}}))},ee=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},te=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new s(e)}}))},ne=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:v,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ie=function(e,t){return a(this,arguments,void 0,(function*(e,t,n=1){
|
|
163
191
|
// if (this.#ackeeInstance)
|
|
164
192
|
// await sendAnalyticsEvent(this.#ackeeInstance, event, message, count);
|
|
165
193
|
// else return;
|
|
@@ -180,7 +208,7 @@ class{
|
|
|
180
208
|
* @param {("DEVELOPMENT"|"PRODUCTION")} [options.environment="DEVELOPMENT"] The environment to use.
|
|
181
209
|
* @throws {APIError} - Throws an error if the clientId is not provided.
|
|
182
210
|
*/
|
|
183
|
-
constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,environment:a="DEVELOPMENT"}){if(
|
|
211
|
+
constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,environment:a="DEVELOPMENT"}){if(V.add(this),G.set(this,void 0),Y.set(this,void 0),!e)throw new Error("clientId is required");if(-1===["PRODUCTION","DEVELOPMENT"].indexOf(a))throw new Error("Invalid environment, must be DEVELOPMENT or PRODUCTION");this.viem=null,this.environment=A[a],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),this.clientId=e,this.isAuthenticated=!1,this.jwt=null,this.origin=null,this.walletAddress=null,this.userId=null,function(e,t,n,i,a){if("m"===i)throw new TypeError("Private method is not writable");if("a"===i&&!a)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!a:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===i?a.call(e,n):a?a.value=n:t.set(e,n)}(this,G,{},"f"),g((e=>{r(this,V,"m",X).call(this,"providers",e)})),r(this,V,"m",Z).call(this)}
|
|
184
212
|
/**
|
|
185
213
|
* Subscribe to an event. Possible events are "state", "provider", "providers", and "viem".
|
|
186
214
|
* @param {("state"|"provider"|"providers"|"viem")} event The event.
|
|
@@ -190,12 +218,12 @@ constructor({clientId:e,redirectUri:t,allowAnalytics:n=!0,ackeeInstance:i,enviro
|
|
|
190
218
|
* auth.on("state", (state) => {
|
|
191
219
|
* console.log(state);
|
|
192
220
|
* });
|
|
193
|
-
*/on(e,t){r(this,
|
|
221
|
+
*/on(e,t){r(this,G,"f")[e]||(r(this,G,"f")[e]=[]),r(this,G,"f")[e].push(t),"providers"===e&&t(b())}
|
|
194
222
|
/**
|
|
195
223
|
* Set the loading state.
|
|
196
224
|
* @param {boolean} loading The loading state.
|
|
197
225
|
* @returns {void}
|
|
198
|
-
*/setLoading(e){r(this,
|
|
226
|
+
*/setLoading(e){r(this,V,"m",X).call(this,"state",e?"loading":this.isAuthenticated?"authenticated":"unauthenticated")}
|
|
199
227
|
/**
|
|
200
228
|
* 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.
|
|
201
229
|
* @param {object} options The options object. Includes the provider and the provider info.
|
|
@@ -207,7 +235,7 @@ a,r)=>{var s;if(!e&&!y)return console.warn("Provider is required to create a cli
|
|
|
207
235
|
// chain: chain === "mainnet" ? mainnet : testnet,
|
|
208
236
|
chain:a||l,transport:t.custom(e,{name:i})};r&&(s.account=n.toAccount(r)),y=t.createWalletClient(s)}return y})(e,i.name,this.environment.CHAIN,a),this.origin&&this.origin.setViemClient(this.viem),
|
|
209
237
|
// TODO: only use one of these
|
|
210
|
-
r(this,
|
|
238
|
+
r(this,V,"m",X).call(this,"viem",this.viem),r(this,V,"m",X).call(this,"provider",{provider:e,info:i}),localStorage.setItem("camp-sdk:provider",JSON.stringify(i))}
|
|
211
239
|
/**
|
|
212
240
|
* 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.
|
|
213
241
|
* @param {string} walletAddress The wallet address.
|
|
@@ -216,7 +244,7 @@ r(this,z,"m",V).call(this,"viem",this.viem),r(this,z,"m",V).call(this,"provider"
|
|
|
216
244
|
/**
|
|
217
245
|
* Recover the provider from local storage.
|
|
218
246
|
* @returns {Promise<void>}
|
|
219
|
-
*/recoverProvider(){return a(this,void 0,void 0,(function*(){var e,t,n,i,a,r,s,o,d,u,p,l,y,c,h;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const m=JSON.parse(localStorage.getItem("camp-sdk:provider")||"{}");let T;const f=null!==(e=
|
|
247
|
+
*/recoverProvider(){return a(this,void 0,void 0,(function*(){var e,t,n,i,a,r,s,o,d,u,p,l,y,c,h;if(!this.walletAddress)return void console.warn("No wallet address found in local storage. Please connect your wallet again.");const m=JSON.parse(localStorage.getItem("camp-sdk:provider")||"{}");let T;const f=null!==(e=b())&&void 0!==e?e:[];
|
|
220
248
|
// first pass: try to find provider by UUID/name and check if it has the right address
|
|
221
249
|
// without prompting (using eth_accounts)
|
|
222
250
|
for(const e of f)try{if(m.uuid&&(null===(t=e.info)||void 0===t?void 0:t.uuid)===m.uuid||m.name&&(null===(n=e.info)||void 0===n?void 0:n.name)===m.name){
|
|
@@ -233,12 +261,12 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
233
261
|
/**
|
|
234
262
|
* Disconnect the user.
|
|
235
263
|
* @returns {Promise<void>}
|
|
236
|
-
*/disconnect(){return a(this,void 0,void 0,(function*(){this.isAuthenticated&&(r(this,
|
|
264
|
+
*/disconnect(){return a(this,void 0,void 0,(function*(){this.isAuthenticated&&(r(this,V,"m",X).call(this,"state","unauthenticated"),this.isAuthenticated=!1,this.walletAddress=null,this.userId=null,this.jwt=null,this.origin=null,localStorage.removeItem("camp-sdk:wallet-address"),localStorage.removeItem("camp-sdk:user-id"),localStorage.removeItem("camp-sdk:jwt"),localStorage.removeItem("camp-sdk:environment"))}))}
|
|
237
265
|
/**
|
|
238
266
|
* Connect the user's wallet and sign the message.
|
|
239
267
|
* @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
|
|
240
268
|
* @throws {APIError} - Throws an error if the user cannot be authenticated.
|
|
241
|
-
*/connect(){return a(this,void 0,void 0,(function*(){r(this,
|
|
269
|
+
*/connect(){return a(this,void 0,void 0,(function*(){r(this,V,"m",X).call(this,"state","loading");try{this.walletAddress||(yield r(this,V,"m",Q).call(this)),this.walletAddress=t.checksumAddress(this.walletAddress);const e=yield r(this,V,"m",ee).call(this),n=r(this,V,"m",ne).call(this,e),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),a=yield r(this,V,"m",te).call(this,n,i);if(a.success)return this.isAuthenticated=!0,this.userId=a.userId,this.jwt=a.token,this.origin=new ae(this.jwt,this.environment,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),localStorage.setItem("camp-sdk:environment",this.environment.NAME),r(this,V,"m",X).call(this,"state","authenticated"),yield r(this,V,"m",ie).call(this,w.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,V,"m",X).call(this,"state","unauthenticated"),new s("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,V,"m",X).call(this,"state","unauthenticated"),new s(e)}}))}
|
|
242
270
|
/**
|
|
243
271
|
* Get the user's linked social accounts.
|
|
244
272
|
* @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
|
|
@@ -268,7 +296,7 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
268
296
|
* @param {string} handle The user's TikTok handle.
|
|
269
297
|
* @returns {Promise<any>} A promise that resolves with the TikTok account data.
|
|
270
298
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
271
|
-
*/linkTikTok(e){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new s("TikTok service is currently unavailable, try again later"):new s(t.message||"Failed to link TikTok account");return r(this,
|
|
299
|
+
*/linkTikTok(e){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new s("TikTok service is currently unavailable, try again later"):new s(t.message||"Failed to link TikTok account");return r(this,V,"m",ie).call(this,w.TIKTOK_LINKED,"TikTok Linked"),t.data}))}
|
|
272
300
|
/**
|
|
273
301
|
* Send an OTP to the user's Telegram account.
|
|
274
302
|
* @param {string} phoneNumber The user's phone number.
|
|
@@ -282,7 +310,7 @@ if(!T&&(m.uuid||m.name))for(const e of f)try{if(m.uuid&&(null===(u=e.info)||void
|
|
|
282
310
|
* @param {string} phoneCodeHash The phone code hash.
|
|
283
311
|
* @returns {Promise<object>} A promise that resolves with the Telegram account data.
|
|
284
312
|
* @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.
|
|
285
|
-
*/linkTelegram(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new s("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new s(i.message||"Failed to link Telegram account");return r(this,
|
|
313
|
+
*/linkTelegram(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.isAuthenticated)throw new Error("User needs to be authenticated");if(!e||!t||!n)throw new s("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new s(i.message||"Failed to link Telegram account");return r(this,V,"m",ie).call(this,w.TELEGRAM_LINKED,"Telegram Linked"),i.data}))}
|
|
286
314
|
/**
|
|
287
315
|
* Unlink the user's Twitter account.
|
|
288
316
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
package/dist/core.d.ts
CHANGED
|
@@ -206,6 +206,7 @@ interface Environment {
|
|
|
206
206
|
CHAIN: any;
|
|
207
207
|
IPNFT_ABI?: any;
|
|
208
208
|
MARKETPLACE_ABI?: any;
|
|
209
|
+
ROYALTY_VAULT_ABI?: any;
|
|
209
210
|
}
|
|
210
211
|
|
|
211
212
|
/**
|
|
@@ -275,6 +276,13 @@ declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTer
|
|
|
275
276
|
*/
|
|
276
277
|
declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
277
278
|
|
|
279
|
+
/**
|
|
280
|
+
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
281
|
+
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
282
|
+
* @returns The address of the royalty vault associated with the specified token owner.
|
|
283
|
+
*/
|
|
284
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address): Promise<Address>;
|
|
285
|
+
|
|
278
286
|
/**
|
|
279
287
|
* Returns the license terms associated with a specific token ID.
|
|
280
288
|
* @param tokenId The token ID to query.
|
|
@@ -357,6 +365,11 @@ interface OriginUsageReturnType {
|
|
|
357
365
|
teams: Array<any>;
|
|
358
366
|
dataSources: Array<any>;
|
|
359
367
|
}
|
|
368
|
+
interface RoyaltyInfo {
|
|
369
|
+
royaltyVault: Address;
|
|
370
|
+
balance: bigint;
|
|
371
|
+
balanceFormatted: string;
|
|
372
|
+
}
|
|
360
373
|
type CallOptions = {
|
|
361
374
|
value?: bigint;
|
|
362
375
|
gas?: bigint;
|
|
@@ -372,6 +385,7 @@ declare class Origin {
|
|
|
372
385
|
registerIpNFT: typeof registerIpNFT;
|
|
373
386
|
updateTerms: typeof updateTerms;
|
|
374
387
|
finalizeDelete: typeof finalizeDelete;
|
|
388
|
+
getOrCreateRoyaltyVault: typeof getOrCreateRoyaltyVault;
|
|
375
389
|
getTerms: typeof getTerms;
|
|
376
390
|
ownerOf: typeof ownerOf;
|
|
377
391
|
balanceOf: typeof balanceOf;
|
|
@@ -391,14 +405,14 @@ declare class Origin {
|
|
|
391
405
|
constructor(jwt: string, environment: Environment, viemClient?: any);
|
|
392
406
|
getJwt(): string;
|
|
393
407
|
setViemClient(client: any): void;
|
|
394
|
-
uploadFile
|
|
408
|
+
uploadFile(file: File, options?: {
|
|
395
409
|
progressCallback?: (percent: number) => void;
|
|
396
|
-
})
|
|
397
|
-
mintFile
|
|
410
|
+
}): Promise<any>;
|
|
411
|
+
mintFile(file: File, metadata: Record<string, unknown>, license: LicenseTerms, parents?: bigint[], options?: {
|
|
398
412
|
progressCallback?: (percent: number) => void;
|
|
399
|
-
})
|
|
400
|
-
mintSocial
|
|
401
|
-
getOriginUploads
|
|
413
|
+
}): Promise<string | null>;
|
|
414
|
+
mintSocial(source: "spotify" | "twitter" | "tiktok", metadata: Record<string, unknown>, license: LicenseTerms): Promise<string | null>;
|
|
415
|
+
getOriginUploads(): Promise<any[] | null>;
|
|
402
416
|
/**
|
|
403
417
|
* Get the user's Origin stats (multiplier, consent, usage, etc.).
|
|
404
418
|
* @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
|
|
@@ -429,6 +443,29 @@ declare class Origin {
|
|
|
429
443
|
*/
|
|
430
444
|
buyAccessSmart(tokenId: bigint): Promise<any>;
|
|
431
445
|
getData(tokenId: bigint): Promise<any>;
|
|
446
|
+
/**
|
|
447
|
+
* Get royalty information for a wallet address, including the royalty vault address and its balance.
|
|
448
|
+
* @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
|
|
449
|
+
* @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
|
|
450
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
451
|
+
* @example
|
|
452
|
+
* ```typescript
|
|
453
|
+
* // Get royalties for connected wallet
|
|
454
|
+
* const royalties = await origin.getRoyalties();
|
|
455
|
+
*
|
|
456
|
+
* // Get royalties for specific address
|
|
457
|
+
* const royalties = await origin.getRoyalties("0x1234...");
|
|
458
|
+
* ```
|
|
459
|
+
*/
|
|
460
|
+
getRoyalties(token?: Address, owner?: Address): Promise<RoyaltyInfo>;
|
|
461
|
+
/**
|
|
462
|
+
* Claim royalties from the royalty vault.
|
|
463
|
+
* @param {Address} [token] - Optional token address to claim royalties in. If not provided, claims in native token.
|
|
464
|
+
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
465
|
+
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
466
|
+
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
467
|
+
*/
|
|
468
|
+
claimRoyalties(token?: Address, owner?: Address): Promise<any>;
|
|
432
469
|
}
|
|
433
470
|
|
|
434
471
|
declare global {
|