@gardenfi/core 0.2.0-beta.93 → 0.2.0-beta.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -20,7 +20,7 @@
20
20
  OP_CHECKSIGADD
21
21
  OP_2
22
22
  OP_NUMEQUAL
23
- `.trim().replace(/\s+/g," "))}leaves(){return[{version:ir,output:this.redeemLeaf()},[{version:ir,output:this.refundLeaf()},{version:ir,output:this.instantRefundLeaf()}]]}generateMerkleProofFor(t){const r=this.leafHash(1),n=this.leafHash(2),i=this.leafHash(0);switch(t){case 1:{const a=Na(i,n);return[ue.crypto.taggedHash("TapBranch",Buffer.concat(a))]}case 0:return[n,r];case 2:return[i,r];default:throw new Error(me.invalidLeaf)}}}function Nr(e,t){const r=[];for(let n=0;n<t;n++)r.push(e);return r}class Ja{constructor(){this.cache={}}set(t,r,n,i){const a={txHash:n,timeStamp:Date.now(),btcRedeemUTXO:i};this.cache[`${r}_${t.create_order.create_id}`]=a}get(t,r){return this.cache[`${r}_${t.create_order.create_id}`]||null}remove(t,r){delete this.cache[`${r}_${t.create_order.create_id}`]}}class Xa{constructor(t){if(this.eventListeners=new Map,this.getOrderThreshold=20,this.useRelay=!0,this.orderBook=new te.Orderbook({url:t.orderbookURl,walletClient:t.wallets.evmWallet,auth:t.auth}),this.quote=t.quote,this.secretManager=t.secretManager,this.wallets=t.wallets,this.orderbookUrl=t.orderbookURl,this.auth=t.auth,this.orderExecutorCache=new Ja,!t.wallets.evmWallet.account)throw new Error("Account not found in evmWallet");this.evmAddress=t.wallets.evmWallet.account.address,this.blockNumberFetcher=t.blockNumberFetcher}setUseRelay(t){this.useRelay=t}async swap(t){const r=await this.validateAndFillParams(t);if(r.error)return k.Err(r.error);const{sendAddress:n,receiveAddress:i,timelock:a}=r.val;let f=t.nonce;if(!f){const P=await this.orderBook.getOrdersCount(this.evmAddress);if(P.error)return k.Err(P.error);f=P.val+1}const u=this.secretManager.generateSecret(f);if(u.error)return k.Err(u.error);const{strategyId:l,btcAddress:b}=t.additionalData,m={strategy_id:l,...b&&{bitcoin_optional_recipient:b}},g={source_chain:t.fromAsset.chain,destination_chain:t.toAsset.chain,source_asset:t.fromAsset.atomicSwapAddress,destination_asset:t.toAsset.atomicSwapAddress,initiator_source_address:n,initiator_destination_address:i,source_amount:t.sendAmount,destination_amount:t.receiveAmount,fee:"1",nonce:f.toString(),timelock:a,secret_hash:k.trim0x(u.val.secretHash),min_destination_confirmations:t.minDestinationConfirmations??0,additional_data:m},v=await this.quote.getAttestedQuote(g);if(v.error)return k.Err(v.error);const A=await this.orderBook.createOrder(v.val);if(A.error)return k.Err(A.error);const B=await this.pollOrder(A.val);return B.error?k.Err(B.error):k.Ok(B.val)}async validateAndFillParams(t){if(t.fromAsset.chain===t.toAsset.chain&&t.fromAsset.atomicSwapAddress===t.toAsset.atomicSwapAddress)return k.Err("Source and destination assets cannot be the same");if(te.isMainnet(t.fromAsset.chain)&&!te.isMainnet(t.toAsset.chain)||!te.isMainnet(t.fromAsset.chain)&&te.isMainnet(t.toAsset.chain))return k.Err("Both assets should be on the same network (either mainnet or testnet)");if(te.isBitcoin(t.fromAsset.chain)||te.isBitcoin(t.toAsset.chain)){if(!this.wallets.btcWallet)return k.Err("btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor");if(!t.additionalData.btcAddress)return k.Err("btcAddress in additionalData is required for bitcoin chain")}const r=await this.getAddresses(t.fromAsset.chain);if(r.error)return k.Err(r.error);const n=await this.getAddresses(t.toAsset.chain);if(n.error)return k.Err(n.error);const i=this.validateAmount(t.sendAmount);if(i.error)return k.Err(i.error);const a=this.validateAmount(t.receiveAmount);if(a.error)return k.Err(a.error);if(i<a)return k.Err("Send amount should be greater than receive amount");const f=te.getTimeLock(t.fromAsset.chain);return f?k.Ok({sendAddress:r.val,receiveAddress:n.val,timelock:t.timelock??f}):k.Err("Unsupported chain for timelock")}async getAddresses(t){var n;switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return this.wallets.evmWallet.account?k.Ok(this.wallets.evmWallet.account.address):k.Err("EVM Wallet not found");case te.BlockchainType.Bitcoin:{const i=await((n=this.wallets.btcWallet)==null?void 0:n.getPublicKey());return!i||!Ma(i)?k.Err("Invalid btc public key"):k.Ok(Nt(i))}default:return k.Err("Unsupported chain")}}validateAmount(t){if(t==null||t.includes("."))return k.Err("Invalid amount ",t);const r=new js(t);return!r.isInteger()||r.isNaN()||r.lt(0)||r.isLessThanOrEqualTo(0)?k.Err("Invalid amount ",t):k.Ok(r)}async pollOrder(t){let r=await this.orderBook.getOrder(t,!0),n=0;for(;n<this.getOrderThreshold;){if(await we.sleep(1e3),n++,r.error){if(!r.error.includes("result is undefined"))return k.Err(r.error)}else if(r.val&&r.val.create_order.create_id.toLowerCase()===t.toLowerCase())return k.Ok(r.val);r=await this.orderBook.getOrder(t,!0)}return k.Err(`Order not found, createOrder id: ${t}`)}async execute(t=5e3){return await this.orderBook.subscribeToOrders(!0,t,async r=>{const n=Vi(r.data),i=await this.assignOrderStatus(n);this.emit("onPendingOrdersChanged",i);for(let a=0;a<i.length;a++){const f=i[a];switch(xn(f.status)){case ce.Redeem:{const l=this.secretManager.generateSecret(Number(f.create_order.nonce));if(l.error){this.emit("error",f,l.error);return}switch(te.getBlockchainType(f.destination_swap.chain)){case te.BlockchainType.EVM:{await this.evmRedeem(f,l.val.secret);break}case te.BlockchainType.Bitcoin:{const b=this.getWallet(f.destination_swap.chain);if(b.error){this.emit("error",f,b.error);return}await this.btcRedeem(b.val,f,l.val.secret);break}default:this.emit("error",f,"Unsupported chain: "+f.destination_swap.chain)}break}case ce.Refund:{switch(te.getBlockchainType(f.source_swap.chain)){case te.BlockchainType.EVM:{this.emit("error",f,"EVM refund is automatically done by relay service");break}case te.BlockchainType.Bitcoin:{const l=this.getWallet(f.source_swap.chain);if(l.error){this.emit("error",f,l.error);return}await this.btcRefund(l.val,f);break}default:this.emit("error",f,"Unsupported chain: "+f.source_swap.chain)}break}}}},{per_page:500},!0)}async evmRedeem(t,r){if(this.emit("log",t.create_order.create_id,"executing evm redeem"),this.orderExecutorCache.get(t,ce.Redeem)){this.emit("log",t.create_order.create_id,"already redeemed");return}const a=await new Ki(t,this.orderbookUrl,this.auth).redeem(t.create_order.create_id,r);if(a.error){this.emit("error",t,a.error),a.error.includes("Order already redeemed")&&this.orderExecutorCache.set(t,ce.Redeem,t.destination_swap.redeem_tx_hash);return}this.orderExecutorCache.set(t,ce.Redeem,a.val),this.emit("success",t,ce.Redeem,a.val)}async btcRedeem(t,r,n){var u,l;const i=this.orderExecutorCache.get(r,ce.Redeem),a=(u=r.destination_swap.initiate_tx_hash.split(",").at(-1))==null?void 0:u.split(":").at(0);if(!a){this.emit("error",r,"Failed to get initiate_tx_hash");return}let f=!1;if(i)if(i.btcRedeemUTXO&&i.btcRedeemUTXO!==a)f=!0,this.emit("log",r.create_order.create_id,"rbf btc redeem");else{this.emit("log",r.create_order.create_id,"btcRedeem: already redeemed");return}else if(r.destination_swap.redeem_tx_hash&&!Number(r.destination_swap.redeem_block_number))try{const b=await(await t.getProvider()).getTransaction(r.destination_swap.redeem_tx_hash);let m=!1;for(const g of b.vin)if(g.txid===a){m=!0;break}if(m){this.orderExecutorCache.set(r,ce.Redeem,r.destination_swap.redeem_tx_hash,a),this.emit("log",r.create_order.create_id,"already a valid redeem");return}f=!0}catch(b){if(b.message.includes("Transaction not found"))f=!0;else{this.emit("error",r,"Failed to get redeem tx: "+b);return}}this.emit("log",r.create_order.create_id,"executing btc redeem");try{const m=await(await hr.from(t,Number(r.destination_swap.amount),r.create_order.secret_hash,Nt(r.destination_swap.initiator),Nt(r.destination_swap.redeemer),r.destination_swap.timelock,f?[a]:[])).redeem(k.trim0x(n),(l=r.create_order.additional_data)==null?void 0:l.bitcoin_optional_recipient);f?this.emit("log",r.create_order.create_id,"rbf: btc redeem success"):this.emit("success",r,ce.Redeem,m),this.orderExecutorCache.set(r,ce.Redeem,m,a)}catch(b){this.emit("error",r,"Failed btc redeem: "+b)}}async btcRefund(t,r){var n;if(!this.orderExecutorCache.get(r,ce.Refund)){this.emit("log",r.create_order.create_id,"executing btc refund");try{const a=await(await hr.from(t,Number(r.source_swap.amount),r.create_order.secret_hash,Nt(r.source_swap.initiator),Nt(r.source_swap.redeemer),r.source_swap.timelock)).refund((n=r.create_order.additional_data)==null?void 0:n.bitcoin_optional_recipient);this.orderExecutorCache.set(r,ce.Refund,a),this.emit("success",r,ce.Refund,a)}catch(i){this.emit("error",r,"Failed btc refund: "+i)}}}getWallet(t){switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return k.Ok(this.wallets.evmWallet);case te.BlockchainType.Bitcoin:return k.Ok(this.wallets.btcWallet);default:return k.Err("Unsupported chain for wallet")}}emit(t,...r){(this.eventListeners.get(t)??[]).forEach(i=>{i(...r)})}on(t,r){const n=this.eventListeners.get(t)??[];n.push(r),this.eventListeners.set(t,n)}off(t,r){const n=this.eventListeners.get(t)??[],i=n.indexOf(r);i!==-1&&n.splice(i,1)}async fetchCurrentBlockNumbers(t,r){if(!r||!r.source||!r.destination)return k.Err("Provide wallets to fetch the current block number");const n=te.isBitcoin(t.source_swap.chain)?await we.fetchBitcoinBlockNumber(await r.source.getProvider()):await we.fetchEVMBlockNumber(r.source);if(n.error)return k.Err(n.error);const i=te.isBitcoin(t.destination_swap.chain)?await we.fetchBitcoinBlockNumber(await r.destination.getProvider()):await we.fetchEVMBlockNumber(r.destination);return i.error?k.Err(i.error):k.Ok({source:n.val,destination:i.val})}async assignOrderStatus(t){var i;const r=await((i=this.blockNumberFetcher)==null?void 0:i.fetchBlockNumbers()),n=[];for(let a=0;a<t.length;a++){const f=t[a],u=f.source_swap.chain,l=f.destination_swap.chain,b=this.getWallet(u),m=this.getWallet(l);if(b.error||m.error||!b.val||!m.val){this.emit("error",f,"Source or Destination Wallet not found while executing order");continue}let g=r==null?void 0:r.val[u],v=r==null?void 0:r.val[l];if(!g||!v){const B=await this.fetchCurrentBlockNumbers(f,{source:b.val,destination:m.val});if(B.error){this.emit("error",f,"Error while fetching CurrentBlockNumbers: "+B.error);continue}g=B.val.source,v=B.val.destination}const A=wn(f,g,v);n.push({...f,status:A})}return n}}class Qa{constructor(t,r){this.url=new we.Url("/blocknumber/"+r,t)}async fetchBlockNumbers(){try{const t=await k.Fetcher.get(this.url);return k.Ok(t)}catch(t){return k.Err("Failed to fetch block numbers",t)}}}var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Za(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ef(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Yi={},Bt={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.testnet=St.bitcoin=void 0;St.bitcoin={messagePrefix:`Bitcoin Signed Message:
23
+ `.trim().replace(/\s+/g," "))}leaves(){return[{version:ir,output:this.redeemLeaf()},[{version:ir,output:this.refundLeaf()},{version:ir,output:this.instantRefundLeaf()}]]}generateMerkleProofFor(t){const r=this.leafHash(1),n=this.leafHash(2),i=this.leafHash(0);switch(t){case 1:{const a=Na(i,n);return[ue.crypto.taggedHash("TapBranch",Buffer.concat(a))]}case 0:return[n,r];case 2:return[i,r];default:throw new Error(me.invalidLeaf)}}}function Nr(e,t){const r=[];for(let n=0;n<t;n++)r.push(e);return r}class Ja{constructor(){this.cache={}}set(t,r,n,i){const a={txHash:n,timeStamp:Date.now(),btcRedeemUTXO:i};this.cache[`${r}_${t.create_order.create_id}`]=a}get(t,r){return this.cache[`${r}_${t.create_order.create_id}`]||null}remove(t,r){delete this.cache[`${r}_${t.create_order.create_id}`]}}class Xa{constructor(t){if(this.eventListeners=new Map,this.getOrderThreshold=20,this.useRelay=!0,this.orderBook=new te.Orderbook({url:t.orderbookURl,walletClient:t.wallets.evmWallet,auth:t.auth}),this.quote=t.quote,this.secretManager=t.secretManager,this.wallets=t.wallets,this.orderbookUrl=t.orderbookURl,this.auth=t.auth,this.orderExecutorCache=new Ja,!t.wallets.evmWallet.account)throw new Error("Account not found in evmWallet");this.evmAddress=t.wallets.evmWallet.account.address,this.blockNumberFetcher=t.blockNumberFetcher}setUseRelay(t){this.useRelay=t}async swap(t){const r=await this.validateAndFillParams(t);if(r.error)return k.Err(r.error);const{sendAddress:n,receiveAddress:i,timelock:a}=r.val;let f=t.nonce;if(!f){const P=await this.orderBook.getOrdersCount(this.evmAddress);if(P.error)return k.Err(P.error);f=P.val+1}const u=this.secretManager.generateSecret(f);if(u.error)return k.Err(u.error);const{strategyId:l,btcAddress:b}=t.additionalData,m={strategy_id:l,...b&&{bitcoin_optional_recipient:b}},g={source_chain:t.fromAsset.chain,destination_chain:t.toAsset.chain,source_asset:t.fromAsset.atomicSwapAddress,destination_asset:t.toAsset.atomicSwapAddress,initiator_source_address:n,initiator_destination_address:i,source_amount:t.sendAmount,destination_amount:t.receiveAmount,fee:"1",nonce:f.toString(),timelock:a,secret_hash:k.trim0x(u.val.secretHash),min_destination_confirmations:t.minDestinationConfirmations??0,additional_data:m},v=await this.quote.getAttestedQuote(g);if(v.error)return k.Err(v.error);const A=await this.orderBook.createOrder(v.val);if(A.error)return k.Err(A.error);const B=await this.pollOrder(A.val);return B.error?k.Err(B.error):k.Ok(B.val)}async validateAndFillParams(t){if(t.fromAsset.chain===t.toAsset.chain&&t.fromAsset.atomicSwapAddress===t.toAsset.atomicSwapAddress)return k.Err("Source and destination assets cannot be the same");if(te.isMainnet(t.fromAsset.chain)&&!te.isMainnet(t.toAsset.chain)||!te.isMainnet(t.fromAsset.chain)&&te.isMainnet(t.toAsset.chain))return k.Err("Both assets should be on the same network (either mainnet or testnet)");if(te.isBitcoin(t.fromAsset.chain)||te.isBitcoin(t.toAsset.chain)){if(!this.wallets.btcWallet)return k.Err("btcWallet is required for bitcoin chain. Please provide btcWallet in the constructor");if(!t.additionalData.btcAddress)return k.Err("btcAddress in additionalData is required for bitcoin chain")}const r=await this.getAddresses(t.fromAsset.chain);if(r.error)return k.Err(r.error);const n=await this.getAddresses(t.toAsset.chain);if(n.error)return k.Err(n.error);const i=this.validateAmount(t.sendAmount);if(i.error)return k.Err(i.error);const a=this.validateAmount(t.receiveAmount);if(a.error)return k.Err(a.error);if(i<a)return k.Err("Send amount should be greater than receive amount");const f=te.getTimeLock(t.fromAsset.chain);return console.log("timelock from garden :",f),f?k.Ok({sendAddress:r.val,receiveAddress:n.val,timelock:t.timelock??f}):k.Err("Unsupported chain for timelock")}async getAddresses(t){var n;switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return this.wallets.evmWallet.account?k.Ok(this.wallets.evmWallet.account.address):k.Err("EVM Wallet not found");case te.BlockchainType.Bitcoin:{const i=await((n=this.wallets.btcWallet)==null?void 0:n.getPublicKey());return!i||!Ma(i)?k.Err("Invalid btc public key"):k.Ok(Nt(i))}default:return k.Err("Unsupported chain")}}validateAmount(t){if(t==null||t.includes("."))return k.Err("Invalid amount ",t);const r=new js(t);return!r.isInteger()||r.isNaN()||r.lt(0)||r.isLessThanOrEqualTo(0)?k.Err("Invalid amount ",t):k.Ok(r)}async pollOrder(t){let r=await this.orderBook.getOrder(t,!0),n=0;for(;n<this.getOrderThreshold;){if(await we.sleep(1e3),n++,r.error){if(!r.error.includes("result is undefined"))return k.Err(r.error)}else if(r.val&&r.val.create_order.create_id.toLowerCase()===t.toLowerCase())return k.Ok(r.val);r=await this.orderBook.getOrder(t,!0)}return k.Err(`Order not found, createOrder id: ${t}`)}async execute(t=5e3){return await this.orderBook.subscribeToOrders(!0,t,async r=>{const n=Vi(r.data),i=await this.assignOrderStatus(n);this.emit("onPendingOrdersChanged",i);for(let a=0;a<i.length;a++){const f=i[a];switch(xn(f.status)){case ce.Redeem:{const l=this.secretManager.generateSecret(Number(f.create_order.nonce));if(l.error){this.emit("error",f,l.error);return}switch(te.getBlockchainType(f.destination_swap.chain)){case te.BlockchainType.EVM:{await this.evmRedeem(f,l.val.secret);break}case te.BlockchainType.Bitcoin:{const b=this.getWallet(f.destination_swap.chain);if(b.error){this.emit("error",f,b.error);return}await this.btcRedeem(b.val,f,l.val.secret);break}default:this.emit("error",f,"Unsupported chain: "+f.destination_swap.chain)}break}case ce.Refund:{switch(te.getBlockchainType(f.source_swap.chain)){case te.BlockchainType.EVM:{this.emit("error",f,"EVM refund is automatically done by relay service");break}case te.BlockchainType.Bitcoin:{const l=this.getWallet(f.source_swap.chain);if(l.error){this.emit("error",f,l.error);return}await this.btcRefund(l.val,f);break}default:this.emit("error",f,"Unsupported chain: "+f.source_swap.chain)}break}}}},{per_page:500},!0)}async evmRedeem(t,r){if(this.emit("log",t.create_order.create_id,"executing evm redeem"),this.orderExecutorCache.get(t,ce.Redeem)){this.emit("log",t.create_order.create_id,"already redeemed");return}const a=await new Ki(t,this.orderbookUrl,this.auth).redeem(t.create_order.create_id,r);if(a.error){this.emit("error",t,a.error),a.error.includes("Order already redeemed")&&this.orderExecutorCache.set(t,ce.Redeem,t.destination_swap.redeem_tx_hash);return}this.orderExecutorCache.set(t,ce.Redeem,a.val),this.emit("success",t,ce.Redeem,a.val)}async btcRedeem(t,r,n){var u,l;const i=this.orderExecutorCache.get(r,ce.Redeem),a=(u=r.destination_swap.initiate_tx_hash.split(",").at(-1))==null?void 0:u.split(":").at(0);if(!a){this.emit("error",r,"Failed to get initiate_tx_hash");return}let f=!1;if(i)if(i.btcRedeemUTXO&&i.btcRedeemUTXO!==a)f=!0,this.emit("log",r.create_order.create_id,"rbf btc redeem");else{this.emit("log",r.create_order.create_id,"btcRedeem: already redeemed");return}else if(r.destination_swap.redeem_tx_hash&&!Number(r.destination_swap.redeem_block_number))try{const b=await(await t.getProvider()).getTransaction(r.destination_swap.redeem_tx_hash);let m=!1;for(const g of b.vin)if(g.txid===a){m=!0;break}if(m){this.orderExecutorCache.set(r,ce.Redeem,r.destination_swap.redeem_tx_hash,a),this.emit("log",r.create_order.create_id,"already a valid redeem");return}f=!0}catch(b){if(b.message.includes("Transaction not found"))f=!0;else{this.emit("error",r,"Failed to get redeem tx: "+b);return}}this.emit("log",r.create_order.create_id,"executing btc redeem");try{const m=await(await hr.from(t,Number(r.destination_swap.amount),r.create_order.secret_hash,Nt(r.destination_swap.initiator),Nt(r.destination_swap.redeemer),r.destination_swap.timelock,f?[a]:[])).redeem(k.trim0x(n),(l=r.create_order.additional_data)==null?void 0:l.bitcoin_optional_recipient);f?this.emit("log",r.create_order.create_id,"rbf: btc redeem success"):this.emit("success",r,ce.Redeem,m),this.orderExecutorCache.set(r,ce.Redeem,m,a)}catch(b){this.emit("error",r,"Failed btc redeem: "+b)}}async btcRefund(t,r){var n;if(!this.orderExecutorCache.get(r,ce.Refund)){this.emit("log",r.create_order.create_id,"executing btc refund");try{const a=await(await hr.from(t,Number(r.source_swap.amount),r.create_order.secret_hash,Nt(r.source_swap.initiator),Nt(r.source_swap.redeemer),r.source_swap.timelock)).refund((n=r.create_order.additional_data)==null?void 0:n.bitcoin_optional_recipient);this.orderExecutorCache.set(r,ce.Refund,a),this.emit("success",r,ce.Refund,a)}catch(i){this.emit("error",r,"Failed btc refund: "+i)}}}getWallet(t){switch(te.getBlockchainType(t)){case te.BlockchainType.EVM:return k.Ok(this.wallets.evmWallet);case te.BlockchainType.Bitcoin:return k.Ok(this.wallets.btcWallet);default:return k.Err("Unsupported chain for wallet")}}emit(t,...r){(this.eventListeners.get(t)??[]).forEach(i=>{i(...r)})}on(t,r){const n=this.eventListeners.get(t)??[];n.push(r),this.eventListeners.set(t,n)}off(t,r){const n=this.eventListeners.get(t)??[],i=n.indexOf(r);i!==-1&&n.splice(i,1)}async fetchCurrentBlockNumbers(t,r){if(!r||!r.source||!r.destination)return k.Err("Provide wallets to fetch the current block number");const n=te.isBitcoin(t.source_swap.chain)?await we.fetchBitcoinBlockNumber(await r.source.getProvider()):await we.fetchEVMBlockNumber(r.source);if(n.error)return k.Err(n.error);const i=te.isBitcoin(t.destination_swap.chain)?await we.fetchBitcoinBlockNumber(await r.destination.getProvider()):await we.fetchEVMBlockNumber(r.destination);return i.error?k.Err(i.error):k.Ok({source:n.val,destination:i.val})}async assignOrderStatus(t){var i;const r=await((i=this.blockNumberFetcher)==null?void 0:i.fetchBlockNumbers()),n=[];for(let a=0;a<t.length;a++){const f=t[a],u=f.source_swap.chain,l=f.destination_swap.chain,b=this.getWallet(u),m=this.getWallet(l);if(b.error||m.error||!b.val||!m.val){this.emit("error",f,"Source or Destination Wallet not found while executing order");continue}let g=r==null?void 0:r.val[u],v=r==null?void 0:r.val[l];if(!g||!v){const B=await this.fetchCurrentBlockNumbers(f,{source:b.val,destination:m.val});if(B.error){this.emit("error",f,"Error while fetching CurrentBlockNumbers: "+B.error);continue}g=B.val.source,v=B.val.destination}const A=wn(f,g,v);n.push({...f,status:A})}return n}}class Qa{constructor(t,r){this.url=new we.Url("/blocknumber/"+r,t)}async fetchBlockNumbers(){try{const t=await k.Fetcher.get(this.url);return k.Ok(t)}catch(t){return k.Err("Failed to fetch block numbers",t)}}}var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Za(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function ef(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var r=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var Yi={},Bt={},St={};Object.defineProperty(St,"__esModule",{value:!0});St.testnet=St.bitcoin=void 0;St.bitcoin={messagePrefix:`Bitcoin Signed Message:
24
24
  `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};St.testnet={messagePrefix:`Bitcoin Signed Message:
