@campnetwork/origin 1.0.0-alpha.11 → 1.0.0-alpha.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -74,7 +74,7 @@ let y=null,c=null,h=null;const m=e=>{var n;const i=h||l;return c&&(null===(n=c.c
74
74
  * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
75
75
  * @param simulateOnly If true, simulates the transaction without executing it.
76
76
  * @returns The address of the royalty vault associated with the specified token owner.
77
- */function D(e){return a(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return console.log("Royalty Vault Tx:",n),n.simulatedResult}))}
77
+ */function D(e){return a(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return t?n:n.simulatedResult}))}
78
78
  /**
79
79
  * Returns the license terms associated with a specific token ID.
80
80
  * @param tokenId The token ID to query.
@@ -135,8 +135,8 @@ let y=null,c=null,h=null;const m=e=>{var n;const i=h||l;return c&&(null===(n=c.c
135
135
  this.mintWithSignature=_.bind(this),this.registerIpNFT=C.bind(this),this.updateTerms=k.bind(this),this.finalizeDelete=S.bind(this),this.getOrCreateRoyaltyVault=D.bind(this),this.getTerms=N.bind(this),this.ownerOf=P.bind(this),this.balanceOf=x.bind(this),this.tokenURI=O.bind(this),this.dataStatus=U.bind(this),this.isApprovedForAll=M.bind(this),this.transferFrom=B.bind(this),this.safeTransferFrom=R.bind(this),this.approve=F.bind(this),this.setApprovalForAll=$.bind(this),
136
136
  // Marketplace methods
137
137
  this.buyAccess=H.bind(this),this.hasAccess=j.bind(this),this.subscriptionExpiry=L.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return a(this,void 0,void 0,(function*(){let i;try{i=yield r(this,q,"m",W).call(this,t)}catch(e){throw console.error("Failed to generate upload URL:",e),new Error(`Failed to generate upload URL: ${e instanceof Error?e.message:String(e)}`)}if(!i)throw new Error("Failed to generate upload URL: No upload info returned");try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield r(this,q,"m",z).call(this,i.key,"failed")}catch(e){console.error("Failed to update status to failed:",e)}const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to upload file: ${t}`)}try{yield r(this,q,"m",z).call(this,i.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return i}))}mintFile(e,t,n,i,r){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const a=yield this.uploadFile(e,r);if(!a||!a.key)throw new Error("Failed to upload file or get upload info.");const s=BigInt(Date.now()+6e5),o=yield this.registerIpNFT("file",s,n,t,a.key,i),{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:y}=o;// 10 minutes from now
138
- if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const c=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()}))}mintSocial(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
139
- if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const p=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
138
+ if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const c=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if(-1===["0x1","success"].indexOf(h.receipt.status))throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.receipt.status}`);return d.toString()}))}mintSocial(e,t,n){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
139
+ if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const p=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if(-1===["0x1","success"].indexOf(l.status))throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return a(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
140
140
  /**
141
141
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
142
142
  * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
@@ -166,6 +166,7 @@ if(s.simulate)return p;try{const e=yield this.viemClient.writeContract(l);if("st
166
166
  */buyAccessSmart(e){return a(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const n=yield this.getTerms(e);if(!n)throw new Error("Failed to fetch terms for asset");const{price:i,paymentToken:r,duration:s}=n;if(void 0===i||void 0===r||void 0===s)throw new Error("Terms missing price, paymentToken, or duration");const o=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],d=i;return r===t.zeroAddress?this.buyAccess(o,e,d,s,r,d):(yield function(e){return a(this,arguments,void 0,(function*({walletClient:e,publicClient:n,tokenAddress:i,owner:a,spender:r,amount:s}){(yield n.readContract({address:i,abi:t.erc20Abi,functionName:"allowance",args:[a,r]}))<s&&(yield e.writeContract({address:i,account:a,abi:t.erc20Abi,functionName:"approve",args:[r,s],chain:l}))}))}({walletClient:this.viemClient,publicClient:m(),tokenAddress:r,owner:o,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:d}),this.buyAccess(o,e,d,s,r))}))}getData(e){return a(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
167
167
  /**
168
168
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
169
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
169
170
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
170
171
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
171
172
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
@@ -177,7 +178,7 @@ if(s.simulate)return p;try{const e=yield this.viemClient.writeContract(l);if("st
177
178
  * // Get royalties for specific address
178
179
  * const royalties = await origin.getRoyalties("0x1234...");
179
180
  * ```
180
- */getRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,q,"m",V).call(this,n);try{const n=yield this.getOrCreateRoyaltyVault(i);console.log("Royalty Vault Address:",n);const a=m();let r,s;if(e&&e!==t.zeroAddress){
181
+ */getRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,q,"m",V).call(this,n);try{const n=yield this.getOrCreateRoyaltyVault(i,!0),a=m();let r,s;if(e&&e!==t.zeroAddress){
181
182
  // erc20 (wrapped camp)
182
183
  const i=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];r=yield this.callContractMethod(e,i,"balanceOf",[n]);const a=yield this.callContractMethod(e,i,"decimals",[]);s=t.formatUnits(r,a)}else r=yield a.getBalance({address:n}),s=t.formatEther(r);return{royaltyVault:n,balance:r,balanceFormatted:s}}catch(e){throw new Error(`Failed to retrieve royalties for address ${i}: ${e instanceof Error?e.message:String(e)}`)}}))}
