@lombard.finance/sdk 2.0.0 → 2.0.1
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/index.cjs +1 -65
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +662 -2877
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk/getLBTCExchangeRate/index.ts +1 -1
- package/dist/style.css +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,66 +1,2 @@
|
|
|
1
|
-
"use strict";var $r=Object.defineProperty;var Wr=(t,a,u)=>a in t?$r(t,a,{enumerable:!0,configurable:!0,writable:!0,value:u}):t[a]=u;var Qe=(t,a,u)=>(Wr(t,typeof a!="symbol"?a+"":a,u),u);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const tt=require("axios"),et=require("bignumber.js"),ge=require("web3"),Vr=require("@bitcoin-js/tiny-secp256k1-asmjs"),ft=require("bitcoinjs-lib");function Gr(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const u in t)if(u!=="default"){const c=Object.getOwnPropertyDescriptor(t,u);Object.defineProperty(a,u,c.get?c:{enumerable:!0,get:()=>t[u]})}}return a.default=t,Object.freeze(a)}const Yr=Gr(Vr),ue={prod:"prod",testnet:"testnet",stage:"stage"},y={ethereum:1,holesky:17e3,binanceSmartChain:56,binanceSmartChainTestnet:97,sepolia:11155111,base:8453,baseTestnet:84532,berachainBartioTestnet:80084,corn:21e6},nt=ue.prod,w="0x0000000000000000000000000000000000000000",qr={baseApiUrl:"https://bft-dev.stage.lombard.finance",claimerApiUrl:"https://claimer.staging.lombard.finance"},zr={baseApiUrl:"https://gastald-testnet.prod.lombard.finance",claimerApiUrl:"https://claimer.staging.lombard.finance"},Hr={baseApiUrl:"https://mainnet.prod.lombard.finance",claimerApiUrl:""},Ve=(t=nt)=>{switch(t){case ue.prod:return Hr;case ue.testnet:return zr;default:return qr}};function Ge(t){return typeof t=="string"?t:(u=>{var c;return((c=u==null?void 0:u.data)==null?void 0:c.message)&&typeof u.data.message=="string"})(t)?t.data.message:t instanceof Error?Jr(t):Kr(t)}function Jr(t){return t.response?t.response.data.message:t.message}function Kr(t){return t!=null&&t.message?t.message:"Unknown error"}const Zr={eth:"DESTINATION_BLOCKCHAIN_ETHEREUM"};function wn(t){switch(t){case y.holesky:case y.sepolia:case y.ethereum:return Zr.eth;default:throw new Error(`Unknown chain ID: ${t}`)}}const ir="sanctioned_address",Xr="api/v1/address/generate",Qr="destination address is under sanctions";async function ea({address:t,chainId:a,signature:u,env:c,captchaToken:p,referrerCode:b,referralId:E}){const{baseApiUrl:A}=Ve(c),C=wn(a),B={to_address:t,to_address_signature:u,to_chain:C,referrer_code:b,referral_id:E,nonce:0,captcha:p};try{const{data:S}=await tt.post(Xr,B,{baseURL:A});return S.address}catch(S){const U=Ge(S);if(ta(U))return ir;throw new Error(U)}}function ta(t){return!!t.includes(Qr)}const na="api/v1/address";async function ra({address:t,chainId:a,env:u,referralId:c}){const p=await or({address:t,chainId:a,env:u,referralId:c}),b=aa(p);if(!b)throw new Error("No address");return b.btc_address}function aa(t){if(!t.length)return;const a=t.reduce((u,c)=>u.created_at<c.created_at?c:u,t[0]);return a.deprecated?void 0:a}async function or({address:t,chainId:a,env:u,referralId:c}){const{baseApiUrl:p}=Ve(u),b=wn(a),E={to_address:t,to_blockchain:b,limit:1,offset:0,asc:!1,referralId:c},{data:A}=await tt.get(na,{baseURL:p,params:E});return(A==null?void 0:A.addresses)||[]}const sa=8,Kt=10**sa;function Nt(t){return+t/Kt}function Cn(t){return Math.floor(+t*Kt)}function ia(t,a=nt){switch(t){case"DESTINATION_BLOCKCHAIN_ETHEREUM":return a===ue.prod?y.ethereum:y.sepolia;default:return y.ethereum}}var ur=(t=>(t.NOTARIZATION_STATUS_UNSPECIFIED="NOTARIZATION_STATUS_UNSPECIFIED",t.NOTARIZATION_STATUS_PENDING="NOTARIZATION_STATUS_PENDING",t.NOTARIZATION_STATUS_SUBMITTED="NOTARIZATION_STATUS_SUBMITTED",t.NOTARIZATION_STATUS_SESSION_APPROVED="NOTARIZATION_STATUS_SESSION_APPROVED",t.NOTARIZATION_STATUS_FAILED="NOTARIZATION_STATUS_FAILED",t))(ur||{}),cr=(t=>(t.SESSION_STATE_UNSPECIFIED="SESSION_STATE_UNSPECIFIED",t.SESSION_STATE_PENDING="SESSION_STATE_PENDING",t.SESSION_STATE_COMPLETED="SESSION_STATE_COMPLETED",t.SESSION_STATE_EXPIRED="SESSION_STATE_EXPIRED",t))(cr||{});async function oa({address:t,env:a}){const{baseApiUrl:u}=Ve(a),{data:c}=await tt.get(`api/v1/address/outputs-v2/${t}`,{baseURL:u});return((c==null?void 0:c.outputs)??[]).map(ua(a))}function ua(t){return a=>({txid:a.txid,index:a.index??0,blockHeight:a.block_height?Number(a.block_height):void 0,blockTime:a.block_time?Number(a.block_time):void 0,value:new et(Nt(a.value)),address:a.address,chainId:ia(a.to_chain,t),claimedTxId:a.claim_tx,rawPayload:a.raw_payload,signature:a.proof,isRestricted:!!a.sanctioned,notarizationWaitDur:a.notarization_wait_dur?Number(a.notarization_wait_dur):void 0,payload:a.payload_hash,sessionId:a.session_id,notarizationStatus:a.notarization_status,sessionState:a.session_state})}var Rn={exports:{}},ct={},Mt={exports:{}},x={};/**
|
|
2
|
-
* @license React
|
|
3
|
-
* react.production.min.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var Xn;function ca(){if(Xn)return x;Xn=1;var t=Symbol.for("react.element"),a=Symbol.for("react.portal"),u=Symbol.for("react.fragment"),c=Symbol.for("react.strict_mode"),p=Symbol.for("react.profiler"),b=Symbol.for("react.provider"),E=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),C=Symbol.for("react.suspense"),B=Symbol.for("react.memo"),S=Symbol.for("react.lazy"),U=Symbol.iterator;function Q(s){return s===null||typeof s!="object"?null:(s=U&&s[U]||s["@@iterator"],typeof s=="function"?s:null)}var se={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},de=Object.assign,be={};function $(s,f,R){this.props=s,this.context=f,this.refs=be,this.updater=R||se}$.prototype.isReactComponent={},$.prototype.setState=function(s,f){if(typeof s!="object"&&typeof s!="function"&&s!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,s,f,"setState")},$.prototype.forceUpdate=function(s){this.updater.enqueueForceUpdate(this,s,"forceUpdate")};function ce(){}ce.prototype=$.prototype;function V(s,f,R){this.props=s,this.context=f,this.refs=be,this.updater=R||se}var ee=V.prototype=new ce;ee.constructor=V,de(ee,$.prototype),ee.isPureReactComponent=!0;var ie=Array.isArray,z=Object.prototype.hasOwnProperty,te={current:null},Te={key:!0,ref:!0,__self:!0,__source:!0};function we(s,f,R){var N,O={},W=null,G=null;if(f!=null)for(N in f.ref!==void 0&&(G=f.ref),f.key!==void 0&&(W=""+f.key),f)z.call(f,N)&&!Te.hasOwnProperty(N)&&(O[N]=f[N]);var j=arguments.length-2;if(j===1)O.children=R;else if(1<j){for(var k=Array(j),X=0;X<j;X++)k[X]=arguments[X+2];O.children=k}if(s&&s.defaultProps)for(N in j=s.defaultProps,j)O[N]===void 0&&(O[N]=j[N]);return{$$typeof:t,type:s,key:W,ref:G,props:O,_owner:te.current}}function Ie(s,f){return{$$typeof:t,type:s.type,key:f,ref:s.ref,props:s.props,_owner:s._owner}}function De(s){return typeof s=="object"&&s!==null&&s.$$typeof===t}function at(s){var f={"=":"=0",":":"=2"};return"$"+s.replace(/[=:]/g,function(R){return f[R]})}var Me=/\/+/g;function oe(s,f){return typeof s=="object"&&s!==null&&s.key!=null?at(""+s.key):f.toString(36)}function le(s,f,R,N,O){var W=typeof s;(W==="undefined"||W==="boolean")&&(s=null);var G=!1;if(s===null)G=!0;else switch(W){case"string":case"number":G=!0;break;case"object":switch(s.$$typeof){case t:case a:G=!0}}if(G)return G=s,O=O(G),s=N===""?"."+oe(G,0):N,ie(O)?(R="",s!=null&&(R=s.replace(Me,"$&/")+"/"),le(O,f,R,"",function(X){return X})):O!=null&&(De(O)&&(O=Ie(O,R+(!O.key||G&&G.key===O.key?"":(""+O.key).replace(Me,"$&/")+"/")+s)),f.push(O)),1;if(G=0,N=N===""?".":N+":",ie(s))for(var j=0;j<s.length;j++){W=s[j];var k=N+oe(W,j);G+=le(W,f,R,k,O)}else if(k=Q(s),typeof k=="function")for(s=k.call(s),j=0;!(W=s.next()).done;)W=W.value,k=N+oe(W,j++),G+=le(W,f,R,k,O);else if(W==="object")throw f=String(s),Error("Objects are not valid as a React child (found: "+(f==="[object Object]"?"object with keys {"+Object.keys(s).join(", ")+"}":f)+"). If you meant to render a collection of children, use an array instead.");return G}function ne(s,f,R){if(s==null)return s;var N=[],O=0;return le(s,N,"","",function(W){return f.call(R,W,O++)}),N}function he(s){if(s._status===-1){var f=s._result;f=f(),f.then(function(R){(s._status===0||s._status===-1)&&(s._status=1,s._result=R)},function(R){(s._status===0||s._status===-1)&&(s._status=2,s._result=R)}),s._status===-1&&(s._status=0,s._result=f)}if(s._status===1)return s._result.default;throw s._result}var g={current:null},Ee={transition:null},Ne={ReactCurrentDispatcher:g,ReactCurrentBatchConfig:Ee,ReactCurrentOwner:te};return x.Children={map:ne,forEach:function(s,f,R){ne(s,function(){f.apply(this,arguments)},R)},count:function(s){var f=0;return ne(s,function(){f++}),f},toArray:function(s){return ne(s,function(f){return f})||[]},only:function(s){if(!De(s))throw Error("React.Children.only expected to receive a single React element child.");return s}},x.Component=$,x.Fragment=u,x.Profiler=p,x.PureComponent=V,x.StrictMode=c,x.Suspense=C,x.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ne,x.cloneElement=function(s,f,R){if(s==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+s+".");var N=de({},s.props),O=s.key,W=s.ref,G=s._owner;if(f!=null){if(f.ref!==void 0&&(W=f.ref,G=te.current),f.key!==void 0&&(O=""+f.key),s.type&&s.type.defaultProps)var j=s.type.defaultProps;for(k in f)z.call(f,k)&&!Te.hasOwnProperty(k)&&(N[k]=f[k]===void 0&&j!==void 0?j[k]:f[k])}var k=arguments.length-2;if(k===1)N.children=R;else if(1<k){j=Array(k);for(var X=0;X<k;X++)j[X]=arguments[X+2];N.children=j}return{$$typeof:t,type:s.type,key:O,ref:W,props:N,_owner:G}},x.createContext=function(s){return s={$$typeof:E,_currentValue:s,_currentValue2:s,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},s.Provider={$$typeof:b,_context:s},s.Consumer=s},x.createElement=we,x.createFactory=function(s){var f=we.bind(null,s);return f.type=s,f},x.createRef=function(){return{current:null}},x.forwardRef=function(s){return{$$typeof:A,render:s}},x.isValidElement=De,x.lazy=function(s){return{$$typeof:S,_payload:{_status:-1,_result:s},_init:he}},x.memo=function(s,f){return{$$typeof:B,type:s,compare:f===void 0?null:f}},x.startTransition=function(s){var f=Ee.transition;Ee.transition={};try{s()}finally{Ee.transition=f}},x.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")},x.useCallback=function(s,f){return g.current.useCallback(s,f)},x.useContext=function(s){return g.current.useContext(s)},x.useDebugValue=function(){},x.useDeferredValue=function(s){return g.current.useDeferredValue(s)},x.useEffect=function(s,f){return g.current.useEffect(s,f)},x.useId=function(){return g.current.useId()},x.useImperativeHandle=function(s,f,R){return g.current.useImperativeHandle(s,f,R)},x.useInsertionEffect=function(s,f){return g.current.useInsertionEffect(s,f)},x.useLayoutEffect=function(s,f){return g.current.useLayoutEffect(s,f)},x.useMemo=function(s,f){return g.current.useMemo(s,f)},x.useReducer=function(s,f,R){return g.current.useReducer(s,f,R)},x.useRef=function(s){return g.current.useRef(s)},x.useState=function(s){return g.current.useState(s)},x.useSyncExternalStore=function(s,f,R){return g.current.useSyncExternalStore(s,f,R)},x.useTransition=function(){return g.current.useTransition()},x.version="18.2.0",x}var dt={exports:{}};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/dt.exports;var Qn;function la(){return Qn||(Qn=1,function(t,a){process.env.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var u="18.2.0",c=Symbol.for("react.element"),p=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),E=Symbol.for("react.strict_mode"),A=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),B=Symbol.for("react.context"),S=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),Q=Symbol.for("react.suspense_list"),se=Symbol.for("react.memo"),de=Symbol.for("react.lazy"),be=Symbol.for("react.offscreen"),$=Symbol.iterator,ce="@@iterator";function V(e){if(e===null||typeof e!="object")return null;var n=$&&e[$]||e[ce];return typeof n=="function"?n:null}var ee={current:null},ie={transition:null},z={current:null,isBatchingLegacy:!1,didScheduleLegacyUpdate:!1},te={current:null},Te={},we=null;function Ie(e){we=e}Te.setExtraStackFrame=function(e){we=e},Te.getCurrentStack=null,Te.getStackAddendum=function(){var e="";we&&(e+=we);var n=Te.getCurrentStack;return n&&(e+=n()||""),e};var De=!1,at=!1,Me=!1,oe=!1,le=!1,ne={ReactCurrentDispatcher:ee,ReactCurrentBatchConfig:ie,ReactCurrentOwner:te};ne.ReactDebugCurrentFrame=Te,ne.ReactCurrentActQueue=z;function he(e){{for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];Ee("warn",e,i)}}function g(e){{for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];Ee("error",e,i)}}function Ee(e,n,i){{var o=ne.ReactDebugCurrentFrame,d=o.getStackAddendum();d!==""&&(n+="%s",i=i.concat([d]));var T=i.map(function(v){return String(v)});T.unshift("Warning: "+n),Function.prototype.apply.call(console[e],console,T)}}var Ne={};function s(e,n){{var i=e.constructor,o=i&&(i.displayName||i.name)||"ReactClass",d=o+"."+n;if(Ne[d])return;g("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",n,o),Ne[d]=!0}}var f={isMounted:function(e){return!1},enqueueForceUpdate:function(e,n,i){s(e,"forceUpdate")},enqueueReplaceState:function(e,n,i,o){s(e,"replaceState")},enqueueSetState:function(e,n,i,o){s(e,"setState")}},R=Object.assign,N={};Object.freeze(N);function O(e,n,i){this.props=e,this.context=n,this.refs=N,this.updater=i||f}O.prototype.isReactComponent={},O.prototype.setState=function(e,n){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw new Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,n,"setState")},O.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};{var W={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see https://github.com/facebook/react/issues/3236)."]},G=function(e,n){Object.defineProperty(O.prototype,e,{get:function(){he("%s(...) is deprecated in plain JavaScript React classes. %s",n[0],n[1])}})};for(var j in W)W.hasOwnProperty(j)&&G(j,W[j])}function k(){}k.prototype=O.prototype;function X(e,n,i){this.props=e,this.context=n,this.refs=N,this.updater=i||f}var Se=X.prototype=new k;Se.constructor=X,R(Se,O.prototype),Se.isPureReactComponent=!0;function Qt(){var e={current:null};return Object.seal(e),e}var yt=Array.isArray;function qe(e){return yt(e)}function en(e){{var n=typeof Symbol=="function"&&Symbol.toStringTag,i=n&&e[Symbol.toStringTag]||e.constructor.name||"Object";return i}}function ze(e){try{return ke(e),!1}catch{return!0}}function ke(e){return""+e}function Fe(e){if(ze(e))return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",en(e)),ke(e)}function mt(e,n,i){var o=e.displayName;if(o)return o;var d=n.displayName||n.name||"";return d!==""?i+"("+d+")":i}function Ue(e){return e.displayName||"Context"}function _e(e){if(e==null)return null;if(typeof e.tag=="number"&&g("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case p:return"Portal";case A:return"Profiler";case E:return"StrictMode";case U:return"Suspense";case Q:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case B:var n=e;return Ue(n)+".Consumer";case C:var i=e;return Ue(i._context)+".Provider";case S:return mt(e,e.render,"ForwardRef");case se:var o=e.displayName||null;return o!==null?o:_e(e.type)||"Memo";case de:{var d=e,T=d._payload,v=d._init;try{return _e(v(T))}catch{return null}}}return null}var je=Object.prototype.hasOwnProperty,He={key:!0,ref:!0,__self:!0,__source:!0},bt,ht,Je;Je={};function st(e){if(je.call(e,"ref")){var n=Object.getOwnPropertyDescriptor(e,"ref").get;if(n&&n.isReactWarning)return!1}return e.ref!==void 0}function Ae(e){if(je.call(e,"key")){var n=Object.getOwnPropertyDescriptor(e,"key").get;if(n&&n.isReactWarning)return!1}return e.key!==void 0}function tn(e,n){var i=function(){bt||(bt=!0,g("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"key",{get:i,configurable:!0})}function vt(e,n){var i=function(){ht||(ht=!0,g("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",n))};i.isReactWarning=!0,Object.defineProperty(e,"ref",{get:i,configurable:!0})}function gt(e){if(typeof e.ref=="string"&&te.current&&e.__self&&te.current.stateNode!==e.__self){var n=_e(te.current.type);Je[n]||(g('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',n,e.ref),Je[n]=!0)}}var Le=function(e,n,i,o,d,T,v){var _={$$typeof:c,type:e,key:n,ref:i,props:v,_owner:T};return _._store={},Object.defineProperty(_._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(_,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(_,"_source",{configurable:!1,enumerable:!1,writable:!1,value:d}),Object.freeze&&(Object.freeze(_.props),Object.freeze(_)),_};function nn(e,n,i){var o,d={},T=null,v=null,_=null,D=null;if(n!=null){st(n)&&(v=n.ref,gt(n)),Ae(n)&&(Fe(n.key),T=""+n.key),_=n.__self===void 0?null:n.__self,D=n.__source===void 0?null:n.__source;for(o in n)je.call(n,o)&&!He.hasOwnProperty(o)&&(d[o]=n[o])}var L=arguments.length-2;if(L===1)d.children=i;else if(L>1){for(var Y=Array(L),q=0;q<L;q++)Y[q]=arguments[q+2];Object.freeze&&Object.freeze(Y),d.children=Y}if(e&&e.defaultProps){var J=e.defaultProps;for(o in J)d[o]===void 0&&(d[o]=J[o])}if(T||v){var Z=typeof e=="function"?e.displayName||e.name||"Unknown":e;T&&tn(d,Z),v&&vt(d,Z)}return Le(e,T,v,_,D,te.current,d)}function rn(e,n){var i=Le(e.type,n,e.ref,e._self,e._source,e._owner,e.props);return i}function an(e,n,i){if(e==null)throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".");var o,d=R({},e.props),T=e.key,v=e.ref,_=e._self,D=e._source,L=e._owner;if(n!=null){st(n)&&(v=n.ref,L=te.current),Ae(n)&&(Fe(n.key),T=""+n.key);var Y;e.type&&e.type.defaultProps&&(Y=e.type.defaultProps);for(o in n)je.call(n,o)&&!He.hasOwnProperty(o)&&(n[o]===void 0&&Y!==void 0?d[o]=Y[o]:d[o]=n[o])}var q=arguments.length-2;if(q===1)d.children=i;else if(q>1){for(var J=Array(q),Z=0;Z<q;Z++)J[Z]=arguments[Z+2];d.children=J}return Le(e.type,T,v,_,D,L,d)}function Pe(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}var Tt=".",sn=":";function on(e){var n=/[=:]/g,i={"=":"=0",":":"=2"},o=e.replace(n,function(d){return i[d]});return"$"+o}var Ke=!1,Et=/\/+/g;function Ce(e){return e.replace(Et,"$&/")}function Be(e,n){return typeof e=="object"&&e!==null&&e.key!=null?(Fe(e.key),on(""+e.key)):n.toString(36)}function xe(e,n,i,o,d){var T=typeof e;(T==="undefined"||T==="boolean")&&(e=null);var v=!1;if(e===null)v=!0;else switch(T){case"string":case"number":v=!0;break;case"object":switch(e.$$typeof){case c:case p:v=!0}}if(v){var _=e,D=d(_),L=o===""?Tt+Be(_,0):o;if(qe(D)){var Y="";L!=null&&(Y=Ce(L)+"/"),xe(D,n,Y,"",function(Br){return Br})}else D!=null&&(Pe(D)&&(D.key&&(!_||_.key!==D.key)&&Fe(D.key),D=rn(D,i+(D.key&&(!_||_.key!==D.key)?Ce(""+D.key)+"/":"")+L)),n.push(D));return 1}var q,J,Z=0,ae=o===""?Tt:o+sn;if(qe(e))for(var Dt=0;Dt<e.length;Dt++)q=e[Dt],J=ae+Be(q,Dt),Z+=xe(q,n,i,J,d);else{var En=V(e);if(typeof En=="function"){var Jn=e;En===Jn.entries&&(Ke||he("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),Ke=!0);for(var jr=En.call(Jn),Kn,Lr=0;!(Kn=jr.next()).done;)q=Kn.value,J=ae+Be(q,Lr++),Z+=xe(q,n,i,J,d)}else if(T==="object"){var Zn=String(e);throw new Error("Objects are not valid as a React child (found: "+(Zn==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":Zn)+"). If you meant to render a collection of children, use an array instead.")}}return Z}function $e(e,n,i){if(e==null)return e;var o=[],d=0;return xe(e,o,"","",function(T){return n.call(i,T,d++)}),o}function un(e){var n=0;return $e(e,function(){n++}),n}function _t(e,n,i){$e(e,function(){n.apply(this,arguments)},i)}function cn(e){return $e(e,function(n){return n})||[]}function Rt(e){if(!Pe(e))throw new Error("React.Children.only expected to receive a single React element child.");return e}function wt(e){var n={$$typeof:B,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};n.Provider={$$typeof:C,_context:n};var i=!1,o=!1,d=!1;{var T={$$typeof:B,_context:n};Object.defineProperties(T,{Provider:{get:function(){return o||(o=!0,g("Rendering <Context.Consumer.Provider> is not supported and will be removed in a future major release. Did you mean to render <Context.Provider> instead?")),n.Provider},set:function(v){n.Provider=v}},_currentValue:{get:function(){return n._currentValue},set:function(v){n._currentValue=v}},_currentValue2:{get:function(){return n._currentValue2},set:function(v){n._currentValue2=v}},_threadCount:{get:function(){return n._threadCount},set:function(v){n._threadCount=v}},Consumer:{get:function(){return i||(i=!0,g("Rendering <Context.Consumer.Consumer> is not supported and will be removed in a future major release. Did you mean to render <Context.Consumer> instead?")),n.Consumer}},displayName:{get:function(){return n.displayName},set:function(v){d||(he("Setting `displayName` on Context.Consumer has no effect. You should set it directly on the context with Context.displayName = '%s'.",v),d=!0)}}}),n.Consumer=T}return n._currentRenderer=null,n._currentRenderer2=null,n}var We=-1,it=0,ot=1,ln=2;function pn(e){if(e._status===We){var n=e._result,i=n();if(i.then(function(T){if(e._status===it||e._status===We){var v=e;v._status=ot,v._result=T}},function(T){if(e._status===it||e._status===We){var v=e;v._status=ln,v._result=T}}),e._status===We){var o=e;o._status=it,o._result=i}}if(e._status===ot){var d=e._result;return d===void 0&&g(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
18
|
-
|
|
19
|
-
Your code should look like:
|
|
20
|
-
const MyComponent = lazy(() => import('./MyComponent'))
|
|
21
|
-
|
|
22
|
-
Did you accidentally put curly braces around the import?`,d),"default"in d||g(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
23
|
-
|
|
24
|
-
Your code should look like:
|
|
25
|
-
const MyComponent = lazy(() => import('./MyComponent'))`,d),d.default}else throw e._result}function dn(e){var n={_status:We,_result:e},i={$$typeof:de,_payload:n,_init:pn};{var o,d;Object.defineProperties(i,{defaultProps:{configurable:!0,get:function(){return o},set:function(T){g("React.lazy(...): It is not supported to assign `defaultProps` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),o=T,Object.defineProperty(i,"defaultProps",{enumerable:!0})}},propTypes:{configurable:!0,get:function(){return d},set:function(T){g("React.lazy(...): It is not supported to assign `propTypes` to a lazy component import. Either specify them where the component is defined, or create a wrapping component around it."),d=T,Object.defineProperty(i,"propTypes",{enumerable:!0})}}})}return i}function fn(e){e!=null&&e.$$typeof===se?g("forwardRef requires a render function but received a `memo` component. Instead of forwardRef(memo(...)), use memo(forwardRef(...))."):typeof e!="function"?g("forwardRef requires a render function but was given %s.",e===null?"null":typeof e):e.length!==0&&e.length!==2&&g("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined."),e!=null&&(e.defaultProps!=null||e.propTypes!=null)&&g("forwardRef render functions do not support propTypes or defaultProps. Did you accidentally pass a React component?");var n={$$typeof:S,render:e};{var i;Object.defineProperty(n,"displayName",{enumerable:!1,configurable:!0,get:function(){return i},set:function(o){i=o,!e.name&&!e.displayName&&(e.displayName=o)}})}return n}var r;r=Symbol.for("react.module.reference");function l(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===A||le||e===E||e===U||e===Q||oe||e===be||De||at||Me||typeof e=="object"&&e!==null&&(e.$$typeof===de||e.$$typeof===se||e.$$typeof===C||e.$$typeof===B||e.$$typeof===S||e.$$typeof===r||e.getModuleId!==void 0))}function m(e,n){l(e)||g("memo: The first argument must be a component. Instead received: %s",e===null?"null":typeof e);var i={$$typeof:se,type:e,compare:n===void 0?null:n};{var o;Object.defineProperty(i,"displayName",{enumerable:!1,configurable:!0,get:function(){return o},set:function(d){o=d,!e.name&&!e.displayName&&(e.displayName=d)}})}return i}function h(){var e=ee.current;return e===null&&g(`Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
|
|
26
|
-
1. You might have mismatching versions of React and the renderer (such as React DOM)
|
|
27
|
-
2. You might be breaking the Rules of Hooks
|
|
28
|
-
3. You might have more than one copy of React in the same app
|
|
29
|
-
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.`),e}function M(e){var n=h();if(e._context!==void 0){var i=e._context;i.Consumer===e?g("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be removed in a future major release. Did you mean to call useContext(Context) instead?"):i.Provider===e&&g("Calling useContext(Context.Provider) is not supported. Did you mean to call useContext(Context) instead?")}return n.useContext(e)}function F(e){var n=h();return n.useState(e)}function I(e,n,i){var o=h();return o.useReducer(e,n,i)}function P(e){var n=h();return n.useRef(e)}function re(e,n){var i=h();return i.useEffect(e,n)}function H(e,n){var i=h();return i.useInsertionEffect(e,n)}function K(e,n){var i=h();return i.useLayoutEffect(e,n)}function pe(e,n){var i=h();return i.useCallback(e,n)}function Oe(e,n){var i=h();return i.useMemo(e,n)}function Ct(e,n,i){var o=h();return o.useImperativeHandle(e,n,i)}function ve(e,n){{var i=h();return i.useDebugValue(e,n)}}function mr(){var e=h();return e.useTransition()}function br(e){var n=h();return n.useDeferredValue(e)}function hr(){var e=h();return e.useId()}function vr(e,n,i){var o=h();return o.useSyncExternalStore(e,n,i)}var ut=0,xn,On,In,Dn,Mn,Nn,kn;function Fn(){}Fn.__reactDisabledLog=!0;function gr(){{if(ut===0){xn=console.log,On=console.info,In=console.warn,Dn=console.error,Mn=console.group,Nn=console.groupCollapsed,kn=console.groupEnd;var e={configurable:!0,enumerable:!0,value:Fn,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}ut++}}function Tr(){{if(ut--,ut===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:R({},e,{value:xn}),info:R({},e,{value:On}),warn:R({},e,{value:In}),error:R({},e,{value:Dn}),group:R({},e,{value:Mn}),groupCollapsed:R({},e,{value:Nn}),groupEnd:R({},e,{value:kn})})}ut<0&&g("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var yn=ne.ReactCurrentDispatcher,mn;function St(e,n,i){{if(mn===void 0)try{throw Error()}catch(d){var o=d.stack.trim().match(/\n( *(at )?)/);mn=o&&o[1]||""}return`
|
|
30
|
-
`+mn+e}}var bn=!1,At;{var Er=typeof WeakMap=="function"?WeakMap:Map;At=new Er}function Un(e,n){if(!e||bn)return"";{var i=At.get(e);if(i!==void 0)return i}var o;bn=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var T;T=yn.current,yn.current=null,gr();try{if(n){var v=function(){throw Error()};if(Object.defineProperty(v.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(v,[])}catch(ae){o=ae}Reflect.construct(e,[],v)}else{try{v.call()}catch(ae){o=ae}e.call(v.prototype)}}else{try{throw Error()}catch(ae){o=ae}e()}}catch(ae){if(ae&&o&&typeof ae.stack=="string"){for(var _=ae.stack.split(`
|
|
31
|
-
`),D=o.stack.split(`
|
|
32
|
-
`),L=_.length-1,Y=D.length-1;L>=1&&Y>=0&&_[L]!==D[Y];)Y--;for(;L>=1&&Y>=0;L--,Y--)if(_[L]!==D[Y]){if(L!==1||Y!==1)do if(L--,Y--,Y<0||_[L]!==D[Y]){var q=`
|
|
33
|
-
`+_[L].replace(" at new "," at ");return e.displayName&&q.includes("<anonymous>")&&(q=q.replace("<anonymous>",e.displayName)),typeof e=="function"&&At.set(e,q),q}while(L>=1&&Y>=0);break}}}finally{bn=!1,yn.current=T,Tr(),Error.prepareStackTrace=d}var J=e?e.displayName||e.name:"",Z=J?St(J):"";return typeof e=="function"&&At.set(e,Z),Z}function _r(e,n,i){return Un(e,!1)}function Rr(e){var n=e.prototype;return!!(n&&n.isReactComponent)}function Pt(e,n,i){if(e==null)return"";if(typeof e=="function")return Un(e,Rr(e));if(typeof e=="string")return St(e);switch(e){case U:return St("Suspense");case Q:return St("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case S:return _r(e.render);case se:return Pt(e.type,n,i);case de:{var o=e,d=o._payload,T=o._init;try{return Pt(T(d),n,i)}catch{}}}return""}var jn={},Ln=ne.ReactDebugCurrentFrame;function xt(e){if(e){var n=e._owner,i=Pt(e.type,e._source,n?n.type:null);Ln.setExtraStackFrame(i)}else Ln.setExtraStackFrame(null)}function wr(e,n,i,o,d){{var T=Function.call.bind(je);for(var v in e)if(T(e,v)){var _=void 0;try{if(typeof e[v]!="function"){var D=Error((o||"React class")+": "+i+" type `"+v+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[v]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw D.name="Invariant Violation",D}_=e[v](n,v,o,i,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(L){_=L}_&&!(_ instanceof Error)&&(xt(d),g("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",o||"React class",i,v,typeof _),xt(null)),_ instanceof Error&&!(_.message in jn)&&(jn[_.message]=!0,xt(d),g("Failed %s type: %s",i,_.message),xt(null))}}}function Ze(e){if(e){var n=e._owner,i=Pt(e.type,e._source,n?n.type:null);Ie(i)}else Ie(null)}var hn;hn=!1;function Bn(){if(te.current){var e=_e(te.current.type);if(e)return`
|
|
34
|
-
|
|
35
|
-
Check the render method of \``+e+"`."}return""}function Cr(e){if(e!==void 0){var n=e.fileName.replace(/^.*[\\\/]/,""),i=e.lineNumber;return`
|
|
36
|
-
|
|
37
|
-
Check your code at `+n+":"+i+"."}return""}function Sr(e){return e!=null?Cr(e.__source):""}var $n={};function Ar(e){var n=Bn();if(!n){var i=typeof e=="string"?e:e.displayName||e.name;i&&(n=`
|
|
38
|
-
|
|
39
|
-
Check the top-level render call using <`+i+">.")}return n}function Wn(e,n){if(!(!e._store||e._store.validated||e.key!=null)){e._store.validated=!0;var i=Ar(n);if(!$n[i]){$n[i]=!0;var o="";e&&e._owner&&e._owner!==te.current&&(o=" It was passed a child from "+_e(e._owner.type)+"."),Ze(e),g('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',i,o),Ze(null)}}}function Vn(e,n){if(typeof e=="object"){if(qe(e))for(var i=0;i<e.length;i++){var o=e[i];Pe(o)&&Wn(o,n)}else if(Pe(e))e._store&&(e._store.validated=!0);else if(e){var d=V(e);if(typeof d=="function"&&d!==e.entries)for(var T=d.call(e),v;!(v=T.next()).done;)Pe(v.value)&&Wn(v.value,n)}}}function Gn(e){{var n=e.type;if(n==null||typeof n=="string")return;var i;if(typeof n=="function")i=n.propTypes;else if(typeof n=="object"&&(n.$$typeof===S||n.$$typeof===se))i=n.propTypes;else return;if(i){var o=_e(n);wr(i,e.props,"prop",o,e)}else if(n.PropTypes!==void 0&&!hn){hn=!0;var d=_e(n);g("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",d||"Unknown")}typeof n.getDefaultProps=="function"&&!n.getDefaultProps.isReactClassApproved&&g("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function Pr(e){{for(var n=Object.keys(e.props),i=0;i<n.length;i++){var o=n[i];if(o!=="children"&&o!=="key"){Ze(e),g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",o),Ze(null);break}}e.ref!==null&&(Ze(e),g("Invalid attribute `ref` supplied to `React.Fragment`."),Ze(null))}}function Yn(e,n,i){var o=l(e);if(!o){var d="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(d+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var T=Sr(n);T?d+=T:d+=Bn();var v;e===null?v="null":qe(e)?v="array":e!==void 0&&e.$$typeof===c?(v="<"+(_e(e.type)||"Unknown")+" />",d=" Did you accidentally export a JSX literal instead of a component?"):v=typeof e,g("React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",v,d)}var _=nn.apply(this,arguments);if(_==null)return _;if(o)for(var D=2;D<arguments.length;D++)Vn(arguments[D],e);return e===b?Pr(_):Gn(_),_}var qn=!1;function xr(e){var n=Yn.bind(null,e);return n.type=e,qn||(qn=!0,he("React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.")),Object.defineProperty(n,"type",{enumerable:!1,get:function(){return he("Factory.type is deprecated. Access the class directly before passing it to createFactory."),Object.defineProperty(this,"type",{value:e}),e}}),n}function Or(e,n,i){for(var o=an.apply(this,arguments),d=2;d<arguments.length;d++)Vn(arguments[d],o.type);return Gn(o),o}function Ir(e,n){var i=ie.transition;ie.transition={};var o=ie.transition;ie.transition._updatedFibers=new Set;try{e()}finally{if(ie.transition=i,i===null&&o._updatedFibers){var d=o._updatedFibers.size;d>10&&he("Detected a large number of updates inside startTransition. If this is due to a subscription please re-write it to use React provided hooks. Otherwise concurrent mode guarantees are off the table."),o._updatedFibers.clear()}}}var zn=!1,Ot=null;function Dr(e){if(Ot===null)try{var n=("require"+Math.random()).slice(0,7),i=t&&t[n];Ot=i.call(t,"timers").setImmediate}catch{Ot=function(d){zn===!1&&(zn=!0,typeof MessageChannel>"u"&&g("This browser does not have a MessageChannel implementation, so enqueuing tasks via await act(async () => ...) will fail. Please file an issue at https://github.com/facebook/react/issues if you encounter this warning."));var T=new MessageChannel;T.port1.onmessage=d,T.port2.postMessage(void 0)}}return Ot(e)}var Xe=0,Hn=!1;function Mr(e){{var n=Xe;Xe++,z.current===null&&(z.current=[]);var i=z.isBatchingLegacy,o;try{if(z.isBatchingLegacy=!0,o=e(),!i&&z.didScheduleLegacyUpdate){var d=z.current;d!==null&&(z.didScheduleLegacyUpdate=!1,Tn(d))}}catch(J){throw It(n),J}finally{z.isBatchingLegacy=i}if(o!==null&&typeof o=="object"&&typeof o.then=="function"){var T=o,v=!1,_={then:function(J,Z){v=!0,T.then(function(ae){It(n),Xe===0?vn(ae,J,Z):J(ae)},function(ae){It(n),Z(ae)})}};return!Hn&&typeof Promise<"u"&&Promise.resolve().then(function(){}).then(function(){v||(Hn=!0,g("You called act(async () => ...) without await. This could lead to unexpected testing behaviour, interleaving multiple act calls and mixing their scopes. You should - await act(async () => ...);"))}),_}else{var D=o;if(It(n),Xe===0){var L=z.current;L!==null&&(Tn(L),z.current=null);var Y={then:function(J,Z){z.current===null?(z.current=[],vn(D,J,Z)):J(D)}};return Y}else{var q={then:function(J,Z){J(D)}};return q}}}}function It(e){e!==Xe-1&&g("You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one. "),Xe=e}function vn(e,n,i){{var o=z.current;if(o!==null)try{Tn(o),Dr(function(){o.length===0?(z.current=null,n(e)):vn(e,n,i)})}catch(d){i(d)}else n(e)}}var gn=!1;function Tn(e){if(!gn){gn=!0;var n=0;try{for(;n<e.length;n++){var i=e[n];do i=i(!0);while(i!==null)}e.length=0}catch(o){throw e=e.slice(n+1),o}finally{gn=!1}}}var Nr=Yn,kr=Or,Fr=xr,Ur={map:$e,forEach:_t,count:un,toArray:cn,only:Rt};a.Children=Ur,a.Component=O,a.Fragment=b,a.Profiler=A,a.PureComponent=X,a.StrictMode=E,a.Suspense=U,a.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=ne,a.cloneElement=kr,a.createContext=wt,a.createElement=Nr,a.createFactory=Fr,a.createRef=Qt,a.forwardRef=fn,a.isValidElement=Pe,a.lazy=dn,a.memo=m,a.startTransition=Ir,a.unstable_act=Mr,a.useCallback=pe,a.useContext=M,a.useDebugValue=ve,a.useDeferredValue=br,a.useEffect=re,a.useId=hr,a.useImperativeHandle=Ct,a.useInsertionEffect=H,a.useLayoutEffect=K,a.useMemo=Oe,a.useReducer=I,a.useRef=P,a.useState=F,a.useSyncExternalStore=vr,a.useTransition=mr,a.version=u,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}()}(dt,dt.exports)),dt.exports}var er;function Sn(){return er||(er=1,process.env.NODE_ENV==="production"?Mt.exports=ca():Mt.exports=la()),Mt.exports}/**
|
|
40
|
-
* @license React
|
|
41
|
-
* react-jsx-runtime.production.min.js
|
|
42
|
-
*
|
|
43
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
44
|
-
*
|
|
45
|
-
* This source code is licensed under the MIT license found in the
|
|
46
|
-
* LICENSE file in the root directory of this source tree.
|
|
47
|
-
*/var tr;function pa(){if(tr)return ct;tr=1;var t=Sn(),a=Symbol.for("react.element"),u=Symbol.for("react.fragment"),c=Object.prototype.hasOwnProperty,p=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,b={key:!0,ref:!0,__self:!0,__source:!0};function E(A,C,B){var S,U={},Q=null,se=null;B!==void 0&&(Q=""+B),C.key!==void 0&&(Q=""+C.key),C.ref!==void 0&&(se=C.ref);for(S in C)c.call(C,S)&&!b.hasOwnProperty(S)&&(U[S]=C[S]);if(A&&A.defaultProps)for(S in C=A.defaultProps,C)U[S]===void 0&&(U[S]=C[S]);return{$$typeof:a,type:A,key:Q,ref:se,props:U,_owner:p.current}}return ct.Fragment=u,ct.jsx=E,ct.jsxs=E,ct}var lt={};/**
|
|
48
|
-
* @license React
|
|
49
|
-
* react-jsx-runtime.development.js
|
|
50
|
-
*
|
|
51
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
52
|
-
*
|
|
53
|
-
* This source code is licensed under the MIT license found in the
|
|
54
|
-
* LICENSE file in the root directory of this source tree.
|
|
55
|
-
*/var nr;function da(){return nr||(nr=1,process.env.NODE_ENV!=="production"&&function(){var t=Sn(),a=Symbol.for("react.element"),u=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),p=Symbol.for("react.strict_mode"),b=Symbol.for("react.profiler"),E=Symbol.for("react.provider"),A=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),B=Symbol.for("react.suspense"),S=Symbol.for("react.suspense_list"),U=Symbol.for("react.memo"),Q=Symbol.for("react.lazy"),se=Symbol.for("react.offscreen"),de=Symbol.iterator,be="@@iterator";function $(r){if(r===null||typeof r!="object")return null;var l=de&&r[de]||r[be];return typeof l=="function"?l:null}var ce=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function V(r){{for(var l=arguments.length,m=new Array(l>1?l-1:0),h=1;h<l;h++)m[h-1]=arguments[h];ee("error",r,m)}}function ee(r,l,m){{var h=ce.ReactDebugCurrentFrame,M=h.getStackAddendum();M!==""&&(l+="%s",m=m.concat([M]));var F=m.map(function(I){return String(I)});F.unshift("Warning: "+l),Function.prototype.apply.call(console[r],console,F)}}var ie=!1,z=!1,te=!1,Te=!1,we=!1,Ie;Ie=Symbol.for("react.module.reference");function De(r){return!!(typeof r=="string"||typeof r=="function"||r===c||r===b||we||r===p||r===B||r===S||Te||r===se||ie||z||te||typeof r=="object"&&r!==null&&(r.$$typeof===Q||r.$$typeof===U||r.$$typeof===E||r.$$typeof===A||r.$$typeof===C||r.$$typeof===Ie||r.getModuleId!==void 0))}function at(r,l,m){var h=r.displayName;if(h)return h;var M=l.displayName||l.name||"";return M!==""?m+"("+M+")":m}function Me(r){return r.displayName||"Context"}function oe(r){if(r==null)return null;if(typeof r.tag=="number"&&V("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof r=="function")return r.displayName||r.name||null;if(typeof r=="string")return r;switch(r){case c:return"Fragment";case u:return"Portal";case b:return"Profiler";case p:return"StrictMode";case B:return"Suspense";case S:return"SuspenseList"}if(typeof r=="object")switch(r.$$typeof){case A:var l=r;return Me(l)+".Consumer";case E:var m=r;return Me(m._context)+".Provider";case C:return at(r,r.render,"ForwardRef");case U:var h=r.displayName||null;return h!==null?h:oe(r.type)||"Memo";case Q:{var M=r,F=M._payload,I=M._init;try{return oe(I(F))}catch{return null}}}return null}var le=Object.assign,ne=0,he,g,Ee,Ne,s,f,R;function N(){}N.__reactDisabledLog=!0;function O(){{if(ne===0){he=console.log,g=console.info,Ee=console.warn,Ne=console.error,s=console.group,f=console.groupCollapsed,R=console.groupEnd;var r={configurable:!0,enumerable:!0,value:N,writable:!0};Object.defineProperties(console,{info:r,log:r,warn:r,error:r,group:r,groupCollapsed:r,groupEnd:r})}ne++}}function W(){{if(ne--,ne===0){var r={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:le({},r,{value:he}),info:le({},r,{value:g}),warn:le({},r,{value:Ee}),error:le({},r,{value:Ne}),group:le({},r,{value:s}),groupCollapsed:le({},r,{value:f}),groupEnd:le({},r,{value:R})})}ne<0&&V("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var G=ce.ReactCurrentDispatcher,j;function k(r,l,m){{if(j===void 0)try{throw Error()}catch(M){var h=M.stack.trim().match(/\n( *(at )?)/);j=h&&h[1]||""}return`
|
|
56
|
-
`+j+r}}var X=!1,Se;{var Qt=typeof WeakMap=="function"?WeakMap:Map;Se=new Qt}function yt(r,l){if(!r||X)return"";{var m=Se.get(r);if(m!==void 0)return m}var h;X=!0;var M=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var F;F=G.current,G.current=null,O();try{if(l){var I=function(){throw Error()};if(Object.defineProperty(I.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(I,[])}catch(ve){h=ve}Reflect.construct(r,[],I)}else{try{I.call()}catch(ve){h=ve}r.call(I.prototype)}}else{try{throw Error()}catch(ve){h=ve}r()}}catch(ve){if(ve&&h&&typeof ve.stack=="string"){for(var P=ve.stack.split(`
|
|
57
|
-
`),re=h.stack.split(`
|
|
58
|
-
`),H=P.length-1,K=re.length-1;H>=1&&K>=0&&P[H]!==re[K];)K--;for(;H>=1&&K>=0;H--,K--)if(P[H]!==re[K]){if(H!==1||K!==1)do if(H--,K--,K<0||P[H]!==re[K]){var pe=`
|
|
59
|
-
`+P[H].replace(" at new "," at ");return r.displayName&&pe.includes("<anonymous>")&&(pe=pe.replace("<anonymous>",r.displayName)),typeof r=="function"&&Se.set(r,pe),pe}while(H>=1&&K>=0);break}}}finally{X=!1,G.current=F,W(),Error.prepareStackTrace=M}var Oe=r?r.displayName||r.name:"",Ct=Oe?k(Oe):"";return typeof r=="function"&&Se.set(r,Ct),Ct}function qe(r,l,m){return yt(r,!1)}function en(r){var l=r.prototype;return!!(l&&l.isReactComponent)}function ze(r,l,m){if(r==null)return"";if(typeof r=="function")return yt(r,en(r));if(typeof r=="string")return k(r);switch(r){case B:return k("Suspense");case S:return k("SuspenseList")}if(typeof r=="object")switch(r.$$typeof){case C:return qe(r.render);case U:return ze(r.type,l,m);case Q:{var h=r,M=h._payload,F=h._init;try{return ze(F(M),l,m)}catch{}}}return""}var ke=Object.prototype.hasOwnProperty,Fe={},mt=ce.ReactDebugCurrentFrame;function Ue(r){if(r){var l=r._owner,m=ze(r.type,r._source,l?l.type:null);mt.setExtraStackFrame(m)}else mt.setExtraStackFrame(null)}function _e(r,l,m,h,M){{var F=Function.call.bind(ke);for(var I in r)if(F(r,I)){var P=void 0;try{if(typeof r[I]!="function"){var re=Error((h||"React class")+": "+m+" type `"+I+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof r[I]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw re.name="Invariant Violation",re}P=r[I](l,I,h,m,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(H){P=H}P&&!(P instanceof Error)&&(Ue(M),V("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",h||"React class",m,I,typeof P),Ue(null)),P instanceof Error&&!(P.message in Fe)&&(Fe[P.message]=!0,Ue(M),V("Failed %s type: %s",m,P.message),Ue(null))}}}var je=Array.isArray;function He(r){return je(r)}function bt(r){{var l=typeof Symbol=="function"&&Symbol.toStringTag,m=l&&r[Symbol.toStringTag]||r.constructor.name||"Object";return m}}function ht(r){try{return Je(r),!1}catch{return!0}}function Je(r){return""+r}function st(r){if(ht(r))return V("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",bt(r)),Je(r)}var Ae=ce.ReactCurrentOwner,tn={key:!0,ref:!0,__self:!0,__source:!0},vt,gt,Le;Le={};function nn(r){if(ke.call(r,"ref")){var l=Object.getOwnPropertyDescriptor(r,"ref").get;if(l&&l.isReactWarning)return!1}return r.ref!==void 0}function rn(r){if(ke.call(r,"key")){var l=Object.getOwnPropertyDescriptor(r,"key").get;if(l&&l.isReactWarning)return!1}return r.key!==void 0}function an(r,l){if(typeof r.ref=="string"&&Ae.current&&l&&Ae.current.stateNode!==l){var m=oe(Ae.current.type);Le[m]||(V('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',oe(Ae.current.type),r.ref),Le[m]=!0)}}function Pe(r,l){{var m=function(){vt||(vt=!0,V("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};m.isReactWarning=!0,Object.defineProperty(r,"key",{get:m,configurable:!0})}}function Tt(r,l){{var m=function(){gt||(gt=!0,V("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",l))};m.isReactWarning=!0,Object.defineProperty(r,"ref",{get:m,configurable:!0})}}var sn=function(r,l,m,h,M,F,I){var P={$$typeof:a,type:r,key:l,ref:m,props:I,_owner:F};return P._store={},Object.defineProperty(P._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(P,"_self",{configurable:!1,enumerable:!1,writable:!1,value:h}),Object.defineProperty(P,"_source",{configurable:!1,enumerable:!1,writable:!1,value:M}),Object.freeze&&(Object.freeze(P.props),Object.freeze(P)),P};function on(r,l,m,h,M){{var F,I={},P=null,re=null;m!==void 0&&(st(m),P=""+m),rn(l)&&(st(l.key),P=""+l.key),nn(l)&&(re=l.ref,an(l,M));for(F in l)ke.call(l,F)&&!tn.hasOwnProperty(F)&&(I[F]=l[F]);if(r&&r.defaultProps){var H=r.defaultProps;for(F in H)I[F]===void 0&&(I[F]=H[F])}if(P||re){var K=typeof r=="function"?r.displayName||r.name||"Unknown":r;P&&Pe(I,K),re&&Tt(I,K)}return sn(r,P,re,M,h,Ae.current,I)}}var Ke=ce.ReactCurrentOwner,Et=ce.ReactDebugCurrentFrame;function Ce(r){if(r){var l=r._owner,m=ze(r.type,r._source,l?l.type:null);Et.setExtraStackFrame(m)}else Et.setExtraStackFrame(null)}var Be;Be=!1;function xe(r){return typeof r=="object"&&r!==null&&r.$$typeof===a}function $e(){{if(Ke.current){var r=oe(Ke.current.type);if(r)return`
|
|
60
|
-
|
|
61
|
-
Check the render method of \``+r+"`."}return""}}function un(r){{if(r!==void 0){var l=r.fileName.replace(/^.*[\\\/]/,""),m=r.lineNumber;return`
|
|
62
|
-
|
|
63
|
-
Check your code at `+l+":"+m+"."}return""}}var _t={};function cn(r){{var l=$e();if(!l){var m=typeof r=="string"?r:r.displayName||r.name;m&&(l=`
|
|
64
|
-
|
|
65
|
-
Check the top-level render call using <`+m+">.")}return l}}function Rt(r,l){{if(!r._store||r._store.validated||r.key!=null)return;r._store.validated=!0;var m=cn(l);if(_t[m])return;_t[m]=!0;var h="";r&&r._owner&&r._owner!==Ke.current&&(h=" It was passed a child from "+oe(r._owner.type)+"."),Ce(r),V('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',m,h),Ce(null)}}function wt(r,l){{if(typeof r!="object")return;if(He(r))for(var m=0;m<r.length;m++){var h=r[m];xe(h)&&Rt(h,l)}else if(xe(r))r._store&&(r._store.validated=!0);else if(r){var M=$(r);if(typeof M=="function"&&M!==r.entries)for(var F=M.call(r),I;!(I=F.next()).done;)xe(I.value)&&Rt(I.value,l)}}}function We(r){{var l=r.type;if(l==null||typeof l=="string")return;var m;if(typeof l=="function")m=l.propTypes;else if(typeof l=="object"&&(l.$$typeof===C||l.$$typeof===U))m=l.propTypes;else return;if(m){var h=oe(l);_e(m,r.props,"prop",h,r)}else if(l.PropTypes!==void 0&&!Be){Be=!0;var M=oe(l);V("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",M||"Unknown")}typeof l.getDefaultProps=="function"&&!l.getDefaultProps.isReactClassApproved&&V("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function it(r){{for(var l=Object.keys(r.props),m=0;m<l.length;m++){var h=l[m];if(h!=="children"&&h!=="key"){Ce(r),V("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",h),Ce(null);break}}r.ref!==null&&(Ce(r),V("Invalid attribute `ref` supplied to `React.Fragment`."),Ce(null))}}function ot(r,l,m,h,M,F){{var I=De(r);if(!I){var P="";(r===void 0||typeof r=="object"&&r!==null&&Object.keys(r).length===0)&&(P+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var re=un(M);re?P+=re:P+=$e();var H;r===null?H="null":He(r)?H="array":r!==void 0&&r.$$typeof===a?(H="<"+(oe(r.type)||"Unknown")+" />",P=" Did you accidentally export a JSX literal instead of a component?"):H=typeof r,V("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",H,P)}var K=on(r,l,m,M,F);if(K==null)return K;if(I){var pe=l.children;if(pe!==void 0)if(h)if(He(pe)){for(var Oe=0;Oe<pe.length;Oe++)wt(pe[Oe],r);Object.freeze&&Object.freeze(pe)}else V("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else wt(pe,r)}return r===c?it(K):We(K),K}}function ln(r,l,m){return ot(r,l,m,!0)}function pn(r,l,m){return ot(r,l,m,!1)}var dn=pn,fn=ln;lt.Fragment=c,lt.jsx=dn,lt.jsxs=fn}()),lt}process.env.NODE_ENV==="production"?Rn.exports=pa():Rn.exports=da();var Re=Rn.exports;function fa({color:t="text-primary",size:a="sm",className:u}){return Re.jsx("div",{className:["spinner-border",t,a==="sm"?"spinner-border-sm":"",u||""].join(" "),role:"status",children:Re.jsx("span",{className:"visually-hidden",children:"Loading..."})})}const ya=({primary:t=!0,size:a="medium",children:u,isLoading:c,...p})=>Re.jsxs("button",{type:"button",className:["btn",a==="small"?"btn-sm":"",a==="large"?"btn-lg":"",t?"btn-primary":"btn-secondary"].join(" "),...p,children:[u,c&&Re.jsx(fa,{color:"text-light",className:"ms-2"})]});function ma({text:t,withFormatting:a=!0}){const u=t&&a?JSON.stringify(t,null,2):t;return t==null?null:Re.jsx("pre",{className:"card my-3 code-block--max-height",children:Re.jsx("code",{className:"card-body",children:u})})}var pt=Sn();function ba(t,a=[],u=!0){const[c,p]=pt.useState(null),[b,E]=pt.useState(null),[A,C]=pt.useState(!1),B=pt.useCallback(async()=>{C(!0),E(null),p(null);try{const S=await t();p(S)}catch(S){console.error(S);const U=Ge(S);E(U)}finally{C(!1)}},[t,...a]);return pt.useEffect(()=>{u&&B()},[u,B,...a]),{data:c,error:b,isLoading:A,refetch:B}}const ha=2e-4;async function va({env:t,chainId:a=y.ethereum,amount:u=1}){const{baseApiUrl:c}=Ve(t),p=wn(a),{data:b}=await tt.get(`api/v1/exchange/rate/${p}`,{baseURL:c,params:{amount:u}}),E=new et(ha).multipliedBy(Kt).toFixed();return{exchangeRate:+b.amount_out,minAmount:+E}}const ga={args:{env:nt,amount:1,chainId:y.ethereum}};function Ta(t){const{data:a,error:u,isLoading:c,refetch:p}=ba(()=>va(t),[t],!1);return Re.jsxs(Re.Fragment,{children:[Re.jsx(ya,{onClick:p,disabled:c,isLoading:c,children:"Get LBTC Exchange Rate"}),Re.jsx(ma,{text:u||a})]})}async function Ea({address:t,chainId:a,env:u}){const{claimerApiUrl:c}=Ve(u);try{const{data:p}=await tt.get(`${c}/claimer/v1/mintwithfee/get-user-signature`,{params:{user_destination_address:t,chain_id:a}});return{expirationDate:p==null?void 0:p.expiration_date,hasSignature:p==null?void 0:p.has_signature,isDelayed:p==null?void 0:p.is_delayed}}catch(p){const b=Ge(p);throw new Error(b)}}async function _a({signature:t,typedData:a,address:u,env:c}){const{claimerApiUrl:p}=Ve(c);try{const{data:b}=await tt.post(`${p}/claimer/v1/mintwithfee/save-user-signature`,null,{params:{typed_data:a,signature:t,user_destination_address:u}});return b.status}catch(b){const E=Ge(b);throw new Error(E)}}const kt={[y.ethereum]:"https://rpc.ankr.com/eth",[y.holesky]:"https://rpc.ankr.com/eth_holesky",[y.sepolia]:"https://rpc.ankr.com/eth_sepolia",[y.base]:"https://rpc.ankr.com/base",[y.baseTestnet]:"https://rpc.ankr.com/base_sepolia",[y.binanceSmartChain]:"https://rpc.ankr.com/bsc"};async function Ra(t){const u=await(await fetch(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_maxPriorityFeePerGas",params:[]})})).json(),c=ge.utils.hexToNumber(u==null?void 0:u.result);return new et(Number(c))}const wa=2,Ca=25e3;class Zt{constructor({chainId:a,rpcUrlConfig:u}){Qe(this,"chainId");Qe(this,"rpcConfig");this.chainId=a,this.rpcConfig={...kt,...u}}getReadWeb3(){const a=this.getRpcUrl(),u=new ge.Web3,c=new ge.Web3.providers.HttpProvider(a);return u.setProvider(c),u}getRpcUrl(){var c;const{chainId:a}=this,u=(c=this.rpcConfig)==null?void 0:c[a];if(!u)throw console.error(`You might need to add the rpcConfig for the ${a} chain ID when creating the provider.`),new Error(`RPC URL for chainId ${a} not found`);return u}async getMaxFees(){const a=this.getReadWeb3(),u=this.getRpcUrl(),[c,p]=await Promise.all([a.eth.getBlock("latest"),Ra(u)]);return!(c!=null&&c.baseFeePerGas)&&typeof(c==null?void 0:c.baseFeePerGas)!="bigint"?{}:{maxFeePerGas:+new et(c.baseFeePerGas.toString(10)).multipliedBy(wa).plus(p),maxPriorityFeePerGas:+p}}async getSafeGasPriceWei(){const a=await this.getReadWeb3().eth.getGasPrice();return new et(a.toString(10)).plus(Ca)}createContract(a,u){const c=this.getReadWeb3();return new c.eth.Contract(a,u)}}class rt extends Zt{constructor({provider:u,account:c,chainId:p,rpcUrlConfig:b}){super({chainId:p,rpcUrlConfig:b});Qe(this,"web3");Qe(this,"account");Qe(this,"rpcConfig",kt);this.web3=new ge(u),this.account=c,this.chainId=p,this.rpcConfig={...kt,...b}}async signMessage(u){const{account:c}=this,p=`0x${Buffer.from(u,"utf8").toString("hex")}`;return this.web3.currentProvider.request({method:"personal_sign",params:[p,c]})}async sendTransactionAsync(u,c,p){const{chainId:b,web3:E}=this,A=this.getReadWeb3(),{data:C,estimate:B=!1,estimateFee:S=!1,extendedGasLimit:U,gasLimit:Q="0",value:se="0",gasLimitMultiplier:de=1}=p;let{nonce:be}=p;be||(be=await A.eth.getTransactionCount(u)),console.log(`Nonce: ${be}`);const $={from:u,to:c,value:ge.utils.numberToHex(se),data:C,nonce:be,chainId:ge.utils.numberToHex(b)};if(B)try{const ee=await A.eth.estimateGas($),ie=Math.round(Number(ee)*de);U?$.gas=ge.utils.numberToHex(ie+U):$.gas=ge.utils.numberToHex(ie)}catch(ee){throw new Error(ee.message??"Failed to estimate gas limit for transaction.")}else $.gas=ge.utils.numberToHex(Q);const{maxFeePerGas:ce,maxPriorityFeePerGas:V}=S?await this.getMaxFees().catch(()=>p):p;if(V!==void 0&&($.maxPriorityFeePerGas=ge.utils.numberToHex(V)),ce!==void 0&&($.maxFeePerGas=ge.utils.numberToHex(ce)),!$.maxFeePerGas&&!$.maxPriorityFeePerGas){const ee=await this.getSafeGasPriceWei();$.gasPrice=ee.toString(10)}if(!$.maxFeePerGas&&!$.maxPriorityFeePerGas){const ee=await this.getSafeGasPriceWei();$.gasPrice=ee.toString(10)}return console.log("Sending transaction via Web3: ",$),new Promise((ee,ie)=>{const z=E.eth.sendTransaction($);z.once("transactionHash",async te=>{console.log(`Just signed transaction has is: ${te}`),ee({receiptPromise:z,transactionHash:te})}).catch(ie)})}createContract(u,c){return new this.web3.eth.Contract(u,c)}}function An(t){switch(t){case y.ethereum:return 1.3;case y.holesky:case y.sepolia:return 1.5;default:return 1.3}}function Xt(t){return Object.values(y).includes(t)}const Sa={[y.holesky]:"0xED7bfd5C1790576105Af4649817f6d35A75CD818",[y.ethereum]:w,[y.binanceSmartChainTestnet]:"0x731eFa688F3679688cf60A3993b8658138953ED6",[y.binanceSmartChain]:w,[y.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[y.base]:w,[y.baseTestnet]:w,[y.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[y.corn]:w},Aa={[y.holesky]:"0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",[y.ethereum]:w,[y.binanceSmartChainTestnet]:"0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",[y.binanceSmartChain]:w,[y.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[y.base]:w,[y.baseTestnet]:w,[y.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[y.corn]:w},Pa={[y.ethereum]:"0x8236a87084f8b84306f72007f36f2618a5634494",[y.holesky]:w,[y.sepolia]:w,[y.binanceSmartChainTestnet]:w,[y.binanceSmartChain]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[y.base]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[y.baseTestnet]:w,[y.berachainBartioTestnet]:w,[y.corn]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1"};function lr(t=nt){switch(t){case ue.prod:return Pa;case ue.testnet:return Aa;default:return Sa}}const xa=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],Oa=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"uint256",name:"dustLimit",type:"uint256"}],name:"AmountBelowDustLimit",type:"error"},{inputs:[{internalType:"uint256",name:"fee",type:"uint256"}],name:"AmountLessThanCommission",type:"error"},{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"}],name:"ERC2612ExpiredSignature",type:"error"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC2612InvalidSigner",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FeeGreaterThanAmount",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"currentNonce",type:"uint256"}],name:"InvalidAccountNonce",type:"error"},{inputs:[],name:"InvalidDustFeeRate",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidInputLength",type:"error"},{inputs:[],name:"InvalidUserSignature",type:"error"},{inputs:[],name:"KnownDestination",type:"error"},{inputs:[],name:"NotInitializing",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:"PayloadAlreadyUsed",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"ScriptPubkeyUnsupported",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"UnauthorizedAccount",type:"error"},{inputs:[{internalType:"bytes4",name:"action",type:"bytes4"}],name:"UnexpectedAction",type:"error"},{inputs:[],name:"UnknownDestination",type:"error"},{inputs:[{internalType:"uint256",name:"fromChainId",type:"uint256"},{internalType:"address",name:"fromContract",type:"address"}],name:"UnknownOriginContract",type:"error"},{inputs:[{internalType:"uint256",name:"expiry",type:"uint256"}],name:"UserSignatureExpired",type:"error"},{inputs:[],name:"WithdrawalsDisabled",type:"error"},{inputs:[],name:"WrongChainId",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAmount",type:"error"},{inputs:[],name:"ZeroChainId",type:"error"},{inputs:[],name:"ZeroContractHash",type:"error"},{inputs:[],name:"ZeroFee",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"BasculeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"BridgeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint64",name:"prevValue",type:"uint64"},{indexed:!0,internalType:"uint64",name:"newValue",type:"uint64"}],name:"BurnCommissionChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"bool",name:"isClaimer",type:"bool"}],name:"ClaimerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"ConsortiumChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oldRate",type:"uint256"},{indexed:!0,internalType:"uint256",name:"newRate",type:"uint256"}],name:"DustFeeRateChanged",type:"event"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oldFee",type:"uint256"},{indexed:!0,internalType:"uint256",name:"newFee",type:"uint256"}],name:"FeeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"fee",type:"uint256"},{indexed:!1,internalType:"bytes",name:"userSignature",type:"bytes"}],name:"FeeCharged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"bytes32",name:"payloadHash",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"payload",type:"bytes"}],name:"MintProofConsumed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"bool",name:"isMinter",type:"bool"}],name:"MinterUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"name",type:"string"},{indexed:!1,internalType:"string",name:"symbol",type:"string"}],name:"NameAndSymbolChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferStarted",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:"address",name:"previousPauser",type:"address"},{indexed:!0,internalType:"address",name:"newPauser",type:"address"}],name:"PauserRoleTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevValue",type:"address"},{indexed:!0,internalType:"address",name:"newValue",type:"address"}],name:"TreasuryAddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"fromAddress",type:"address"},{indexed:!1,internalType:"bytes",name:"scriptPubKey",type:"bytes"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"UnstakeRequest",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"",type:"bool"}],name:"WithdrawalsEnabled",type:"event"},{inputs:[],name:"Bascule",outputs:[{internalType:"contract IBascule",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newClaimer",type:"address"}],name:"addClaimer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newMinter",type:"address"}],name:"addMinter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"to",type:"address[]"},{internalType:"uint256[]",name:"amount",type:"uint256[]"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"payload",type:"bytes[]"},{internalType:"bytes[]",name:"proof",type:"bytes[]"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"mintPayload",type:"bytes[]"},{internalType:"bytes[]",name:"proof",type:"bytes[]"},{internalType:"bytes[]",name:"feePayload",type:"bytes[]"},{internalType:"bytes[]",name:"userSignature",type:"bytes[]"}],name:"batchMintWithFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"scriptPubkey",type:"bytes"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"calcUnstakeRequestAmount",outputs:[{internalType:"uint256",name:"amountAfterFee",type:"uint256"},{internalType:"bool",name:"isAboveDust",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newVal",type:"address"}],name:"changeBascule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newBridge",type:"address"}],name:"changeBridge",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newValue",type:"uint64"}],name:"changeBurnCommission",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newVal",type:"address"}],name:"changeConsortium",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newRate",type:"uint256"}],name:"changeDustFeeRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],name:"changeNameAndSymbol",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newValue",type:"address"}],name:"changeTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"consortium",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBurnCommission",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDustFeeRate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getMintFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTreasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"consortium_",type:"address"},{internalType:"uint64",name:"burnCommission_",type:"uint64"},{internalType:"address",name:"owner_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"claimer",type:"address"}],name:"isClaimer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"minter",type:"address"}],name:"isMinter",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"bytes",name:"proof",type:"bytes"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"mintPayload",type:"bytes"},{internalType:"bytes",name:"proof",type:"bytes"},{internalType:"bytes",name:"feePayload",type:"bytes"},{internalType:"bytes",name:"userSignature",type:"bytes"}],name:"mintWithFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"pauser",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"scriptPubkey",type:"bytes"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"reinitialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oldClaimer",type:"address"}],name:"removeClaimer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oldMinter",type:"address"}],name:"removeMinter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"fee",type:"uint256"}],name:"setMintFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"toggleWithdrawals",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newPauser",type:"address"}],name:"transferPauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"fromChain",type:"uint256"},{internalType:"address",name:"fromContract",type:"address"},{internalType:"uint256",name:"toChain",type:"uint256"},{internalType:"address",name:"toContract",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint64",name:"amount",type:"uint64"},{internalType:"bytes32",name:"uniqueActionData",type:"bytes32"}],internalType:"struct Actions.DepositBridgeAction",name:"action",type:"tuple"},{internalType:"bytes32",name:"",type:"bytes32"},{internalType:"bytes",name:"",type:"bytes"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"}],Ia=[{inputs:[{internalType:"address",name:"aDefaultAdmin",type:"address"},{internalType:"address",name:"aPauser",type:"address"},{internalType:"address",name:"aDepositReporter",type:"address"},{internalType:"address",name:"aWithdrawalValidator",type:"address"},{internalType:"uint256",name:"aMaxDeposits",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessControlBadConfirmation",type:"error"},{inputs:[{internalType:"uint48",name:"schedule",type:"uint48"}],name:"AccessControlEnforcedDefaultAdminDelay",type:"error"},{inputs:[],name:"AccessControlEnforcedDefaultAdminRules",type:"error"},{inputs:[{internalType:"address",name:"defaultAdmin",type:"address"}],name:"AccessControlInvalidDefaultAdmin",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bytes32",name:"neededRole",type:"bytes32"}],name:"AccessControlUnauthorizedAccount",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"}],name:"AlreadyReported",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"AlreadyWithdrawn",type:"error"},{inputs:[],name:"BadDepositReport",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint8",name:"bits",type:"uint8"},{internalType:"uint256",name:"value",type:"uint256"}],name:"SafeCastOverflowedUintDowncast",type:"error"},{inputs:[],name:"SameValidationThreshold",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalFailedValidation",type:"error"},{anonymous:!1,inputs:[],name:"DefaultAdminDelayChangeCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint48",name:"newDelay",type:"uint48"},{indexed:!1,internalType:"uint48",name:"effectSchedule",type:"uint48"}],name:"DefaultAdminDelayChangeScheduled",type:"event"},{anonymous:!1,inputs:[],name:"DefaultAdminTransferCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newAdmin",type:"address"},{indexed:!1,internalType:"uint48",name:"acceptSchedule",type:"uint48"}],name:"DefaultAdminTransferScheduled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"reportId",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"numDeposits",type:"uint256"}],name:"DepositsReported",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"numDeposits",type:"uint256"}],name:"MaxDepositsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"oldThreshold",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newThreshold",type:"uint256"}],name:"UpdateValidateThreshold",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"depositID",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalNotValidated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"depositID",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalValidated",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEPOSIT_REPORTER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"VALIDATION_GUARDIAN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITHDRAWAL_VALIDATOR_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"beginDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"newDelay",type:"uint48"}],name:"changeDefaultAdminDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultAdminDelay",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultAdminDelayIncreaseWait",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"}],name:"depositHistory",outputs:[{internalType:"enum Bascule.DepositState",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxDeposits",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"pendingDefaultAdmin",outputs:[{internalType:"address",name:"newAdmin",type:"address"},{internalType:"uint48",name:"schedule",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingDefaultAdminDelay",outputs:[{internalType:"uint48",name:"newDelay",type:"uint48"},{internalType:"uint48",name:"schedule",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"reportId",type:"bytes32"},{internalType:"bytes32[]",name:"depositIDs",type:"bytes32[]"}],name:"reportDeposits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollbackDefaultAdminDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"aMaxDeposits",type:"uint256"}],name:"setMaxDeposits",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:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newThreshold",type:"uint256"}],name:"updateValidateThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"validateThreshold",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"validateWithdrawal",outputs:[],stateMutability:"nonpayable",type:"function"}];function Da(t){switch(t){case"LBTC":return Oa;default:return xa}}function Ye(t,a){const u=lr(a),{chainId:c}=t;if(!Xt(c))throw new Error(`This chain ${c} is not supported`);const p=u[c];if(!p)throw new Error(`Token address for chain ${c} is not defined`);const b=Da("LBTC"),E=t.createContract(b,p);return E.options.address||(E.options.address=p),E}function Ma({spender:t,amount:a,env:u,...c}){const p=new rt(c),b=Ye(p,u),E=Cn(a),A=b.methods.approve(t,E);return p.sendTransactionAsync(p.account,b.options.address,{data:A.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:An(p.chainId)})}const Na="insufficient funds",ka="Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.",rr=t=>t.startsWith("0x")?t:"0x"+t;async function Fa({data:t,proofSignature:a,env:u,...c}){const p=new rt(c),b=Ye(p,u),E=b.methods.mint(rr(t),rr(a));try{return await p.sendTransactionAsync(p.account,b.options.address,{data:E.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:An(p.chainId)})}catch(A){console.log("error",A);const C=Ge(A);throw C.includes(Na)?new Error(ka):new Error(C)}}const Ua=208,ja=4001,La=4100,Ba=4200,$a=4900,Wa=4901,Ft=-32700,Ut=-32600,jt=-32601,Lt=-32602,Bt=-32603,$t=-32e3,Wt=-32001,Vt=-32002,Gt=-32003,Yt=-32004,qt=-32005,zt=-32006;class pr extends Error{constructor(a,u){super(a),Array.isArray(u)?this.cause=new _n(u):this.cause=u,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(new.target.constructor):this.stack=new Error().stack}get innerError(){return this.cause instanceof _n?this.cause.errors:this.cause}set innerError(a){Array.isArray(a)?this.cause=new _n(a):this.cause=a}static convertToString(a,u=!1){if(a==null)return"undefined";const c=JSON.stringify(a,(p,b)=>typeof b=="bigint"?b.toString():b);return u&&["bigint","string"].includes(typeof a)?c.replace(/['\\"]+/g,""):c}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:this.cause,innerError:this.cause}}}class _n extends pr{constructor(a){super(`Multiple errors occurred: [${a.map(u=>u.message).join("], [")}]`),this.code=Ua,this.errors=a}}const Va="An Rpc error has occured with a code of *code*",fe={[Ft]:{message:"Parse error",description:"Invalid JSON"},[Ut]:{message:"Invalid request",description:"JSON is not a valid request object "},[jt]:{message:"Method not found",description:"Method does not exist "},[Lt]:{message:"Invalid params",description:"Invalid method parameters"},[Bt]:{message:"Internal error",description:"Internal JSON-RPC error"},[$t]:{message:"Invalid input",description:"Missing or invalid parameters"},[Wt]:{message:"Resource not found",description:"Requested resource not found"},[Vt]:{message:"Resource unavailable",description:"Requested resource not available"},[Gt]:{message:"Transaction rejected",description:"Transaction creation failed"},[Yt]:{message:"Method not supported",description:"Method is not implemented"},[qt]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[zt]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[ja]:{name:"User Rejected Request",message:"The user rejected the request."},[La]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[Ba]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[$a]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[Wa]:{name:"Chain Disconnected",message:"The Provider is not connected to the requested chain."},"0-999":{name:"",message:"Not used."},1e3:{name:"Normal Closure",message:"The connection successfully completed the purpose for which it was created."},1001:{name:"Going Away",message:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{name:"Protocol error",message:"The endpoint is terminating the connection due to a protocol error."},1003:{name:"Unsupported Data",message:"The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"},1004:{name:"Reserved",message:"Reserved. A meaning might be defined in the future."},1005:{name:"No Status Rcvd",message:"Reserved. Indicates that no status code was provided even though one was expected."},1006:{name:"Abnormal Closure",message:"Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{name:"Invalid frame payload data",message:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{name:"Policy Violation",message:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{name:"Message Too Big",message:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{name:"Mandatory Ext.",message:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{name:"Internal Error",message:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{name:"Service Restart",message:"The server is terminating the connection because it is restarting."},1013:{name:"Try Again Later",message:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{name:"Bad Gateway",message:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{name:"TLS handshake",message:"Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},"1016-2999":{name:"",message:"For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."},"3000-3999":{name:"",message:"For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol."},"4000-4999":{name:"",message:"For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."}};class ye extends pr{constructor(a,u){super(u??Va.replace("*code*",a.error.code.toString())),this.code=a.error.code,this.id=a.id,this.jsonrpc=a.jsonrpc,this.jsonRpcError=a.error}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{error:this.jsonRpcError,id:this.id,jsonRpc:this.jsonrpc})}}class Ga extends ye{constructor(a){super(a,fe[Ft].message),this.code=Ft}}class Ya extends ye{constructor(a){super(a,fe[Ut].message),this.code=Ut}}class qa extends ye{constructor(a){super(a,fe[jt].message),this.code=jt}}class za extends ye{constructor(a){super(a,fe[Lt].message),this.code=Lt}}class Ha extends ye{constructor(a){super(a,fe[Bt].message),this.code=Bt}}class Ja extends ye{constructor(a){super(a,fe[$t].message),this.code=$t}}class Ka extends ye{constructor(a){super(a,fe[Yt].message),this.code=Yt}}class Za extends ye{constructor(a){super(a,fe[Vt].message),this.code=Vt}}class Xa extends ye{constructor(a){super(a,fe[Wt].message),this.code=Wt}}class Qa extends ye{constructor(a){super(a,fe[zt].message),this.code=zt}}class es extends ye{constructor(a){super(a,fe[Gt].message),this.code=Gt}}class ts extends ye{constructor(a){super(a,fe[qt].message),this.code=qt}}const me=new Map;me.set(Ft,{error:Ga});me.set(Ut,{error:Ya});me.set(jt,{error:qa});me.set(Lt,{error:za});me.set(Bt,{error:Ha});me.set($t,{error:Ja});me.set(Yt,{error:Ka});me.set(Vt,{error:Za});me.set(Gt,{error:es});me.set(Wt,{error:Xa});me.set(zt,{error:Qa});me.set(qt,{error:ts});const ns=t=>typeof t=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(t);var Ht;(function(t){t.NUMBER="NUMBER_NUMBER",t.HEX="NUMBER_HEX",t.STR="NUMBER_STR",t.BIGINT="NUMBER_BIGINT"})(Ht||(Ht={}));var Jt;(function(t){t.HEX="BYTES_HEX",t.UINT8ARRAY="BYTES_UINT8ARRAY"})(Jt||(Jt={}));Ht.BIGINT,Jt.HEX;Ht.HEX,Jt.HEX;var ar;(function(t){t.EARLIEST="earliest",t.LATEST="latest",t.PENDING="pending",t.SAFE="safe",t.FINALIZED="finalized"})(ar||(ar={}));var sr;(function(t){t.chainstart="chainstart",t.frontier="frontier",t.homestead="homestead",t.dao="dao",t.tangerineWhistle="tangerineWhistle",t.spuriousDragon="spuriousDragon",t.byzantium="byzantium",t.constantinople="constantinople",t.petersburg="petersburg",t.istanbul="istanbul",t.muirGlacier="muirGlacier",t.berlin="berlin",t.london="london",t.altair="altair",t.arrowGlacier="arrowGlacier",t.grayGlacier="grayGlacier",t.bellatrix="bellatrix",t.merge="merge",t.capella="capella",t.shanghai="shanghai"})(sr||(sr={}));const rs={[y.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[y.sepolia]:w,[y.ethereum]:w,[y.binanceSmartChainTestnet]:w,[y.binanceSmartChain]:w,[y.base]:w,[y.baseTestnet]:w,[y.berachainBartioTestnet]:w,[y.corn]:w},as={[y.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[y.sepolia]:w,[y.ethereum]:w,[y.binanceSmartChainTestnet]:w,[y.binanceSmartChain]:w,[y.base]:w,[y.baseTestnet]:w,[y.berachainBartioTestnet]:w,[y.corn]:w},ss={[y.holesky]:w,[y.sepolia]:w,[y.ethereum]:"0xc750eCAC7250E0D18ecE2C7a5F130E3A765dc260",[y.binanceSmartChainTestnet]:w,[y.binanceSmartChain]:w,[y.base]:w,[y.baseTestnet]:w,[y.berachainBartioTestnet]:w,[y.corn]:w};function is(t=nt){switch(t){case ue.prod:return ss;case ue.testnet:return as;default:return rs}}function os(t,a){const u=is(a),{chainId:c}=t;if(!Xt(c))throw new Error(`This chain ${c} is not supported`);const p=u[c];if(!p)throw new Error("The address for bascule module is not defined");const b=t.createContract(Ia,p);return b.options.address||(b.options.address=p),b}const us="No deposit ID provided. Please provide a deposit ID as an argument.",cs="Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";var dr=(t=>(t[t.UNREPORTED=0]="UNREPORTED",t[t.REPORTED=1]="REPORTED",t[t.WITHDRAWN=2]="WITHDRAWN",t))(dr||{});async function ls({txId:t,env:a,...u}){if(!t)throw new Error(us);if(!ns(t))throw new Error(cs);const c=new rt(u),p=os(c,a);try{const b=await p.methods.depositHistory(Buffer.from(t.replace(/^0x/,""),"hex")).call();return Number(b)}catch(b){const E=Ge(b);throw new Error(E)}}const fr=t=>t in[y.ethereum,y.base,y.binanceSmartChain]?ue.prod:ue.stage;function yr(t,a){if(!Xt(t))throw new Error(`This chain ${t} is not supported`);const u=a?{[t]:a}:kt;if(!u[t])throw new Error(`RPC URL for chainId ${t} not found`);return u}async function ps({chainId:t,bakeGasEstimate:a=0,rpcUrl:u}){const c=yr(t,u),p=new Zt({chainId:t,rpcUrlConfig:c}),b=fr(t),A=await Ye(p,b).methods.getMintFee().call(),C=new et(Nt(A.toString(10)));return a?C.plus(Nt(a)):C}async function ds({env:t,rpcUrl:a,chainId:u}){const c={[u]:a},p=new Zt({chainId:u,rpcUrlConfig:c});return(await Ye(p,t).methods.totalSupply().call()).toString()}async function fs({owner:t,rpcUrl:a,chainId:u}){const c=yr(u,a),p=new Zt({chainId:u,rpcUrlConfig:c}),b=fr(u),E=Ye(p,b);try{return(await E.methods.nonces(t).call()).toString()}catch(A){const C=Ge(A);throw new Error(C)}}const Pn={[y.sepolia]:"0xe3748bF0Ec0A76767539eE28610B3367e35fe2C2",[y.berachainBartioTestnet]:"0x1977013acaf27856ac8048C42EE2ed0134d53895",[y.corn]:w,[y.ethereum]:w},ys={...Pn},ms={...Pn,[y.corn]:"0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A",[y.ethereum]:"0x6bc15d7930839ec18a57f6f7df72ae1b439d077f"};function bs(t=nt){switch(t){case ue.prod:return ms;case ue.testnet:return ys;default:return Pn}}async function hs(t){const a=new rt(t),u=`destination chain id is ${t.chainId}`;return a.signMessage(u)}function vs({chainId:t,verifyingContract:a,fee:u,expiry:c}){return{domain:{name:"Lombard Staked Bitcoin",version:"1",chainId:t,verifyingContract:a},message:{chainId:t,fee:u,expiry:c},primaryType:"feeApproval",types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],feeApproval:[{name:"chainId",type:"uint256"},{name:"fee",type:"uint256"},{name:"expiry",type:"uint256"}]}}}const gs="Failed to obtain a valid signature. The response is undefined or invalid.";async function Ts({address:t,provider:a,fee:u,expiry:c,chainId:p,env:b}){var U,Q;const E=new rt({provider:a,account:t,chainId:p}),C=Ye(E,b).options.address,B=JSON.stringify(vs({chainId:p,verifyingContract:C,fee:u,expiry:c})),S=await((Q=(U=E.web3)==null?void 0:U.currentProvider)==null?void 0:Q.request({method:"eth_signTypedData_v4",params:[t,B]}));if(typeof S=="string")return{signature:S,typedData:B};if(!(S!=null&&S.result))throw new Error(gs);return{signature:S.result,typedData:B}}ft.initEccLib(Yr);function Es(t,a=ue.prod){var b;const u=_s(t),p=(b=ft.payments[u]({address:t,network:a===ue.prod?ft.networks.bitcoin:ft.networks.testnet}).output)==null?void 0:b.toString("hex");if(!p)throw new Error("Output script is not found.");return`0x${p}`}function _s(t){const a=ft.address.fromBech32(t);if(a.version===1&&a.data.length===32)return"p2tr";if(a.version===0&&a.data.length===20)return"p2wpkh";if(Rs(t))return"p2wsh";throw new Error("Address type is not supported.")}function Rs(t){return(t.startsWith("bc1")||t.startsWith("tb1"))&&t.length===62}function ws({btcAddress:t,amount:a,env:u,...c}){const p=new rt(c),b=Ye(p,u),E=Es(t,u),A=Cn(a),C=b.methods.redeem(E,A);return p.sendTransactionAsync(p.account,b.options.address,{data:C.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:An(p.chainId)})}exports.BasculeDepositStatus=dr;exports.ENotarizationStatus=ur;exports.ESessionState=cr;exports.OChainId=y;exports.OEnv=ue;exports.SANCTIONED_ADDRESS=ir;exports.SATOSHI_SCALE=Kt;exports.StoryView=Ta;exports.WithDefaults=ga;exports.approveLBTC=Ma;exports.claimLBTC=Fa;exports.fromSatoshi=Nt;exports.generateDepositBtcAddress=ea;exports.getApiConfig=Ve;exports.getBasculeDepositStatus=ls;exports.getDepositBtcAddress=ra;exports.getDepositBtcAddresses=or;exports.getDepositsByAddress=oa;exports.getLBTCMintingFee=ps;exports.getLBTCTotalSupply=ds;exports.getLbtcAddressConfig=lr;exports.getLbtcOFTAdapterAddressConfig=bs;exports.getNetworkFeeSignature=Ea;exports.getPermitNonce=fs;exports.isValidChain=Xt;exports.signLbtcDestionationAddr=hs;exports.signNetworkFee=Ts;exports.storeNetworkFeeSignature=_a;exports.toSatoshi=Cn;exports.unstakeLBTC=ws;
|
|
1
|
+
"use strict";var Ee=Object.defineProperty;var Ae=(e,t,n)=>t in e?Ee(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var v=(e,t,n)=>(Ae(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=require("axios"),R=require("bignumber.js"),T=require("web3"),ve=require("@bitcoin-js/tiny-secp256k1-asmjs"),_=require("bitcoinjs-lib");function Re(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Se=Re(ve),y={prod:"prod",testnet:"testnet",stage:"stage"},s={ethereum:1,holesky:17e3,binanceSmartChain:56,binanceSmartChainTestnet:97,sepolia:11155111,base:8453,baseTestnet:84532,berachainBartioTestnet:80084,corn:21e6},x=y.prod,o="0x0000000000000000000000000000000000000000",Ce={baseApiUrl:"https://bft-dev.stage.lombard.finance",claimerApiUrl:"https://claimer.staging.lombard.finance"},Ie={baseApiUrl:"https://gastald-testnet.prod.lombard.finance",claimerApiUrl:"https://claimer.staging.lombard.finance"},_e={baseApiUrl:"https://mainnet.prod.lombard.finance",claimerApiUrl:""},E=(e=x)=>{switch(e){case y.prod:return _e;case y.testnet:return Ie;default:return Ce}};function C(e){return typeof e=="string"?e:(n=>{var a;return((a=n==null?void 0:n.data)==null?void 0:a.message)&&typeof n.data.message=="string"})(e)?e.data.message:e instanceof Error?xe(e):De(e)}function xe(e){return e.response?e.response.data.message:e.message}function De(e){return e!=null&&e.message?e.message:"Unknown error"}const Me={eth:"DESTINATION_BLOCKCHAIN_ETHEREUM"};function Q(e){switch(e){case s.holesky:case s.sepolia:case s.ethereum:return Me.eth;default:throw new Error(`Unknown chain ID: ${e}`)}}const de="sanctioned_address",Ne="api/v1/address/generate",Pe="destination address is under sanctions";async function Oe({address:e,chainId:t,signature:n,env:a,captchaToken:i,referrerCode:r,referralId:p}){const{baseApiUrl:u}=E(a),d=Q(t),g={to_address:e,to_address_signature:n,to_chain:d,referrer_code:r,referral_id:p,nonce:0,captcha:i};try{const{data:l}=await S.post(Ne,g,{baseURL:u});return l.address}catch(l){const w=C(l);if(Ue(w))return de;throw new Error(w)}}function Ue(e){return!!e.includes(Pe)}const Fe="api/v1/address";async function Be({address:e,chainId:t,env:n,referralId:a}){const i=await ye({address:e,chainId:t,env:n,referralId:a}),r=Le(i);if(!r)throw new Error("No address");return r.btc_address}function Le(e){if(!e.length)return;const t=e.reduce((n,a)=>n.created_at<a.created_at?a:n,e[0]);return t.deprecated?void 0:t}async function ye({address:e,chainId:t,env:n,referralId:a}){const{baseApiUrl:i}=E(n),r=Q(t),p={to_address:e,to_blockchain:r,limit:1,offset:0,asc:!1,referralId:a},{data:u}=await S.get(Fe,{baseURL:i,params:p});return(u==null?void 0:u.addresses)||[]}const ke=8,z=10**ke;function P(e){return+e/z}function ee(e){return Math.floor(+e*z)}function Ge(e,t=x){switch(e){case"DESTINATION_BLOCKCHAIN_ETHEREUM":return t===y.prod?s.ethereum:s.sepolia;default:return s.ethereum}}var ce=(e=>(e.NOTARIZATION_STATUS_UNSPECIFIED="NOTARIZATION_STATUS_UNSPECIFIED",e.NOTARIZATION_STATUS_PENDING="NOTARIZATION_STATUS_PENDING",e.NOTARIZATION_STATUS_SUBMITTED="NOTARIZATION_STATUS_SUBMITTED",e.NOTARIZATION_STATUS_SESSION_APPROVED="NOTARIZATION_STATUS_SESSION_APPROVED",e.NOTARIZATION_STATUS_FAILED="NOTARIZATION_STATUS_FAILED",e))(ce||{}),le=(e=>(e.SESSION_STATE_UNSPECIFIED="SESSION_STATE_UNSPECIFIED",e.SESSION_STATE_PENDING="SESSION_STATE_PENDING",e.SESSION_STATE_COMPLETED="SESSION_STATE_COMPLETED",e.SESSION_STATE_EXPIRED="SESSION_STATE_EXPIRED",e))(le||{});async function We({address:e,env:t}){const{baseApiUrl:n}=E(t),{data:a}=await S.get(`api/v1/address/outputs-v2/${e}`,{baseURL:n});return((a==null?void 0:a.outputs)??[]).map(Ve(t))}function Ve(e){return t=>({txid:t.txid,index:t.index??0,blockHeight:t.block_height?Number(t.block_height):void 0,blockTime:t.block_time?Number(t.block_time):void 0,value:new R(P(t.value)),address:t.address,chainId:Ge(t.to_chain,e),claimedTxId:t.claim_tx,rawPayload:t.raw_payload,signature:t.proof,isRestricted:!!t.sanctioned,notarizationWaitDur:t.notarization_wait_dur?Number(t.notarization_wait_dur):void 0,payload:t.payload_hash,sessionId:t.session_id,notarizationStatus:t.notarization_status,sessionState:t.session_state})}const $e=2e-4;async function je({env:e,chainId:t=s.ethereum,amount:n=1}){const{baseApiUrl:a}=E(e),i=Q(t),{data:r}=await S.get(`api/v1/exchange/rate/${i}`,{baseURL:a,params:{amount:n}}),p=new R($e).multipliedBy(z).toFixed();return{exchangeRate:+r.amount_out,minAmount:+p}}async function qe({address:e,chainId:t,env:n}){const{claimerApiUrl:a}=E(n);try{const{data:i}=await S.get(`${a}/claimer/v1/mintwithfee/get-user-signature`,{params:{user_destination_address:e,chain_id:t}});return{expirationDate:i==null?void 0:i.expiration_date,hasSignature:i==null?void 0:i.has_signature,isDelayed:i==null?void 0:i.is_delayed}}catch(i){const r=C(i);throw new Error(r)}}async function He({signature:e,typedData:t,address:n,env:a}){const{claimerApiUrl:i}=E(a);try{const{data:r}=await S.post(`${i}/claimer/v1/mintwithfee/save-user-signature`,null,{params:{typed_data:t,signature:e,user_destination_address:n}});return r.status}catch(r){const p=C(r);throw new Error(p)}}const O={[s.ethereum]:"https://rpc.ankr.com/eth",[s.holesky]:"https://rpc.ankr.com/eth_holesky",[s.sepolia]:"https://rpc.ankr.com/eth_sepolia",[s.base]:"https://rpc.ankr.com/base",[s.baseTestnet]:"https://rpc.ankr.com/base_sepolia",[s.binanceSmartChain]:"https://rpc.ankr.com/bsc"};async function Je(e){const n=await(await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({jsonrpc:"2.0",id:1,method:"eth_maxPriorityFeePerGas",params:[]})})).json(),a=T.utils.hexToNumber(n==null?void 0:n.result);return new R(Number(a))}const Ze=2,ze=25e3;class X{constructor({chainId:t,rpcUrlConfig:n}){v(this,"chainId");v(this,"rpcConfig");this.chainId=t,this.rpcConfig={...O,...n}}getReadWeb3(){const t=this.getRpcUrl(),n=new T.Web3,a=new T.Web3.providers.HttpProvider(t);return n.setProvider(a),n}getRpcUrl(){var a;const{chainId:t}=this,n=(a=this.rpcConfig)==null?void 0:a[t];if(!n)throw console.error(`You might need to add the rpcConfig for the ${t} chain ID when creating the provider.`),new Error(`RPC URL for chainId ${t} not found`);return n}async getMaxFees(){const t=this.getReadWeb3(),n=this.getRpcUrl(),[a,i]=await Promise.all([t.eth.getBlock("latest"),Je(n)]);return!(a!=null&&a.baseFeePerGas)&&typeof(a==null?void 0:a.baseFeePerGas)!="bigint"?{}:{maxFeePerGas:+new R(a.baseFeePerGas.toString(10)).multipliedBy(Ze).plus(i),maxPriorityFeePerGas:+i}}async getSafeGasPriceWei(){const t=await this.getReadWeb3().eth.getGasPrice();return new R(t.toString(10)).plus(ze)}createContract(t,n){const a=this.getReadWeb3();return new a.eth.Contract(t,n)}}class I extends X{constructor({provider:n,account:a,chainId:i,rpcUrlConfig:r}){super({chainId:i,rpcUrlConfig:r});v(this,"web3");v(this,"account");v(this,"rpcConfig",O);this.web3=new T(n),this.account=a,this.chainId=i,this.rpcConfig={...O,...r}}async signMessage(n){const{account:a}=this,i=`0x${Buffer.from(n,"utf8").toString("hex")}`;return this.web3.currentProvider.request({method:"personal_sign",params:[i,a]})}async sendTransactionAsync(n,a,i){const{chainId:r,web3:p}=this,u=this.getReadWeb3(),{data:d,estimate:g=!1,estimateFee:l=!1,extendedGasLimit:w,gasLimit:D="0",value:ge="0",gasLimitMultiplier:we=1}=i;let{nonce:M}=i;M||(M=await u.eth.getTransactionCount(n)),console.log(`Nonce: ${M}`);const c={from:n,to:a,value:T.utils.numberToHex(ge),data:d,nonce:M,chainId:T.utils.numberToHex(r)};if(g)try{const h=await u.eth.estimateGas(c),N=Math.round(Number(h)*we);w?c.gas=T.utils.numberToHex(N+w):c.gas=T.utils.numberToHex(N)}catch(h){throw new Error(h.message??"Failed to estimate gas limit for transaction.")}else c.gas=T.utils.numberToHex(D);const{maxFeePerGas:ae,maxPriorityFeePerGas:se}=l?await this.getMaxFees().catch(()=>i):i;if(se!==void 0&&(c.maxPriorityFeePerGas=T.utils.numberToHex(se)),ae!==void 0&&(c.maxFeePerGas=T.utils.numberToHex(ae)),!c.maxFeePerGas&&!c.maxPriorityFeePerGas){const h=await this.getSafeGasPriceWei();c.gasPrice=h.toString(10)}if(!c.maxFeePerGas&&!c.maxPriorityFeePerGas){const h=await this.getSafeGasPriceWei();c.gasPrice=h.toString(10)}return console.log("Sending transaction via Web3: ",c),new Promise((h,N)=>{const ie=p.eth.sendTransaction(c);ie.once("transactionHash",async re=>{console.log(`Just signed transaction has is: ${re}`),h({receiptPromise:ie,transactionHash:re})}).catch(N)})}createContract(n,a){return new this.web3.eth.Contract(n,a)}}function te(e){switch(e){case s.ethereum:return 1.3;case s.holesky:case s.sepolia:return 1.5;default:return 1.3}}function K(e){return Object.values(s).includes(e)}const Xe={[s.holesky]:"0xED7bfd5C1790576105Af4649817f6d35A75CD818",[s.ethereum]:o,[s.binanceSmartChainTestnet]:"0x731eFa688F3679688cf60A3993b8658138953ED6",[s.binanceSmartChain]:o,[s.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[s.base]:o,[s.baseTestnet]:o,[s.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[s.corn]:o},Ke={[s.holesky]:"0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",[s.ethereum]:o,[s.binanceSmartChainTestnet]:"0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",[s.binanceSmartChain]:o,[s.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[s.base]:o,[s.baseTestnet]:o,[s.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[s.corn]:o},Ye={[s.ethereum]:"0x8236a87084f8b84306f72007f36f2618a5634494",[s.holesky]:o,[s.sepolia]:o,[s.binanceSmartChainTestnet]:o,[s.binanceSmartChain]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[s.base]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[s.baseTestnet]:o,[s.berachainBartioTestnet]:o,[s.corn]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1"};function me(e=x){switch(e){case y.prod:return Ye;case y.testnet:return Ke;default:return Xe}}const Qe=[{constant:!0,inputs:[],name:"name",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_spender",type:"address"},{name:"_value",type:"uint256"}],name:"approve",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"totalSupply",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transferFrom",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[],name:"decimals",outputs:[{name:"",type:"uint8"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"balanceOf",outputs:[{name:"balance",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{constant:!0,inputs:[],name:"symbol",outputs:[{name:"",type:"string"}],payable:!1,stateMutability:"view",type:"function"},{constant:!1,inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],name:"transfer",outputs:[{name:"",type:"bool"}],payable:!1,stateMutability:"nonpayable",type:"function"},{constant:!0,inputs:[{name:"_owner",type:"address"},{name:"_spender",type:"address"}],name:"allowance",outputs:[{name:"",type:"uint256"}],payable:!1,stateMutability:"view",type:"function"},{payable:!0,stateMutability:"payable",type:"fallback"},{anonymous:!1,inputs:[{indexed:!0,name:"owner",type:"address"},{indexed:!0,name:"spender",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"from",type:"address"},{indexed:!0,name:"to",type:"address"},{indexed:!1,name:"value",type:"uint256"}],name:"Transfer",type:"event"}],et=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"uint256",name:"dustLimit",type:"uint256"}],name:"AmountBelowDustLimit",type:"error"},{inputs:[{internalType:"uint256",name:"fee",type:"uint256"}],name:"AmountLessThanCommission",type:"error"},{inputs:[],name:"ECDSAInvalidSignature",type:"error"},{inputs:[{internalType:"uint256",name:"length",type:"uint256"}],name:"ECDSAInvalidSignatureLength",type:"error"},{inputs:[{internalType:"bytes32",name:"s",type:"bytes32"}],name:"ECDSAInvalidSignatureS",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"allowance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientAllowance",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"},{internalType:"uint256",name:"balance",type:"uint256"},{internalType:"uint256",name:"needed",type:"uint256"}],name:"ERC20InsufficientBalance",type:"error"},{inputs:[{internalType:"address",name:"approver",type:"address"}],name:"ERC20InvalidApprover",type:"error"},{inputs:[{internalType:"address",name:"receiver",type:"address"}],name:"ERC20InvalidReceiver",type:"error"},{inputs:[{internalType:"address",name:"sender",type:"address"}],name:"ERC20InvalidSender",type:"error"},{inputs:[{internalType:"address",name:"spender",type:"address"}],name:"ERC20InvalidSpender",type:"error"},{inputs:[{internalType:"uint256",name:"deadline",type:"uint256"}],name:"ERC2612ExpiredSignature",type:"error"},{inputs:[{internalType:"address",name:"signer",type:"address"},{internalType:"address",name:"owner",type:"address"}],name:"ERC2612InvalidSigner",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[],name:"FeeGreaterThanAmount",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"currentNonce",type:"uint256"}],name:"InvalidAccountNonce",type:"error"},{inputs:[],name:"InvalidDustFeeRate",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidInputLength",type:"error"},{inputs:[],name:"InvalidUserSignature",type:"error"},{inputs:[],name:"KnownDestination",type:"error"},{inputs:[],name:"NotInitializing",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:"PayloadAlreadyUsed",type:"error"},{inputs:[],name:"ReentrancyGuardReentrantCall",type:"error"},{inputs:[],name:"ScriptPubkeyUnsupported",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"UnauthorizedAccount",type:"error"},{inputs:[{internalType:"bytes4",name:"action",type:"bytes4"}],name:"UnexpectedAction",type:"error"},{inputs:[],name:"UnknownDestination",type:"error"},{inputs:[{internalType:"uint256",name:"fromChainId",type:"uint256"},{internalType:"address",name:"fromContract",type:"address"}],name:"UnknownOriginContract",type:"error"},{inputs:[{internalType:"uint256",name:"expiry",type:"uint256"}],name:"UserSignatureExpired",type:"error"},{inputs:[],name:"WithdrawalsDisabled",type:"error"},{inputs:[],name:"WrongChainId",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAddress",type:"error"},{inputs:[],name:"ZeroAmount",type:"error"},{inputs:[],name:"ZeroChainId",type:"error"},{inputs:[],name:"ZeroContractHash",type:"error"},{inputs:[],name:"ZeroFee",type:"error"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"owner",type:"address"},{indexed:!0,internalType:"address",name:"spender",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Approval",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"BasculeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"BridgeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint64",name:"prevValue",type:"uint64"},{indexed:!0,internalType:"uint64",name:"newValue",type:"uint64"}],name:"BurnCommissionChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"claimer",type:"address"},{indexed:!1,internalType:"bool",name:"isClaimer",type:"bool"}],name:"ClaimerUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevVal",type:"address"},{indexed:!0,internalType:"address",name:"newVal",type:"address"}],name:"ConsortiumChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oldRate",type:"uint256"},{indexed:!0,internalType:"uint256",name:"newRate",type:"uint256"}],name:"DustFeeRateChanged",type:"event"},{anonymous:!1,inputs:[],name:"EIP712DomainChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"oldFee",type:"uint256"},{indexed:!0,internalType:"uint256",name:"newFee",type:"uint256"}],name:"FeeChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"uint256",name:"fee",type:"uint256"},{indexed:!1,internalType:"bytes",name:"userSignature",type:"bytes"}],name:"FeeCharged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"recipient",type:"address"},{indexed:!0,internalType:"bytes32",name:"payloadHash",type:"bytes32"},{indexed:!1,internalType:"bytes",name:"payload",type:"bytes"}],name:"MintProofConsumed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"minter",type:"address"},{indexed:!1,internalType:"bool",name:"isMinter",type:"bool"}],name:"MinterUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"string",name:"name",type:"string"},{indexed:!1,internalType:"string",name:"symbol",type:"string"}],name:"NameAndSymbolChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"previousOwner",type:"address"},{indexed:!0,internalType:"address",name:"newOwner",type:"address"}],name:"OwnershipTransferStarted",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:"address",name:"previousPauser",type:"address"},{indexed:!0,internalType:"address",name:"newPauser",type:"address"}],name:"PauserRoleTransferred",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"from",type:"address"},{indexed:!0,internalType:"address",name:"to",type:"address"},{indexed:!1,internalType:"uint256",name:"value",type:"uint256"}],name:"Transfer",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"prevValue",type:"address"},{indexed:!0,internalType:"address",name:"newValue",type:"address"}],name:"TreasuryAddressChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"fromAddress",type:"address"},{indexed:!1,internalType:"bytes",name:"scriptPubKey",type:"bytes"},{indexed:!1,internalType:"uint256",name:"amount",type:"uint256"}],name:"UnstakeRequest",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bool",name:"",type:"bool"}],name:"WithdrawalsEnabled",type:"event"},{inputs:[],name:"Bascule",outputs:[{internalType:"contract IBascule",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"DOMAIN_SEPARATOR",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newClaimer",type:"address"}],name:"addClaimer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newMinter",type:"address"}],name:"addMinter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"}],name:"allowance",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"approve",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"balanceOf",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address[]",name:"to",type:"address[]"},{internalType:"uint256[]",name:"amount",type:"uint256[]"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"payload",type:"bytes[]"},{internalType:"bytes[]",name:"proof",type:"bytes[]"}],name:"batchMint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes[]",name:"mintPayload",type:"bytes[]"},{internalType:"bytes[]",name:"proof",type:"bytes[]"},{internalType:"bytes[]",name:"feePayload",type:"bytes[]"},{internalType:"bytes[]",name:"userSignature",type:"bytes[]"}],name:"batchMintWithFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"burn",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"scriptPubkey",type:"bytes"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"calcUnstakeRequestAmount",outputs:[{internalType:"uint256",name:"amountAfterFee",type:"uint256"},{internalType:"bool",name:"isAboveDust",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newVal",type:"address"}],name:"changeBascule",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newBridge",type:"address"}],name:"changeBridge",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint64",name:"newValue",type:"uint64"}],name:"changeBurnCommission",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newVal",type:"address"}],name:"changeConsortium",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newRate",type:"uint256"}],name:"changeDustFeeRate",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"string",name:"name_",type:"string"},{internalType:"string",name:"symbol_",type:"string"}],name:"changeNameAndSymbol",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newValue",type:"address"}],name:"changeTreasuryAddress",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"consortium",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"decimals",outputs:[{internalType:"uint8",name:"",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[],name:"eip712Domain",outputs:[{internalType:"bytes1",name:"fields",type:"bytes1"},{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"version",type:"string"},{internalType:"uint256",name:"chainId",type:"uint256"},{internalType:"address",name:"verifyingContract",type:"address"},{internalType:"bytes32",name:"salt",type:"bytes32"},{internalType:"uint256[]",name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getBurnCommission",outputs:[{internalType:"uint64",name:"",type:"uint64"}],stateMutability:"view",type:"function"},{inputs:[],name:"getDustFeeRate",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getMintFee",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getTreasury",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"consortium_",type:"address"},{internalType:"uint64",name:"burnCommission_",type:"uint64"},{internalType:"address",name:"owner_",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"claimer",type:"address"}],name:"isClaimer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"minter",type:"address"}],name:"isMinter",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"payload",type:"bytes"},{internalType:"bytes",name:"proof",type:"bytes"}],name:"mint",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"mintPayload",type:"bytes"},{internalType:"bytes",name:"proof",type:"bytes"},{internalType:"bytes",name:"feePayload",type:"bytes"},{internalType:"bytes",name:"userSignature",type:"bytes"}],name:"mintWithFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"name",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"}],name:"nonces",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"pauser",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingOwner",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"owner",type:"address"},{internalType:"address",name:"spender",type:"address"},{internalType:"uint256",name:"value",type:"uint256"},{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],name:"permit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes",name:"scriptPubkey",type:"bytes"},{internalType:"uint256",name:"amount",type:"uint256"}],name:"redeem",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"reinitialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oldClaimer",type:"address"}],name:"removeClaimer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"oldMinter",type:"address"}],name:"removeMinter",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"renounceOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"fee",type:"uint256"}],name:"setMintFee",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"symbol",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"toggleWithdrawals",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"totalSupply",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transfer",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"from",type:"address"},{internalType:"address",name:"to",type:"address"},{internalType:"uint256",name:"value",type:"uint256"}],name:"transferFrom",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newOwner",type:"address"}],name:"transferOwnership",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newPauser",type:"address"}],name:"transferPauserRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{components:[{internalType:"uint256",name:"fromChain",type:"uint256"},{internalType:"address",name:"fromContract",type:"address"},{internalType:"uint256",name:"toChain",type:"uint256"},{internalType:"address",name:"toContract",type:"address"},{internalType:"address",name:"recipient",type:"address"},{internalType:"uint64",name:"amount",type:"uint64"},{internalType:"bytes32",name:"uniqueActionData",type:"bytes32"}],internalType:"struct Actions.DepositBridgeAction",name:"action",type:"tuple"},{internalType:"bytes32",name:"",type:"bytes32"},{internalType:"bytes",name:"",type:"bytes"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"}],tt=[{inputs:[{internalType:"address",name:"aDefaultAdmin",type:"address"},{internalType:"address",name:"aPauser",type:"address"},{internalType:"address",name:"aDepositReporter",type:"address"},{internalType:"address",name:"aWithdrawalValidator",type:"address"},{internalType:"uint256",name:"aMaxDeposits",type:"uint256"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[],name:"AccessControlBadConfirmation",type:"error"},{inputs:[{internalType:"uint48",name:"schedule",type:"uint48"}],name:"AccessControlEnforcedDefaultAdminDelay",type:"error"},{inputs:[],name:"AccessControlEnforcedDefaultAdminRules",type:"error"},{inputs:[{internalType:"address",name:"defaultAdmin",type:"address"}],name:"AccessControlInvalidDefaultAdmin",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"bytes32",name:"neededRole",type:"bytes32"}],name:"AccessControlUnauthorizedAccount",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"}],name:"AlreadyReported",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"AlreadyWithdrawn",type:"error"},{inputs:[],name:"BadDepositReport",type:"error"},{inputs:[],name:"EnforcedPause",type:"error"},{inputs:[],name:"ExpectedPause",type:"error"},{inputs:[{internalType:"uint8",name:"bits",type:"uint8"},{internalType:"uint256",name:"value",type:"uint256"}],name:"SafeCastOverflowedUintDowncast",type:"error"},{inputs:[],name:"SameValidationThreshold",type:"error"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalFailedValidation",type:"error"},{anonymous:!1,inputs:[],name:"DefaultAdminDelayChangeCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint48",name:"newDelay",type:"uint48"},{indexed:!1,internalType:"uint48",name:"effectSchedule",type:"uint48"}],name:"DefaultAdminDelayChangeScheduled",type:"event"},{anonymous:!1,inputs:[],name:"DefaultAdminTransferCanceled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"newAdmin",type:"address"},{indexed:!1,internalType:"uint48",name:"acceptSchedule",type:"uint48"}],name:"DefaultAdminTransferScheduled",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"reportId",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"numDeposits",type:"uint256"}],name:"DepositsReported",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"numDeposits",type:"uint256"}],name:"MaxDepositsUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Paused",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"previousAdminRole",type:"bytes32"},{indexed:!0,internalType:"bytes32",name:"newAdminRole",type:"bytes32"}],name:"RoleAdminChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleGranted",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"bytes32",name:"role",type:"bytes32"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!0,internalType:"address",name:"sender",type:"address"}],name:"RoleRevoked",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"account",type:"address"}],name:"Unpaused",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint256",name:"oldThreshold",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newThreshold",type:"uint256"}],name:"UpdateValidateThreshold",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"depositID",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalNotValidated",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"bytes32",name:"depositID",type:"bytes32"},{indexed:!1,internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"WithdrawalValidated",type:"event"},{inputs:[],name:"DEFAULT_ADMIN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"DEPOSIT_REPORTER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"PAUSER_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"VALIDATION_GUARDIAN_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"WITHDRAWAL_VALIDATOR_ROLE",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[],name:"acceptDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAdmin",type:"address"}],name:"beginDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"cancelDefaultAdminTransfer",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint48",name:"newDelay",type:"uint48"}],name:"changeDefaultAdminDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"defaultAdmin",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultAdminDelay",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[],name:"defaultAdminDelayIncreaseWait",outputs:[{internalType:"uint48",name:"",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"}],name:"depositHistory",outputs:[{internalType:"enum Bascule.DepositState",name:"status",type:"uint8"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"}],name:"getRoleAdmin",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"grantRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"hasRole",outputs:[{internalType:"bool",name:"",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"maxDeposits",outputs:[{internalType:"uint256",name:"",type:"uint256"}],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:"pendingDefaultAdmin",outputs:[{internalType:"address",name:"newAdmin",type:"address"},{internalType:"uint48",name:"schedule",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[],name:"pendingDefaultAdminDelay",outputs:[{internalType:"uint48",name:"newDelay",type:"uint48"},{internalType:"uint48",name:"schedule",type:"uint48"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"renounceRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"reportId",type:"bytes32"},{internalType:"bytes32[]",name:"depositIDs",type:"bytes32[]"}],name:"reportDeposits",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"bytes32",name:"role",type:"bytes32"},{internalType:"address",name:"account",type:"address"}],name:"revokeRole",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"rollbackDefaultAdminDelay",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"aMaxDeposits",type:"uint256"}],name:"setMaxDeposits",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:"unpause",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint256",name:"newThreshold",type:"uint256"}],name:"updateValidateThreshold",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"validateThreshold",outputs:[{internalType:"uint256",name:"",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"bytes32",name:"depositID",type:"bytes32"},{internalType:"uint256",name:"withdrawalAmount",type:"uint256"}],name:"validateWithdrawal",outputs:[],stateMutability:"nonpayable",type:"function"}];function nt(e){switch(e){case"LBTC":return et;default:return Qe}}function A(e,t){const n=me(t),{chainId:a}=e;if(!K(a))throw new Error(`This chain ${a} is not supported`);const i=n[a];if(!i)throw new Error(`Token address for chain ${a} is not defined`);const r=nt("LBTC"),p=e.createContract(r,i);return p.options.address||(p.options.address=i),p}function at({spender:e,amount:t,env:n,...a}){const i=new I(a),r=A(i,n),p=ee(t),u=r.methods.approve(e,p);return i.sendTransactionAsync(i.account,r.options.address,{data:u.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:te(i.chainId)})}const st="insufficient funds",it="Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.",oe=e=>e.startsWith("0x")?e:"0x"+e;async function rt({data:e,proofSignature:t,env:n,...a}){const i=new I(a),r=A(i,n),p=r.methods.mint(oe(e),oe(t));try{return await i.sendTransactionAsync(i.account,r.options.address,{data:p.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:te(i.chainId)})}catch(u){console.log("error",u);const d=C(u);throw d.includes(st)?new Error(it):new Error(d)}}const ot=208,pt=4001,ut=4100,dt=4200,yt=4900,ct=4901,U=-32700,F=-32600,B=-32601,L=-32602,k=-32603,G=-32e3,W=-32001,V=-32002,$=-32003,j=-32004,q=-32005,H=-32006;class be extends Error{constructor(t,n){super(t),Array.isArray(n)?this.cause=new Y(n):this.cause=n,this.name=this.constructor.name,typeof Error.captureStackTrace=="function"?Error.captureStackTrace(new.target.constructor):this.stack=new Error().stack}get innerError(){return this.cause instanceof Y?this.cause.errors:this.cause}set innerError(t){Array.isArray(t)?this.cause=new Y(t):this.cause=t}static convertToString(t,n=!1){if(t==null)return"undefined";const a=JSON.stringify(t,(i,r)=>typeof r=="bigint"?r.toString():r);return n&&["bigint","string"].includes(typeof t)?a.replace(/['\\"]+/g,""):a}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:this.cause,innerError:this.cause}}}class Y extends be{constructor(t){super(`Multiple errors occurred: [${t.map(n=>n.message).join("], [")}]`),this.code=ot,this.errors=t}}const lt="An Rpc error has occured with a code of *code*",m={[U]:{message:"Parse error",description:"Invalid JSON"},[F]:{message:"Invalid request",description:"JSON is not a valid request object "},[B]:{message:"Method not found",description:"Method does not exist "},[L]:{message:"Invalid params",description:"Invalid method parameters"},[k]:{message:"Internal error",description:"Internal JSON-RPC error"},[G]:{message:"Invalid input",description:"Missing or invalid parameters"},[W]:{message:"Resource not found",description:"Requested resource not found"},[V]:{message:"Resource unavailable",description:"Requested resource not available"},[$]:{message:"Transaction rejected",description:"Transaction creation failed"},[j]:{message:"Method not supported",description:"Method is not implemented"},[q]:{message:"Limit exceeded",description:"Request exceeds defined limit"},[H]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[pt]:{name:"User Rejected Request",message:"The user rejected the request."},[ut]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[dt]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[yt]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[ct]:{name:"Chain Disconnected",message:"The Provider is not connected to the requested chain."},"0-999":{name:"",message:"Not used."},1e3:{name:"Normal Closure",message:"The connection successfully completed the purpose for which it was created."},1001:{name:"Going Away",message:"The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."},1002:{name:"Protocol error",message:"The endpoint is terminating the connection due to a protocol error."},1003:{name:"Unsupported Data",message:"The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"},1004:{name:"Reserved",message:"Reserved. A meaning might be defined in the future."},1005:{name:"No Status Rcvd",message:"Reserved. Indicates that no status code was provided even though one was expected."},1006:{name:"Abnormal Closure",message:"Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."},1007:{name:"Invalid frame payload data",message:"The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."},1008:{name:"Policy Violation",message:"The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."},1009:{name:"Message Too Big",message:"The endpoint is terminating the connection because a data frame was received that is too large."},1010:{name:"Mandatory Ext.",message:"The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."},1011:{name:"Internal Error",message:"The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."},1012:{name:"Service Restart",message:"The server is terminating the connection because it is restarting."},1013:{name:"Try Again Later",message:"The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."},1014:{name:"Bad Gateway",message:"The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."},1015:{name:"TLS handshake",message:"Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."},"1016-2999":{name:"",message:"For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."},"3000-3999":{name:"",message:"For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol."},"4000-4999":{name:"",message:"For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."}};class b extends be{constructor(t,n){super(n??lt.replace("*code*",t.error.code.toString())),this.code=t.error.code,this.id=t.id,this.jsonrpc=t.jsonrpc,this.jsonRpcError=t.error}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{error:this.jsonRpcError,id:this.id,jsonRpc:this.jsonrpc})}}class mt extends b{constructor(t){super(t,m[U].message),this.code=U}}class bt extends b{constructor(t){super(t,m[F].message),this.code=F}}class ft extends b{constructor(t){super(t,m[B].message),this.code=B}}class Tt extends b{constructor(t){super(t,m[L].message),this.code=L}}class ht extends b{constructor(t){super(t,m[k].message),this.code=k}}class gt extends b{constructor(t){super(t,m[G].message),this.code=G}}class wt extends b{constructor(t){super(t,m[j].message),this.code=j}}class Et extends b{constructor(t){super(t,m[V].message),this.code=V}}class At extends b{constructor(t){super(t,m[W].message),this.code=W}}class vt extends b{constructor(t){super(t,m[H].message),this.code=H}}class Rt extends b{constructor(t){super(t,m[$].message),this.code=$}}class St extends b{constructor(t){super(t,m[q].message),this.code=q}}const f=new Map;f.set(U,{error:mt});f.set(F,{error:bt});f.set(B,{error:ft});f.set(L,{error:Tt});f.set(k,{error:ht});f.set(G,{error:gt});f.set(j,{error:wt});f.set(V,{error:Et});f.set($,{error:Rt});f.set(W,{error:At});f.set(H,{error:vt});f.set(q,{error:St});const Ct=e=>typeof e=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(e);var J;(function(e){e.NUMBER="NUMBER_NUMBER",e.HEX="NUMBER_HEX",e.STR="NUMBER_STR",e.BIGINT="NUMBER_BIGINT"})(J||(J={}));var Z;(function(e){e.HEX="BYTES_HEX",e.UINT8ARRAY="BYTES_UINT8ARRAY"})(Z||(Z={}));J.BIGINT,Z.HEX;J.HEX,Z.HEX;var pe;(function(e){e.EARLIEST="earliest",e.LATEST="latest",e.PENDING="pending",e.SAFE="safe",e.FINALIZED="finalized"})(pe||(pe={}));var ue;(function(e){e.chainstart="chainstart",e.frontier="frontier",e.homestead="homestead",e.dao="dao",e.tangerineWhistle="tangerineWhistle",e.spuriousDragon="spuriousDragon",e.byzantium="byzantium",e.constantinople="constantinople",e.petersburg="petersburg",e.istanbul="istanbul",e.muirGlacier="muirGlacier",e.berlin="berlin",e.london="london",e.altair="altair",e.arrowGlacier="arrowGlacier",e.grayGlacier="grayGlacier",e.bellatrix="bellatrix",e.merge="merge",e.capella="capella",e.shanghai="shanghai"})(ue||(ue={}));const It={[s.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[s.sepolia]:o,[s.ethereum]:o,[s.binanceSmartChainTestnet]:o,[s.binanceSmartChain]:o,[s.base]:o,[s.baseTestnet]:o,[s.berachainBartioTestnet]:o,[s.corn]:o},_t={[s.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[s.sepolia]:o,[s.ethereum]:o,[s.binanceSmartChainTestnet]:o,[s.binanceSmartChain]:o,[s.base]:o,[s.baseTestnet]:o,[s.berachainBartioTestnet]:o,[s.corn]:o},xt={[s.holesky]:o,[s.sepolia]:o,[s.ethereum]:"0xc750eCAC7250E0D18ecE2C7a5F130E3A765dc260",[s.binanceSmartChainTestnet]:o,[s.binanceSmartChain]:o,[s.base]:o,[s.baseTestnet]:o,[s.berachainBartioTestnet]:o,[s.corn]:o};function Dt(e=x){switch(e){case y.prod:return xt;case y.testnet:return _t;default:return It}}function Mt(e,t){const n=Dt(t),{chainId:a}=e;if(!K(a))throw new Error(`This chain ${a} is not supported`);const i=n[a];if(!i)throw new Error("The address for bascule module is not defined");const r=e.createContract(tt,i);return r.options.address||(r.options.address=i),r}const Nt="No deposit ID provided. Please provide a deposit ID as an argument.",Pt="Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";var fe=(e=>(e[e.UNREPORTED=0]="UNREPORTED",e[e.REPORTED=1]="REPORTED",e[e.WITHDRAWN=2]="WITHDRAWN",e))(fe||{});async function Ot({txId:e,env:t,...n}){if(!e)throw new Error(Nt);if(!Ct(e))throw new Error(Pt);const a=new I(n),i=Mt(a,t);try{const r=await i.methods.depositHistory(Buffer.from(e.replace(/^0x/,""),"hex")).call();return Number(r)}catch(r){const p=C(r);throw new Error(p)}}const Te=e=>e in[s.ethereum,s.base,s.binanceSmartChain]?y.prod:y.stage;function he(e,t){if(!K(e))throw new Error(`This chain ${e} is not supported`);const n=t?{[e]:t}:O;if(!n[e])throw new Error(`RPC URL for chainId ${e} not found`);return n}async function Ut({chainId:e,bakeGasEstimate:t=0,rpcUrl:n}){const a=he(e,n),i=new X({chainId:e,rpcUrlConfig:a}),r=Te(e),u=await A(i,r).methods.getMintFee().call(),d=new R(P(u.toString(10)));return t?d.plus(P(t)):d}async function Ft({env:e,rpcUrl:t,chainId:n}){const a={[n]:t},i=new X({chainId:n,rpcUrlConfig:a});return(await A(i,e).methods.totalSupply().call()).toString()}async function Bt({owner:e,rpcUrl:t,chainId:n}){const a=he(n,t),i=new X({chainId:n,rpcUrlConfig:a}),r=Te(n),p=A(i,r);try{return(await p.methods.nonces(e).call()).toString()}catch(u){const d=C(u);throw new Error(d)}}const ne={[s.sepolia]:"0xe3748bF0Ec0A76767539eE28610B3367e35fe2C2",[s.berachainBartioTestnet]:"0x1977013acaf27856ac8048C42EE2ed0134d53895",[s.corn]:o,[s.ethereum]:o},Lt={...ne},kt={...ne,[s.corn]:"0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A",[s.ethereum]:"0x6bc15d7930839ec18a57f6f7df72ae1b439d077f"};function Gt(e=x){switch(e){case y.prod:return kt;case y.testnet:return Lt;default:return ne}}async function Wt(e){const t=new I(e),n=`destination chain id is ${e.chainId}`;return t.signMessage(n)}function Vt({chainId:e,verifyingContract:t,fee:n,expiry:a}){return{domain:{name:"Lombard Staked Bitcoin",version:"1",chainId:e,verifyingContract:t},message:{chainId:e,fee:n,expiry:a},primaryType:"feeApproval",types:{EIP712Domain:[{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"}],feeApproval:[{name:"chainId",type:"uint256"},{name:"fee",type:"uint256"},{name:"expiry",type:"uint256"}]}}}const $t="Failed to obtain a valid signature. The response is undefined or invalid.";async function jt({address:e,provider:t,fee:n,expiry:a,chainId:i,env:r}){var w,D;const p=new I({provider:t,account:e,chainId:i}),d=A(p,r).options.address,g=JSON.stringify(Vt({chainId:i,verifyingContract:d,fee:n,expiry:a})),l=await((D=(w=p.web3)==null?void 0:w.currentProvider)==null?void 0:D.request({method:"eth_signTypedData_v4",params:[e,g]}));if(typeof l=="string")return{signature:l,typedData:g};if(!(l!=null&&l.result))throw new Error($t);return{signature:l.result,typedData:g}}_.initEccLib(Se);function qt(e,t=y.prod){var r;const n=Ht(e),i=(r=_.payments[n]({address:e,network:t===y.prod?_.networks.bitcoin:_.networks.testnet}).output)==null?void 0:r.toString("hex");if(!i)throw new Error("Output script is not found.");return`0x${i}`}function Ht(e){const t=_.address.fromBech32(e);if(t.version===1&&t.data.length===32)return"p2tr";if(t.version===0&&t.data.length===20)return"p2wpkh";if(Jt(e))return"p2wsh";throw new Error("Address type is not supported.")}function Jt(e){return(e.startsWith("bc1")||e.startsWith("tb1"))&&e.length===62}function Zt({btcAddress:e,amount:t,env:n,...a}){const i=new I(a),r=A(i,n),p=qt(e,n),u=ee(t),d=r.methods.redeem(p,u);return i.sendTransactionAsync(i.account,r.options.address,{data:d.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:te(i.chainId)})}exports.BasculeDepositStatus=fe;exports.ENotarizationStatus=ce;exports.ESessionState=le;exports.OChainId=s;exports.OEnv=y;exports.SANCTIONED_ADDRESS=de;exports.SATOSHI_SCALE=z;exports.approveLBTC=at;exports.claimLBTC=rt;exports.fromSatoshi=P;exports.generateDepositBtcAddress=Oe;exports.getApiConfig=E;exports.getBasculeDepositStatus=Ot;exports.getDepositBtcAddress=Be;exports.getDepositBtcAddresses=ye;exports.getDepositsByAddress=We;exports.getLBTCExchangeRate=je;exports.getLBTCMintingFee=Ut;exports.getLBTCTotalSupply=Ft;exports.getLbtcAddressConfig=me;exports.getLbtcOFTAdapterAddressConfig=Gt;exports.getNetworkFeeSignature=qe;exports.getPermitNonce=Bt;exports.isValidChain=K;exports.signLbtcDestionationAddr=Wt;exports.signNetworkFee=jt;exports.storeNetworkFeeSignature=He;exports.toSatoshi=ee;exports.unstakeLBTC=Zt;
|
|
66
2
|
//# sourceMappingURL=index.cjs.map
|