25
25
  `,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var Ji={},qt={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};qt.Null=qt.Nil;for(var jn in qt)qt[jn].toJSON=(function(e){return e}).bind(null,jn);var vn=qt,st=vn;function Xi(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function En(e){return st.Nil(e)?"":Xi(e.constructor)}function tf(e){return st.Function(e)?"":st.String(e)?JSON.stringify(e):e&&st.Object(e)?"":e}function Bn(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function dr(e){return st.Function(e)?e.toJSON?e.toJSON():Xi(e):st.Array(e)?"Array":e&&st.Object(e)?"Object":e!==void 0?e:""}function Qi(e,t,r){var n=tf(t);return"Expected "+dr(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function ze(e,t,r){r=r||En(t),this.message=Qi(e,t,r),Bn(this,ze),this.__type=e,this.__value=t,this.__valueTypeName=r}ze.prototype=Object.create(Error.prototype);ze.prototype.constructor=ze;function rf(e,t,r,n,i){var a='" of type ';return t==="key"&&(a='" with key type '),Qi('property "'+dr(r)+a+dr(e),n,i)}function xt(e,t,r,n,i){e?(i=i||En(n),this.message=rf(e,r,t,n,i)):this.message='Unexpected property "'+t+'"',Bn(this,ze),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=i}xt.prototype=Object.create(Error.prototype);xt.prototype.constructor=ze;function nf(e,t){return new ze(e,{},t)}function sf(e,t,r){return e instanceof xt?(t=t+"."+e.__property,e=new xt(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof ze&&(e=new xt(e.__type,t,r,e.__value,e.__valueTypeName)),Bn(e),e}var Zi={TfTypeError:ze,TfPropertyTypeError:xt,tfCustomError:nf,tfSubError:sf,tfJSON:dr,getValueTypeName:En},Mr,Gn;function of(){if(Gn)return Mr;Gn=1;var e=vn,t=Zi;function r(S){return Buffer.isBuffer(S)}function n(S){return typeof S=="string"&&/^([0-9a-f]{2})+$/i.test(S)}function i(S,z){var M=S.toJSON();function $(oe){if(!S(oe))return!1;if(oe.length===z)return!0;throw t.tfCustomError(M+"(Length: "+z+")",M+"(Length: "+oe.length+")")}return $.toJSON=function(){return M},$}var a=i.bind(null,e.Array),f=i.bind(null,r),u=i.bind(null,n),l=i.bind(null,e.String);function b(S,z,M){M=M||e.Number;function $(oe,ke){return M(oe,ke)&&oe>S&&oe<z}return $.toJSON=function(){return`${M.toJSON()} between [${S}, ${z}]`},$}var m=Math.pow(2,53)-1;function g(S){return typeof S=="number"&&isFinite(S)}function v(S){return S<<24>>24===S}function A(S){return S<<16>>16===S}function B(S){return(S|0)===S}function P(S){return typeof S=="number"&&S>=-m&&S<=m&&Math.floor(S)===S}function T(S){return(S&255)===S}function C(S){return(S&65535)===S}function F(S){return S>>>0===S}function O(S){return typeof S=="number"&&S>=0&&S<=m&&Math.floor(S)===S}var L={ArrayN:a,Buffer:r,BufferN:f,Finite:g,Hex:n,HexN:u,Int8:v,Int16:A,Int32:B,Int53:P,Range:b,StringN:l,UInt8:T,UInt16:C,UInt32:F,UInt53:O};for(var U in L)L[U].toJSON=(function(S){return S}).bind(null,U);return Mr=L,Mr}var Xt=Zi,he=vn,De=Xt.tfJSON,es=Xt.TfTypeError,ts=Xt.TfPropertyTypeError,Mt=Xt.tfSubError,af=Xt.getValueTypeName,$e={arrayOf:function(t,r){t=Fe(t),r=r||{};function n(i,a){return!he.Array(i)||he.Nil(i)||r.minLength!==void 0&&i.length<r.minLength||r.maxLength!==void 0&&i.length>r.maxLength||r.length!==void 0&&i.length!==r.length?!1:i.every(function(f,u){try{return xe(t,f,a)}catch(l){throw Mt(l,u)}})}return n.toJSON=function(){var i="["+De(t)+"]";return r.length!==void 0?i+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(i+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),i},n},maybe:function e(t){t=Fe(t);function r(n,i){return he.Nil(n)||t(n,i,e)}return r.toJSON=function(){return"?"+De(t)},r},map:function(t,r){t=Fe(t),r&&(r=Fe(r));function n(i,a){if(!he.Object(i)||he.Nil(i))return!1;for(var f in i){try{r&&xe(r,f,a)}catch(l){throw Mt(l,f,"key")}try{var u=i[f];xe(t,u,a)}catch(l){throw Mt(l,f)}}return!0}return r?n.toJSON=function(){return"{"+De(r)+": "+De(t)+"}"}:n.toJSON=function(){return"{"+De(t)+"}"},n},object:function(t){var r={};for(var n in t)r[n]=Fe(t[n]);function i(a,f){if(!he.Object(a)||he.Nil(a))return!1;var u;try{for(u in r){var l=r[u],b=a[u];xe(l,b,f)}}catch(m){throw Mt(m,u)}if(f){for(u in a)if(!r[u])throw new ts(void 0,u)}return!0}return i.toJSON=function(){return De(r)},i},anyOf:function(){var t=[].slice.call(arguments).map(Fe);function r(n,i){return t.some(function(a){try{return xe(a,n,i)}catch{return!1}})}return r.toJSON=function(){return t.map(De).join("|")},r},allOf:function(){var t=[].slice.call(arguments).map(Fe);function r(n,i){return t.every(function(a){try{return xe(a,n,i)}catch{return!1}})}return r.toJSON=function(){return t.map(De).join(" & ")},r},quacksLike:function(t){function r(n){return t===af(n)}return r.toJSON=function(){return t},r},tuple:function(){var t=[].slice.call(arguments).map(Fe);function r(n,i){return he.Nil(n)||he.Nil(n.length)||i&&n.length!==t.length?!1:t.every(function(a,f){try{return xe(a,n[f],i)}catch(u){throw Mt(u,f)}})}return r.toJSON=function(){return"("+t.map(De).join(", ")+")"},r},value:function(t){function r(n){return n===t}return r.toJSON=function(){return t},r}};$e.oneOf=$e.anyOf;function Fe(e){if(he.String(e))return e[0]==="?"?$e.maybe(e.slice(1)):he[e]||$e.quacksLike(e);if(e&&he.Object(e)){if(he.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return $e.arrayOf(e[0])}return $e.object(e)}else if(he.Function(e))return e;return $e.value(e)}function xe(e,t,r,n){if(he.Function(e)){if(e(t,r))return!0;throw new es(n||e,t)}return xe(Fe(e),t,r)}for(var Xe in he)xe[Xe]=he[Xe];for(Xe in $e)xe[Xe]=$e[Xe];var Wn=of();for(Xe in Wn)xe[Xe]=Wn[Xe];xe.compile=Fe;xe.TfTypeError=es;xe.TfPropertyTypeError=ts;var ff=xe;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.maybe=e.Boolean=e.Array=e.Buffer256bit=e.Network=e.typeforce=void 0,e.typeforce=ff,e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.maybe=e.typeforce.maybe})(Ji);var rn={exports:{}},nn={exports:{}},Tt={},vr={};vr.byteLength=lf;vr.toByteArray=df;vr.fromByteArray=yf;var Ue=[],Re=[],uf=typeof Uint8Array<"u"?Uint8Array:Array,Dr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var _t=0,cf=Dr.length;_t<cf;++_t)Ue[_t]=Dr[_t],Re[Dr.charCodeAt(_t)]=_t;Re[45]=62;Re[95]=63;function rs(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function lf(e){var t=rs(e),r=t[0],n=t[1];return(r+n)*3/4-n}function hf(e,t,r){return(t+r)*3/4-r}function df(e){var t,r=rs(e),n=r[0],i=r[1],a=new uf(hf(e,n,i)),f=0,u=i>0?n-4:n,l;for(l=0;l<u;l+=4)t=Re[e.charCodeAt(l)]<<18|Re[e.charCodeAt(l+1)]<<12|Re[e.charCodeAt(l+2)]<<6|Re[e.charCodeAt(l+3)],a[f++]=t>>16&255,a[f++]=t>>8&255,a[f++]=t&255;return i===2&&(t=Re[e.charCodeAt(l)]<<2|Re[e.charCodeAt(l+1)]>>4,a[f++]=t&255),i===1&&(t=Re[e.charCodeAt(l)]<<10|Re[e.charCodeAt(l+1)]<<4|Re[e.charCodeAt(l+2)]>>2,a[f++]=t>>8&255,a[f++]=t&255),a}function pf(e){return Ue[e>>18&63]+Ue[e>>12&63]+Ue[e>>6&63]+Ue[e&63]}function bf(e,t,r){for(var n,i=[],a=t;a<r;a+=3)n=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(pf(n));return i.join("")}function yf(e){for(var t,r=e.length,n=r%3,i=[],a=16383,f=0,u=r-n;f<u;f+=a)i.push(bf(e,f,f+a>u?u:f+a));return n===1?(t=e[r-1],i.push(Ue[t>>2]+Ue[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(Ue[t>>10]+Ue[t>>4&63]+Ue[t<<2&63]+"=")),i.join("")}var Sn={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */Sn.read=function(e,t,r,n,i){var a,f,u=i*8-n-1,l=(1<<u)-1,b=l>>1,m=-7,g=r?i-1:0,v=r?-1:1,A=e[t+g];for(g+=v,a=A&(1<<-m)-1,A>>=-m,m+=u;m>0;a=a*256+e[t+g],g+=v,m-=8);for(f=a&(1<<-m)-1,a>>=-m,m+=n;m>0;f=f*256+e[t+g],g+=v,m-=8);if(a===0)a=1-b;else{if(a===l)return f?NaN:(A?-1:1)*(1/0);f=f+Math.pow(2,n),a=a-b}return(A?-1:1)*f*Math.pow(2,a-n)};Sn.write=function(e,t,r,n,i,a){var f,u,l,b=a*8-i-1,m=(1<<b)-1,g=m>>1,v=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,A=n?0:a-1,B=n?1:-1,P=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,f=m):(f=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-f))<1&&(f--,l*=2),f+g>=1?t+=v/l:t+=v*Math.pow(2,1-g),t*l>=2&&(f++,l/=2),f+g>=m?(u=0,f=m):f+g>=1?(u=(t*l-1)*Math.pow(2,i),f=f+g):(u=t*Math.pow(2,g-1)*Math.pow(2,i),f=0));i>=8;e[r+A]=u&255,A+=B,u/=256,i-=8);for(f=f<<i|u,b+=i;b>0;e[r+A]=f&255,A+=B,f/=256,b-=8);e[r+A-B]|=P*128};/*!
26
26
  * The buffer module from node.js, for the browser.
package/dist/index.js CHANGED
@@ -144,7 +144,7 @@ function oo(e, { dir: t, size: r = 32 } = {}) {
144
144
  }
145
145
  const ao = /* @__PURE__ */ Array.from({ length: 256 }, (e, t) => t.toString(16).padStart(2, "0"));
146
146
  function W(e, t = {}) {
147
- return typeof e == "number" || typeof e == "bigint" ? Ci(e, t) : typeof e == "string" ? co(e, t) : typeof e == "boolean" ? fo(e, t) : Qe(e, t);
147
+ return typeof e == "number" || typeof e == "bigint" ? ki(e, t) : typeof e == "string" ? co(e, t) : typeof e == "boolean" ? fo(e, t) : Qe(e, t);
148
148
  }
149
149
  function fo(e, t = {}) {
150
150
  const r = `0x${Number(e)}`;
@@ -157,7 +157,7 @@ function Qe(e, t = {}) {
157
157
  const n = `0x${r}`;
158
158
  return typeof t.size == "number" ? (Tt(n, { size: t.size }), Rt(n, { dir: "right", size: t.size })) : n;
159
159
  }
160
- function Ci(e, t = {}) {
160
+ function ki(e, t = {}) {
161
161
  const { signed: r, size: n } = t, i = BigInt(e);
162
162
  let a;
163
163
  n ? r ? a = (1n << BigInt(n) * 8n - 1n) - 1n : a = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (a = BigInt(Number.MAX_SAFE_INTEGER));
@@ -181,7 +181,7 @@ function co(e, t = {}) {
181
181
  return Qe(r, t);
182
182
  }
183
183
  const lo = /* @__PURE__ */ new TextEncoder();
184
- function ki(e, t = {}) {
184
+ function Ci(e, t = {}) {
185
185
  return typeof e == "number" || typeof e == "bigint" ? po(e, t) : typeof e == "boolean" ? ho(e, t) : Kt(e) ? at(e, t) : Li(e, t);
186
186
  }
187
187
  function ho(e, t = {}) {
@@ -219,7 +219,7 @@ function at(e, t = {}) {
219
219
  return a;
220
220
  }
221
221
  function po(e, t) {
222
- const r = Ci(e, t);
222
+ const r = ki(e, t);
223
223
  return at(r);
224
224
  }
225
225
  function Li(e, t = {}) {
@@ -571,14 +571,14 @@ function Po(e) {
571
571
  return t.map(([n, i]) => ` ${`${n}:`.padEnd(r + 1)} ${i}`).join(`
