@campnetwork/origin 1.4.0-alpha.2 → 1.4.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core.cjs CHANGED
@@ -838,9 +838,9 @@ o,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e ins
838
838
  * @param {CallOptions} [options] The call options.
839
839
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
840
840
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
841
- */callContractMethod(t,n,i,r){return a(this,arguments,void 0,(function*(t,n,i,a,r={}){var o;let p=null;try{p=yield s(this,Le,"m",Ke).call(this)}catch(e){throw new v(`Cannot call "${i}" on contract ${t}: wallet not connected`)}const d=e.getAbiItem({abi:n,name:i});if(d&&"stateMutability"in d&&("view"===d.stateMutability||"pure"===d.stateMutability)){const e=C();return(yield e.readContract({address:t,abi:n,functionName:i,args:a}))||null}yield s(this,Le,"m",Ge).call(this,this.environment.CHAIN);const u=C(),{result:l,request:y}=yield u.simulateContract({account:p,address:t,abi:n,functionName:i,args:a,value:r.value});
841
+ */callContractMethod(t,n,i,r){return a(this,arguments,void 0,(function*(t,n,i,a,r={}){var o,p;let d=null;try{d=yield s(this,Le,"m",Ke).call(this)}catch(e){throw new v(`Cannot call "${i}" on contract ${t}: wallet not connected`)}const u=e.getAbiItem({abi:n,name:i});if(u&&"stateMutability"in u&&("view"===u.stateMutability||"pure"===u.stateMutability)){const e=C();return null!==(o=yield e.readContract({address:t,abi:n,functionName:i,args:a}))&&void 0!==o?o:null}yield s(this,Le,"m",Ge).call(this,this.environment.CHAIN);const l=C(),{result:y,request:c}=yield l.simulateContract({account:d,address:t,abi:n,functionName:i,args:a,value:r.value});
842
842
  // simulate
843
- if(r.simulate)return l;try{const e=yield null===(o=this.viemClient)||void 0===o?void 0:o.writeContract(y);if("string"!=typeof e)throw new w(`Transaction for "${i}" failed to send: no transaction hash returned`,{contractName:t,methodName:i});if(!r.waitForReceipt)return{txHash:e,simulatedResult:l};return{txHash:e,receipt:yield s(this,Le,"m",We).call(this,e),simulatedResult:l}}catch(e){if(e instanceof w||e instanceof v)throw e;throw new w(`Transaction for "${i}" failed: ${A(e)}`,{contractName:t,methodName:i})}}))}
843
+ if(r.simulate)return y;try{const e=yield null===(p=this.viemClient)||void 0===p?void 0:p.writeContract(c);if("string"!=typeof e)throw new w(`Transaction for "${i}" failed to send: no transaction hash returned`,{contractName:t,methodName:i});if(!r.waitForReceipt)return{txHash:e,simulatedResult:y};return{txHash:e,receipt:yield s(this,Le,"m",We).call(this,e),simulatedResult:y}}catch(e){if(e instanceof w||e instanceof v)throw e;throw new w(`Transaction for "${i}" failed: ${A(e)}`,{contractName:t,methodName:i})}}))}
844
844
  /**
845
845
  * Gets comprehensive token information in a single call.
846
846
  * Combines owner, status, terms, URI, and access information.
package/dist/core.esm.js CHANGED
@@ -828,9 +828,9 @@ r,this.appId)}catch(e){throw new Error(`Failed to register Social IpNFT: ${e ins
828
828
  * @param {CallOptions} [options] The call options.
829
829
  * @returns {Promise<any>} A promise that resolves with the result of the contract call or transaction hash.
830
830
  * @throws {Error} - Throws an error if the wallet client is not connected and the method is not a view function.
831
- */callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s;let r=null;try{r=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const p=o({abi:t,name:n});if(p&&"stateMutability"in p&&("view"===p.stateMutability||"pure"===p.stateMutability)){const a=B();return(yield a.readContract({address:e,abi:t,functionName:n,args:i}))||null}yield h(this,nt,"m",pt).call(this,this.environment.CHAIN);const d=B(),{result:u,request:l}=yield d.simulateContract({account:r,address:e,abi:t,functionName:n,args:i,value:a.value});
831
+ */callContractMethod(e,t,n,i){return m(this,arguments,void 0,(function*(e,t,n,i,a={}){var s,r;let p=null;try{p=yield h(this,nt,"m",dt).call(this)}catch(t){throw new R(`Cannot call "${n}" on contract ${e}: wallet not connected`)}const d=o({abi:t,name:n});if(d&&"stateMutability"in d&&("view"===d.stateMutability||"pure"===d.stateMutability)){const a=B();return null!==(s=yield a.readContract({address:e,abi:t,functionName:n,args:i}))&&void 0!==s?s:null}yield h(this,nt,"m",pt).call(this,this.environment.CHAIN);const u=B(),{result:l,request:y}=yield u.simulateContract({account:p,address:e,abi:t,functionName:n,args:i,value:a.value});
832
832
  // simulate
833
- if(a.simulate)return u;try{const t=yield null===(s=this.viemClient)||void 0===s?void 0:s.writeContract(l);if("string"!=typeof t)throw new x(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:u};return{txHash:t,receipt:yield h(this,nt,"m",ot).call(this,t),simulatedResult:u}}catch(t){if(t instanceof x||t instanceof R)throw t;throw new x(`Transaction for "${n}" failed: ${k(t)}`,{contractName:e,methodName:n})}}))}
833
+ if(a.simulate)return l;try{const t=yield null===(r=this.viemClient)||void 0===r?void 0:r.writeContract(y);if("string"!=typeof t)throw new x(`Transaction for "${n}" failed to send: no transaction hash returned`,{contractName:e,methodName:n});if(!a.waitForReceipt)return{txHash:t,simulatedResult:l};return{txHash:t,receipt:yield h(this,nt,"m",ot).call(this,t),simulatedResult:l}}catch(t){if(t instanceof x||t instanceof R)throw t;throw new x(`Transaction for "${n}" failed: ${k(t)}`,{contractName:e,methodName:n})}}))}
834
834
  /**
835
835
  * Gets comprehensive token information in a single call.
836
836
  * Combines owner, status, terms, URI, and access information.
@@ -8874,7 +8874,7 @@ class Origin {
8874
8874
  */
