@gardenfi/core 2.1.7 → 2.1.8-beta.2

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-EDkIESxk.cjs");function A(a){const{abi:o,data:r}=a,n=e.slice(r,0,4),t=o.find(c=>c.type==="function"&&n===e.toFunctionSelector(e.formatAbiItem(c)));if(!t)throw new e.AbiFunctionSignatureNotFoundError(n,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?e.decodeAbiParameters(t.inputs,e.slice(r,4)):void 0}}const h="/docs/contract/encodeErrorResult";function b(a){const{abi:o,errorName:r,args:n}=a;let t=o[0];if(r){const d=e.getAbiItem({abi:o,args:n,name:r});if(!d)throw new e.AbiErrorNotFoundError(r,{docsPath:h});t=d}if(t.type!=="error")throw new e.AbiErrorNotFoundError(void 0,{docsPath:h});const c=e.formatAbiItem(t),s=e.toFunctionSelector(c);let i="0x";if(n&&n.length>0){if(!t.inputs)throw new e.AbiErrorInputsNotFoundError(t.name,{docsPath:h});i=e.encodeAbiParameters(t.inputs,n)}return e.concatHex([s,i])}const m="/docs/contract/encodeFunctionResult";function R(a){const{abi:o,functionName:r,result:n}=a;let t=o[0];if(r){const s=e.getAbiItem({abi:o,name:r});if(!s)throw new e.AbiFunctionNotFoundError(r,{docsPath:m});t=s}if(t.type!=="function")throw new e.AbiFunctionNotFoundError(void 0,{docsPath:m});if(!t.outputs)throw new e.AbiFunctionOutputsNotFoundError(t.name,{docsPath:m});const c=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[n];if(Array.isArray(n))return n;throw new e.InvalidArrayError(n)})();return e.encodeAbiParameters(t.outputs,c)}const k="x-batch-gateway:true";async function F(a){const{data:o,ccipRequest:r}=a,{args:[n]}=A({abi:e.batchGatewayAbi,data:o}),t=[],c=[];return await Promise.all(n.map(async(s,i)=>{try{c[i]=await r(s),t[i]=!1}catch(d){t[i]=!0,c[i]=L(d)}})),R({abi:e.batchGatewayAbi,functionName:"query",result:[t,c]})}function L(a){return a.name==="HttpRequestError"&&a.status?b({abi:e.batchGatewayAbi,errorName:"HttpError",args:[a.status,a.shortMessage]}):b({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in a?a.shortMessage:a.message]})}class O extends e.BaseError{constructor({callbackSelector:o,cause:r,data:n,extraData:t,sender:c,urls:s}){var i;super(r.shortMessage||"An error occurred while fetching for an offchain result.",{cause:r,metaMessages:[...r.metaMessages||[],(i=r.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(d=>` ${e.getUrl(d)}`)],` Sender: ${c}`,` Data: ${n}`,` Callback selector: ${o}`,` Extra data: ${t}`].flat(),name:"OffchainLookupError"})}}class q extends e.BaseError{constructor({result:o,url:r}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(r)}`,`Response: ${e.stringify(o)}`],name:"OffchainLookupResponseMalformedError"})}}class P extends e.BaseError{constructor({sender:o,to:r}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${r}`,`OffchainLookup sender address: ${o}`],name:"OffchainLookupSenderMismatchError"})}}const S="0x556f1830",w={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function x(a,{blockNumber:o,blockTag:r,data:n,to:t}){const{args:c}=e.decodeErrorResult({data:n,abi:[w]}),[s,i,d,l,f]=c,{ccipRead:u}=a,y=u&&typeof(u==null?void 0:u.request)=="function"?u.request:g;try{if(!e.isAddressEqual(t,s))throw new P({sender:s,to:t});const p=i.includes(k)?await F({data:d,ccipRequest:y}):await y({data:d,sender:s,urls:i}),{data:E}=await e.call(a,{blockNumber:o,blockTag:r,data:e.concat([l,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,f])]),to:t});return E}catch(p){throw new O({callbackSelector:l,cause:p,data:n,extraData:f,sender:s,urls:i})}}async function g({data:a,sender:o,urls:r}){var t;let n=new Error("An unknown error occurred.");for(let c=0;c<r.length;c++){const s=r[c],i=s.includes("{data}")?"GET":"POST",d=i==="POST"?{data:a,sender:o}:void 0,l=i==="POST"?{"Content-Type":"application/json"}:{};try{const f=await fetch(s.replace("{sender}",o.toLowerCase()).replace("{data}",a),{body:JSON.stringify(d),headers:l,method:i});let u;if((t=f.headers.get("Content-Type"))!=null&&t.startsWith("application/json")?u=(await f.json()).data:u=await f.text(),!f.ok){n=new e.HttpRequestError({body:d,details:u!=null&&u.error?e.stringify(u.error):f.statusText,headers:f.headers,status:f.status,url:s});continue}if(!e.isHex(u)){n=new q({result:u,url:s});continue}return u}catch(f){n=new e.HttpRequestError({body:d,details:f.message,url:s})}}throw n}exports.ccipRequest=g;exports.offchainLookup=x;exports.offchainLookupAbiItem=w;exports.offchainLookupSignature=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-MdPbIwUv.cjs");function A(a){const{abi:o,data:r}=a,n=e.slice(r,0,4),t=o.find(c=>c.type==="function"&&n===e.toFunctionSelector(e.formatAbiItem(c)));if(!t)throw new e.AbiFunctionSignatureNotFoundError(n,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:t.name,args:"inputs"in t&&t.inputs&&t.inputs.length>0?e.decodeAbiParameters(t.inputs,e.slice(r,4)):void 0}}const h="/docs/contract/encodeErrorResult";function b(a){const{abi:o,errorName:r,args:n}=a;let t=o[0];if(r){const d=e.getAbiItem({abi:o,args:n,name:r});if(!d)throw new e.AbiErrorNotFoundError(r,{docsPath:h});t=d}if(t.type!=="error")throw new e.AbiErrorNotFoundError(void 0,{docsPath:h});const c=e.formatAbiItem(t),s=e.toFunctionSelector(c);let i="0x";if(n&&n.length>0){if(!t.inputs)throw new e.AbiErrorInputsNotFoundError(t.name,{docsPath:h});i=e.encodeAbiParameters(t.inputs,n)}return e.concatHex([s,i])}const m="/docs/contract/encodeFunctionResult";function R(a){const{abi:o,functionName:r,result:n}=a;let t=o[0];if(r){const s=e.getAbiItem({abi:o,name:r});if(!s)throw new e.AbiFunctionNotFoundError(r,{docsPath:m});t=s}if(t.type!=="function")throw new e.AbiFunctionNotFoundError(void 0,{docsPath:m});if(!t.outputs)throw new e.AbiFunctionOutputsNotFoundError(t.name,{docsPath:m});const c=(()=>{if(t.outputs.length===0)return[];if(t.outputs.length===1)return[n];if(Array.isArray(n))return n;throw new e.InvalidArrayError(n)})();return e.encodeAbiParameters(t.outputs,c)}const k="x-batch-gateway:true";async function F(a){const{data:o,ccipRequest:r}=a,{args:[n]}=A({abi:e.batchGatewayAbi,data:o}),t=[],c=[];return await Promise.all(n.map(async(s,i)=>{try{c[i]=await r(s),t[i]=!1}catch(d){t[i]=!0,c[i]=L(d)}})),R({abi:e.batchGatewayAbi,functionName:"query",result:[t,c]})}function L(a){return a.name==="HttpRequestError"&&a.status?b({abi:e.batchGatewayAbi,errorName:"HttpError",args:[a.status,a.shortMessage]}):b({abi:[e.solidityError],errorName:"Error",args:["shortMessage"in a?a.shortMessage:a.message]})}class O extends e.BaseError{constructor({callbackSelector:o,cause:r,data:n,extraData:t,sender:c,urls:s}){var i;super(r.shortMessage||"An error occurred while fetching for an offchain result.",{cause:r,metaMessages:[...r.metaMessages||[],(i=r.metaMessages)!=null&&i.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(d=>` ${e.getUrl(d)}`)],` Sender: ${c}`,` Data: ${n}`,` Callback selector: ${o}`,` Extra data: ${t}`].flat(),name:"OffchainLookupError"})}}class q extends e.BaseError{constructor({result:o,url:r}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(r)}`,`Response: ${e.stringify(o)}`],name:"OffchainLookupResponseMalformedError"})}}class P extends e.BaseError{constructor({sender:o,to:r}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${r}`,`OffchainLookup sender address: ${o}`],name:"OffchainLookupSenderMismatchError"})}}const S="0x556f1830",w={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function x(a,{blockNumber:o,blockTag:r,data:n,to:t}){const{args:c}=e.decodeErrorResult({data:n,abi:[w]}),[s,i,d,l,f]=c,{ccipRead:u}=a,y=u&&typeof(u==null?void 0:u.request)=="function"?u.request:g;try{if(!e.isAddressEqual(t,s))throw new P({sender:s,to:t});const p=i.includes(k)?await F({data:d,ccipRequest:y}):await y({data:d,sender:s,urls:i}),{data:E}=await e.call(a,{blockNumber:o,blockTag:r,data:e.concat([l,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,f])]),to:t});return E}catch(p){throw new O({callbackSelector:l,cause:p,data:n,extraData:f,sender:s,urls:i})}}async function g({data:a,sender:o,urls:r}){var t;let n=new Error("An unknown error occurred.");for(let c=0;c<r.length;c++){const s=r[c],i=s.includes("{data}")?"GET":"POST",d=i==="POST"?{data:a,sender:o}:void 0,l=i==="POST"?{"Content-Type":"application/json"}:{};try{const f=await fetch(s.replace("{sender}",o.toLowerCase()).replace("{data}",a),{body:JSON.stringify(d),headers:l,method:i});let u;if((t=f.headers.get("Content-Type"))!=null&&t.startsWith("application/json")?u=(await f.json()).data:u=await f.text(),!f.ok){n=new e.HttpRequestError({body:d,details:u!=null&&u.error?e.stringify(u.error):f.statusText,headers:f.headers,status:f.status,url:s});continue}if(!e.isHex(u)){n=new q({result:u,url:s});continue}return u}catch(f){n=new e.HttpRequestError({body:d,details:f.message,url:s})}}throw n}exports.ccipRequest=g;exports.offchainLookup=x;exports.offchainLookupAbiItem=w;exports.offchainLookupSignature=S;
@@ -1,4 +1,4 @@
1
- import { s as b, t as O, f as x, A as N, d as P, g as F, a as E, b as S, e as w, c as $, h as A, i as I, I as D, j as m, k as G, B as y, l as L, m as q, n as T, o as C, p as H, q as j, H as R, r as v } from "./index-DfENugaW.js";
1
+ import { s as b, t as O, f as x, A as N, d as P, g as F, a as E, b as S, e as w, c as $, h as A, i as I, I as D, j as m, k as G, B as y, l as L, m as q, n as T, o as C, p as H, q as j, H as R, r as v } from "./index-BklQ_b7e.js";
2
2
  function B(a) {
3
3
  const { abi: r, data: e } = a, s = b(e, 0, 4), t = r.find((o) => o.type === "function" && s === O(x(o)));
4
4
  if (!t)
@@ -3231,7 +3231,7 @@ function Jp(e) {
3231
3231
  return Ii(`0x${t}`);
3232
3232
  }
3233
3233
  async function Qp({ hash: e, signature: t }) {
3234
- const r = yr(e) ? e : X(e), { secp256k1: n } = await import("./secp256k1-CagCO8ou.js");
3234
+ const r = yr(e) ? e : X(e), { secp256k1: n } = await import("./secp256k1-B0Im43i_.js");
3235
3235
  return `0x${(() => {
3236
3236
  if (typeof t == "object" && "r" in t && "s" in t) {
3237
3237
  const { r: f, s: l, v: h, yParity: y } = t, p = Number(y ?? h), g = tu(p);
@@ -4817,7 +4817,7 @@ async function Cd(e, t) {
4817
4817
  });
4818
4818
  return ue === "0x" ? { data: void 0 } : { data: ue };
4819
4819
  } catch (Y) {
4820
- const re = Gy(Y), { offchainLookup: le, offchainLookupSignature: be } = await import("./ccip-D0RTImEf.js");
4820
+ const re = Gy(Y), { offchainLookup: le, offchainLookupSignature: be } = await import("./ccip-CvAn6Vlq.js");
4821
4821
  if (e.ccipRead !== !1 && (re == null ? void 0 : re.slice(0, 10)) === be && T)
4822
4822
  return { data: await le(e, { data: re, to: T }) };
4823
4823
  throw B && (re == null ? void 0 : re.slice(0, 10)) === "0x101bb98d" ? new Wp({ factory: l }) : My(Y, {
@@ -17350,13 +17350,18 @@ class C_ {
17350
17350
  address: Qr(s),
17351
17351
  abi: pf,
17352
17352
  client: this.wallet
17353
- }), l = await fh(
17353
+ });
17354
+ console.log(
17355
+ "wallet Id in _initiateOnErc20HTLC",
17356
+ await this.wallet.getChainId()
17357
+ );
17358
+ const l = await fh(
17354
17359
  Number(n),
17355
17360
  o,
17356
17361
  s,
17357
17362
  this.wallet
17358
17363
  );
17359
- if (l.error) return Se(l.error);
17364
+ if (console.log("approval.error :", l.error), l.error) return Se(l.error);
17360
17365
  const h = await f.read.eip712Domain(), y = await this.wallet.signTypedData({
17361
17366
  account: this.wallet.account,
17362
17367
  domain: {