572
572
  `);
573
573
  }
574
- class Co extends X {
574
+ class ko extends X {
575
575
  constructor({ v: t }) {
576
576
  super(`Invalid \`v\` value "${t}". Expected 27 or 28.`, {
577
577
  name: "InvalidLegacyVError"
578
578
  });
579
579
  }
580
580
  }
581
- class ko extends X {
581
+ class Co extends X {
582
582
  constructor({ transaction: t }) {
583
583
  super("Cannot infer a transaction type from provided transaction.", {
584
584
  metaMessages: [
@@ -834,7 +834,7 @@ class Go extends Ho {
834
834
  }
835
835
  const jo = /* @__PURE__ */ zi(() => new Go());
836
836
  function Wo(e, t) {
837
- return jo(Kt(e, { strict: !1 }) ? ki(e) : e);
837
+ return jo(Kt(e, { strict: !1 }) ? Ci(e) : e);
838
838
  }
839
839
  function qo(e) {
840
840
  const { commitment: t, version: r = 1 } = e, n = e.to ?? (typeof t == "string" ? "hex" : "bytes"), i = Wo(t);
@@ -1116,7 +1116,7 @@ class En extends Hi {
1116
1116
  }
1117
1117
  const pa = (e, t, r) => zi(() => new En(t, e, r)), ba = /* @__PURE__ */ pa(1, 136, 256 / 8);
1118
1118
  function ya(e, t) {
1119
- return ba(Kt(e, { strict: !1 }) ? ki(e) : e);
1119
+ return ba(Kt(e, { strict: !1 }) ? Ci(e) : e);
1120
1120
  }
1121
1121
  const $r = /* @__PURE__ */ new Ki(8192);
1122
1122
  function ga(e, t) {
@@ -1233,7 +1233,7 @@ function Aa(e) {
1233
1233
  return "eip1559";
1234
1234
  if (typeof e.gasPrice < "u")
1235
1235
  return typeof e.accessList < "u" ? "eip2930" : "legacy";
1236
- throw new ko({ transaction: e });
1236
+ throw new Co({ transaction: e });
1237
1237
  }
1238
1238
  function Ar(e) {
1239
1239
  if (!e || e.length === 0)
@@ -1252,7 +1252,7 @@ function Ar(e) {
1252
1252
  }
1253
1253
  function Ia(e, t) {
1254
1254
  const r = Aa(e);
1255
- return r === "eip1559" ? Pa(e, t) : r === "eip2930" ? Ca(e, t) : r === "eip4844" ? Ta(e, t) : r === "eip7702" ? Ra(e, t) : ka(e, t);
1255
+ return r === "eip1559" ? Pa(e, t) : r === "eip2930" ? ka(e, t) : r === "eip4844" ? Ta(e, t) : r === "eip7702" ? Ra(e, t) : Ca(e, t);
1256
1256
  }
1257
1257
  function Ra(e, t) {
1258
1258
  const { authorizationList: r, chainId: n, gas: i, nonce: a, to: f, value: u, maxFeePerGas: l, maxPriorityFeePerGas: b, accessList: m, data: g } = e;
@@ -1280,14 +1280,14 @@ function Ta(e, t) {
1280
1280
  Ea(e);
1281
1281
  let v = e.blobVersionedHashes, A = e.sidecars;
1282
1282
  if (e.blobs && (typeof v > "u" || typeof A > "u")) {
1283
- const L = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((S) => Qe(S)), k = e.kzg, O = Mi({
1283
+ const L = typeof e.blobs[0] == "string" ? e.blobs : e.blobs.map((S) => Qe(S)), C = e.kzg, O = Mi({
1284
1284
  blobs: L,
1285
- kzg: k
1285
+ kzg: C
1286
1286
  });
1287
1287
  if (typeof v > "u" && (v = Vo({
1288
1288
  commitments: O
1289
1289
  })), typeof A > "u") {
1290
- const S = Di({ blobs: L, commitments: O, kzg: k });
1290
+ const S = Di({ blobs: L, commitments: O, kzg: C });
1291
1291
  A = Qo({ blobs: L, commitments: O, proofs: S });
1292
1292
  }
1293
1293
  }
@@ -1304,16 +1304,16 @@ function Ta(e, t) {
1304
1304
  u ? W(u) : "0x",
1305
1305
  v ?? [],
1306
1306
  ...Jt(e, t)
1307
- ], T = [], C = [], F = [];
1307
+ ], T = [], k = [], F = [];
1308
1308
  if (A)
1309
1309
  for (let L = 0; L < A.length; L++) {
1310
- const { blob: k, commitment: O, proof: S } = A[L];
1311
- T.push(k), C.push(O), F.push(S);
1310
+ const { blob: C, commitment: O, proof: S } = A[L];
1311
+ T.push(C), k.push(O), F.push(S);
1312
1312
  }
1313
1313
  return Yt([
1314
1314
  "0x03",
1315
1315
  // If sidecars are enabled, envelope turns into a "wrapper":
1316
- ft(A ? [P, T, C, F] : P)
1316
+ ft(A ? [P, T, k, F] : P)
1317
1317
  ]);
1318
1318
  }
1319
1319
  function Pa(e, t) {
@@ -1336,7 +1336,7 @@ function Pa(e, t) {
1336
1336
  ft(v)
1337
1337
  ]);
1338
1338
  }
1339
- function Ca(e, t) {
1339
+ function ka(e, t) {
1340
1340
  const { chainId: r, gas: n, data: i, nonce: a, to: f, value: u, accessList: l, gasPrice: b } = e;
1341
1341
  Ba(e);
1342
1342
  const m = Ar(l), g = [
@@ -1355,7 +1355,7 @@ function Ca(e, t) {
1355
1355
  ft(g)
1356
1356
  ]);
1357
1357
  }
1358
- function ka(e, t) {
1358
+ function Ca(e, t) {
1359
1359
  const { chainId: r = 0, gas: n, data: i, nonce: a, to: f, value: u, gasPrice: l } = e;
1360
1360
  Sa(e);
1361
1361
  let b = [
@@ -1374,7 +1374,7 @@ function ka(e, t) {
1374
1374
  return BigInt(r * 2) + BigInt(35n + t.v - 27n);
1375
1375
  const A = 27n + (t.v === 27n ? 0n : 1n);
1376
1376
  if (t.v !== A)
1377
- throw new Co({ v: t.v });
1377
+ throw new ko({ v: t.v });
1378
1378
  return A;
1379
1379
  })(), g = dr(t.r), v = dr(t.s);
1380
1380
  b = [
@@ -2860,7 +2860,7 @@ class Sl {
2860
2860
  if (i < a)
2861
2861
  return N("Send amount should be greater than receive amount");
2862
2862
  const f = Js(t.fromAsset.chain);
2863
- return f ? ue({
2863
+ return console.log("timelock from garden :", f), f ? ue({
2864
2864
  sendAddress: r.val,
2865
2865
  receiveAddress: n.val,
2866
2866
  timelock: t.timelock ?? f
@@ -3378,7 +3378,7 @@ function gf() {
3378
3378
  function T(S) {
3379
3379
  return (S & 255) === S;
3380
3380
  }
3381
- function C(S) {
3381
+ function k(S) {
3382
3382
  return (S & 65535) === S;
3383
3383
  }
3384
3384
  function F(S) {
@@ -3387,7 +3387,7 @@ function gf() {
3387
3387
  function L(S) {
3388
3388
  return typeof S == "number" && S >= 0 && S <= m && Math.floor(S) === S;
3389
3389
  }
3390
- var k = {
3390
+ var C = {
3391
3391
  ArrayN: a,
3392
3392
  Buffer: r,
3393
3393
  BufferN: f,
@@ -3401,15 +3401,15 @@ function gf() {
3401
3401
  Range: b,
3402
3402
  StringN: l,
3403
3403
  UInt8: T,
3404
- UInt16: C,
3404
+ UInt16: k,
3405
3405
  UInt32: F,
3406
3406
  UInt53: L
3407
3407
  };
3408
- for (var O in k)
3409
- k[O].toJSON = (function(S) {
3408
+ for (var O in C)
3409
+ C[O].toJSON = (function(S) {
3410
3410
  return S;
3411
3411
  }).bind(null, O);
3412
- return Gr = k, Gr;
3412
+ return Gr = C, Gr;
3413
3413
  }
3414
3414
  var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTypeError, Dt = Xt.tfSubError, mf = Xt.getValueTypeName, De = {
3415
3415
  arrayOf: function(t, r) {
@@ -3765,7 +3765,7 @@ Rn.write = function(e, t, r, n, i, a) {
3765
3765
  return m(c, s, o);
3766
3766
  };
3767
3767
  function g(c) {
3768
- return b(c), f(c < 0 ? 0 : C(c) | 0);
3768
+ return b(c), f(c < 0 ? 0 : k(c) | 0);
3769
3769
  }
3770
3770
  u.allocUnsafe = function(c) {
3771
3771
  return g(c);
@@ -3781,7 +3781,7 @@ Rn.write = function(e, t, r, n, i, a) {
3781
3781
  return y !== o && (h = h.slice(0, y)), h;
3782
3782
  }
3783
3783
  function A(c) {
3784
- const s = c.length < 0 ? 0 : C(c.length) | 0, o = f(s);
3784
+ const s = c.length < 0 ? 0 : k(c.length) | 0, o = f(s);
3785
3785
  for (let h = 0; h < s; h += 1)
3786
3786
  o[h] = c[h] & 255;
3787
3787
  return o;
@@ -3803,7 +3803,7 @@ Rn.write = function(e, t, r, n, i, a) {
3803
3803
  }
3804
3804
  function T(c) {
3805
3805
  if (u.isBuffer(c)) {
3806
- const s = C(c.length) | 0, o = f(s);
3806
+ const s = k(c.length) | 0, o = f(s);
3807
3807
  return o.length === 0 || c.copy(o, 0, 0, s), o;
3808
3808
  }
3809
3809
  if (c.length !== void 0)
@@ -3811,7 +3811,7 @@ Rn.write = function(e, t, r, n, i, a) {
3811
3811
  if (c.type === "Buffer" && Array.isArray(c.data))
3812
3812
  return A(c.data);
3813
3813
  }
3814
- function C(c) {
3814
+ function k(c) {
3815
3815
  if (c >= i)
3816
3816
  throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes");
3817
3817
  return c | 0;
@@ -3907,7 +3907,7 @@ Rn.write = function(e, t, r, n, i, a) {
3907
3907
  case "hex":
3908
3908
  return o >>> 1;
3909
3909
  case "base64":
3910
- return kt(c).length;
3910
+ return Ct(c).length;
3911
3911
  default:
3912
3912
  if (y)
3913
3913
  return h ? -1 : V(c).length;
@@ -3915,14 +3915,14 @@ Rn.write = function(e, t, r, n, i, a) {
3915
3915
  }
3916
3916
  }
3917
3917
  u.byteLength = L;
3918
- function k(c, s, o) {
3918
+ function C(c, s, o) {
3919
3919
  let h = !1;
3920
3920
  if ((s === void 0 || s < 0) && (s = 0), s > this.length || ((o === void 0 || o > this.length) && (o = this.length), o <= 0) || (o >>>= 0, s >>>= 0, o <= s))
3921
3921
  return "";
3922
3922
  for (c || (c = "utf8"); ; )
3923
3923
  switch (c) {
3924
3924
  case "hex":
3925
- return Ce(this, s, o);
3925
+ return ke(this, s, o);
3926
3926
  case "utf8":
3927
3927
  case "utf-8":
3928
3928
  return ve(this, s, o);
@@ -3971,7 +3971,7 @@ Rn.write = function(e, t, r, n, i, a) {
3971
3971
  return this;
3972
3972
  }, u.prototype.toString = function() {
3973
3973
  const s = this.length;
3974
- return s === 0 ? "" : arguments.length === 0 ? ve(this, 0, s) : k.apply(this, arguments);
3974
+ return s === 0 ? "" : arguments.length === 0 ? ve(this, 0, s) : C.apply(this, arguments);
3975
3975
  }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(s) {
3976
3976
  if (!u.isBuffer(s)) throw new TypeError("Argument must be a Buffer");
3977
3977
  return this === s ? !0 : u.compare(this, s) === 0;
@@ -4074,7 +4074,7 @@ Rn.write = function(e, t, r, n, i, a) {
4074
4074
  return yt(qe(s), c, o, h);
4075
4075
  }
4076
4076
  function Te(c, s, o, h) {
4077
- return yt(kt(s), c, o, h);
4077
+ return yt(Ct(s), c, o, h);
4078
4078
  }
4079
4079
  function ze(c, s, o, h) {
4080
4080
  return yt(bt(s, c.length - o), c, o, h);
@@ -4180,7 +4180,7 @@ Rn.write = function(e, t, r, n, i, a) {
4180
4180
  h += String.fromCharCode(c[y]);
4181
4181
  return h;
4182
4182
  }
4183
- function Ce(c, s, o) {
4183
+ function ke(c, s, o) {
4184
4184
  const h = c.length;
4185
4185
  (!s || s < 0) && (s = 0), (!o || o < 0 || o > h) && (o = h);
4186
4186
  let y = "";
@@ -4583,7 +4583,7 @@ Rn.write = function(e, t, r, n, i, a) {
4583
4583
  o = c.charCodeAt(E), h = o >> 8, y = o % 256, x.push(y), x.push(h);
4584
4584
  return x;
4585
4585
  }
4586
- function kt(c) {
4586
+ function Ct(c) {
4587
4587
  return t.toByteArray(j(c));
4588
4588
  }
4589
4589
  function yt(c, s, o, h) {
@@ -4650,8 +4650,8 @@ function Tf() {
4650
4650
  Use Chrome, Firefox or Internet Explorer 11`);
4651
4651
  }
4652
4652
  var Pf = xe.Buffer, wr = Xe.crypto || Xe.msCrypto;
4653
- wr && wr.getRandomValues ? an.exports = Cf : an.exports = Tf;
4654
- function Cf(e, t) {
4653
+ wr && wr.getRandomValues ? an.exports = kf : an.exports = Tf;
4654
+ function kf(e, t) {
4655
4655
  if (e > Rf) throw new RangeError("requested too many random bytes");
4656
4656
  var r = Pf.allocUnsafe(e);
4657
4657
  if (e > 0)
@@ -4664,7 +4664,7 @@ function Cf(e, t) {
4664
4664
  t(null, r);
4665
4665
  }) : r;
4666
4666
  }
4667
- var kf = an.exports, un = { exports: {} };
4667
+ var Cf = an.exports, un = { exports: {} };
4668
4668
  typeof Object.create == "function" ? un.exports = function(t, r) {
4669
4669
  r && (t.super_ = r, t.prototype = Object.create(r.prototype, {
4670
4670
  constructor: {
@@ -4917,20 +4917,20 @@ function Hf() {
4917
4917
  function e(B, P) {
4918
4918
  var T = Object.keys(B);
4919
4919
  if (Object.getOwnPropertySymbols) {
4920
- var C = Object.getOwnPropertySymbols(B);
4921
- P && (C = C.filter(function(F) {
4920
+ var k = Object.getOwnPropertySymbols(B);
4921
+ P && (k = k.filter(function(F) {
4922
4922
  return Object.getOwnPropertyDescriptor(B, F).enumerable;
4923
- })), T.push.apply(T, C);
4923
+ })), T.push.apply(T, k);
4924
4924
  }
4925
4925
  return T;
4926
4926
  }
4927
4927
  function t(B) {
4928
4928
  for (var P = 1; P < arguments.length; P++) {
4929
4929
  var T = arguments[P] != null ? arguments[P] : {};
4930
- P % 2 ? e(Object(T), !0).forEach(function(C) {
4931
- r(B, C, T[C]);
4932
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(B, Object.getOwnPropertyDescriptors(T)) : e(Object(T)).forEach(function(C) {
4933
- Object.defineProperty(B, C, Object.getOwnPropertyDescriptor(T, C));
4930
+ P % 2 ? e(Object(T), !0).forEach(function(k) {
4931
+ r(B, k, T[k]);
4932
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(B, Object.getOwnPropertyDescriptors(T)) : e(Object(T)).forEach(function(k) {
4933
+ Object.defineProperty(B, k, Object.getOwnPropertyDescriptor(T, k));
4934
4934
  });
4935
4935
  }
4936
4936
  return B;
@@ -4944,8 +4944,8 @@ function Hf() {
4944
4944
  }
4945
4945
  function i(B, P) {
4946
4946
  for (var T = 0; T < P.length; T++) {
4947
- var C = P[T];
4948
- C.enumerable = C.enumerable || !1, C.configurable = !0, "value" in C && (C.writable = !0), Object.defineProperty(B, f(C.key), C);
4947
+ var k = P[T];
4948
+ k.enumerable = k.enumerable || !1, k.configurable = !0, "value" in k && (k.writable = !0), Object.defineProperty(B, f(k.key), k);
4949
4949
  }
4950
4950
  }
4951
4951
  function a(B, P, T) {
@@ -4959,8 +4959,8 @@ function Hf() {
4959
4959
  if (typeof B != "object" || B === null) return B;
4960
4960
  var T = B[Symbol.toPrimitive];
4961
4961
  if (T !== void 0) {
4962
- var C = T.call(B, P || "default");
4963
- if (typeof C != "object") return C;
4962
+ var k = T.call(B, P || "default");
4963
+ if (typeof k != "object") return k;
4964
4964
  throw new TypeError("@@toPrimitive must return a primitive value.");
4965
4965
  }
4966
4966
  return (P === "string" ? String : Number)(B);
@@ -4976,20 +4976,20 @@ function Hf() {
4976
4976
  return a(B, [{
4977
4977
  key: "push",
4978
4978
  value: function(T) {
4979
- var C = {
4979
+ var k = {
4980
4980
  data: T,
4981
4981
  next: null
4982
4982
  };
4983
- this.length > 0 ? this.tail.next = C : this.head = C, this.tail = C, ++this.length;
4983
+ this.length > 0 ? this.tail.next = k : this.head = k, this.tail = k, ++this.length;
4984
4984
  }
4985
4985
  }, {
4986
4986
  key: "unshift",
4987
4987
  value: function(T) {
4988
- var C = {
4988
+ var k = {
4989
4989
  data: T,
4990
4990
  next: this.head
4991
4991
  };
4992
- this.length === 0 && (this.tail = C), this.head = C, ++this.length;
4992
+ this.length === 0 && (this.tail = k), this.head = k, ++this.length;
4993
4993
  }
4994
4994
  }, {
4995
4995
  key: "shift",
@@ -5008,23 +5008,23 @@ function Hf() {
5008
5008
  key: "join",
5009
5009
  value: function(T) {
5010
5010
  if (this.length === 0) return "";
5011
- for (var C = this.head, F = "" + C.data; C = C.next; ) F += T + C.data;
5011
+ for (var k = this.head, F = "" + k.data; k = k.next; ) F += T + k.data;
5012
5012
  return F;
5013
5013
  }
5014
5014
  }, {
5015
5015
  key: "concat",
5016
5016
  value: function(T) {
5017
5017
  if (this.length === 0) return b.alloc(0);
5018
- for (var C = b.allocUnsafe(T >>> 0), F = this.head, L = 0; F; )
5019
- A(F.data, C, L), L += F.data.length, F = F.next;
5020
- return C;
5018
+ for (var k = b.allocUnsafe(T >>> 0), F = this.head, L = 0; F; )
5019
+ A(F.data, k, L), L += F.data.length, F = F.next;
5020
+ return k;
5021
5021
  }
5022
5022
  // Consumes a specified amount of bytes or characters from the buffered data.
5023
5023
  }, {
5024
5024
  key: "consume",
5025
- value: function(T, C) {
5025
+ value: function(T, k) {
5026
5026
  var F;
5027
- return T < this.head.data.length ? (F = this.head.data.slice(0, T), this.head.data = this.head.data.slice(T)) : T === this.head.data.length ? F = this.shift() : F = C ? this._getString(T) : this._getBuffer(T), F;
5027
+ return T < this.head.data.length ? (F = this.head.data.slice(0, T), this.head.data = this.head.data.slice(T)) : T === this.head.data.length ? F = this.shift() : F = k ? this._getString(T) : this._getBuffer(T), F;
5028
5028
  }
5029
5029
  }, {
5030
5030
  key: "first",
@@ -5035,11 +5035,11 @@ function Hf() {
5035
5035
  }, {
5036
5036
  key: "_getString",
5037
5037
  value: function(T) {
5038
- var C = this.head, F = 1, L = C.data;
5039
- for (T -= L.length; C = C.next; ) {
5040
- var k = C.data, O = T > k.length ? k.length : T;
5041
- if (O === k.length ? L += k : L += k.slice(0, T), T -= O, T === 0) {
5042
- O === k.length ? (++F, C.next ? this.head = C.next : this.head = this.tail = null) : (this.head = C, C.data = k.slice(O));
5038
+ var k = this.head, F = 1, L = k.data;
5039
+ for (T -= L.length; k = k.next; ) {
5040
+ var C = k.data, O = T > C.length ? C.length : T;
5041
+ if (O === C.length ? L += C : L += C.slice(0, T), T -= O, T === 0) {
5042
+ O === C.length ? (++F, k.next ? this.head = k.next : this.head = this.tail = null) : (this.head = k, k.data = C.slice(O));
5043
5043
  break;
5044
5044
  }
5045
5045
  ++F;
@@ -5050,22 +5050,22 @@ function Hf() {
5050
5050
  }, {
5051
5051
  key: "_getBuffer",
5052
5052
  value: function(T) {
5053
- var C = b.allocUnsafe(T), F = this.head, L = 1;
5054
- for (F.data.copy(C), T -= F.data.length; F = F.next; ) {
5055
- var k = F.data, O = T > k.length ? k.length : T;
5056
- if (k.copy(C, C.length - T, 0, O), T -= O, T === 0) {
5057
- O === k.length ? (++L, F.next ? this.head = F.next : this.head = this.tail = null) : (this.head = F, F.data = k.slice(O));
5053
+ var k = b.allocUnsafe(T), F = this.head, L = 1;
5054
+ for (F.data.copy(k), T -= F.data.length; F = F.next; ) {
5055
+ var C = F.data, O = T > C.length ? C.length : T;
5056
+ if (C.copy(k, k.length - T, 0, O), T -= O, T === 0) {
5057
+ O === C.length ? (++L, F.next ? this.head = F.next : this.head = this.tail = null) : (this.head = F, F.data = C.slice(O));
5058
5058
  break;
5059
5059
  }
5060
5060
  ++L;
5061
5061
  }
5062
- return this.length -= L, C;
5062
+ return this.length -= L, k;
5063
5063
  }
5064
5064
  // Make sure the linked list only shows the minimal necessary information.
5065
5065
  }, {
5066
5066
  key: v,
5067
- value: function(T, C) {
5068
- return g(this, t(t({}, C), {}, {
5067
+ value: function(T, k) {
5068
+ return g(this, t(t({}, k), {}, {
5069
5069
  // Only inspect one level.
5070
5070
  depth: 0,
5071
5071
  // It should not recurse.
@@ -5233,7 +5233,7 @@ function vs() {
5233
5233
  function u(w) {
5234
5234
  return i.isBuffer(w) || w instanceof a;
5235
5235
  }
5236
- var l = _s, b = xs, m = b.getHighWaterMark, g = dt.codes, v = g.ERR_INVALID_ARG_TYPE, A = g.ERR_METHOD_NOT_IMPLEMENTED, B = g.ERR_MULTIPLE_CALLBACK, P = g.ERR_STREAM_CANNOT_PIPE, T = g.ERR_STREAM_DESTROYED, C = g.ERR_STREAM_NULL_VALUES, F = g.ERR_STREAM_WRITE_AFTER_END, L = g.ERR_UNKNOWN_ENCODING, k = l.errorOrDestroy;
5236
+ var l = _s, b = xs, m = b.getHighWaterMark, g = dt.codes, v = g.ERR_INVALID_ARG_TYPE, A = g.ERR_METHOD_NOT_IMPLEMENTED, B = g.ERR_MULTIPLE_CALLBACK, P = g.ERR_STREAM_CANNOT_PIPE, T = g.ERR_STREAM_DESTROYED, k = g.ERR_STREAM_NULL_VALUES, F = g.ERR_STREAM_WRITE_AFTER_END, L = g.ERR_UNKNOWN_ENCODING, C = l.errorOrDestroy;
5237
5237
  de(M, n);
5238
5238
  function O() {
5239
5239
  }
@@ -5273,15 +5273,15 @@ function vs() {
5273
5273
  this._writableState = new S(w, this, _), this.writable = !0, w && (typeof w.write == "function" && (this._write = w.write), typeof w.writev == "function" && (this._writev = w.writev), typeof w.destroy == "function" && (this._destroy = w.destroy), typeof w.final == "function" && (this._final = w.final)), n.call(this);
5274
5274
  }
5275
5275
  M.prototype.pipe = function() {
5276
- k(this, new P());
5276
+ C(this, new P());
5277
5277
  };
5278
5278
  function $(w, _) {
5279
5279
  var R = new F();
5280
- k(w, R), process.nextTick(_, R);
5280
+ C(w, R), process.nextTick(_, R);
5281
5281
  }
5282
5282
  function se(w, _, R, D) {
5283
5283
  var G;
5284
- return R === null ? G = new C() : typeof R != "string" && !_.objectMode && (G = new v("chunk", ["string", "Buffer"], R)), G ? (k(w, G), process.nextTick(D, G), !1) : !0;
5284
+ return R === null ? G = new k() : typeof R != "string" && !_.objectMode && (G = new v("chunk", ["string", "Buffer"], R)), G ? (C(w, G), process.nextTick(D, G), !1) : !0;
5285
5285
  }
5286
5286
  M.prototype.write = function(w, _, R) {
5287
5287
  var D = this._writableState, G = !1, d = !D.objectMode && u(w);
@@ -5290,7 +5290,7 @@ function vs() {
5290
5290
  this._writableState.corked++;
5291
5291
  }, M.prototype.uncork = function() {
5292
5292
  var w = this._writableState;
5293
- w.corked && (w.corked--, !w.writing && !w.corked && !w.bufferProcessing && w.bufferedRequest && Ce(this, w));
5293
+ w.corked && (w.corked--, !w.writing && !w.corked && !w.bufferProcessing && w.bufferedRequest && ke(this, w));
5294
5294
  }, M.prototype.setDefaultEncoding = function(_) {
5295
5295
  if (typeof _ == "string" && (_ = _.toLowerCase()), !(["hex", "utf8", "utf-8", "ascii", "binary", "base64", "ucs2", "ucs-2", "utf16le", "utf-16le", "raw"].indexOf((_ + "").toLowerCase()) > -1)) throw new L(_);
5296
5296
  return this._writableState.defaultEncoding = _, this;
@@ -5340,7 +5340,7 @@ function vs() {
5340
5340
  _.writelen = D, _.writecb = p, _.writing = !0, _.sync = !0, _.destroyed ? _.onwrite(new T("write")) : R ? w._writev(G, _.onwrite) : w._write(G, d, _.onwrite), _.sync = !1;
5341
5341
  }
5342
5342
  function ve(w, _, R, D, G) {
5343
- --_.pendingcb, R ? (process.nextTick(G, D), process.nextTick(Be, w, _), w._writableState.errorEmitted = !0, k(w, D)) : (G(D), w._writableState.errorEmitted = !0, k(w, D), Be(w, _));
5343
+ --_.pendingcb, R ? (process.nextTick(G, D), process.nextTick(Be, w, _), w._writableState.errorEmitted = !0, C(w, D)) : (G(D), w._writableState.errorEmitted = !0, C(w, D), Be(w, _));
5344
5344
  }
5345
5345
  function Ee(w) {
5346
5346
  w.writing = !1, w.writecb = null, w.length -= w.writelen, w.writelen = 0;
@@ -5351,7 +5351,7 @@ function vs() {
5351
5351
  if (Ee(R), _) ve(w, R, D, _, G);
5352
5352
  else {
5353
5353
  var d = je(R) || w.destroyed;
5354
- !d && !R.corked && !R.bufferProcessing && R.bufferedRequest && Ce(w, R), D ? process.nextTick(Pe, w, R, d, G) : Pe(w, R, d, G);
5354
+ !d && !R.corked && !R.bufferProcessing && R.bufferedRequest && ke(w, R), D ? process.nextTick(Pe, w, R, d, G) : Pe(w, R, d, G);
5355
5355
  }
5356
5356
  }
5357
5357
  function Pe(w, _, R, D) {
@@ -5360,7 +5360,7 @@ function vs() {
5360
5360
  function Ge(w, _) {
5361
5361
  _.length === 0 && _.needDrain && (_.needDrain = !1, w.emit("drain"));
5362
5362
  }
5363
- function Ce(w, _) {
5363
+ function ke(w, _) {
5364
5364
  _.bufferProcessing = !0;
5365
5365
  var R = _.bufferedRequest;
5366
5366
  if (w._writev && R && R.next) {
@@ -5398,7 +5398,7 @@ function vs() {
5398
5398
  }
5399
5399
  function Q(w, _) {
5400
5400
  w._final(function(R) {
5401
- _.pendingcb--, R && k(w, R), _.prefinished = !0, w.emit("prefinish"), Be(w, _);
5401
+ _.pendingcb--, R && C(w, R), _.prefinished = !0, w.emit("prefinish"), Be(w, _);
5402
5402
  });
5403
5403
  }
5404
5404
  function oe(w, _) {
@@ -5502,7 +5502,7 @@ function It() {
5502
5502
  }
5503
5503
  }), Yr;
5504
5504
  }
5505
- var xr = {}, Cn = xe.Buffer, fi = Cn.isEncoding || function(e) {
5505
+ var xr = {}, kn = xe.Buffer, fi = kn.isEncoding || function(e) {
5506
5506
  switch (e = "" + e, e && e.toLowerCase()) {
5507
5507
  case "hex":
5508
5508
  case "utf8":
@@ -5546,7 +5546,7 @@ function eu(e) {
5546
5546
  }
5547
5547
  function tu(e) {
5548
5548
  var t = eu(e);
5549
- if (typeof t != "string" && (Cn.isEncoding === fi || !fi(e))) throw new Error("Unknown encoding: " + e);
5549
+ if (typeof t != "string" && (kn.isEncoding === fi || !fi(e))) throw new Error("Unknown encoding: " + e);
5550
5550
  return t || e;
5551
5551
  }
5552
5552
  xr.StringDecoder = Qt;
@@ -5567,7 +5567,7 @@ function Qt(e) {
5567
5567
  this.write = lu, this.end = hu;
5568
5568
  return;
5569
5569
  }
5570
- this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Cn.allocUnsafe(t);
5570
+ this.lastNeed = 0, this.lastTotal = 0, this.lastChar = kn.allocUnsafe(t);
5571
5571
  }
5572
5572
  Qt.prototype.write = function(e) {
5573
5573
  if (e.length === 0) return "";
@@ -5698,63 +5698,63 @@ function Es(e, t, r) {
5698
5698
  e.removeListener("complete", u), e.removeListener("abort", g), e.removeListener("request", v), e.req && e.req.removeListener("finish", u), e.removeListener("end", a), e.removeListener("close", a), e.removeListener("finish", u), e.removeListener("end", b), e.removeListener("error", m), e.removeListener("close", g);
5699
5699
  };
5700
5700
  }
5701
- var kn = Es, Xr, ci;
5701
+ var Cn = Es, Xr, ci;
5702
5702
  function yu() {
5703
5703
  if (ci) return Xr;
5704
5704
  ci = 1;
5705
5705
  var e;
5706
- function t(L, k, O) {
5707
- return k = r(k), k in L ? Object.defineProperty(L, k, { value: O, enumerable: !0, configurable: !0, writable: !0 }) : L[k] = O, L;
5706
+ function t(L, C, O) {
5707
+ return C = r(C), C in L ? Object.defineProperty(L, C, { value: O, enumerable: !0, configurable: !0, writable: !0 }) : L[C] = O, L;
5708
5708
  }
5709
5709
  function r(L) {
5710
- var k = n(L, "string");
5711
- return typeof k == "symbol" ? k : String(k);
5710
+ var C = n(L, "string");
5711
+ return typeof C == "symbol" ? C : String(C);
5712
5712
  }
5713
- function n(L, k) {
5713
+ function n(L, C) {
5714
5714
  if (typeof L != "object" || L === null) return L;
5715
5715
  var O = L[Symbol.toPrimitive];
5716
5716
  if (O !== void 0) {
5717
- var S = O.call(L, k || "default");
5717
+ var S = O.call(L, C || "default");
5718
5718
  if (typeof S != "object") return S;
5719
5719
  throw new TypeError("@@toPrimitive must return a primitive value.");
5720
5720
  }
5721
- return (k === "string" ? String : Number)(L);
5721
+ return (C === "string" ? String : Number)(L);
5722
5722
  }
5723
- var i = kn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"), m = Symbol("handlePromise"), g = Symbol("stream");
5724
- function v(L, k) {
5723
+ var i = Cn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"), m = Symbol("handlePromise"), g = Symbol("stream");
5724
+ function v(L, C) {
5725
5725
  return {
5726
5726
  value: L,
5727
- done: k
5727
+ done: C
5728
5728
  };
5729
5729
  }
5730
5730
  function A(L) {
5731
- var k = L[a];
5732
- if (k !== null) {
5731
+ var C = L[a];
5732
+ if (C !== null) {
5733
5733
  var O = L[g].read();
5734
- O !== null && (L[b] = null, L[a] = null, L[f] = null, k(v(O, !1)));
5734
+ O !== null && (L[b] = null, L[a] = null, L[f] = null, C(v(O, !1)));
5735
5735
  }
5736
5736
  }
5737
5737
  function B(L) {
5738
5738
  process.nextTick(A, L);
5739
5739
  }
5740
- function P(L, k) {
5740
+ function P(L, C) {
5741
5741
  return function(O, S) {
5742
5742
  L.then(function() {
5743
- if (k[l]) {
5743
+ if (C[l]) {
5744
5744
  O(v(void 0, !0));
5745
5745
  return;
5746
5746
  }
5747
- k[m](O, S);
5747
+ C[m](O, S);
5748
5748
  }, S);
5749
5749
  };
5750
5750
  }
5751
5751
  var T = Object.getPrototypeOf(function() {
5752
- }), C = Object.setPrototypeOf((e = {
5752
+ }), k = Object.setPrototypeOf((e = {
5753
5753
  get stream() {
5754
5754
  return this[g];
5755
5755
  },
5756
5756
  next: function() {
5757
- var k = this, O = this[u];
5757
+ var C = this, O = this[u];
5758
5758
  if (O !== null)
5759
5759
  return Promise.reject(O);
5760
5760
  if (this[l])
@@ -5762,7 +5762,7 @@ function yu() {
5762
5762
  if (this[g].destroyed)
5763
5763
  return new Promise(function($, se) {
5764
5764
  process.nextTick(function() {
5765
- k[u] ? se(k[u]) : $(v(void 0, !0));
5765
+ C[u] ? se(C[u]) : $(v(void 0, !0));
5766
5766
  });
5767
5767
  });
5768
5768
  var S = this[b], z;
@@ -5779,9 +5779,9 @@ function yu() {
5779
5779
  }, t(e, Symbol.asyncIterator, function() {
5780
5780
  return this;
5781
5781
  }), t(e, "return", function() {
5782
- var k = this;
5782
+ var C = this;
5783
5783
  return new Promise(function(O, S) {
5784
- k[g].destroy(null, function(z) {
5784
+ C[g].destroy(null, function(z) {
5785
5785
  if (z) {
5786
5786
  S(z);
5787
5787
  return;
@@ -5789,9 +5789,9 @@ function yu() {
5789
5789
  O(v(void 0, !0));
5790
5790
  });
5791
5791
  });
5792
- }), e), T), F = function(k) {
5793
- var O, S = Object.create(C, (O = {}, t(O, g, {
5794
- value: k,
5792
+ }), e), T), F = function(C) {
5793
+ var O, S = Object.create(k, (O = {}, t(O, g, {
5794
+ value: C,
5795
5795
  writable: !0
5796
5796
  }), t(O, a, {
5797
5797
  value: null,
@@ -5803,7 +5803,7 @@ function yu() {
5803
5803
  value: null,
5804
5804
  writable: !0
5805
5805
  }), t(O, l, {
5806
- value: k._readableState.endEmitted,
5806
+ value: C._readableState.endEmitted,
5807
5807
  writable: !0
5808
5808
  }), t(O, m, {
5809
5809
  value: function(M, $) {
@@ -5812,7 +5812,7 @@ function yu() {
5812
5812
  },
5813
5813
  writable: !0
5814
5814
  }), O));
5815
- return S[b] = null, i(k, function(z) {
5815
+ return S[b] = null, i(C, function(z) {
5816
5816
  if (z && z.code !== "ERR_STREAM_PREMATURE_CLOSE") {
5817
5817
  var M = S[f];
5818
5818
  M !== null && (S[b] = null, S[a] = null, S[f] = null, M(z)), S[u] = z;
@@ -5820,7 +5820,7 @@ function yu() {
5820
5820
  }
5821
5821
  var $ = S[a];
5822
5822
  $ !== null && (S[b] = null, S[a] = null, S[f] = null, $(v(void 0, !0))), S[l] = !0;
5823
- }), k.on("readable", B.bind(null, S)), S;
5823
+ }), C.on("readable", B.bind(null, S)), S;
5824
5824
  };
5825
5825
  return Xr = F, Xr;
5826
5826
  }
@@ -5849,7 +5849,7 @@ function Bs() {
5849
5849
  var u = Pn, l;
5850
5850
  u && u.debuglog ? l = u.debuglog("stream") : l = function() {
5851
5851
  };
5852
- var b = Hf(), m = _s, g = xs, v = g.getHighWaterMark, A = dt.codes, B = A.ERR_INVALID_ARG_TYPE, P = A.ERR_STREAM_PUSH_AFTER_EOF, T = A.ERR_METHOD_NOT_IMPLEMENTED, C = A.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, F, L, k;
5852
+ var b = Hf(), m = _s, g = xs, v = g.getHighWaterMark, A = dt.codes, B = A.ERR_INVALID_ARG_TYPE, P = A.ERR_STREAM_PUSH_AFTER_EOF, T = A.ERR_METHOD_NOT_IMPLEMENTED, k = A.ERR_STREAM_UNSHIFT_AFTER_END_EVENT, F, L, C;
5853
5853
  de($, r);
5854
5854
  var O = m.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
5855
5855
  function z(d, p, I) {
@@ -5894,20 +5894,20 @@ function Bs() {
5894
5894
  O(d, V);
5895
5895
  else if (j.objectMode || p && p.length > 0)
5896
5896
  if (typeof p != "string" && !j.objectMode && Object.getPrototypeOf(p) !== n.prototype && (p = a(p)), U)
5897
- j.endEmitted ? O(d, new C()) : Te(d, j, p, !0);
5897
+ j.endEmitted ? O(d, new k()) : Te(d, j, p, !0);
5898
5898
  else if (j.ended)
5899
5899
  O(d, new P());
5900
5900
  else {
5901
5901
  if (j.destroyed)
5902
5902
  return !1;
5903
- j.reading = !1, j.decoder && !I ? (p = j.decoder.write(p), j.objectMode || p.length !== 0 ? Te(d, j, p, !1) : Ce(d, j)) : Te(d, j, p, !1);
5903
+ j.reading = !1, j.decoder && !I ? (p = j.decoder.write(p), j.objectMode || p.length !== 0 ? Te(d, j, p, !1) : ke(d, j)) : Te(d, j, p, !1);
5904
5904
  }
5905
- else U || (j.reading = !1, Ce(d, j));
5905
+ else U || (j.reading = !1, ke(d, j));
5906
5906
  }
5907
5907
  return !j.ended && (j.length < j.highWaterMark || j.length === 0);
5908
5908
  }
5909
5909
  function Te(d, p, I, U) {
5910
- p.flowing && p.length === 0 && !p.sync ? (p.awaitDrain = 0, d.emit("data", I)) : (p.length += p.objectMode ? 1 : I.length, U ? p.buffer.unshift(I) : p.buffer.push(I), p.needReadable && Pe(d)), Ce(d, p);
5910
+ p.flowing && p.length === 0 && !p.sync ? (p.awaitDrain = 0, d.emit("data", I)) : (p.length += p.objectMode ? 1 : I.length, U ? p.buffer.unshift(I) : p.buffer.push(I), p.needReadable && Pe(d)), ke(d, p);
5911
5911
  }
5912
5912
  function ze(d, p) {
5913
5913
  var I;
@@ -5959,7 +5959,7 @@ function Bs() {
5959
5959
  var p = d._readableState;
5960
5960
  l("emitReadable_", p.destroyed, p.length, p.ended), !p.destroyed && (p.length || p.ended) && (d.emit("readable"), p.emittedReadable = !1), p.needReadable = !p.flowing && !p.ended && p.length <= p.highWaterMark, w(d);
5961
5961
  }
5962
- function Ce(d, p) {
5962
+ function ke(d, p) {
5963
5963
  p.readingMore || (p.readingMore = !0, process.nextTick(je, d, p));
5964
5964
  }
5965
5965
  function je(d, p) {
@@ -5996,15 +5996,15 @@ function Bs() {
5996
5996
  }
5997
5997
  var bt = Q(I);
5998
5998
  d.on("drain", bt);
5999
- var kt = !1;
5999
+ var Ct = !1;
6000
6000
  function yt() {
6001
- l("cleanup"), d.removeListener("close", Lt), d.removeListener("finish", Ae), d.removeListener("drain", bt), d.removeListener("error", rt), d.removeListener("unpipe", V), I.removeListener("end", qe), I.removeListener("end", nt), I.removeListener("data", Se), kt = !0, U.awaitDrain && (!d._writableState || d._writableState.needDrain) && bt();
6001
+ l("cleanup"), d.removeListener("close", Lt), d.removeListener("finish", Ae), d.removeListener("drain", bt), d.removeListener("error", rt), d.removeListener("unpipe", V), I.removeListener("end", qe), I.removeListener("end", nt), I.removeListener("data", Se), Ct = !0, U.awaitDrain && (!d._writableState || d._writableState.needDrain) && bt();
6002
6002
  }
6003
6003
  I.on("data", Se);
6004
6004
  function Se(c) {
6005
6005
  l("ondata");
6006
6006
  var s = d.write(c);
6007
- l("dest.write", s), s === !1 && ((U.pipesCount === 1 && U.pipes === d || U.pipesCount > 1 && G(U.pipes, d) !== -1) && !kt && (l("false write response, pause", U.awaitDrain), U.awaitDrain++), I.pause());
6007
+ l("dest.write", s), s === !1 && ((U.pipesCount === 1 && U.pipes === d || U.pipesCount > 1 && G(U.pipes, d) !== -1) && !Ct && (l("false write response, pause", U.awaitDrain), U.awaitDrain++), I.pause());
6008
6008
  }
6009
6009
  function rt(c) {
6010
6010
  l("onerror", c), nt(), d.removeListener("error", rt), t(d, "error") === 0 && O(d, c);
@@ -6159,7 +6159,7 @@ function Bs() {
6159
6159
  }
6160
6160
  }
6161
6161
  typeof Symbol == "function" && ($.from = function(d, p) {
6162
- return k === void 0 && (k = gu()), k($, d, p);
6162
+ return C === void 0 && (C = gu()), C($, d, p);
6163
6163
  });
6164
6164
  function G(d, p) {
6165
6165
  for (var I = 0, U = d.length; I < U; I++)
@@ -6253,7 +6253,7 @@ function Tu(e, t, r, n) {
6253
6253
  var i = !1;
6254
6254
  e.on("close", function() {
6255
6255
  i = !0;
6256
- }), en === void 0 && (en = kn), en(e, {
6256
+ }), en === void 0 && (en = Cn), en(e, {
6257
6257
  readable: t,
6258
6258
  writable: r
6259
6259
  }, function(f) {
@@ -6275,13 +6275,13 @@ function bi(e) {
6275
6275
  function Pu(e, t) {
6276
6276
  return e.pipe(t);
6277
6277
  }
6278
- function Cu(e) {
6278
+ function ku(e) {
6279
6279
  return !e.length || typeof e[e.length - 1] != "function" ? pi : e.pop();
6280
6280
  }
6281
- function ku() {
6281
+ function Cu() {
6282
6282
  for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
6283
6283
  t[r] = arguments[r];
6284
- var n = Cu(t);
6284
+ var n = ku(t);
6285
6285
  if (Array.isArray(t[0]) && (t = t[0]), t.length < 2)
6286
6286
  throw new Au("streams");
6287
6287
  var i, a = t.map(function(f, u) {
@@ -6292,9 +6292,9 @@ function ku() {
6292
6292
  });
6293
6293
  return t.reduce(Pu);
6294
6294
  }
6295
- var Lu = ku;
6295
+ var Lu = Cu;
6296
6296
  (function(e, t) {
6297
- t = e.exports = Bs(), t.Stream = t, t.Readable = t, t.Writable = vs(), t.Duplex = It(), t.Transform = Ss, t.PassThrough = Bu, t.finished = kn, t.pipeline = Lu;
6297
+ t = e.exports = Bs(), t.Stream = t, t.Readable = t, t.Writable = vs(), t.Duplex = It(), t.Transform = Ss, t.PassThrough = Bu, t.finished = Cn, t.pipeline = Lu;
6298
6298
  })(cn, cn.exports);
6299
6299
  var Rs = cn.exports, vr = xe.Buffer, Ts = Rs.Transform, Fu = de;
6300
6300
  function Ou(e, t) {
@@ -6350,44 +6350,44 @@ Ze.prototype._digest = function() {
6350
6350
  throw new Error("_digest is not implemented");
6351
6351
  };
6352
6352
  var Uu = Ze, Nu = de, Ps = Uu, Mu = xe.Buffer, Du = new Array(16);
6353
- function Cr() {
6353
+ function kr() {
6354
6354
  Ps.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;
6355
6355
  }
6356
- Nu(Cr, Ps);
6357
- Cr.prototype._update = function() {
6356
+ Nu(kr, Ps);
6357
+ kr.prototype._update = function() {
6358
6358
  for (var e = Du, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
6359
6359
  var r = this._a, n = this._b, i = this._c, a = this._d;
6360
6360
  r = pe(r, n, i, a, e[0], 3614090360, 7), a = pe(a, r, n, i, e[1], 3905402710, 12), i = pe(i, a, r, n, e[2], 606105819, 17), n = pe(n, i, a, r, e[3], 3250441966, 22), r = pe(r, n, i, a, e[4], 4118548399, 7), a = pe(a, r, n, i, e[5], 1200080426, 12), i = pe(i, a, r, n, e[6], 2821735955, 17), n = pe(n, i, a, r, e[7], 4249261313, 22), r = pe(r, n, i, a, e[8], 1770035416, 7), a = pe(a, r, n, i, e[9], 2336552879, 12), i = pe(i, a, r, n, e[10], 4294925233, 17), n = pe(n, i, a, r, e[11], 2304563134, 22), r = pe(r, n, i, a, e[12], 1804603682, 7), a = pe(a, r, n, i, e[13], 4254626195, 12), i = pe(i, a, r, n, e[14], 2792965006, 17), n = pe(n, i, a, r, e[15], 1236535329, 22), r = be(r, n, i, a, e[1], 4129170786, 5), a = be(a, r, n, i, e[6], 3225465664, 9), i = be(i, a, r, n, e[11], 643717713, 14), n = be(n, i, a, r, e[0], 3921069994, 20), r = be(r, n, i, a, e[5], 3593408605, 5), a = be(a, r, n, i, e[10], 38016083, 9), i = be(i, a, r, n, e[15], 3634488961, 14), n = be(n, i, a, r, e[4], 3889429448, 20), r = be(r, n, i, a, e[9], 568446438, 5), a = be(a, r, n, i, e[14], 3275163606, 9), i = be(i, a, r, n, e[3], 4107603335, 14), n = be(n, i, a, r, e[8], 1163531501, 20), r = be(r, n, i, a, e[13], 2850285829, 5), a = be(a, r, n, i, e[2], 4243563512, 9), i = be(i, a, r, n, e[7], 1735328473, 14), n = be(n, i, a, r, e[12], 2368359562, 20), r = ye(r, n, i, a, e[5], 4294588738, 4), a = ye(a, r, n, i, e[8], 2272392833, 11), i = ye(i, a, r, n, e[11], 1839030562, 16), n = ye(n, i, a, r, e[14], 4259657740, 23), r = ye(r, n, i, a, e[1], 2763975236, 4), a = ye(a, r, n, i, e[4], 1272893353, 11), i = ye(i, a, r, n, e[7], 4139469664, 16), n = ye(n, i, a, r, e[10], 3200236656, 23), r = ye(r, n, i, a, e[13], 681279174, 4), a = ye(a, r, n, i, e[0], 3936430074, 11), i = ye(i, a, r, n, e[3], 3572445317, 16), n = ye(n, i, a, r, e[6], 76029189, 23), r = ye(r, n, i, a, e[9], 3654602809, 4), a = ye(a, r, n, i, e[12], 3873151461, 11), i = ye(i, a, r, n, e[15], 530742520, 16), n = ye(n, i, a, r, e[2], 3299628645, 23), r = ge(r, n, i, a, e[0], 4096336452, 6), a = ge(a, r, n, i, e[7], 1126891415, 10), i = ge(i, a, r, n, e[14], 2878612391, 15), n = ge(n, i, a, r, e[5], 4237533241, 21), r = ge(r, n, i, a, e[12], 1700485571, 6), a = ge(a, r, n, i, e[3], 2399980690, 10), i = ge(i, a, r, n, e[10], 4293915773, 15), n = ge(n, i, a, r, e[1], 2240044497, 21), r = ge(r, n, i, a, e[8], 1873313359, 6), a = ge(a, r, n, i, e[15], 4264355552, 10), i = ge(i, a, r, n, e[6], 2734768916, 15), n = ge(n, i, a, r, e[13], 1309151649, 21), r = ge(r, n, i, a, e[4], 4149444226, 6), a = ge(a, r, n, i, e[11], 3174756917, 10), i = ge(i, a, r, n, e[2], 718787259, 15), n = ge(n, i, a, r, e[9], 3951481745, 21), this._a = this._a + r | 0, this._b = this._b + n | 0, this._c = this._c + i | 0, this._d = this._d + a | 0;
6361
6361
  };
6362
- Cr.prototype._digest = function() {
6362
+ kr.prototype._digest = function() {
6363
6363
  this._block[this._blockOffset++] = 128, this._blockOffset > 56 && (this._block.fill(0, this._blockOffset, 64), this._update(), this._blockOffset = 0), this._block.fill(0, this._blockOffset, 56), this._block.writeUInt32LE(this._length[0], 56), this._block.writeUInt32LE(this._length[1], 60), this._update();
6364
6364
  var e = Mu.allocUnsafe(16);
6365
6365
  return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e;
6366
6366
  };
6367
- function kr(e, t) {
6367
+ function Cr(e, t) {
6368
6368
  return e << t | e >>> 32 - t;
6369
6369
  }
6370
6370
  function pe(e, t, r, n, i, a, f) {
6371
- return kr(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
6371
+ return Cr(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
6372
6372
  }
6373
6373
  function be(e, t, r, n, i, a, f) {
6374
- return kr(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
6374
+ return Cr(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
6375
6375
  }
6376
6376
  function ye(e, t, r, n, i, a, f) {
6377
- return kr(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
6377
+ return Cr(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
6378
6378
  }
6379
6379
  function ge(e, t, r, n, i, a, f) {
6380
- return kr(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
6380
+ return Cr(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
6381
6381
  }
6382
- var $u = Cr, Er = xe.Buffer, Cs = Rs.Transform, Hu = de;
6382
+ var $u = kr, Er = xe.Buffer, ks = Rs.Transform, Hu = de;
6383
6383
  function zu(e, t) {
6384
6384
  if (!Er.isBuffer(e) && typeof e != "string")
6385
6385
  throw new TypeError(t + " must be a string or a buffer");
6386
6386
  }
6387
6387
  function et(e) {
6388
- Cs.call(this), this._block = Er.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
6388
+ ks.call(this), this._block = Er.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
6389
6389
  }
6390
- Hu(et, Cs);
6390
+ Hu(et, ks);
6391
6391
  et.prototype._transform = function(e, t, r) {
6392
6392
  var n = null;
6393
6393
  try {
@@ -6432,7 +6432,7 @@ et.prototype.digest = function(e) {
6432
6432
  et.prototype._digest = function() {
6433
6433
  throw new Error("_digest is not implemented");
6434
6434
  };
6435
- var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
6435
+ var Gu = et, tn = Pt.Buffer, ju = de, Cs = Gu, Wu = new Array(16), $t = [
6436
6436
  0,
6437
6437
  1,
6438
6438
  2,
@@ -6758,9 +6758,9 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
6758
6758
  11
6759
6759
  ], jt = [0, 1518500249, 1859775393, 2400959708, 2840853838], Wt = [1352829926, 1548603684, 1836072691, 2053994217, 0];
6760
6760
  function Lr() {
6761
- ks.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
6761
+ Cs.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
6762
6762
  }
6763
- ju(Lr, ks);
6763
+ ju(Lr, Cs);
6764
6764
  Lr.prototype._update = function() {
6765
6765
  for (var e = Wu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
6766
6766
  for (var r = this._a | 0, n = this._b | 0, i = this._c | 0, a = this._d | 0, f = this._e | 0, u = this._a | 0, l = this._b | 0, b = this._c | 0, m = this._d | 0, g = this._e | 0, v = 0; v < 80; v += 1) {
@@ -6823,7 +6823,7 @@ Fr.prototype.digest = function(e) {
6823
6823
  Fr.prototype._update = function() {
6824
6824
  throw new Error("_update must be implemented by subclass");
6825
6825
  };
6826
- var Ct = Fr, Vu = de, Os = Ct, Ku = xe.Buffer, Yu = [
6826
+ var kt = Fr, Vu = de, Os = kt, Ku = xe.Buffer, Yu = [
6827
6827
  1518500249,
6828
6828
  1859775393,
6829
6829
  -1894007588,
@@ -6858,7 +6858,7 @@ Zt.prototype._hash = function() {
6858
6858
  var e = Ku.allocUnsafe(20);
6859
6859
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
6860
6860
  };
6861
- var ec = Zt, tc = de, Us = Ct, rc = xe.Buffer, nc = [
6861
+ var ec = Zt, tc = de, Us = kt, rc = xe.Buffer, nc = [
6862
6862
  1518500249,
6863
6863
  1859775393,
6864
6864
  -1894007588,
@@ -6896,7 +6896,7 @@ er.prototype._hash = function() {
6896
6896
  var e = rc.allocUnsafe(20);
6897
6897
  return e.writeInt32BE(this._a | 0, 0), e.writeInt32BE(this._b | 0, 4), e.writeInt32BE(this._c | 0, 8), e.writeInt32BE(this._d | 0, 12), e.writeInt32BE(this._e | 0, 16), e;
6898
6898
  };
6899
- var uc = er, cc = de, Ns = Ct, lc = xe.Buffer, hc = [
6899
+ var uc = er, cc = de, Ns = kt, lc = xe.Buffer, hc = [
6900
6900
  1116352408,
6901
6901
  1899447441,
6902
6902
  3049323471,
@@ -7000,7 +7000,7 @@ tr.prototype._hash = function() {
7000
7000
  var e = lc.allocUnsafe(32);
7001
7001
  return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e.writeInt32BE(this._h, 28), e;
7002
7002
  };
7003
- var Ms = tr, wc = de, xc = Ms, vc = Ct, Ec = xe.Buffer, Bc = new Array(64);
7003
+ var Ms = tr, wc = de, xc = Ms, vc = kt, Ec = xe.Buffer, Bc = new Array(64);
7004
7004
  function Or() {
7005
7005
  this.init(), this._w = Bc, vc.call(this, 64, 56);
7006
7006
  }
@@ -7012,7 +7012,7 @@ Or.prototype._hash = function() {
7012
7012
  var e = Ec.allocUnsafe(28);
7013
7013
  return e.writeInt32BE(this._a, 0), e.writeInt32BE(this._b, 4), e.writeInt32BE(this._c, 8), e.writeInt32BE(this._d, 12), e.writeInt32BE(this._e, 16), e.writeInt32BE(this._f, 20), e.writeInt32BE(this._g, 24), e;
7014
7014
  };
7015
- var Sc = Or, Ac = de, Ds = Ct, Ic = xe.Buffer, xi = [
7015
+ var Sc = Or, Ac = de, Ds = kt, Ic = xe.Buffer, xi = [
7016
7016
  1116352408,
7017
7017
  3609767458,
7018
7018
  1899447441,
@@ -7199,32 +7199,32 @@ function Tc(e, t) {
7199
7199
  function Pc(e, t) {
7200
7200
  return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25);
7201
7201
  }
7202
- function Cc(e, t) {
7202
+ function kc(e, t) {
7203
7203
  return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6;
7204
7204
  }
7205
- function kc(e, t) {
7205
+ function Cc(e, t) {
7206
7206
  return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26);
7207
7207
  }
7208
7208
  function ce(e, t) {
7209
7209
  return e >>> 0 < t >>> 0 ? 1 : 0;
7210
7210
  }
7211
7211
  rr.prototype._update = function(e) {
7212
- for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0, b = this._hh | 0, m = this._al | 0, g = this._bl | 0, v = this._cl | 0, A = this._dl | 0, B = this._el | 0, P = this._fl | 0, T = this._gl | 0, C = this._hl | 0, F = 0; F < 32; F += 2)
7212
+ for (var t = this._w, r = this._ah | 0, n = this._bh | 0, i = this._ch | 0, a = this._dh | 0, f = this._eh | 0, u = this._fh | 0, l = this._gh | 0, b = this._hh | 0, m = this._al | 0, g = this._bl | 0, v = this._cl | 0, A = this._dl | 0, B = this._el | 0, P = this._fl | 0, T = this._gl | 0, k = this._hl | 0, F = 0; F < 32; F += 2)
7213
7213
  t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
7214
7214
  for (; F < 160; F += 2) {
7215
- var L = t[F - 30], k = t[F - 15 * 2 + 1], O = Tc(L, k), S = Pc(k, L);
7216
- L = t[F - 2 * 2], k = t[F - 2 * 2 + 1];
7217
- var z = Cc(L, k), M = kc(k, L), $ = t[F - 7 * 2], se = t[F - 7 * 2 + 1], Te = t[F - 16 * 2], ze = t[F - 16 * 2 + 1], ae = S + se | 0, ve = O + $ + ce(ae, S) | 0;
7215
+ var L = t[F - 30], C = t[F - 15 * 2 + 1], O = Tc(L, C), S = Pc(C, L);
7216
+ L = t[F - 2 * 2], C = t[F - 2 * 2 + 1];
7217
+ var z = kc(L, C), M = Cc(C, L), $ = t[F - 7 * 2], se = t[F - 7 * 2 + 1], Te = t[F - 16 * 2], ze = t[F - 16 * 2 + 1], ae = S + se | 0, ve = O + $ + ce(ae, S) | 0;
7218
7218
  ae = ae + M | 0, ve = ve + z + ce(ae, M) | 0, ae = ae + ze | 0, ve = ve + Te + ce(ae, ze) | 0, t[F] = ve, t[F + 1] = ae;
7219
7219
  }
7220
7220
  for (var Ee = 0; Ee < 160; Ee += 2) {
7221
7221
  ve = t[Ee], ae = t[Ee + 1];
7222
- var tt = Ei(r, n, i), Pe = Ei(m, g, v), Ge = Bi(r, m), Ce = Bi(m, r), je = Si(f, B), Q = Si(B, f), oe = xi[Ee], Be = xi[Ee + 1], We = vi(f, u, l), Ue = vi(B, P, T), w = C + Q | 0, _ = b + je + ce(w, C) | 0;
7222
+ var tt = Ei(r, n, i), Pe = Ei(m, g, v), Ge = Bi(r, m), ke = Bi(m, r), je = Si(f, B), Q = Si(B, f), oe = xi[Ee], Be = xi[Ee + 1], We = vi(f, u, l), Ue = vi(B, P, T), w = k + Q | 0, _ = b + je + ce(w, k) | 0;
7223
7223
  w = w + Ue | 0, _ = _ + We + ce(w, Ue) | 0, w = w + Be | 0, _ = _ + oe + ce(w, Be) | 0, w = w + ae | 0, _ = _ + ve + ce(w, ae) | 0;
7224
- var R = Ce + Pe | 0, D = Ge + tt + ce(R, Ce) | 0;
7225
- b = l, C = T, l = u, T = P, u = f, P = B, B = A + w | 0, f = a + _ + ce(B, A) | 0, a = i, A = v, i = n, v = g, n = r, g = m, m = w + R | 0, r = _ + D + ce(m, w) | 0;
7224
+ var R = ke + Pe | 0, D = Ge + tt + ce(R, ke) | 0;
7225
+ b = l, k = T, l = u, T = P, u = f, P = B, B = A + w | 0, f = a + _ + ce(B, A) | 0, a = i, A = v, i = n, v = g, n = r, g = m, m = w + R | 0, r = _ + D + ce(m, w) | 0;
7226
7226
  }
7227
- this._al = this._al + m | 0, this._bl = this._bl + g | 0, this._cl = this._cl + v | 0, this._dl = this._dl + A | 0, this._el = this._el + B | 0, this._fl = this._fl + P | 0, this._gl = this._gl + T | 0, this._hl = this._hl + C | 0, this._ah = this._ah + r + ce(this._al, m) | 0, this._bh = this._bh + n + ce(this._bl, g) | 0, this._ch = this._ch + i + ce(this._cl, v) | 0, this._dh = this._dh + a + ce(this._dl, A) | 0, this._eh = this._eh + f + ce(this._el, B) | 0, this._fh = this._fh + u + ce(this._fl, P) | 0, this._gh = this._gh + l + ce(this._gl, T) | 0, this._hh = this._hh + b + ce(this._hl, C) | 0;
7227
+ this._al = this._al + m | 0, this._bl = this._bl + g | 0, this._cl = this._cl + v | 0, this._dl = this._dl + A | 0, this._el = this._el + B | 0, this._fl = this._fl + P | 0, this._gl = this._gl + T | 0, this._hl = this._hl + k | 0, this._ah = this._ah + r + ce(this._al, m) | 0, this._bh = this._bh + n + ce(this._bl, g) | 0, this._ch = this._ch + i + ce(this._cl, v) | 0, this._dh = this._dh + a + ce(this._dl, A) | 0, this._eh = this._eh + f + ce(this._el, B) | 0, this._fh = this._fh + u + ce(this._fl, P) | 0, this._gh = this._gh + l + ce(this._gl, T) | 0, this._hh = this._hh + b + ce(this._hl, k) | 0;
7228
7228
  };
7229
7229
  rr.prototype._hash = function() {
7230
7230
  var e = Ic.allocUnsafe(64);
@@ -7233,7 +7233,7 @@ rr.prototype._hash = function() {
7233
7233
  }
7234
7234
  return t(this._ah, this._al, 0), t(this._bh, this._bl, 8), t(this._ch, this._cl, 16), t(this._dh, this._dl, 24), t(this._eh, this._el, 32), t(this._fh, this._fl, 40), t(this._gh, this._gl, 48), t(this._hh, this._hl, 56), e;
7235
7235
  };
7236
- var $s = rr, Lc = de, Fc = $s, Oc = Ct, Uc = xe.Buffer, Nc = new Array(160);
7236
+ var $s = rr, Lc = de, Fc = $s, Oc = kt, Uc = xe.Buffer, Nc = new Array(160);
7237
7237
  function Ur() {
7238
7238
  this.init(), this._w = Nc, Oc.call(this, 128, 112);
7239
7239
  }
@@ -7261,27 +7261,27 @@ pt.sha256 = Ms;
7261
7261
  pt.sha384 = Mc;
7262
7262
  pt.sha512 = $s;
7263
7263
  var Dc = Ls.exports, Hs = xe.Buffer, zs = Pn.Transform, $c = xr.StringDecoder, Hc = de;
7264
- function ke(e) {
7264
+ function Ce(e) {
7265
7265
  zs.call(this), this.hashMode = typeof e == "string", this.hashMode ? this[e] = this._finalOrDigest : this.final = this._finalOrDigest, this._final && (this.__final = this._final, this._final = null), this._decoder = null, this._encoding = null;
7266
7266
  }
7267
- Hc(ke, zs);
7268
- ke.prototype.update = function(e, t, r) {
7267
+ Hc(Ce, zs);
7268
+ Ce.prototype.update = function(e, t, r) {
7269
7269
  typeof e == "string" && (e = Hs.from(e, t));
7270
7270
  var n = this._update(e);
7271
7271
  return this.hashMode ? this : (r && (n = this._toString(n, r)), n);
7272
7272
  };
7273
- ke.prototype.setAutoPadding = function() {
7273
+ Ce.prototype.setAutoPadding = function() {
7274
7274
  };
7275
- ke.prototype.getAuthTag = function() {
7275
+ Ce.prototype.getAuthTag = function() {
7276
7276
  throw new Error("trying to get auth tag in unsupported state");
7277
7277
  };
7278
- ke.prototype.setAuthTag = function() {
7278
+ Ce.prototype.setAuthTag = function() {
7279
7279
  throw new Error("trying to set auth tag in unsupported state");
7280
7280
  };
7281
- ke.prototype.setAAD = function() {
7281
+ Ce.prototype.setAAD = function() {
7282
7282
  throw new Error("trying to set aad in unsupported state");
7283
7283
  };
7284
- ke.prototype._transform = function(e, t, r) {
7284
+ Ce.prototype._transform = function(e, t, r) {
7285
7285
  var n;
7286
7286
  try {
7287
7287
  this.hashMode ? this._update(e) : this.push(this._update(e));
@@ -7291,7 +7291,7 @@ ke.prototype._transform = function(e, t, r) {
7291
7291
  r(n);
7292
7292
  }
7293
7293
  };
7294
- ke.prototype._flush = function(e) {
7294
+ Ce.prototype._flush = function(e) {
7295
7295
  var t;
7296
7296
  try {
7297
7297
  this.push(this.__final());
@@ -7300,16 +7300,16 @@ ke.prototype._flush = function(e) {
7300
7300
  }
7301
7301
  e(t);
7302
7302
  };
7303
- ke.prototype._finalOrDigest = function(e) {
7303
+ Ce.prototype._finalOrDigest = function(e) {
7304
7304
  var t = this.__final() || Hs.alloc(0);
7305
7305
  return e && (t = this._toString(t, e, !0)), t;
7306
7306
  };
7307
- ke.prototype._toString = function(e, t, r) {
7307
+ Ce.prototype._toString = function(e, t, r) {
7308
7308
  if (this._decoder || (this._decoder = new $c(t), this._encoding = t), this._encoding !== t) throw new Error("can't switch encodings");
7309
7309
  var n = this._decoder.write(e);
7310
7310
  return r && (n += this._decoder.end()), n;
7311
7311
  };
7312
- var zc = ke, Gc = de, jc = $u, Wc = qu, qc = Dc, Gs = zc;
7312
+ var zc = Ce, Gc = de, jc = $u, Wc = qu, qc = Dc, Gs = zc;
7313
7313
  function Nr(e) {
7314
7314
  Gs.call(this, "digest"), this._hash = e;
7315
7315
  }
@@ -7340,12 +7340,12 @@ function Kc(e) {
7340
7340
  throw new TypeError("Expected Buffer");
7341
7341
  if (A.length === 0)
7342
7342
  return "";
7343
- for (var B = 0, P = 0, T = 0, C = A.length; T !== C && A[T] === 0; )
7343
+ for (var B = 0, P = 0, T = 0, k = A.length; T !== k && A[T] === 0; )
7344
7344
  T++, B++;
7345
- for (var F = (C - T) * b + 1 >>> 0, L = new Uint8Array(F); T !== C; ) {
7346
- for (var k = A[T], O = 0, S = F - 1; (k !== 0 || O < P) && S !== -1; S--, O++)
7347
- k += 256 * L[S] >>> 0, L[S] = k % f >>> 0, k = k / f >>> 0;
7348
- if (k !== 0)
7345
+ for (var F = (k - T) * b + 1 >>> 0, L = new Uint8Array(F); T !== k; ) {
7346
+ for (var C = A[T], O = 0, S = F - 1; (C !== 0 || O < P) && S !== -1; S--, O++)
7347
+ C += 256 * L[S] >>> 0, L[S] = C % f >>> 0, C = C / f >>> 0;
7348
+ if (C !== 0)
7349
7349
  throw new Error("Non-zero carry");
7350
7350
  P = O, T++;
7351
7351
  }
@@ -7362,21 +7362,21 @@ function Kc(e) {
7362
7362
  return ur.alloc(0);
7363
7363
  for (var B = 0, P = 0, T = 0; A[B] === u; )
7364
7364
  P++, B++;
7365
- for (var C = (A.length - B) * l + 1 >>> 0, F = new Uint8Array(C); B < A.length; ) {
7365
+ for (var k = (A.length - B) * l + 1 >>> 0, F = new Uint8Array(k); B < A.length; ) {
7366
7366
  var L = t[A.charCodeAt(B)];
7367
7367
  if (L === 255)
7368
7368
  return;
7369
- for (var k = 0, O = C - 1; (L !== 0 || k < T) && O !== -1; O--, k++)
7369
+ for (var C = 0, O = k - 1; (L !== 0 || C < T) && O !== -1; O--, C++)
7370
7370
  L += f * F[O] >>> 0, F[O] = L % 256 >>> 0, L = L / 256 >>> 0;
7371
7371
  if (L !== 0)
7372
7372
  throw new Error("Non-zero carry");
7373
- T = k, B++;
7373
+ T = C, B++;
7374
7374
  }
7375
- for (var S = C - T; S !== C && F[S] === 0; )
7375
+ for (var S = k - T; S !== k && F[S] === 0; )
7376
7376
  S++;
7377
- var z = ur.allocUnsafe(P + (C - S));
7377
+ var z = ur.allocUnsafe(P + (k - S));
7378
7378
  z.fill(0, 0, P);
7379
- for (var M = P; S !== C; )
7379
+ for (var M = P; S !== k; )
7380
7380
  z[M++] = F[S++];
7381
7381
  return z;
7382
7382
  }
@@ -7665,7 +7665,7 @@ Object.defineProperty(St, "__esModule", { value: !0 });
7665
7665
  St.ECPairFactory = St.networks = void 0;
7666
7666
  const pn = At;
7667
7667
  St.networks = pn;
7668
- const _e = rs, fl = kf, Ii = ol, ul = Mr, nn = _e.typeforce.maybe(
7668
+ const _e = rs, fl = Cf, Ii = ol, ul = Mr, nn = _e.typeforce.maybe(
7669
7669
  _e.typeforce.compile({
7670
7670
  compressed: _e.maybe(_e.Boolean),
7671
7671
  network: _e.maybe(_e.Network)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/core",
3
- "version": "0.2.0-beta.93",
3
+ "version": "0.2.0-beta.95",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -28,7 +28,7 @@
28
28
  "dependencies": {
29
29
  "@catalogfi/utils": "^0.1.6",
30
30
  "@catalogfi/wallets": "^0.2.51",
31
- "@gardenfi/orderbook": "^0.2.0-beta.30",
31
+ "@gardenfi/orderbook": "^0.2.0-beta.32",
32
32
  "@gardenfi/utils": "^0.0.1-beta.18",
33
33
  "bignumber.js": "^9.1.2",
34
34
  "bitcoinjs-lib": "^6.1.6",