@campnetwork/origin 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -970,6 +970,89 @@ The difference between the `openXModal` functions and the `linkX / unlinkX` func
970
970
 
971
971
  For example, if the user is linked to Twitter, calling `openTwitterModal` will open the modal to _unlink_ their Twitter account, while calling `linkTwitter` will not do anything, and calling `unlinkTwitter` will open the modal to unlink their Twitter account.
972
972
 
973
+ ## Origin Methods (`auth.origin`)
974
+
975
+ The `Origin` class provides methods for interacting with Origin IpNFTs, uploading files, managing user stats, and more. You can access these methods via `auth.origin` after authentication.
976
+
977
+ ### Minting
978
+
979
+ #### `mintFile(file: File, license: LicenseTerms, options?: { progressCallback?: (percent: number) => void })`
980
+
981
+ Uploads a file and mints an IpNFT for it.
982
+
983
+ - `file`: The file to upload and mint.
984
+ - `license`: License terms for the IpNFT.
985
+ - `options.progressCallback`: Optional progress callback.
986
+ - **Returns:** The minted token ID as a string, or `null` on failure.
987
+
988
+ #### `mintSocial(source: "spotify" | "twitter" | "tiktok")`
989
+
990
+ Mints an IpNFT for a connected social account.
991
+
992
+ - `source`: The social platform.
993
+ - **Returns:** The minted token ID as a string, or `null` on failure.
994
+
995
+ ### IpNFT & Marketplace Methods
996
+
997
+ The following methods are available for interacting with IpNFTs and the marketplace. All methods mirror the smart contract functions and require appropriate permissions.
998
+
999
+ - `mintWithSignature(...)`
1000
+ - `registerIpNFT(...)`
1001
+ - `updateTerms(...)`
1002
+ - `requestDelete(...)`
1003
+ - `getTerms(tokenId: bigint)`
1004
+ - `ownerOf(tokenId: bigint)`
1005
+ - `balanceOf(owner: string)`
1006
+ - `contentHash(tokenId: bigint)`
1007
+ - `tokenURI(tokenId: bigint)`
1008
+ - `dataStatus(tokenId: bigint)`
1009
+ - `royaltyInfo(tokenId: bigint, value: bigint)`
1010
+ - `getApproved(tokenId: bigint)`
1011
+ - `isApprovedForAll(owner: string, operator: string)`
1012
+ - `transferFrom(from: string, to: string, tokenId: bigint)`
1013
+ - `safeTransferFrom(from: string, to: string, tokenId: bigint)`
1014
+ - `approve(to: string, tokenId: bigint)`
1015
+ - `setApprovalForAll(operator: string, approved: boolean)`
1016
+ - `buyAccess(tokenId: bigint, periods: number, value?: bigint)`
1017
+ - `renewAccess(tokenId: bigint, periods: number)`
1018
+ - `hasAccess(tokenId: bigint, user: string)`
1019
+ - `subscriptionExpiry(tokenId: bigint, user: string)`
1020
+
1021
+ > See the SDK source or contract ABI for full parameter details.
1022
+
1023
+ #### `buyAccessSmart(tokenId: bigint, periods: number)`
1024
+
1025
+ Buys access to an asset, handling payment approval if needed.
1026
+
1027
+ - `tokenId`: The IpNFT token ID.
1028
+ - `periods`: Number of periods to buy.
1029
+ - **Returns:** Result of the buy access transaction.
1030
+
1031
+ #### `getData(tokenId: bigint)`
1032
+
1033
+ Fetches metadata for a given IpNFT.
1034
+
1035
+ - `tokenId`: The IpNFT token ID.
1036
+ - **Returns:** Data object for the token.
1037
+
1038
+ ### User Data & Stats
1039
+
1040
+ #### `getOriginUsage()`
1041
+
1042
+ Fetches the user's Origin stats (multiplier, consent, usage, etc).
1043
+
1044
+ - **Returns:** Object with user stats and usage.
1045
+
1046
+ #### `setOriginConsent(consent: boolean)`
1047
+
1048
+ Sets the user's consent for Origin usage.
1049
+
1050
+ - `consent`: `true` or `false`.
1051
+
1052
+ ---
1053
+
1054
+ You can call these methods as `await auth.origin.methodName(...)` after authenticating with the SDK. For more details, see the inline code documentation.
1055
+
973
1056
  # Contributing