8875
8875
  callContractMethod(contractAddress_1, abi_1, methodName_1, params_1) {
8876
8876
  return __awaiter(this, arguments, void 0, function* (contractAddress, abi, methodName, params, options = {}) {
8877
- var _a;
8877
+ var _a, _b;
8878
8878
  let account = null;
8879
8879
  try {
8880
8880
  account = yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_getCurrentAccount).call(this);
@@ -8889,12 +8889,12 @@ class Origin {
8889
8889
  abiItem.stateMutability === "pure");
8890
8890
  if (isView) {
8891
8891
  const publicClient = getPublicClient();
8892
- const result = (yield publicClient.readContract({
8892
+ const result = (_a = (yield publicClient.readContract({
8893
8893
  address: contractAddress,
8894
8894
  abi,
8895
8895
  functionName: methodName,
8896
8896
  args: params,
8897
- })) || null;
8897
+ }))) !== null && _a !== void 0 ? _a : null;
8898
8898
  return result;
8899
8899
  }
8900
8900
  yield __classPrivateFieldGet(this, _Origin_instances, "m", _Origin_ensureChainId).call(this, this.environment.CHAIN);
@@ -8912,7 +8912,7 @@ class Origin {
8912
8912
  return simulatedResult;
8913
8913
  }
8914
8914
  try {
8915
- const txHash = yield ((_a = this.viemClient) === null || _a === void 0 ? void 0 : _a.writeContract(request));
8915
+ const txHash = yield ((_b = this.viemClient) === null || _b === void 0 ? void 0 : _b.writeContract(request));
8916
8916
  if (typeof txHash !== "string") {
8917
8917
  throw new ContractError(`Transaction for "${methodName}" failed to send: no transaction hash returned`, { contractName: contractAddress, methodName });
8918
8918
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campnetwork/origin",
3
- "version": "1.4.0-alpha.2",
3
+ "version": "1.4.0-alpha.3",
4
4
  "main": "dist/core.cjs",
5
5
  "exports": {
6
6
  ".": {