@campnetwork/origin 1.0.0-alpha.8 → 1.0.0-alpha.9
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 +3 -2
- package/dist/core.d.ts +2 -1
- package/dist/core.esm.d.ts +2 -1
- package/dist/core.esm.js +3 -2
- package/dist/react/index.esm.d.ts +2 -1
- package/dist/react/index.esm.js +5 -4
- package/package.json +1 -1
package/dist/core.cjs
CHANGED
|
@@ -72,8 +72,9 @@ let y=null,c=null,h=null;const m=e=>{var n;const i=h||l;return c&&(null===(n=c.c
|
|
|
72
72
|
/**
|
|
73
73
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
74
74
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
75
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
75
76
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
76
|
-
*/function D(e){return a(this,
|
|
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
78
|
/**
|
|
78
79
|
* Returns the license terms associated with a specific token ID.
|
|
79
80
|
* @param tokenId The token ID to query.
|
|
@@ -185,7 +186,7 @@ const i=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
|
|
|
185
186
|
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
186
187
|
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
187
188
|
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
188
|
-
*/claimRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,q,"m",V).call(this,n),a=yield this.getOrCreateRoyaltyVault(i);return this.callContractMethod(a,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:t.zeroAddress],{waitForReceipt:!0})}))}}q=new WeakSet,W=function(e){return a(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},z=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},K=function(e){return a(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=m();let s=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield r.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
|
|
189
|
+
*/claimRoyalties(e,n){return a(this,void 0,void 0,(function*(){const i=yield r(this,q,"m",V).call(this,n),a=yield this.getOrCreateRoyaltyVault(i,!0);return this.callContractMethod(a,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:t.zeroAddress],{waitForReceipt:!0})}))}}q=new WeakSet,W=function(e){return a(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},z=function(e,t){return a(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},K=function(e){return a(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=m();let s=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield r.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
|
|
189
190
|
// fallback
|
|
190
191
|
const t=Date.now();for(;Date.now()-t<d;){try{const e=yield r.getTransactionReceipt({hash:s});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,u)))}throw e}}))},J=function(e){return a(this,void 0,void 0,(function*(){
|
|
191
192
|
// return;
|
package/dist/core.d.ts
CHANGED
|
@@ -279,9 +279,10 @@ declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
|
279
279
|
/**
|
|
280
280
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
281
281
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
282
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
282
283
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
283
284
|
*/
|
|
284
|
-
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address): Promise<Address>;
|
|
285
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
|
|
285
286
|
|
|
286
287
|
/**
|
|
287
288
|
* Returns the license terms associated with a specific token ID.
|
package/dist/core.esm.d.ts
CHANGED
|
@@ -279,9 +279,10 @@ declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
|
279
279
|
/**
|
|
280
280
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
281
281
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
282
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
282
283
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
283
284
|
*/
|
|
284
|
-
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address): Promise<Address>;
|
|
285
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
|
|
285
286
|
|
|
286
287
|
/**
|
|
287
288
|
* Returns the license terms associated with a specific token ID.
|
package/dist/core.esm.js
CHANGED
|
@@ -235,8 +235,9 @@ let g=null,E=null,_=null;const C=e=>{var t;const n=_||b;return E&&(null===(t=E.c
|
|
|
235
235
|
/**
|
|
236
236
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
237
237
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
238
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
238
239
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
239
|
-
*/function H(e){return c(this,
|
|
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
241
|
/**
|
|
241
242
|
* Returns the license terms associated with a specific token ID.
|
|
242
243
|
* @param tokenId The token ID to query.
|
|
@@ -348,7 +349,7 @@ const n=[{inputs:[{name:"owner",type:"address"}],name:"balanceOf",outputs:[{name
|
|
|
348
349
|
* @param {Address} [owner] - Optional wallet address to claim royalties for. If not provided, uses the connected wallet.
|
|
349
350
|
* @returns {Promise<any>} A promise that resolves when the claim transaction is confirmed.
|
|
350
351
|
* @throws {Error} Throws an error if no wallet is connected and no owner address is provided.
|
|
351
|
-
*/claimRoyalties(e,t){return c(this,void 0,void 0,(function*(){const n=yield h(this,ee,"m",re).call(this,t),i=yield this.getOrCreateRoyaltyVault(n);return this.callContractMethod(i,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:o],{waitForReceipt:!0})}))}}ee=new WeakSet,te=function(e){return c(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},ne=function(e,t){return c(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},ie=function(e){return c(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=C();let s=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield r.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
|
|
352
|
+
*/claimRoyalties(e,t){return c(this,void 0,void 0,(function*(){const n=yield h(this,ee,"m",re).call(this,t),i=yield this.getOrCreateRoyaltyVault(n,!0);return this.callContractMethod(i,this.environment.ROYALTY_VAULT_ABI,"claimRoyalties",[null!=e?e:o],{waitForReceipt:!0})}))}}ee=new WeakSet,te=function(e){return c(this,void 0,void 0,(function*(){try{const t=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/upload-url`,{method:"POST",body:JSON.stringify({name:e.name,type:e.type}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!t.ok)throw new Error(`HTTP ${t.status}: ${t.statusText}`);const n=yield t.json();if(n.isError)throw new Error(n.message||"Failed to generate upload URL");return n.data}catch(e){throw console.error("Failed to generate upload URL:",e),e}}))},ne=function(e,t){return c(this,void 0,void 0,(function*(){try{const n=yield fetch(`${this.environment.AUTH_HUB_BASE_API}/${this.environment.AUTH_ENDPOINT}/origin/update-status`,{method:"PATCH",body:JSON.stringify({status:t,fileKey:e}),headers:{Authorization:`Bearer ${this.jwt}`,"Content-Type":"application/json"}});if(!n.ok){const e=yield n.text().catch((()=>"Unknown error"));throw new Error(`HTTP ${n.status}: ${e}`)}return!0}catch(e){throw console.error("Failed to update origin status:",e),e}}))},ie=function(e){return c(this,arguments,void 0,(function*(e,t={}){var n,i,a;const r=C();let s=e;const o=null!==(n=t.confirmations)&&void 0!==n?n:1,d=null!==(i=t.timeoutMs)&&void 0!==i?i:18e4,u=null!==(a=t.pollingIntervalMs)&&void 0!==a?a:1500;try{return yield r.waitForTransactionReceipt({hash:s,confirmations:o,timeout:d,pollingInterval:u,onReplaced:e=>{s=e.transaction.hash}})}catch(e){
|
|
352
353
|
// fallback
|
|
353
354
|
const t=Date.now();for(;Date.now()-t<d;){try{const e=yield r.getTransactionReceipt({hash:s});if(e&&e.blockNumber)return e}catch(e){}yield new Promise((e=>setTimeout(e,u)))}throw e}}))},ae=function(e){return c(this,void 0,void 0,(function*(){
|
|
354
355
|
// return;
|
|
@@ -85,9 +85,10 @@ declare function finalizeDelete(this: Origin, tokenId: bigint): Promise<any>;
|
|
|
85
85
|
/**
|
|
86
86
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
87
87
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
88
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
88
89
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
89
90
|
*/
|
|
90
|
-
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address): Promise<Address>;
|
|
91
|
+
declare function getOrCreateRoyaltyVault(this: Origin, tokenOwner: Address, simulateOnly?: boolean): Promise<Address>;
|
|
91
92
|
|
|
92
93
|
/**
|
|
93
94
|
* Returns the license terms associated with a specific token ID.
|
package/dist/react/index.esm.js
CHANGED
|
@@ -2736,11 +2736,12 @@ function finalizeDelete(tokenId) {
|
|
|
2736
2736
|
/**
|
|
2737
2737
|
* Calls the getOrCreateRoyaltyVault method on the IPNFT contract.
|
|
2738
2738
|
* @param tokenOwner The address of the token owner for whom to get or create the royalty vault.
|
|
2739
|
+
* @param simulateOnly If true, simulates the transaction without executing it.
|
|
2739
2740
|
* @returns The address of the royalty vault associated with the specified token owner.
|
|
2740
2741
|
*/
|
|
2741
|
-
function getOrCreateRoyaltyVault(
|
|
2742
|
-
return __awaiter(this,
|
|
2743
|
-
const royaltyVaultTx = yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS, this.environment.IPNFT_ABI, "getOrCreateRoyaltyVault", [tokenOwner], { waitForReceipt: true, simulate:
|
|
2742
|
+
function getOrCreateRoyaltyVault(tokenOwner_1) {
|
|
2743
|
+
return __awaiter(this, arguments, void 0, function* (tokenOwner, simulateOnly = false) {
|
|
2744
|
+
const royaltyVaultTx = yield this.callContractMethod(this.environment.DATANFT_CONTRACT_ADDRESS, this.environment.IPNFT_ABI, "getOrCreateRoyaltyVault", [tokenOwner], { waitForReceipt: true, simulate: simulateOnly });
|
|
2744
2745
|
console.log("Royalty Vault Tx:", royaltyVaultTx);
|
|
2745
2746
|
return royaltyVaultTx.simulatedResult;
|
|
2746
2747
|
});
|
|
@@ -3275,7 +3276,7 @@ class Origin {
|
|
|
3275
3276
|
claimRoyalties(token, owner) {
|
|
3276
3277
|
return __awaiter(this, void 0, void 0, function* () {
|
|
3277
3278
|
const walletAddress = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_resolveWalletAddress).call(this, owner);
|
|
3278
|
-
const royaltyVaultAddress = yield this.getOrCreateRoyaltyVault(walletAddress);
|
|
3279
|
+
const royaltyVaultAddress = yield this.getOrCreateRoyaltyVault(walletAddress, true);
|
|
3279
3280
|
return this.callContractMethod(royaltyVaultAddress, this.environment.ROYALTY_VAULT_ABI, "claimRoyalties", [token !== null && token !== void 0 ? token : zeroAddress], { waitForReceipt: true });
|
|
3280
3281
|
});
|
|
3281
3282
|
}
|