974
1057
 
975
1058
  Install the dependencies.
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 u(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 l="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",p="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/spotify";const c={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,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.http()})),h);var f="Connect with Camp Network",w="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",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"},T="0x3bd5C81a8Adf3355078Dc5F73c41d3194B316690",b="0xAc79E9Ef69021F9bf7Ccb175611F3115Ff65A44D";let g=[];const I=()=>g,A=e=>{function t(t){g.some((e=>e.info.uuid===t.detail.info.uuid))||(g=[...g,t.detail],e(g))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};var k=[{inputs:[{internalType:"string",name:"_name",type:"string"},{internalType:"string",name:"_symbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DurationZero",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"SignatureAlreadyUsed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"contentHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"royaltyAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyPercentages",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyReceivers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"terms",outputs:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"_royaltyReceiver",type:"address"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"usedNonces",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];
41
+ let y=null,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.http()})),h);var f="Connect with Camp Network",w="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev",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"},T="0xb55066f2793773B3784f8c57c415a8b5932B33Cd",b="0x977fdEF62CE095Ae8750Fd3496730F24F60dea7a";let g=[];const I=()=>g,A=e=>{function t(t){g.some((e=>e.info.uuid===t.detail.info.uuid))||(g=[...g,t.detail],e(g))}if("undefined"!=typeof window)return window.addEventListener("eip6963:announceProvider",t),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",t)};var k=[{inputs:[{internalType:"string",name:"_name",type:"string"},{internalType:"string",name:"_symbol",type:"string"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"DurationZero",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"owner",type:"address"}],name:"ERC721IncorrectOwner",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721InsufficientApproval",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC721InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"operator",type:"address"}],name:"ERC721InvalidOperator",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"ERC721InvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC721InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC721InvalidSender",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ERC721NonexistentToken",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"InvalidDeadline",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[],name:"InvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"caller",type:"address"}],name:"NotTokenOwner",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"SignatureAlreadyUsed",type:"error"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"TokenAlreadyExists",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"approved",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"operator",type:"address"},{indexed:!1,internalType:"bool",name:"approved",type:"bool"}],name:"ApprovalForAll",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"approve",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"contentHash",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"dataStatus",outputs:[{internalType:"enum IpNFT.DataStatus",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"finalizeDelete",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getApproved",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"getTerms",outputs:[{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"",type:"tuple"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"operator",type:"address"}],name:"isApprovedForAll",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes32",name:"creatorContentHash",type:"bytes32"},{internalType:"string",name:"uri",type:"string"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"licenseTerms",type:"tuple"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"bytes",name:"signature",type:"bytes"}],name:"mintWithSignature",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"ownerOf",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"salePrice",type:"uint256"}],name:"royaltyInfo",outputs:[{internalType:"address",name:"receiver",type:"address"},{internalType:"uint256",name:"royaltyAmount",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyPercentages",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"royaltyReceivers",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"bytes",name:"data",type:"bytes"}],name:"safeTransferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"operator",type:"address"},{internalType:"bool",name:"approved",type:"bool"}],name:"setApprovalForAll",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes4",name:"interfaceId",type:"bytes4"}],name:"supportsInterface",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"}],name:"terms",outputs:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"uint256",name:"_tokenId",type:"uint256"}],name:"tokenURI",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"transferFrom",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"address",name:"_royaltyReceiver",type:"address"},{components:[{internalType:"uint128",name:"price",type:"uint128"},{internalType:"uint32",name:"duration",type:"uint32"},{internalType:"uint16",name:"royaltyBps",type:"uint16"},{internalType:"address",name:"paymentToken",type:"address"}],internalType:"struct IpNFT.LicenseTerms",name:"newTerms",type:"tuple"}],name:"updateTerms",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"",type:"bytes32"}],name:"usedNonces",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"}];
42
42
  /**
43
43
  * Mints a Data NFT with a signature.
44
44
  * @param to The address to mint the NFT to.
@@ -56,7 +56,7 @@ let y=null,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.h
56
56
  * @param deadline The deadline for the registration operation.
57
57
  * @param fileKey Optional file key for file uploads.
58
58
  * @return A promise that resolves with the registration data.
59
- */function E(e,t,n){return a(this,void 0,void 0,(function*(){const i={source:e,deadline:t.toString()};void 0!==n&&(i.fileKey=n);const a=yield fetch(`${w}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(i)});if(!a.ok)throw new Error(`Failed to get signature: ${a.statusText}`);const r=yield a.json();if(r.isError)throw new Error(`Failed to get signature: ${r.message}`);return r.data}))}function x(e,t){return this.callContractMethod(T,k,"updateTerms",[e,t],{waitForReceipt:!0})}function M(e){return this.callContractMethod(T,k,"requestDelete",[e])}function S(e){return this.callContractMethod(T,k,"getTerms",[e])}function O(e){return this.callContractMethod(T,k,"ownerOf",[e])}function $(e){return this.callContractMethod(T,k,"balanceOf",[e])}function F(e){return this.callContractMethod(T,k,"contentHash",[e])}function P(e){return this.callContractMethod(T,k,"tokenURI",[e])}function j(e){return this.callContractMethod(T,k,"dataStatus",[e])}function U(e,t){return a(this,void 0,void 0,(function*(){return this.callContractMethod(T,k,"royaltyInfo",[e,t])}))}function N(e){return this.callContractMethod(T,k,"getApproved",[e])}function D(e,t){return this.callContractMethod(T,k,"isApprovedForAll",[e,t])}function B(e,t,n){return this.callContractMethod(T,k,"transferFrom",[e,t,n])}function _(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(T,k,"safeTransferFrom",a)}function W(e,t){return this.callContractMethod(T,k,"approve",[e,t])}function R(e,t){return this.callContractMethod(T,k,"setApprovalForAll",[e,t])}var q,z,L,K,J,H,G,V,Z,Y,Q,X,ee,te,ne,ie=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function ae(e,t,n){return this.callContractMethod(b,ie,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function re(e,t,n,i){return this.callContractMethod(b,ie,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function se(e,t){return this.callContractMethod(b,ie,"hasAccess",[e,t])}function oe(e,t){return this.callContractMethod(b,ie,"subscriptionExpiry",[e,t])}
59
+ */function E(e,t,n,i){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==i&&(a.fileKey=i);const r=yield fetch(`${w}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},body:JSON.stringify(a)});if(!r.ok)throw new Error(`Failed to get signature: ${r.statusText}`);const s=yield r.json();if(s.isError)throw new Error(`Failed to get signature: ${s.message}`);return s.data}))}function x(e,t){return this.callContractMethod(T,k,"updateTerms",[e,t],{waitForReceipt:!0})}function M(e){return this.callContractMethod(T,k,"requestDelete",[e])}function S(e){return this.callContractMethod(T,k,"getTerms",[e])}function O(e){return this.callContractMethod(T,k,"ownerOf",[e])}function $(e){return this.callContractMethod(T,k,"balanceOf",[e])}function F(e){return this.callContractMethod(T,k,"contentHash",[e])}function j(e){return this.callContractMethod(T,k,"tokenURI",[e])}function P(e){return this.callContractMethod(T,k,"dataStatus",[e])}function U(e,t){return a(this,void 0,void 0,(function*(){return this.callContractMethod(T,k,"royaltyInfo",[e,t])}))}function N(e){return this.callContractMethod(T,k,"getApproved",[e])}function B(e,t){return this.callContractMethod(T,k,"isApprovedForAll",[e,t])}function D(e,t,n){return this.callContractMethod(T,k,"transferFrom",[e,t,n])}function _(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(T,k,"safeTransferFrom",a)}function W(e,t){return this.callContractMethod(T,k,"approve",[e,t])}function R(e,t){return this.callContractMethod(T,k,"setApprovalForAll",[e,t])}var q,z,L,K,J,H,G,V,Z,Y,Q,X,ee,te,ne,ie=[{inputs:[{internalType:"address",name:"dataNFT_",type:"address"},{internalType:"uint16",name:"protocolFeeBps_",type:"uint16"},{internalType:"address",name:"treasury_",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint256",name:"expected",type:"uint256"},{internalType:"uint256",name:"actual",type:"uint256"}],name:"InvalidPayment",type:"error"},{inputs:[{internalType:"uint32",name:"periods",type:"uint32"}],name:"InvalidPeriods",type:"error"},{inputs:[{internalType:"uint16",name:"royaltyBps",type:"uint16"}],name:"InvalidRoyalty",type:"error"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"OwnableInvalidOwner",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"OwnableUnauthorizedAccount",type:"error"},{inputs:[],name:"TransferFailed",type:"error"},{inputs:[],name:"Unauthorized",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"buyer",type:"address"},{indexed:!1,internalType:"uint32",name:"periods",type:"uint32"},{indexed:!1,internalType:"uint256",name:"newExpiry",type:"uint256"},{indexed:!1,internalType:"uint256",name:"amountPaid",type:"uint256"}],name:"AccessPurchased",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"}],name:"DataDeleted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!0,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"bytes32",name:"contentHash",type:"bytes32"}],name:"DataMinted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint256",name:"royaltyAmount",type:"uint256"},{indexed:!1,internalType:"address",name:"creator",type:"address"},{indexed:!1,internalType:"uint256",name:"protocolAmount",type:"uint256"}],name:"RoyaltyPaid",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"tokenId",type:"uint256"},{indexed:!1,internalType:"uint128",name:"newPrice",type:"uint128"},{indexed:!1,internalType:"uint32",name:"newDuration",type:"uint32"},{indexed:!1,internalType:"uint16",name:"newRoyaltyBps",type:"uint16"},{indexed:!1,internalType:"address",name:"paymentToken",type:"address"}],name:"TermsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"addFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"buyer",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint32",name:"periods",type:"uint32"}],name:"buyAccess",outputs:[],stateMutability:"payable",type:"function"},{inputs:[],name:"dataNFT",outputs:[{internalType:"contract IpNFT",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"",type:"address"}],name:"feeManagers",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"}],name:"hasAccess",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"owner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"paused",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"protocolFeeBps",outputs:[{internalType:"uint16",name:"",type:"uint16"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"feeManager",type:"address"}],name:"removeFeeManager",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"",type:"uint256"},{internalType:"address",name:"",type:"address"}],name:"subscriptionExpiry",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"treasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint16",name:"newFeeBps",type:"uint16"}],name:"updateProtocolFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newTreasury",type:"address"}],name:"updateTreasury",outputs:[],stateMutability:"nonpayable",type:"function"},{stateMutability:"payable",type:"receive"}];function ae(e,t,n){return this.callContractMethod(b,ie,"buyAccess",[e,t],{waitForReceipt:!0,value:n})}function re(e,t,n,i){return this.callContractMethod(b,ie,"renewAccess",[e,t,n],void 0!==i?{value:i}:void 0)}function se(e,t){return this.callContractMethod(b,ie,"hasAccess",[e,t])}function oe(e,t){return this.callContractMethod(b,ie,"subscriptionExpiry",[e,t])}
60
60
  /**
61
61
  * Approves a spender to spend a specified amount of tokens on behalf of the owner.
62
62
  * If the current allowance is less than the specified amount, it will perform the approval.
@@ -66,11 +66,21 @@ let y=null,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.h
66
66
  * The Origin class
67
67
  * Handles the upload of files to Origin, as well as querying the user's stats
68
68
  */