183
184
  /**
package/dist/core.d.ts CHANGED
@@ -447,6 +447,7 @@ declare class Origin {
447
447
  getData(tokenId: bigint): Promise<any>;
448
448
  /**
449
449
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
450
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
450
451
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
451
452
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
452
453
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
@@ -447,6 +447,7 @@ declare class Origin {
447
447
  getData(tokenId: bigint): Promise<any>;
448
448
  /**
449
449
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
450
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
450
451
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
451
452
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
452
453
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
package/dist/core.esm.js CHANGED
@@ -237,7 +237,7 @@ let g=null,E=null,_=null;const C=e=>{var t;const n=_||b;return E&&(null===(t=E.c
237
237
  * @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
238
238
  * @param simulateOnly If true, simulates the transaction without executing it.
239
239
  * @returns The address of the royalty vault associated with the specified token owner.
240
- */function H(e){return c(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return console.log("Royalty Vault Tx:",n),n.simulatedResult}))}
240
+ */function H(e){return c(this,arguments,void 0,(function*(e,t=!1){const n=yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS,this.environment.IPNFT_ABI,"getOrCreateRoyaltyVault",[e],{waitForReceipt:!0,simulate:t});return t?n:n.simulatedResult}))}
241
241
  /**
242
242
  * Returns the license terms associated with a specific token ID.
243
243
  * @param tokenId The token ID to query.
@@ -298,8 +298,8 @@ let g=null,E=null,_=null;const C=e=>{var t;const n=_||b;return E&&(null===(t=E.c
298
298
  this.mintWithSignature=B.bind(this),this.registerIpNFT=R.bind(this),this.updateTerms=F.bind(this),this.finalizeDelete=$.bind(this),this.getOrCreateRoyaltyVault=H.bind(this),this.getTerms=j.bind(this),this.ownerOf=L.bind(this),this.balanceOf=W.bind(this),this.tokenURI=q.bind(this),this.dataStatus=z.bind(this),this.isApprovedForAll=K.bind(this),this.transferFrom=J.bind(this),this.safeTransferFrom=V.bind(this),this.approve=G.bind(this),this.setApprovalForAll=Y.bind(this),
299
299
  // Marketplace methods
300
300
  this.buyAccess=X.bind(this),this.hasAccess=Z.bind(this),this.subscriptionExpiry=Q.bind(this)}getJwt(){return this.jwt}setViemClient(e){this.viemClient=e}uploadFile(t,n){return c(this,void 0,void 0,(function*(){let i;try{i=yield h(this,ee,"m",te).call(this,t)}catch(e){throw console.error("Failed to generate upload URL:",e),new Error(`Failed to generate upload URL: ${e instanceof Error?e.message:String(e)}`)}if(!i)throw new Error("Failed to generate upload URL: No upload info returned");try{yield((t,n,i)=>new Promise(((a,r)=>{e.put(n,t,Object.assign({headers:{"Content-Type":t.type}},"undefined"!=typeof window&&"function"==typeof i?{onUploadProgress:e=>{if(e.total){const t=e.loaded/e.total*100;i(t)}}}:{})).then((e=>{a(e.data)})).catch((e=>{var t;const n=(null===(t=null==e?void 0:e.response)||void 0===t?void 0:t.data)||(null==e?void 0:e.message)||"Upload failed";r(n)}))})))(t,i.url,(null==n?void 0:n.progressCallback)||(()=>{}))}catch(e){try{yield h(this,ee,"m",ne).call(this,i.key,"failed")}catch(e){console.error("Failed to update status to failed:",e)}const t=e instanceof Error?e.message:String(e);throw new Error(`Failed to upload file: ${t}`)}try{yield h(this,ee,"m",ne).call(this,i.key,"success")}catch(e){console.error("Failed to update status to success:",e)}return i}))}mintFile(e,t,n,i,a){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const r=yield this.uploadFile(e,a);if(!r||!r.key)throw new Error("Failed to upload file or get upload info.");const s=BigInt(Date.now()+6e5),o=yield this.registerIpNFT("file",s,n,t,r.key,i),{tokenId:d,signerAddress:u,creatorContentHash:p,signature:l,uri:y}=o;// 10 minutes from now
301
- if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const c=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if("0x1"!==h.status)throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.status}`);return d.toString()}))}mintSocial(e,t,n){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
302
- if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const p=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if("0x1"!==l.status)throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return c(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
301
+ if(!(d&&u&&p&&void 0!==l&&y))throw new Error("Failed to register IpNFT: Missing required fields in registration response.");const c=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],h=yield this.mintWithSignature(c,d,i||[],p,y,n,s,l);if(-1===["0x1","success"].indexOf(h.receipt.status))throw console.error("Minting failed:",h),new Error(`Minting failed with status: ${h.receipt.status}`);return d.toString()}))}mintSocial(e,t,n){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const i=BigInt(Math.floor(Date.now()/1e3)+600),a=yield this.registerIpNFT(e,i,n,t),{tokenId:r,signerAddress:s,creatorContentHash:o,signature:d,uri:u}=a;// 10 minutes from now
302
+ if(!(r&&s&&o&&void 0!==d&&u))throw new Error("Failed to register Social IpNFT: Missing required fields in registration response.");const p=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],l=yield this.mintWithSignature(p,r,[],o,u,n,i,d);if(-1===["0x1","success"].indexOf(l.status))throw new Error(`Minting Social IpNFT failed with status: ${l.status}`);return r.toString()}))}getOriginUploads(){return c(this,void 0,void 0,(function*(){const e=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/files`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`}});if(!e.ok)return console.error("Failed to get origin uploads"),null;return(yield e.json()).data}))}
303
303
  /**
304
304
  * Get the user's Origin stats (multiplier, consent, usage, etc.).
305
305
  * @returns {Promise<OriginUsageReturnType>} A promise that resolves with the user's Origin stats.
@@ -329,6 +329,7 @@ if(a.simulate)return u;try{const e=yield this.viemClient.writeContract(p);if("st
329
329
  */buyAccessSmart(e){return c(this,void 0,void 0,(function*(){if(!this.viemClient)throw new Error("WalletClient not connected.");const t=yield this.getTerms(e);if(!t)throw new Error("Failed to fetch terms for asset");const{price:n,paymentToken:i,duration:a}=t;if(void 0===n||void 0===i||void 0===a)throw new Error("Terms missing price, paymentToken, or duration");const s=(yield this.viemClient.request({method:"eth_requestAccounts",params:[]}))[0],d=n;return i===o?this.buyAccess(s,e,d,a,i,d):(yield function(e){return c(this,arguments,void 0,(function*({walletClient:e,publicClient:t,tokenAddress:n,owner:i,spender:a,amount:s}){(yield t.readContract({address:n,abi:r,functionName:"allowance",args:[i,a]}))<s&&(yield e.writeContract({address:n,account:i,abi:r,functionName:"approve",args:[a,s],chain:b}))}))}({walletClient:this.viemClient,publicClient:C(),tokenAddress:i,owner:s,spender:this.environment.MARKETPLACE_CONTRACT_ADDRESS,amount:d}),this.buyAccess(s,e,d,a,i))}))}getData(e){return c(this,void 0,void 0,(function*(){const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/data/${e}`,{method:"GET",headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error("Failed to fetch data");return t.json()}))}
330
330
  /**
331
331
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
332
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
332
333
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
333
334
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
334
335
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
@@ -340,7 +341,7 @@ if(a.simulate)return u;try{const e=yield this.viemClient.writeContract(p);if("st
340
341
  * // Get royalties for specific address
341
342
  * const royalties = await origin.getRoyalties("0x1234...");
342
343
  * ```
343
- */getRoyalties(e,t){return c(this,void 0,void 0,(function*(){const n=yield h(this,ee,"m",re).call(this,t);try{const t=yield this.getOrCreateRoyaltyVault(n);console.log("Royalty Vault Address:",t);const i=C();let a,r;if(e&&e!==o){
344
+ */getRoyalties(e,t){return c(this,void 0,void 0,(function*(){const n=yield h(this,ee,"m",re).call(this,t);try{const t=yield this.getOrCreateRoyaltyVault(n,!0),i=C();let a,r;if(e&&e!==o){
344
345
  // erc20 (wrapped camp)
345
346
  const n=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],stateMutability:"view",type:"function"}];a=yield this.callContractMethod(e,n,"balanceOf",[t]);const i=yield this.callContractMethod(e,n,"decimals",[]);r=u(a,i)}else a=yield i.getBalance({address:t}),r=d(a);return{royaltyVault:t,balance:a,balanceFormatted:r}}catch(e){throw new Error(`Failed to retrieve royalties for address ${n}: ${e instanceof Error?e.message:String(e)}`)}}))}
346
347
  /**
@@ -253,6 +253,7 @@ declare class Origin {
253
253
  getData(tokenId: bigint): Promise<any>;
254
254
  /**
255
255
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
256
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
256
257
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
257
258
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
258
259
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
@@ -2742,8 +2742,9 @@ function finalizeDelete(tokenId) {
2742
2742
  function getOrCreateRoyaltyVault(tokenOwner_1) {
2743
2743
  return __awaiter(this, arguments, void 0, function* (tokenOwner, simulateOnly = false) {
2744
2744
  const royaltyVaultTx = yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS, this.environment.IPNFT_ABI, "getOrCreateRoyaltyVault", [tokenOwner], { waitForReceipt: true, simulate: simulateOnly });
2745
- console.log("Royalty Vault Tx:", royaltyVaultTx);
2746
- return royaltyVaultTx.simulatedResult;
2745
+ return simulateOnly
2746
+ ? royaltyVaultTx
2747
+ : royaltyVaultTx.simulatedResult;
2747
2748
  });
2748
2749
  }
2749
2750
 
@@ -2981,9 +2982,9 @@ class Origin {
2981
2982
  }));
2982
2983
  const account = accounts[0];
2983
2984
  const mintResult = yield this.mintWithSignature(account, tokenId, parents || [], creatorContentHash, uri, license, deadline, signature);
2984
- if (mintResult.status !== "0x1") {
2985
+ if (["0x1", "success"].indexOf(mintResult.receipt.status) === -1) {
2985
2986
  console.error("Minting failed:", mintResult);
2986
- throw new Error(`Minting failed with status: ${mintResult.status}`);
2987
+ throw new Error(`Minting failed with status: ${mintResult.receipt.status}`);
2987
2988
  }
2988
2989
  return tokenId.toString();
2989
2990
  });
@@ -3009,7 +3010,7 @@ class Origin {
3009
3010
  }));
3010
3011
  const account = accounts[0];
3011
3012
  const mintResult = yield this.mintWithSignature(account, tokenId, [], creatorContentHash, uri, license, deadline, signature);
3012
- if (mintResult.status !== "0x1") {
3013
+ if (["0x1", "success"].indexOf(mintResult.status) === -1) {
3013
3014
  throw new Error(`Minting Social IpNFT failed with status: ${mintResult.status}`);
3014
3015
  }
3015
3016
  return tokenId.toString();
@@ -3204,6 +3205,7 @@ class Origin {
3204
3205
  }
3205
3206
  /**
3206
3207
  * Get royalty information for a wallet address, including the royalty vault address and its balance.
3208
+ * @param {Address} [token] - Optional token address to check royalties for. If not provided, checks for native token.
3207
3209
  * @param {Address} [owner] - Optional wallet address to check royalties for. If not provided, uses the connected wallet.
3208
3210
  * @returns {Promise<RoyaltyInfo>} A promise that resolves with the royalty vault address and balance information.
3209
3211
  * @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
@@ -3220,8 +3222,7 @@ class Origin {
3220
3222
  return __awaiter(this, void 0, void 0, function* () {
3221
3223
  const walletAddress = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_resolveWalletAddress).call(this, owner);
3222
3224
  try {
3223
- const royaltyVaultAddress = yield this.getOrCreateRoyaltyVault(walletAddress);
3224
- console.log("Royalty Vault Address:", royaltyVaultAddress);
3225
+ const royaltyVaultAddress = yield this.getOrCreateRoyaltyVault(walletAddress, true);
3225
3226
  const publicClient = getPublicClient();
3226
3227
  let balance;
3227
3228
  let balanceFormatted;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campnetwork/origin",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.13",
4
4
  "main": "dist/core.cjs",
5
5
  "exports": {
6
6
  ".": {