@campnetwork/origin 0.0.8 → 0.0.10
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 +32 -31
- package/dist/core.d.ts +4 -3
- package/dist/core.esm.d.ts +4 -3
- package/dist/core.esm.js +52 -51
- package/dist/react/index.esm.d.ts +4 -3
- package/dist/react/index.esm.js +106 -13
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -36,27 +36,28 @@ function a(e,t,n,i){return new(n||(n=Promise))((function(a,r){function s(e){try{
|
|
|
36
36
|
* @param {object} params - An object representing query parameters.
|
|
37
37
|
* @returns {string} - The complete URL with query string.
|
|
38
38
|
*/
|
|
39
|
-
function 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
|
|
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 p="https://wv2h4to5qa.execute-api.us-east-2.amazonaws.com/dev/twitter",l="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="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"}];
|
|
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",T={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"},v="0xF90733b9eCDa3b49C250B2C3E3E42c96fC93324E",b="0x5c5e6b458b2e3924E7688b8Dee1Bb49088F6Fef5";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"},{internalType:"uint256",name:"maxTermDuration_",type:"uint256"},{internalType:"address",name:"signer_",type:"address"}],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:[],name:"InvalidDuration",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:[],name:"maxTermDuration",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"tokenId",type:"uint256"},{internalType:"uint256",name:"parentId",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:[{internalType:"uint256",name:"",type:"uint256"}],name:"parentIpOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"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:"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.
|
|
45
45
|
* @param tokenId The ID of the token to mint.
|
|
46
|
+
* @param parentId The ID of the parent NFT, if applicable.
|
|
46
47
|
* @param hash The hash of the data associated with the NFT.
|
|
47
48
|
* @param uri The URI of the NFT metadata.
|
|
48
49
|
* @param licenseTerms The terms of the license for the NFT.
|
|
49
50
|
* @param deadline The deadline for the minting operation.
|
|
50
51
|
* @param signature The signature for the minting operation.
|
|
51
52
|
* @returns A promise that resolves when the minting is complete.
|
|
52
|
-
*/function C(e,t,n,i,r,s,o){return a(this,void 0,void 0,(function*(){return yield this.callContractMethod(
|
|
53
|
+
*/function C(e,t,n,i,r,s,o,d){return a(this,void 0,void 0,(function*(){return yield this.callContractMethod(v,k,"mintWithSignature",[e,t,n,i,r,s,o,d],{waitForReceipt:!0})}))}
|
|
53
54
|
/**
|
|
54
55
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
55
56
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
56
57
|
* @param deadline The deadline for the registration operation.
|
|
57
58
|
* @param fileKey Optional file key for file uploads.
|
|
58
59
|
* @return A promise that resolves with the registration data.
|
|
59
|
-
*/function E(e,t,n,i){return a(this,void 0,void 0,(function*(){const a={source:e,deadline:Number(t),licenseTerms:{price:n.price.toString(),duration:n.duration,royaltyBps:n.royaltyBps,paymentToken:n.paymentToken}};void 0!==
|
|
60
|
+
*/function E(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:Number(s)||0};void 0!==r&&(a.fileKey=r);const o=yield fetch(`${w}/auth/origin/register`,{method:"POST",headers:{Authorization:`Bearer ${this.getJwt()}`},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}))}function x(e,t){return this.callContractMethod(v,k,"updateTerms",[e,t],{waitForReceipt:!0})}function M(e){return this.callContractMethod(v,k,"requestDelete",[e])}function S(e){return this.callContractMethod(v,k,"getTerms",[e])}function O(e){return this.callContractMethod(v,k,"ownerOf",[e])}function $(e){return this.callContractMethod(v,k,"balanceOf",[e])}function F(e){return this.callContractMethod(v,k,"contentHash",[e])}function j(e){return this.callContractMethod(v,k,"tokenURI",[e])}function P(e){return this.callContractMethod(v,k,"dataStatus",[e])}function N(e,t){return a(this,void 0,void 0,(function*(){return this.callContractMethod(v,k,"royaltyInfo",[e,t])}))}function U(e){return this.callContractMethod(v,k,"getApproved",[e])}function D(e,t){return this.callContractMethod(v,k,"isApprovedForAll",[e,t])}function B(e,t,n){return this.callContractMethod(v,k,"transferFrom",[e,t,n])}function _(e,t,n,i){const a=i?[e,t,n,i]:[e,t,n];return this.callContractMethod(v,k,"safeTransferFrom",a)}function W(e,t){return this.callContractMethod(v,k,"approve",[e,t])}function R(e,t){return this.callContractMethod(v,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
61
|
/**
|
|
61
62
|
* Approves a spender to spend a specified amount of tokens on behalf of the owner.
|
|
62
63
|
* If the current allowance is less than the specified amount, it will perform the approval.
|
|
@@ -66,21 +67,21 @@ let y=null,h=null;const m=()=>(h||(h=t.createPublicClient({chain:c,transport:t.h
|
|
|
66
67
|
* The Origin class
|
|
67
68
|
* Handles the upload of files to Origin, as well as querying the user's stats
|
|
68
69
|
*/
|
|
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
|
|
70
|
-
if(!(
|
|
70
|
+
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,i,r)=>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(Math.floor(Date.now())+600),o=yield this.registerIpNFT("file",s,n,t,a.key,i),{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:c}=o;// 10 minutes from now
|
|
71
|
+
if(!(d&&u&&p&&void 0!==l&&c))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const[y]=yield this.viemClient.request({method:"eth_requestAccounts",params:[]}),h=yield this.mintWithSignature(y,d,i||BigInt(0),p,c,n,s,l);if("0x1"!==h.status)throw new Error(`Minting failed with status: ${h.status}`);return d.toString()})),this.mintSocial=(e,t)=>a(this,void 0,void 0,(function*(){
|
|
71
72
|
// try {
|
|
72
|
-
const n=BigInt(Math.floor(Date.now())+600),i=yield this.registerIpNFT(e,n,t);// 10 minutes from now (temp)
|
|
73
|
-
if(!
|
|
73
|
+
const n=BigInt(Math.floor(Date.now())+600),i={name:`${e} IpNFT`,description:`This is a ${e} IpNFT`},a=yield this.registerIpNFT(e,n,t,i);// 10 minutes from now (temp)
|
|
74
|
+
if(!a)
|
|
74
75
|
// console.error("Failed to register IpNFT");
|
|
75
76
|
// return null;
|
|
76
|
-
throw new Error("Failed to register Social IpNFT");return
|
|
77
|
+
throw new Error("Failed to register Social IpNFT");return a.tokenId.toString();
|
|
77
78
|
// } catch (error) {
|
|
78
79
|
// console.error("Failed to mint social IpNFT:", error);
|
|
79
80
|
// return null;
|
|
80
81
|
// }
|
|
81
82
|
})),this.getOriginUploads=()=>a(this,void 0,void 0,(function*(){const e=yield fetch(`${w}/auth/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data})),this.jwt=t,this.viemClient=n,
|
|
82
83
|
// DataNFT methods
|
|
83
|
-
this.mintWithSignature=C.bind(this),this.registerIpNFT=E.bind(this),this.updateTerms=x.bind(this),this.requestDelete=M.bind(this),this.getTerms=S.bind(this),this.ownerOf=O.bind(this),this.balanceOf=$.bind(this),this.contentHash=F.bind(this),this.tokenURI=j.bind(this),this.dataStatus=P.bind(this),this.royaltyInfo=
|
|
84
|
+
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=N.bind(this),this.getApproved=U.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),
|
|
84
85
|
// Marketplace methods
|
|
85
86
|
this.buyAccess=ae.bind(this),this.renewAccess=re.bind(this),this.hasAccess=se.bind(this),this.subscriptionExpiry=oe.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}
|
|
86
87
|
/**
|
|
@@ -206,7 +207,7 @@ r(this,H,"m",Z).call(this,"viem",this.viem),r(this,H,"m",Z).call(this,"provider"
|
|
|
206
207
|
* Connect the user's wallet and sign the message.
|
|
207
208
|
* @returns {Promise<{ success: boolean; message: string; walletAddress: string }>} A promise that resolves with the authentication result.
|
|
208
209
|
* @throws {APIError} - Throws an error if the user cannot be authenticated.
|
|
209
|
-
*/connect(){return a(this,void 0,void 0,(function*(){r(this,H,"m",Z).call(this,"state","loading");try{this.walletAddress||(yield r(this,H,"m",Q).call(this)),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,
|
|
210
|
+
*/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,T.USER_CONNECTED,"User Connected"),{success:!0,message:"Successfully authenticated",walletAddress:this.walletAddress};throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o("Failed to authenticate")}catch(e){throw this.isAuthenticated=!1,r(this,H,"m",Z).call(this,"state","unauthenticated"),new o(e)}}))}
|
|
210
211
|
/**
|
|
211
212
|
* Get the user's linked social accounts.
|
|
212
213
|
* @returns {Promise<Record<string, boolean>>} A promise that resolves with the user's linked social accounts.
|
|
@@ -251,7 +252,7 @@ window.location.href=`${w}/spotify/connect?clientId=${this.clientId}&userId=${th
|
|
|
251
252
|
* @param {string} handle The user's TikTok handle.
|
|
252
253
|
* @returns {Promise<any>} A promise that resolves with the TikTok account data.
|
|
253
254
|
* @throws {Error|APIError} - Throws an error if the user is not authenticated.
|
|
254
|
-
*/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(`${w}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new o("TikTok service is currently unavailable, try again later"):new o(t.message||"Failed to link TikTok account");return r(this,H,"m",ne).call(this,
|
|
255
|
+
*/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(`${w}/tiktok/connect-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({userHandle:e,clientId:this.clientId,userId:this.userId})}).then((e=>e.json()));if(t.isError)throw"Request failed with status code 502"===t.message?new o("TikTok service is currently unavailable, try again later"):new o(t.message||"Failed to link TikTok account");return r(this,H,"m",ne).call(this,T.TIKTOK_LINKED,"TikTok Linked"),t.data}))}
|
|
255
256
|
/**
|
|
256
257
|
* Send an OTP to the user's Telegram account.
|
|
257
258
|
* @param {string} phoneNumber The user's phone number.
|
|
@@ -265,7 +266,7 @@ window.location.href=`${w}/spotify/connect?clientId=${this.clientId}&userId=${th
|
|
|
265
266
|
* @param {string} phoneCodeHash The phone code hash.
|
|
266
267
|
* @returns {Promise<object>} A promise that resolves with the Telegram account data.
|
|
267
268
|
* @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.
|
|
268
|
-
*/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 o("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${w}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new o(i.message||"Failed to link Telegram account");return r(this,H,"m",ne).call(this,
|
|
269
|
+
*/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 o("Phone number, OTP, and phone code hash are required");const i=yield fetch(`${w}/telegram/signIn-sdk`,{method:"POST",redirect:"follow",headers:{Authorization:`Bearer ${this.jwt}`,"x-client-id":this.clientId,"Content-Type":"application/json"},body:JSON.stringify({phone:e,code:t,phone_code_hash:n,userId:this.userId,clientId:this.clientId})}).then((e=>e.json()));if(i.isError)throw new o(i.message||"Failed to link Telegram account");return r(this,H,"m",ne).call(this,T.TELEGRAM_LINKED,"Telegram Linked"),i.data}))}
|
|
269
270
|
/**
|
|
270
271
|
* Unlink the user's Twitter account.
|
|
271
272
|
* @returns {Promise<any>} A promise that resolves with the unlink result.
|
|
@@ -314,45 +315,45 @@ constructor(e){this.apiKey=e.apiKey}
|
|
|
314
315
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
315
316
|
* @returns {Promise<object>} - The saved tracks.
|
|
316
317
|
* @throws {APIError} - Throws an error if the request fails.
|
|
317
|
-
*/fetchSavedTracksById(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
318
|
+
*/fetchSavedTracksById(e){return a(this,void 0,void 0,(function*(){const t=u(`${l}/save-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
318
319
|
/**
|
|
319
320
|
* Fetch the played tracks of a user by Spotify ID.
|
|
320
321
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
321
322
|
* @returns {Promise<object>} - The played tracks.
|
|
322
323
|
* @throws {APIError} - Throws an error if the request fails.
|
|
323
|
-
*/fetchPlayedTracksById(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
324
|
+
*/fetchPlayedTracksById(e){return a(this,void 0,void 0,(function*(){const t=u(`${l}/played-tracks`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
324
325
|
/**
|
|
325
326
|
* Fetch the user's saved albums by Spotify user ID.
|
|
326
327
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
327
328
|
* @returns {Promise<object>} - The saved albums.
|
|
328
329
|
* @throws {APIError} - Throws an error if the request fails.
|
|
329
|
-
*/fetchSavedAlbumsById(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
330
|
+
*/fetchSavedAlbumsById(e){return a(this,void 0,void 0,(function*(){const t=u(`${l}/saved-albums`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
330
331
|
/**
|
|
331
332
|
* Fetch the user's saved playlists by Spotify user ID.
|
|
332
333
|
* @param {string} spotifyId - The user's Spotify ID.
|
|
333
334
|
* @returns {Promise<object>} - The saved playlists.
|
|
334
335
|
* @throws {APIError} - Throws an error if the request fails.
|
|
335
|
-
*/fetchSavedPlaylistsById(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
336
|
+
*/fetchSavedPlaylistsById(e){return a(this,void 0,void 0,(function*(){const t=u(`${l}/saved-playlists`,{spotifyId:e});return this._fetchDataWithAuth(t)}))}
|
|
336
337
|
/**
|
|
337
338
|
* Fetch the tracks of an album by album ID.
|
|
338
339
|
* @param {string} spotifyId - The Spotify ID of the user.
|
|
339
340
|
* @param {string} albumId - The album ID.
|
|
340
341
|
* @returns {Promise<object>} - The tracks in the album.
|
|
341
342
|
* @throws {APIError} - Throws an error if the request fails.
|
|
342
|
-
*/fetchTracksInAlbum(e,t){return a(this,void 0,void 0,(function*(){const n=u(`${
|
|
343
|
+
*/fetchTracksInAlbum(e,t){return a(this,void 0,void 0,(function*(){const n=u(`${l}/album/tracks`,{spotifyId:e,albumId:t});return this._fetchDataWithAuth(n)}))}
|
|
343
344
|
/**
|
|
344
345
|
* Fetch the tracks in a playlist by playlist ID.
|
|
345
346
|
* @param {string} spotifyId - The Spotify ID of the user.
|
|
346
347
|
* @param {string} playlistId - The playlist ID.
|
|
347
348
|
* @returns {Promise<object>} - The tracks in the playlist.
|
|
348
349
|
* @throws {APIError} - Throws an error if the request fails.
|
|
349
|
-
*/fetchTracksInPlaylist(e,t){return a(this,void 0,void 0,(function*(){const n=u(`${
|
|
350
|
+
*/fetchTracksInPlaylist(e,t){return a(this,void 0,void 0,(function*(){const n=u(`${l}/playlist/tracks`,{spotifyId:e,playlistId:t});return this._fetchDataWithAuth(n)}))}
|
|
350
351
|
/**
|
|
351
352
|
* Fetch the user's Spotify data by wallet address.
|
|
352
353
|
* @param {string} walletAddress - The wallet address.
|
|
353
354
|
* @returns {Promise<object>} - The user's Spotify data.
|
|
354
355
|
* @throws {APIError} - Throws an error if the request fails.
|
|
355
|
-
*/fetchUserByWalletAddress(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
356
|
+
*/fetchUserByWalletAddress(e){return a(this,void 0,void 0,(function*(){const t=u(`${l}/wallet-spotify-data`,{walletAddress:e});return this._fetchDataWithAuth(t)}))}
|
|
356
357
|
/**
|
|
357
358
|
* Private method to fetch data with authorization header.
|
|
358
359
|
* @param {string} url - The URL to fetch.
|
|
@@ -376,7 +377,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
376
377
|
* @param {string} twitterUserName - The Twitter username.
|
|
377
378
|
* @returns {Promise<object>} - The user details.
|
|
378
379
|
* @throws {APIError} - Throws an error if the request fails.
|
|
379
|
-
*/fetchUserByUsername(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
380
|
+
*/fetchUserByUsername(e){return a(this,void 0,void 0,(function*(){const t=u(`${p}/user`,{twitterUserName:e});return this._fetchDataWithAuth(t)}))}
|
|
380
381
|
/**
|
|
381
382
|
* Fetch tweets by Twitter username.
|
|
382
383
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -384,7 +385,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
384
385
|
* @param {number} limit - The number of items per page.
|
|
385
386
|
* @returns {Promise<object>} - The tweets.
|
|
386
387
|
* @throws {APIError} - Throws an error if the request fails.
|
|
387
|
-
*/fetchTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
388
|
+
*/fetchTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/tweets`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
388
389
|
/**
|
|
389
390
|
* Fetch followers by Twitter username.
|
|
390
391
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -392,7 +393,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
392
393
|
* @param {number} limit - The number of items per page.
|
|
393
394
|
* @returns {Promise<object>} - The followers.
|
|
394
395
|
* @throws {APIError} - Throws an error if the request fails.
|
|
395
|
-
*/fetchFollowersByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
396
|
+
*/fetchFollowersByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/followers`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
396
397
|
/**
|
|
397
398
|
* Fetch following by Twitter username.
|
|
398
399
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -400,13 +401,13 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
400
401
|
* @param {number} limit - The number of items per page.
|
|
401
402
|
* @returns {Promise<object>} - The following.
|
|
402
403
|
* @throws {APIError} - Throws an error if the request fails.
|
|
403
|
-
*/fetchFollowingByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
404
|
+
*/fetchFollowingByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/following`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
404
405
|
/**
|
|
405
406
|
* Fetch tweet by tweet ID.
|
|
406
407
|
* @param {string} tweetId - The tweet ID.
|
|
407
408
|
* @returns {Promise<object>} - The tweet.
|
|
408
409
|
* @throws {APIError} - Throws an error if the request fails.
|
|
409
|
-
*/fetchTweetById(e){return a(this,void 0,void 0,(function*(){const t=u(`${
|
|
410
|
+
*/fetchTweetById(e){return a(this,void 0,void 0,(function*(){const t=u(`${p}/getTweetById`,{tweetId:e});return this._fetchDataWithAuth(t)}))}
|
|
410
411
|
/**
|
|
411
412
|
* Fetch user by wallet address.
|
|
412
413
|
* @param {string} walletAddress - The wallet address.
|
|
@@ -414,7 +415,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
414
415
|
* @param {number} limit - The number of items per page.
|
|
415
416
|
* @returns {Promise<object>} - The user data.
|
|
416
417
|
* @throws {APIError} - Throws an error if the request fails.
|
|
417
|
-
*/fetchUserByWalletAddress(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
418
|
+
*/fetchUserByWalletAddress(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/wallet-twitter-data`,{walletAddress:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
418
419
|
/**
|
|
419
420
|
* Fetch reposted tweets by Twitter username.
|
|
420
421
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -422,7 +423,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
422
423
|
* @param {number} limit - The number of items per page.
|
|
423
424
|
* @returns {Promise<object>} - The reposted tweets.
|
|
424
425
|
* @throws {APIError} - Throws an error if the request fails.
|
|
425
|
-
*/fetchRepostedByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
426
|
+
*/fetchRepostedByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/reposted`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
426
427
|
/**
|
|
427
428
|
* Fetch replies by Twitter username.
|
|
428
429
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -430,7 +431,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
430
431
|
* @param {number} limit - The number of items per page.
|
|
431
432
|
* @returns {Promise<object>} - The replies.
|
|
432
433
|
* @throws {APIError} - Throws an error if the request fails.
|
|
433
|
-
*/fetchRepliesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
434
|
+
*/fetchRepliesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/replies`,{twitterUserName:e,page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
434
435
|
/**
|
|
435
436
|
* Fetch likes by Twitter username.
|
|
436
437
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -438,7 +439,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
438
439
|
* @param {number} limit - The number of items per page.
|
|
439
440
|
* @returns {Promise<object>} - The likes.
|
|
440
441
|
* @throws {APIError} - Throws an error if the request fails.
|
|
441
|
-
*/fetchLikesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
442
|
+
*/fetchLikesByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/event/likes/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
442
443
|
/**
|
|
443
444
|
* Fetch follows by Twitter username.
|
|
444
445
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -446,7 +447,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
446
447
|
* @param {number} limit - The number of items per page.
|
|
447
448
|
* @returns {Promise<object>} - The follows.
|
|
448
449
|
* @throws {APIError} - Throws an error if the request fails.
|
|
449
|
-
*/fetchFollowsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
450
|
+
*/fetchFollowsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/event/follows/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
450
451
|
/**
|
|
451
452
|
* Fetch viewed tweets by Twitter username.
|
|
452
453
|
* @param {string} twitterUserName - The Twitter username.
|
|
@@ -454,7 +455,7 @@ constructor({apiKey:e}){this.apiKey=e}
|
|
|
454
455
|
* @param {number} limit - The number of items per page.
|
|
455
456
|
* @returns {Promise<object>} - The viewed tweets.
|
|
456
457
|
* @throws {APIError} - Throws an error if the request fails.
|
|
457
|
-
*/fetchViewedTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${
|
|
458
|
+
*/fetchViewedTweetsByUsername(e){return a(this,arguments,void 0,(function*(e,t=1,n=10){const i=u(`${p}/event/viewed-tweets/${e}`,{page:t,limit:n});return this._fetchDataWithAuth(i)}))}
|
|
458
459
|
/**
|
|
459
460
|
* Private method to fetch data with authorization header.
|
|
460
461
|
* @param {string} url - The URL to fetch.
|
package/dist/core.d.ts
CHANGED
|
@@ -230,6 +230,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
230
230
|
* Mints a Data NFT with a signature.
|
|
231
231
|
* @param to The address to mint the NFT to.
|
|
232
232
|
* @param tokenId The ID of the token to mint.
|
|
233
|
+
* @param parentId The ID of the parent NFT, if applicable.
|
|
233
234
|
* @param hash The hash of the data associated with the NFT.
|
|
234
235
|
* @param uri The URI of the NFT metadata.
|
|
235
236
|
* @param licenseTerms The terms of the license for the NFT.
|
|
@@ -237,7 +238,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
237
238
|
* @param signature The signature for the minting operation.
|
|
238
239
|
* @returns A promise that resolves when the minting is complete.
|
|
239
240
|
*/
|
|
240
|
-
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
241
|
+
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parentId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
241
242
|
/**
|
|
242
243
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
243
244
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
@@ -245,7 +246,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, h
|
|
|
245
246
|
* @param fileKey Optional file key for file uploads.
|
|
246
247
|
* @return A promise that resolves with the registration data.
|
|
247
248
|
*/
|
|
248
|
-
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, fileKey?: string | string[]): Promise<any>;
|
|
249
|
+
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parentId?: bigint): Promise<any>;
|
|
249
250
|
|
|
250
251
|
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
251
252
|
|
|
@@ -334,7 +335,7 @@ declare class Origin {
|
|
|
334
335
|
uploadFile: (file: File, options?: {
|
|
335
336
|
progressCallback?: (percent: number) => void;
|
|
336
337
|
}) => Promise<any>;
|
|
337
|
-
mintFile: (file: File, license: LicenseTerms, options?: {
|
|
338
|
+
mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parentId?: bigint, options?: {
|
|
338
339
|
progressCallback?: (percent: number) => void;
|
|
339
340
|
}) => Promise<string | null>;
|
|
340
341
|
mintSocial: (source: "spotify" | "twitter" | "tiktok", license: LicenseTerms) => Promise<string | null>;
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -230,6 +230,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
230
230
|
* Mints a Data NFT with a signature.
|
|
231
231
|
* @param to The address to mint the NFT to.
|
|
232
232
|
* @param tokenId The ID of the token to mint.
|
|
233
|
+
* @param parentId The ID of the parent NFT, if applicable.
|
|
233
234
|
* @param hash The hash of the data associated with the NFT.
|
|
234
235
|
* @param uri The URI of the NFT metadata.
|
|
235
236
|
* @param licenseTerms The terms of the license for the NFT.
|
|
@@ -237,7 +238,7 @@ type IpNFTSource = "spotify" | "twitter" | "tiktok" | "file";
|
|
|
237
238
|
* @param signature The signature for the minting operation.
|
|
238
239
|
* @returns A promise that resolves when the minting is complete.
|
|
239
240
|
*/
|
|
240
|
-
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
241
|
+
declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, parentId: bigint, hash: Hex, uri: string, licenseTerms: LicenseTerms, deadline: bigint, signature: Hex): Promise<any>;
|
|
241
242
|
/**
|
|
242
243
|
* Registers a Data NFT with the Origin service in order to obtain a signature for minting.
|
|
243
244
|
* @param source The source of the Data NFT (e.g., "spotify", "twitter", "tiktok", or "file").
|
|
@@ -245,7 +246,7 @@ declare function mintWithSignature(this: Origin, to: Address, tokenId: bigint, h
|
|
|
245
246
|
* @param fileKey Optional file key for file uploads.
|
|
246
247
|
* @return A promise that resolves with the registration data.
|
|
247
248
|
*/
|
|
248
|
-
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, fileKey?: string | string[]): Promise<any>;
|
|
249
|
+
declare function registerIpNFT(this: Origin, source: IpNFTSource, deadline: bigint, licenseTerms: LicenseTerms, metadata: Record<string, unknown>, fileKey?: string | string[], parentId?: bigint): Promise<any>;
|
|
249
250
|
|
|
250
251
|
declare function updateTerms(this: Origin, tokenId: bigint, newTerms: LicenseTerms): Promise<any>;
|
|
251
252
|
|
|
@@ -334,7 +335,7 @@ declare class Origin {
|
|
|
334
335
|
uploadFile: (file: File, options?: {
|
|
335
336
|
progressCallback?: (percent: number) => void;
|
|
336
337
|
}) => Promise<any>;
|
|
337
|
-
mintFile: (file: File, license: LicenseTerms, options?: {
|
|
338
|
+
mintFile: (file: File, metadata: Record<string, unknown>, license: LicenseTerms, parentId?: bigint, options?: {
|
|
338
339
|
progressCallback?: (percent: number) => void;
|
|
339
340
|
}) => Promise<string | null>;
|
|
340
341
|
mintSocial: (source: "spotify" | "twitter" | "tiktok", license: LicenseTerms) => Promise<string | null>;
|