69
- class de{constructor(t,n){q.add(this),z.set(this,(e=>a(this,void 0,void 0,(function*(){const t=yield fetch(`${w}/auth/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`}}),n=yield t.json();return n.isError?n.message:n.data})))),L.set(this,((e,t)=>a(this,void 0,void 0,(function*(){(yield fetch(`${w}/auth/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}})).ok||console.error("Failed to update origin status")})))),this.uploadFile=(t,n)=>a(this,void 0,void 0,(function*(){const i=yield r(this,z,"f").call(this,t);if(i){try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){throw yield r(this,L,"f").call(this,i.key,"failed"),new Error("Failed to upload file: "+e)}return yield r(this,L,"f").call(this,i.key,"success"),i}console.error("Failed to generate upload URL")})),this.mintFile=(e,t,n)=>a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");try{const i=yield this.uploadFile(e,n);if(!i||!i.key)return console.error("Invalid upload info:",i),null;const a=BigInt(Math.floor(Date.now()/1e3)+600),r=yield this.registerDataNFT("file",a,i.key),{tokenId:s,signerAddress:o,hash:d,signature:u}=r;// 10 minutes from now
70
- if(!s||!o||!d||void 0===u)return console.error("Invalid registration data:",r),null;const[l]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]});yield this.mintWithSignature(l,s,d,i.url,t,a,u);return s.toString()}catch(e){return console.error("Failed to upload file:",e),null}})),this.mintSocial=e=>a(this,void 0,void 0,(function*(){try{const t=BigInt(Math.floor(Date.now()/1e3)+600),n=yield this.registerDataNFT(e,t);// 10 minutes from now (temp)
71
- return n?n.tokenId.toString():(console.error("Failed to register DataNFT"),null)}catch(e){return console.error("Failed to mint social DataNFT:",e),null}})),this.getOriginUploads=()=>a(this,void 0,void 0,(function*(){const e=yield fetch(`${w}/auth/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data})),this.jwt=t,this.viemClient=n,
69
+ class de{constructor(t,n){q.add(this),z.set(this,(e=>a(this,void 0,void 0,(function*(){const t=yield fetch(`${w}/auth/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`}}),n=yield t.json();return n.isError?n.message:n.data})))),L.set(this,((e,t)=>a(this,void 0,void 0,(function*(){(yield fetch(`${w}/auth/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}})).ok||console.error("Failed to update origin status")})))),this.uploadFile=(t,n)=>a(this,void 0,void 0,(function*(){const i=yield r(this,z,"f").call(this,t);if(i){try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){throw yield r(this,L,"f").call(this,i.key,"failed"),new Error("Failed to upload file: "+e)}return yield r(this,L,"f").call(this,i.key,"success"),i}console.error("Failed to generate upload URL")})),this.mintFile=(e,t,n)=>a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=yield this.uploadFile(e,n);if(!i||!i.key)throw new Error("Failed to upload file or get upload info.");const a=BigInt(Math.floor(Date.now())+600),r=yield this.registerIpNFT("file",a,t,i.key),{tokenId:s,signerAddress:o,creatorContentHash:d,signature:u,uri:l}=r;// 10 minutes from now
70
+ if(!(s&&o&&d&&void 0!==u&&l))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[p]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),c=yield this.mintWithSignature(p,s,d,l,t,a,u);if("0x1"!==c.status)throw new Error(`Minting failed with status: ${c.status}`);return s.toString()})),this.mintSocial=(e,t)=>a(this,void 0,void 0,(function*(){
71
+ // try {
72
+ const n=BigInt(Math.floor(Date.now())+600),i=yield this.registerIpNFT(e,n,t);// 10 minutes from now (temp)
73
+ if(!i)
74
+ // console.error("Failed to register IpNFT");
75
+ // return null;
76
+ throw new Error("Failed to register Social IpNFT");return i.tokenId.toString();
77
+ // } catch (error) {
78
+ // console.error("Failed to mint social IpNFT:", error);
79
+ // return null;
80
+ // }
81
+ })),this.getOriginUploads=()=>a(this,void 0,void 0,(function*(){const e=yield fetch(`${w}/auth/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data})),this.jwt=t,this.viemClient=n,
72
82
  // DataNFT methods
73
- this.mintWithSignature=C.bind(this),this.registerDataNFT=E.bind(this),this.updateTerms=x.bind(this),this.requestDelete=M.bind(this),this.getTerms=S.bind(this),this.ownerOf=O.bind(this),this.balanceOf=$.bind(this),this.contentHash=F.bind(this),this.tokenURI=P.bind(this),this.dataStatus=j.bind(this),this.royaltyInfo=U.bind(this),this.getApproved=N.bind(this),this.isApprovedForAll=D.bind(this),this.transferFrom=B.bind(this),this.safeTransferFrom=_.bind(this),this.approve=W.bind(this),this.setApprovalForAll=R.bind(this),
83
+ this.mintWithSignature=C.bind(this),this.registerIpNFT=E.bind(this),this.updateTerms=x.bind(this),this.requestDelete=M.bind(this),this.getTerms=S.bind(this),this.ownerOf=O.bind(this),this.balanceOf=$.bind(this),this.contentHash=F.bind(this),this.tokenURI=j.bind(this),this.dataStatus=P.bind(this),this.royaltyInfo=U.bind(this),this.getApproved=N.bind(this),this.isApprovedForAll=B.bind(this),this.transferFrom=D.bind(this),this.safeTransferFrom=_.bind(this),this.approve=W.bind(this),this.setApprovalForAll=R.bind(this),
74
84
  // Marketplace methods
75
85
  this.buyAccess=ae.bind(this),this.renewAccess=re.bind(this),this.hasAccess=se.bind(this),this.subscriptionExpiry=oe.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
76
86
  /**
@@ -135,7 +145,7 @@ if(4902!==t.code)throw t;yield this.viemClient.request({method:"wallet_addEthere
135
145
  }
136
146
  }
137
147
  */
138
- e?this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t}):(console.warn("No matching provider was given for the stored wallet address. Trying to recover provider."),yield this.recoverProvider())):this.isAuthenticated=!1}))},Q=function(){return a(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=e,e}catch(e){throw new o(e)}}))},X=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${w}/auth/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ee=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${w}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new o(e)}}))},te=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:f,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ne=function(e,t){return a(this,arguments,void 0,(function*(e,t,n=1){
148
+ e&&this.setProvider({provider:e.provider,info:e.info||{name:"Unknown"},address:t})):this.isAuthenticated=!1}))},Q=function(){return a(this,void 0,void 0,(function*(){try{const[e]=yield this.viem.requestAddresses();return this.walletAddress=t.checksumAddress(e),this.walletAddress}catch(e){throw new o(e)}}))},X=function(){return a(this,void 0,void 0,(function*(){try{const e=yield fetch(`${w}/auth/client-user/nonce`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({walletAddress:this.walletAddress})}),t=yield e.json();return 200!==e.status?Promise.reject(t.message||"Failed to fetch nonce"):t.data}catch(e){throw new Error(e)}}))},ee=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${w}/auth/client-user/verify`,{method:"POST",headers:{"Content-Type":"application/json","x-client-id":this.clientId},body:JSON.stringify({message:e,signature:t,walletAddress:this.walletAddress})}),i=yield n.json(),a=i.data.split(".")[1],r=JSON.parse(atob(a));return{success:!i.isError,userId:r.id,token:i.data}}catch(e){throw new o(e)}}))},te=function(e){return i.createSiweMessage({domain:window.location.host,address:this.walletAddress,statement:f,uri:window.location.origin,version:"1",chainId:this.viem.chain.id,nonce:e})},ne=function(e,t){return a(this,arguments,void 0,(function*(e,t,n=1){
139
149
  // if (this.#ackeeInstance)
140
150
  // await sendAnalyticsEvent(this.#ackeeInstance, event, message, count);
141
151
  // else return;
@@ -196,7 +206,7 @@ r(this,H,"m",Z).call(this,"viem",this.viem),r(this,H,"m",Z).call(this,"provider"
196
206
  * Connect the user's wallet and sign the message.
197
207
  * @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
198
208
  * @throws {APIError} - Throws an error if the user cannot be authenticated.
199
- */connect(){return a(this,void 0,void 0,(function*(){r(this,H,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,H,"m",Q).call(this));const e=yield r(this,H,"m",X).call(this),t=r(this,H,"m",te).call(this,e),n=yield this.viem.signMessage({account:this.walletAddress,message:t}),i=yield r(this,H,"m",ee).call(this,t,n);if(i.success)return this.isAuthenticated=!0,this.userId=i.userId,this.jwt=i.token,this.origin=new de(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),r(this,H,"m",Z).call(this,"state","authenticated"),yield r(this,H,"m",ne).call(this,v.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o(e)}}))}
209
+ */connect(){return a(this,void 0,void 0,(function*(){r(this,H,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,H,"m",Q).call(this)),this.walletAddress=t.checksumAddress(this.walletAddress);const e=yield r(this,H,"m",X).call(this),n=r(this,H,"m",te).call(this,e),i=yield this.viem.signMessage({account:this.walletAddress,message:n}),a=yield r(this,H,"m",ee).call(this,n,i);if(a.success)return this.isAuthenticated=!0,this.userId=a.userId,this.jwt=a.token,this.origin=new de(this.jwt,this.viem),localStorage.setItem("camp-sdk:jwt",this.jwt),localStorage.setItem("camp-sdk:wallet-address",this.walletAddress),localStorage.setItem("camp-sdk:user-id",this.userId),r(this,H,"m",Z).call(this,"state","authenticated"),yield r(this,H,"m",ne).call(this,v.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o(e)}}))}
200
210
  /**
201
211
  * Get the user's linked social accounts.
202
212
  * @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
package/dist/core.d.ts CHANGED
@@ -221,10 +221,10 @@ declare enum DataStatus {
221
221
  DELETED = 2
222
222
  }
223
223
  /**
224
- * Represents the source of a Data NFT.
224
+ * Represents the source of an IpNFT.
225
225
  * This can be one of the supported social media platforms or a file upload.
226
226
  */
227
- type DataNFTSource = "spotify" | "twitter" | "tiktok" | "file";
227
+ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
228
228
 
229
229
  /**
230
230
  * Mints a Data NFT with a signature.
@@ -245,7 +245,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, h
245
245
  * @param fileKey Optional file key for file uploads.
246
246
  * @return A promise that resolves with the registration data.
247
247
  */
248
- declare function registerDataNFT(this: Origin, source: DataNFTSource, deadline: bigint, fileKey?: string | string[]): Promise<any>;
248
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, fileKey?: string | string[]): Promise<any>;
249
249
 
250
250
  declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
251
251
 
@@ -306,7 +306,7 @@ type CallOptions = {
306
306
  declare class Origin {
307
307
  #private;
308
308
  mintWithSignature: typeof mintWithSignature;
309
- registerDataNFT: typeof registerDataNFT;
309
+ registerIpNFT: typeof registerIpNFT;
310
310
  updateTerms: typeof updateTerms;
311
311
  requestDelete: typeof requestDelete;
312
312
  getTerms: typeof getTerms;
@@ -337,7 +337,7 @@ declare class Origin {
337
337
  mintFile: (file: File, license: LicenseTerms, options?: {
338
338
  progressCallback?: (percent: number) => void;
339
339
  }) => Promise<string | null>;
340
- mintSocial: (source: "spotify" | "twitter" | "tiktok") => Promise<string | null>;
340
+ mintSocial: (source: "spotify" | "twitter" | "tiktok", license: LicenseTerms) => Promise<string | null>;
341
341
  getOriginUploads: () => Promise<any>;
342
342
  /**
343
343
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
@@ -221,10 +221,10 @@ declare enum DataStatus {
221
221
  DELETED = 2
222
222
  }
223
223
  /**
224
- * Represents the source of a Data NFT.
224
+ * Represents the source of an IpNFT.
225
225
  * This can be one of the supported social media platforms or a file upload.
226
226
  */
227
- type DataNFTSource = "spotify" | "twitter" | "tiktok" | "file";
227
+ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
228
228
 
229
229
  /**
230
230
  * Mints a Data NFT with a signature.
@@ -245,7 +245,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, h
245
245
  * @param fileKey Optional file key for file uploads.
246
246
  * @return A promise that resolves with the registration data.
247
247
  */
248
- declare function registerDataNFT(this: Origin, source: DataNFTSource, deadline: bigint, fileKey?: string | string[]): Promise<any>;
248
+ declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, fileKey?: string | string[]): Promise<any>;
249
249
 
250
250
  declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
251
251
 
@@ -306,7 +306,7 @@ type CallOptions = {
306
306
  declare class Origin {
307
307
  #private;
308
308
  mintWithSignature: typeof mintWithSignature;
309
- registerDataNFT: typeof registerDataNFT;
309
+ registerIpNFT: typeof registerIpNFT;
310
310
  updateTerms: typeof updateTerms;
311
311
  requestDelete: typeof requestDelete;
312
312
  getTerms: typeof getTerms;
@@ -337,7 +337,7 @@ declare class Origin {
337
337
  mintFile: (file: File, license: LicenseTerms, options?: {
338
338
  progressCallback?: (percent: number) => void;
339
339
  }) => Promise<string | null>;
340
- mintSocial: (source: "spotify" | "twitter" | "tiktok") => Promise<string | null>;
340
+ mintSocial: (source: "spotify" | "twitter" | "tiktok", license: LicenseTerms) => Promise<string | null>;
341
341
  getOriginUploads: () => Promise<any>;
342
342
  /**
343
343
  * Get the user's Origin stats (multiplier, consent, usage, etc.).