@lombard.finance/sdk 2.0.1 → 2.0.4

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/README.md CHANGED
@@ -49,7 +49,7 @@ const { getDepositBtcAddress } = require('@lombard.finance/sdk');
49
49
  - [claimLBTC](#claimLBTC)
50
50
  - [unstakeLBTC](#unstakeLBTC)
51
51
  - [getBasculeDepositStatus](#getBasculeDepositStatus)
52
-
52
+ - [getLBTCTotalSupply](#getLBTCTotalSupply)
53
53
 
54
54
  #### getDepositBtcAddress
55
55
 
@@ -63,6 +63,7 @@ Parameters:
63
63
  | `address` | `string` | The destination EVM user address where LBTC will be claimed. |
64
64
  | `chainId` | `TChainId` | The destination chain ID where LBTC will be claimed. |
65
65
  | `env` | `TEnv` | Environment (optional, default: 'prod') |
66
+ | `partnerId` | `string` | Partner ID (optional) |
66
67
 
67
68
  Usage
68
69
 
@@ -72,7 +73,7 @@ import { getDepositBtcAddress } from '@lombard.finance/sdk';
72
73
  const depositBtcAddress = await getDepositBtcAddress({
73
74
  address: '0x...',
74
75
  chainId: 1,
75
- referrerCode: 'YOUR_REFERRAL_ID',
76
+ partnerId: 'YOUR_PARTNER_ID',
76
77
  }); // bc1q...
77
78
  ```
78
79
 
@@ -102,7 +103,7 @@ Parameters:
102
103
  | `referrerCode` | `string` | The referrer code. |
103
104
  | `env` | `TEnv` | Environment (optional, default: 'prod') |
104
105
  | `captchaToken` | `string` | The captcha token (optional) |
105
- | `referralId` | `string` | The referral ID. |
106
+ | `partnerId` | `string` | The partner ID (optional) |
106
107
 
107
108
  Usage
108
109
 
@@ -113,7 +114,7 @@ const depositBtcAddress = await generateDepositBtcAddress({
113
114
  address: '0x...',
114
115
  chainId: 1,
115
116
  signature: 'SIGNATURE',
116
- referralId: 'YOUR_REFERRAL_ID',
117
+ partnerId: 'YOUR_PARTNER_ID',
117
118
  referrerCode: 'YOUR_REFERRER_CODE',
118
119
  }); // bc1q...
119
120
  ```
@@ -125,10 +126,10 @@ Returns all deposits for a given address.
125
126
 
126
127
  Parameters:
127
128
 
128
- | name | type | description |
129
- | --------- | -------- | --------------------------------------- |
130
- | `address` | `string` | The EVM address to get deposits for |
131
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
129
+ | name | type | description |
130
+ |-----------|----------|--------------------------------------|
131
+ | `address` | `string` | The EVM address to get deposits for |
132
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
132
133
 
133
134
  Usage
134
135
 
@@ -148,11 +149,11 @@ Returns the exchange rate for LBTC.
148
149
 
149
150
  Parameters:
150
151
 
151
- | name | type | description |
152
- | --------- | ---------- | ------------------------------------------------------ |
152
+ | name | type | description |
153
+ |-----------|------------|-----------------------------------------------------|
153
154
  | `chainId` | `TChainId` | The chain id of the asset to get the exchange rate for |
154
- | `amount` | `number` | The amount of the asset to get the exchange rate for |
155
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
155
+ | `amount` | `number` | The amount of the asset to get the exchange rate for |
156
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
156
157
 
157
158
  Usage
158
159
 
@@ -174,11 +175,11 @@ Signing is necessary for the generation of the deposit address.
174
175
 
175
176
  Parameters:
176
177
 
177
- | name | type | description |
178
- | ---------- | ------------------ | ------------------------------ |
178
+ | name | type | description |
179
+ |------------|------------------|------------------------------|
179
180
  | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
180
- | `account` | `string` | Current account address |
181
- | `chainId` | `TChainId` | Current chain ID |
181
+ | `account` | `string` | Current account address |
182
+ | `chainId` | `TChainId` | Current chain ID |
182
183
 
183
184
  Usage
184
185
 
@@ -202,14 +203,14 @@ Claims LBTC.
202
203
 
203
204
  Parameters:
204
205
 
205
- | name | type | description |
206
- | ---------------- | ------------------ | -------------------------------------------------------------------------------------- |
207
- | `data` | `string` | Raw payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
208
- | `proofSignature` | `string` | Signature from deposit notarization. Can be obtained from the `getDepositsByAddress` |
209
- | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
210
- | `account` | `string` | Current account address |
211
- | `chainId` | `TChainId` | Current chain ID |
212
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
206
+ | name | type | description |
207
+ |-----------------|------------------|--------------------------------------------------------------------------------------|
208
+ | `data` | `string` | Raw payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
209
+ | `proofSignature` | `string` | Signature from deposit notarization. Can be obtained from the `getDepositsByAddress` |
210
+ | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
211
+ | `account` | `string` | Current account address |
212
+ | `chainId` | `TChainId` | Current chain ID |
213
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
213
214
 
214
215
  Usage
215
216
 
@@ -237,14 +238,14 @@ Unstakes LBTC to the specified BTC address.
237
238
 
238
239
  Parameters:
239
240
 
240
- | name | type | description |
241
- | ------------ | ------------------ | -------------------------------------------- |
242
- | `btcAddress` | `string` | The BTC address to send the unstaked BTC to. |
243
- | `amount` | `string` | The amount of LBTC to unstake. |
244
- | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
245
- | `account` | `string` | Current account address |
246
- | `chainId` | `TChainId` | Current chain ID |
247
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
241
+ | name | type | description |
242
+ |--------------|------------------|-------------------------------------------|
243
+ | `btcAddress` | `string` | The BTC address to send the unstaked BTC to |
244
+ | `amount` | `string` | The amount of LBTC to unstake |
245
+ | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
246
+ | `account` | `string` | Current account address |
247
+ | `chainId` | `TChainId` | Current chain ID |
248
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
248
249
 
249
250
  Usage
250
251
 
@@ -272,13 +273,13 @@ Check Deposit Status by hash id through Bascule
272
273
 
273
274
  Parameters:
274
275
 
275
- | name | type | description |
276
- | ---------------- | ------------------ | -------------------------------------------------------------------------------------- |
277
- | `txId` | `string` | Payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
278
- | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
279
- | `account` | `string` | Current account address |
280
- | `chainId` | `TChainId` | Current chain ID |
281
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
276
+ | name | type | description |
277
+ |-----------------|------------------|--------------------------------------------------------------------------------------|
278
+ | `txId` | `string` | Payload from deposit notarization. Can be obtained from the `getDepositsByAddress` |
279
+ | `provider` | `IEIP1193Provider` | The EIP-1193 provider instance |
280
+ | `account` | `string` | Current account address |
281
+ | `chainId` | `TChainId` | Current chain ID |
282
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
282
283
 
283
284
  Usage
284
285
 
@@ -303,11 +304,11 @@ Get LBTC total supply
303
304
 
304
305
  Parameters:
305
306
 
306
- | name | type | description |
307
- | ---------------- | ------------------ | -------------------------------------------------------------------------------------- |
308
- | `rpcUrl` | `string` | Rpc url for the chain |
309
- | `chainId` | `TChainId` | Current chain ID |
310
- | `env` | `TEnv` | Environment (optional, default: 'prod') |
307
+ | name | type | description |
308
+ |-----------------|------------------|--------------------------------------------------------------------------------------|
309
+ | `rpcUrl` | `string` | Rpc url for the chain |
310
+ | `chainId` | `TChainId` | Current chain ID |
311
+ | `env` | `TEnv` | Environment (optional, default: 'prod') |
311
312
 
312
313
  Usage
313
314
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ "use strict";var Re=Object.defineProperty;var Ie=(e,t,n)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var v=(e,t,n)=>(Ie(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("axios"),S=require("bignumber.js"),T=require("web3"),_e=require("@bitcoin-js/tiny-secp256k1-asmjs"),x=require("bitcoinjs-lib");function xe(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const De=xe(_e),d={prod:"prod",testnet:"testnet",stage:"stage"},a={ethereum:1,holesky:17e3,binanceSmartChain:56,binanceSmartChainTestnet:97,sepolia:11155111,base:8453,baseTestnet:84532,berachainBartioTestnet:80084,corn:21e6},ye=e=>e===d.prod?a.ethereum:a.holesky,ce=e=>e===d.prod?a.binanceSmartChain:a.binanceSmartChainTestnet,le=e=>e===d.prod?a.base:a.baseTestnet,D=d.prod,o="0x0000000000000000000000000000000000000000",Ne={baseApiUrl:"https://staging.prod.lombard.finance"},Me={baseApiUrl:"https://gastald-testnet.prod.lombard.finance"},Pe={baseApiUrl:"https://mainnet.prod.lombard.finance"},E=(e=D)=>{switch(e){case d.prod:return Pe;case d.testnet:return Me;default:return Ne}};function I(e){return typeof e=="string"?e:(n=>{var s;return((s=n==null?void 0:n.data)==null?void 0:s.message)&&typeof n.data.message=="string"})(e)?e.data.message:e instanceof Error?Oe(e):Be(e)}function Oe(e){return e.response?e.response.data.message:e.message}function Be(e){return e!=null&&e.message?e.message:"Unknown error"}const C={eth:"DESTINATION_BLOCKCHAIN_ETHEREUM",base:"DESTINATION_BLOCKCHAIN_BASE",bsc:"DESTINATION_BLOCKCHAIN_BSC",mantle:"DESTINATION_BLOCKCHAIN_MANTLE",linea:"DESTINATION_BLOCKCHAIN_LINEA",zcircuit:"DESTINATION_BLOCKCHAIN_ZIRCUIT",scroll:"DESTINATION_BLOCKCHAIN_SCROLL",xlayer:"DESTINATION_BLOCKCHAIN_XLAYER"};function K(e){switch(e){case a.ethereum:case a.holesky:case a.sepolia:return C.eth;case a.base:case a.baseTestnet:return C.base;case a.binanceSmartChain:case a.binanceSmartChainTestnet:return C.bsc;default:throw new Error(`Unknown chain ID: ${e}`)}}const me="sanctioned_address",Ue="api/v1/address/generate",Le="destination address is under sanctions";async function Fe({address:e,chainId:t,signature:n,env:s,referrerCode:i,partnerId:r,captchaToken:p=""}){const{baseApiUrl:u}=E(s),y=K(t),g={to_address:e,to_address_signature:n,to_chain:y,referrer_code:i,partner_id:r,nonce:0,captcha:p};try{const{data:l}=await R.post(Ue,g,{baseURL:u});return l.address}catch(l){const w=I(l);if(ke(w))return me;throw new Error(w)}}function ke(e){return!!e.includes(Le)}const Ge="api/v1/address";async function We({address:e,chainId:t,env:n,partnerId:s}){const i=await be({address:e,chainId:t,env:n,partnerId:s}),r=Ve(i);if(!r)throw new Error("No address");return r.btc_address}function Ve(e){if(!e.length)return;const t=e.reduce((n,s)=>n.created_at<s.created_at?s:n,e[0]);return t.deprecated?void 0:t}async function be({address:e,chainId:t,env:n,partnerId:s}){const{baseApiUrl:i}=E(n),r=K(t),p={to_address:e,to_blockchain:r,limit:1,offset:0,asc:!1,referralId:s},{data:u}=await R.get(Ge,{baseURL:i,params:p});return(u==null?void 0:u.addresses)||[]}const He=8,X=10**He;function O(e){return+e/X}function te(e){return Math.floor(+e*X)}function fe(e,t=D){switch(e){case C.eth:return ye(t);case C.base:return le(t);case C.bsc:return ce(t);default:return a.ethereum}}var Te=(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))(Te||{}),he=(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))(he||{});async function $e({address:e,env:t}){const{baseApiUrl:n}=E(t),{data:s}=await R.get(`api/v1/address/outputs-v2/${e}`,{baseURL:n});return((s==null?void 0:s.outputs)??[]).map(je(t))}function je(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 S(O(t.value)),address:t.address,chainId:fe(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 qe=2e-4;async function Je({env:e,chainId:t=a.ethereum,amount:n=1}){const{baseApiUrl:s}=E(e),i=K(t),{data:r}=await R.get(`api/v1/exchange/rate/${i}`,{baseURL:s,params:{amount:n}}),p=new S(qe).multipliedBy(X).toFixed();return{exchangeRate:+r.amount_out,minAmount:+p}}async function Ze({address:e,chainId:t,env:n}){const{baseApiUrl:s}=E(n);try{const{data:i}=await R.get(`${s}/api/v1/claimer/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=I(i);throw new Error(r)}}async function ze({signature:e,typedData:t,address:n,env:s}){const{baseApiUrl:i}=E(s);try{const{data:r}=await R.post(`${i}/api/v1/claimer/save-user-signature`,null,{params:{typed_data:t,signature:e,user_destination_address:n}});return r.status}catch(r){const p=I(r);throw new Error(p)}}const B={[a.ethereum]:"https://rpc.ankr.com/eth",[a.holesky]:"https://rpc.ankr.com/eth_holesky",[a.sepolia]:"https://rpc.ankr.com/eth_sepolia",[a.base]:"https://rpc.ankr.com/base",[a.baseTestnet]:"https://rpc.ankr.com/base_sepolia",[a.binanceSmartChain]:"https://rpc.ankr.com/bsc"};async function Ke(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(),s=T.utils.hexToNumber(n==null?void 0:n.result);return new S(Number(s))}const Xe=2,Ye=25e3;class Y{constructor({chainId:t,rpcUrlConfig:n}){v(this,"chainId");v(this,"rpcConfig");this.chainId=t,this.rpcConfig={...B,...n}}getReadWeb3(){const t=this.getRpcUrl(),n=new T.Web3,s=new T.Web3.providers.HttpProvider(t);return n.setProvider(s),n}getRpcUrl(){var s;const{chainId:t}=this,n=(s=this.rpcConfig)==null?void 0:s[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(),[s,i]=await Promise.all([t.eth.getBlock("latest"),Ke(n)]);return!(s!=null&&s.baseFeePerGas)&&typeof(s==null?void 0:s.baseFeePerGas)!="bigint"?{}:{maxFeePerGas:+new S(s.baseFeePerGas.toString(10)).multipliedBy(Xe).plus(i),maxPriorityFeePerGas:+i}}async getSafeGasPriceWei(){const t=await this.getReadWeb3().eth.getGasPrice();return new S(t.toString(10)).plus(Ye)}createContract(t,n){const s=this.getReadWeb3();return new s.eth.Contract(t,n)}}class _ extends Y{constructor({provider:n,account:s,chainId:i,rpcUrlConfig:r}){super({chainId:i,rpcUrlConfig:r});v(this,"web3");v(this,"account");v(this,"rpcConfig",B);this.web3=new T(n),this.account=s,this.chainId=i,this.rpcConfig={...B,...r}}async signMessage(n){const{account:s}=this,i=`0x${Buffer.from(n,"utf8").toString("hex")}`;return this.web3.currentProvider.request({method:"personal_sign",params:[i,s]})}async sendTransactionAsync(n,s,i){const{chainId:r,web3:p}=this,u=this.getReadWeb3(),{data:y,estimate:g=!1,estimateFee:l=!1,extendedGasLimit:w,gasLimit:N="0",value:Ce="0",gasLimitMultiplier:Se=1}=i;let{nonce:M}=i;M||(M=await u.eth.getTransactionCount(n)),console.log(`Nonce: ${M}`);const c={from:n,to:s,value:T.utils.numberToHex(Ce),data:y,nonce:M,chainId:T.utils.numberToHex(r)};if(g)try{const h=await u.eth.estimateGas(c),P=Math.round(Number(h)*Se);w?c.gas=T.utils.numberToHex(P+w):c.gas=T.utils.numberToHex(P)}catch(h){throw new Error(h.message??"Failed to estimate gas limit for transaction.")}else c.gas=T.utils.numberToHex(N);const{maxFeePerGas:se,maxPriorityFeePerGas:ie}=l?await this.getMaxFees().catch(()=>i):i;if(ie!==void 0&&(c.maxPriorityFeePerGas=T.utils.numberToHex(ie)),se!==void 0&&(c.maxFeePerGas=T.utils.numberToHex(se)),!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,P)=>{const re=p.eth.sendTransaction(c);re.once("transactionHash",async oe=>{console.log(`Just signed transaction has is: ${oe}`),h({receiptPromise:re,transactionHash:oe})}).catch(P)})}createContract(n,s){return new this.web3.eth.Contract(n,s)}}function ne(e){switch(e){case a.ethereum:return 1.3;case a.holesky:case a.sepolia:return 1.5;default:return 1.3}}function Q(e){return Object.values(a).includes(e)}const Qe={[a.holesky]:"0xED7bfd5C1790576105Af4649817f6d35A75CD818",[a.ethereum]:o,[a.binanceSmartChainTestnet]:"0x731eFa688F3679688cf60A3993b8658138953ED6",[a.binanceSmartChain]:o,[a.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[a.base]:o,[a.baseTestnet]:o,[a.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[a.corn]:o},et={[a.holesky]:"0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",[a.ethereum]:o,[a.binanceSmartChainTestnet]:"0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",[a.binanceSmartChain]:o,[a.sepolia]:"0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",[a.base]:o,[a.baseTestnet]:o,[a.berachainBartioTestnet]:"0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",[a.corn]:o},tt={[a.ethereum]:"0x8236a87084f8b84306f72007f36f2618a5634494",[a.holesky]:o,[a.sepolia]:o,[a.binanceSmartChainTestnet]:o,[a.binanceSmartChain]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[a.base]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1",[a.baseTestnet]:o,[a.berachainBartioTestnet]:o,[a.corn]:"0xecAc9C5F704e954931349Da37F60E39f515c11c1"};function ge(e=D){switch(e){case d.prod:return tt;case d.testnet:return et;default:return Qe}}const nt=[{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"}],at=[{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"}],st=[{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 it(e){switch(e){case"LBTC":return at;default:return nt}}function A(e,t){const n=ge(t),{chainId:s}=e;if(!Q(s))throw new Error(`This chain ${s} is not supported`);const i=n[s];if(!i)throw new Error(`Token address for chain ${s} is not defined`);const r=it("LBTC"),p=e.createContract(r,i);return p.options.address||(p.options.address=i),p}function rt({spender:e,amount:t,env:n,...s}){const i=new _(s),r=A(i,n),p=te(t),u=r.methods.approve(e,p);return i.sendTransactionAsync(i.account,r.options.address,{data:u.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:ne(i.chainId)})}const ot="insufficient funds",pt="Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.",pe=e=>e.startsWith("0x")?e:"0x"+e;async function ut({data:e,proofSignature:t,env:n,...s}){const i=new _(s),r=A(i,n),p=r.methods.mint(pe(e),pe(t));try{return await i.sendTransactionAsync(i.account,r.options.address,{data:p.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:ne(i.chainId)})}catch(u){console.log("error",u);const y=I(u);throw y.includes(ot)?new Error(pt):new Error(y)}}const dt=208,yt=4001,ct=4100,lt=4200,mt=4900,bt=4901,U=-32700,L=-32600,F=-32601,k=-32602,G=-32603,W=-32e3,V=-32001,H=-32002,$=-32003,j=-32004,q=-32005,J=-32006;class we extends Error{constructor(t,n){super(t),Array.isArray(n)?this.cause=new ee(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 ee?this.cause.errors:this.cause}set innerError(t){Array.isArray(t)?this.cause=new ee(t):this.cause=t}static convertToString(t,n=!1){if(t==null)return"undefined";const s=JSON.stringify(t,(i,r)=>typeof r=="bigint"?r.toString():r);return n&&["bigint","string"].includes(typeof t)?s.replace(/['\\"]+/g,""):s}toJSON(){return{name:this.name,code:this.code,message:this.message,cause:this.cause,innerError:this.cause}}}class ee extends we{constructor(t){super(`Multiple errors occurred: [${t.map(n=>n.message).join("], [")}]`),this.code=dt,this.errors=t}}const ft="An Rpc error has occured with a code of *code*",m={[U]:{message:"Parse error",description:"Invalid JSON"},[L]:{message:"Invalid request",description:"JSON is not a valid request object "},[F]:{message:"Method not found",description:"Method does not exist "},[k]:{message:"Invalid params",description:"Invalid method parameters"},[G]:{message:"Internal error",description:"Internal JSON-RPC error"},[W]:{message:"Invalid input",description:"Missing or invalid parameters"},[V]:{message:"Resource not found",description:"Requested resource not found"},[H]:{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"},[J]:{message:"JSON-RPC version not supported",description:"Version of JSON-RPC protocol is not supported"},[yt]:{name:"User Rejected Request",message:"The user rejected the request."},[ct]:{name:"Unauthorized",message:"The requested method and/or account has not been authorized by the user."},[lt]:{name:"Unsupported Method",message:"The Provider does not support the requested method."},[mt]:{name:"Disconnected",message:"The Provider is disconnected from all chains."},[bt]:{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 we{constructor(t,n){super(n??ft.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 Tt extends b{constructor(t){super(t,m[U].message),this.code=U}}class ht extends b{constructor(t){super(t,m[L].message),this.code=L}}class gt extends b{constructor(t){super(t,m[F].message),this.code=F}}class wt extends b{constructor(t){super(t,m[k].message),this.code=k}}class Et extends b{constructor(t){super(t,m[G].message),this.code=G}}class At extends b{constructor(t){super(t,m[W].message),this.code=W}}class vt extends b{constructor(t){super(t,m[j].message),this.code=j}}class Ct extends b{constructor(t){super(t,m[H].message),this.code=H}}class St extends b{constructor(t){super(t,m[V].message),this.code=V}}class Rt extends b{constructor(t){super(t,m[J].message),this.code=J}}class It extends b{constructor(t){super(t,m[$].message),this.code=$}}class _t extends b{constructor(t){super(t,m[q].message),this.code=q}}const f=new Map;f.set(U,{error:Tt});f.set(L,{error:ht});f.set(F,{error:gt});f.set(k,{error:wt});f.set(G,{error:Et});f.set(W,{error:At});f.set(j,{error:vt});f.set(H,{error:Ct});f.set($,{error:It});f.set(V,{error:St});f.set(J,{error:Rt});f.set(q,{error:_t});const xt=e=>typeof e=="string"&&/^((-)?0x[0-9a-f]+|(0x))$/i.test(e);var Z;(function(e){e.NUMBER="NUMBER_NUMBER",e.HEX="NUMBER_HEX",e.STR="NUMBER_STR",e.BIGINT="NUMBER_BIGINT"})(Z||(Z={}));var z;(function(e){e.HEX="BYTES_HEX",e.UINT8ARRAY="BYTES_UINT8ARRAY"})(z||(z={}));Z.BIGINT,z.HEX;Z.HEX,z.HEX;var ue;(function(e){e.EARLIEST="earliest",e.LATEST="latest",e.PENDING="pending",e.SAFE="safe",e.FINALIZED="finalized"})(ue||(ue={}));var de;(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"})(de||(de={}));const Dt={[a.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[a.sepolia]:o,[a.ethereum]:o,[a.binanceSmartChainTestnet]:o,[a.binanceSmartChain]:o,[a.base]:o,[a.baseTestnet]:o,[a.berachainBartioTestnet]:o,[a.corn]:o},Nt={[a.holesky]:"0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",[a.sepolia]:o,[a.ethereum]:o,[a.binanceSmartChainTestnet]:o,[a.binanceSmartChain]:o,[a.base]:o,[a.baseTestnet]:o,[a.berachainBartioTestnet]:o,[a.corn]:o},Mt={[a.holesky]:o,[a.sepolia]:o,[a.ethereum]:"0xc750eCAC7250E0D18ecE2C7a5F130E3A765dc260",[a.binanceSmartChainTestnet]:o,[a.binanceSmartChain]:o,[a.base]:o,[a.baseTestnet]:o,[a.berachainBartioTestnet]:o,[a.corn]:o};function Pt(e=D){switch(e){case d.prod:return Mt;case d.testnet:return Nt;default:return Dt}}function Ot(e,t){const n=Pt(t),{chainId:s}=e;if(!Q(s))throw new Error(`This chain ${s} is not supported`);const i=n[s];if(!i)throw new Error("The address for bascule module is not defined");const r=e.createContract(st,i);return r.options.address||(r.options.address=i),r}const Bt="No deposit ID provided. Please provide a deposit ID as an argument.",Ut="Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";var Ee=(e=>(e[e.UNREPORTED=0]="UNREPORTED",e[e.REPORTED=1]="REPORTED",e[e.WITHDRAWN=2]="WITHDRAWN",e))(Ee||{});async function Lt({txId:e,env:t,...n}){if(!e)throw new Error(Bt);if(!xt(e))throw new Error(Ut);const s=new _(n),i=Ot(s,t);try{const r=await i.methods.depositHistory(Buffer.from(e.replace(/^0x/,""),"hex")).call();return Number(r)}catch(r){const p=I(r);throw new Error(p)}}const Ae=e=>e in[a.ethereum,a.base,a.binanceSmartChain]?d.prod:d.stage;function ve(e,t){if(!Q(e))throw new Error(`This chain ${e} is not supported`);const n=t?{[e]:t}:B;if(!n[e])throw new Error(`RPC URL for chainId ${e} not found`);return n}async function Ft({chainId:e,bakeGasEstimate:t=0,rpcUrl:n}){const s=ve(e,n),i=new Y({chainId:e,rpcUrlConfig:s}),r=Ae(e),u=await A(i,r).methods.getMintFee().call(),y=new S(O(u.toString(10)));return t?y.plus(O(t)):y}async function kt({env:e,rpcUrl:t,chainId:n}){const s={[n]:t},i=new Y({chainId:n,rpcUrlConfig:s});return(await A(i,e).methods.totalSupply().call()).toString()}async function Gt({owner:e,rpcUrl:t,chainId:n}){const s=ve(n,t),i=new Y({chainId:n,rpcUrlConfig:s}),r=Ae(n),p=A(i,r);try{return(await p.methods.nonces(e).call()).toString()}catch(u){const y=I(u);throw new Error(y)}}const ae={[a.sepolia]:"0xe3748bF0Ec0A76767539eE28610B3367e35fe2C2",[a.berachainBartioTestnet]:"0x1977013acaf27856ac8048C42EE2ed0134d53895",[a.corn]:o,[a.ethereum]:o},Wt={...ae},Vt={...ae,[a.corn]:"0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A",[a.ethereum]:"0x6bc15d7930839ec18a57f6f7df72ae1b439d077f"};function Ht(e=D){switch(e){case d.prod:return Vt;case d.testnet:return Wt;default:return ae}}async function $t(e){const t=new _(e),n=`destination chain id is ${e.chainId}`;return t.signMessage(n)}const jt=24*60*60;function qt({chainId:e,verifyingContract:t,fee:n,expiry:s}){return{domain:{name:"Lombard Staked Bitcoin",version:"1",chainId:e,verifyingContract:t},message:{chainId:e,fee:n,expiry:s},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 Jt="Failed to obtain a valid signature. The response is undefined or invalid.";async function Zt({address:e,provider:t,fee:n,chainId:s,env:i,expiry:r=Date.now()+jt}){var w,N;const p=new _({provider:t,account:e,chainId:s}),y=A(p,i).options.address,g=JSON.stringify(qt({chainId:s,verifyingContract:y,fee:n,expiry:r.toString()})),l=await((N=(w=p.web3)==null?void 0:w.currentProvider)==null?void 0:N.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(Jt);return{signature:l.result,typedData:g}}x.initEccLib(De);function zt(e,t=d.prod){var r;const n=Kt(e),i=(r=x.payments[n]({address:e,network:t===d.prod?x.networks.bitcoin:x.networks.testnet}).output)==null?void 0:r.toString("hex");if(!i)throw new Error("Output script is not found.");return`0x${i}`}function Kt(e){const t=x.address.fromBech32(e);if(t.version===1&&t.data.length===32)return"p2tr";if(t.version===0&&t.data.length===20)return"p2wpkh";if(Xt(e))return"p2wsh";throw new Error("Address type is not supported.")}function Xt(e){return(e.startsWith("bc1")||e.startsWith("tb1"))&&e.length===62}function Yt({btcAddress:e,amount:t,env:n,...s}){const i=new _(s),r=A(i,n),p=zt(e,n),u=te(t),y=r.methods.redeem(p,u);return i.sendTransactionAsync(i.account,r.options.address,{data:y.encodeABI(),estimate:!0,estimateFee:!0,gasLimitMultiplier:ne(i.chainId)})}exports.BasculeDepositStatus=Ee;exports.ENotarizationStatus=Te;exports.ESessionState=he;exports.OChainId=a;exports.OEnv=d;exports.SANCTIONED_ADDRESS=me;exports.SATOSHI_SCALE=X;exports.approveLBTC=rt;exports.claimLBTC=ut;exports.fromSatoshi=O;exports.generateDepositBtcAddress=Fe;exports.getApiConfig=E;exports.getBasculeDepositStatus=Lt;exports.getBaseNetworkByEnv=le;exports.getBscNetworkByEnv=ce;exports.getChainIdByName=fe;exports.getChainNameById=K;exports.getDepositBtcAddress=We;exports.getDepositBtcAddresses=be;exports.getDepositsByAddress=$e;exports.getEthNetworkByEnv=ye;exports.getLBTCExchangeRate=Je;exports.getLBTCMintingFee=Ft;exports.getLBTCTotalSupply=kt;exports.getLbtcAddressConfig=ge;exports.getLbtcOFTAdapterAddressConfig=Ht;exports.getNetworkFeeSignature=Ze;exports.getPermitNonce=Gt;exports.isValidChain=Q;exports.signLbtcDestionationAddr=$t;exports.signNetworkFee=Zt;exports.storeNetworkFeeSignature=ze;exports.toSatoshi=te;exports.unstakeLBTC=Yt;
2
2
  //# sourceMappingURL=index.cjs.map