@gardenfi/core 0.2.0-beta.94 → 0.2.0-beta.96

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){console.log("swap params :",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 = [
@@ -2794,6 +2794,7 @@ class Sl {
2794
2794
  this.useRelay = t;
2795
2795
  }
2796
2796
  async swap(t) {
2797
+ console.log("swap params :", t);
2797
2798
  const r = await this.validateAndFillParams(t);
2798
2799
  if (r.error) return N(r.error);
2799
2800
  const { sendAddress: n, receiveAddress: i, timelock: a } = r.val;
@@ -2860,7 +2861,7 @@ class Sl {
2860
2861
  if (i < a)
2861
2862
  return N("Send amount should be greater than receive amount");
2862
2863
  const f = Js(t.fromAsset.chain);
2863
- return f ? ue({
2864
+ return console.log("timelock from garden :", f), f ? ue({
2864
2865
  sendAddress: r.val,
2865
2866
  receiveAddress: n.val,
2866
2867
  timelock: t.timelock ?? f
@@ -3378,7 +3379,7 @@ function gf() {
3378
3379
  function T(S) {
3379
3380
  return (S & 255) === S;
3380
3381
  }
3381
- function C(S) {
3382
+ function k(S) {
3382
3383
  return (S & 65535) === S;
3383
3384
  }
3384
3385
  function F(S) {
@@ -3387,7 +3388,7 @@ function gf() {
3387
3388
  function L(S) {
3388
3389
  return typeof S == "number" && S >= 0 && S <= m && Math.floor(S) === S;
3389
3390
  }
3390
- var k = {
3391
+ var C = {
3391
3392
  ArrayN: a,
3392
3393
  Buffer: r,
3393
3394
  BufferN: f,
@@ -3401,15 +3402,15 @@ function gf() {
3401
3402
  Range: b,
3402
3403
  StringN: l,
3403
3404
  UInt8: T,
3404
- UInt16: C,
3405
+ UInt16: k,
3405
3406
  UInt32: F,
3406
3407
  UInt53: L
3407
3408
  };
3408
- for (var O in k)
3409
- k[O].toJSON = (function(S) {
3409
+ for (var O in C)
3410
+ C[O].toJSON = (function(S) {
3410
3411
  return S;
3411
3412
  }).bind(null, O);
3412
- return Gr = k, Gr;
3413
+ return Gr = C, Gr;
3413
3414
  }
3414
3415
  var Xt = ss, he = Sn, Me = Xt.tfJSON, os = Xt.TfTypeError, as = Xt.TfPropertyTypeError, Dt = Xt.tfSubError, mf = Xt.getValueTypeName, De = {
3415
3416
  arrayOf: function(t, r) {
@@ -3765,7 +3766,7 @@ Rn.write = function(e, t, r, n, i, a) {
3765
3766
  return m(c, s, o);
3766
3767
  };
3767
3768
  function g(c) {
3768
- return b(c), f(c < 0 ? 0 : C(c) | 0);
3769
+ return b(c), f(c < 0 ? 0 : k(c) | 0);
3769
3770
  }
3770
3771
  u.allocUnsafe = function(c) {
3771
3772
  return g(c);
@@ -3781,7 +3782,7 @@ Rn.write = function(e, t, r, n, i, a) {
3781
3782
  return y !== o && (h = h.slice(0, y)), h;
3782
3783
  }
3783
3784
  function A(c) {
3784
- const s = c.length < 0 ? 0 : C(c.length) | 0, o = f(s);
3785
+ const s = c.length < 0 ? 0 : k(c.length) | 0, o = f(s);
3785
3786
  for (let h = 0; h < s; h += 1)
3786
3787
  o[h] = c[h] & 255;
3787
3788
  return o;
@@ -3803,7 +3804,7 @@ Rn.write = function(e, t, r, n, i, a) {
3803
3804
  }
3804
3805
  function T(c) {
3805
3806
  if (u.isBuffer(c)) {
3806
- const s = C(c.length) | 0, o = f(s);
3807
+ const s = k(c.length) | 0, o = f(s);
3807
3808
  return o.length === 0 || c.copy(o, 0, 0, s), o;
3808
3809
  }
3809
3810
  if (c.length !== void 0)
@@ -3811,7 +3812,7 @@ Rn.write = function(e, t, r, n, i, a) {
3811
3812
  if (c.type === "Buffer" && Array.isArray(c.data))
3812
3813
  return A(c.data);
3813
3814
  }
3814
- function C(c) {
3815
+ function k(c) {
3815
3816
  if (c >= i)
3816
3817
  throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes");
3817
3818
  return c | 0;
@@ -3907,7 +3908,7 @@ Rn.write = function(e, t, r, n, i, a) {
3907
3908
  case "hex":
3908
3909
  return o >>> 1;
3909
3910
  case "base64":
3910
- return kt(c).length;
3911
+ return Ct(c).length;
3911
3912
  default:
3912
3913
  if (y)
3913
3914
  return h ? -1 : V(c).length;
@@ -3915,14 +3916,14 @@ Rn.write = function(e, t, r, n, i, a) {
3915
3916
  }
3916
3917
  }
3917
3918
  u.byteLength = L;
3918
- function k(c, s, o) {
3919
+ function C(c, s, o) {
3919
3920
  let h = !1;
3920
3921
  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
3922
  return "";
3922
3923
  for (c || (c = "utf8"); ; )
3923
3924
  switch (c) {
3924
3925
  case "hex":
3925
- return Ce(this, s, o);
3926
+ return ke(this, s, o);
3926
3927
  case "utf8":
3927
3928
  case "utf-8":
3928
3929
  return ve(this, s, o);
@@ -3971,7 +3972,7 @@ Rn.write = function(e, t, r, n, i, a) {
3971
3972
  return this;
3972
3973
  }, u.prototype.toString = function() {
3973
3974
  const s = this.length;
3974
- return s === 0 ? "" : arguments.length === 0 ? ve(this, 0, s) : k.apply(this, arguments);
3975
+ return s === 0 ? "" : arguments.length === 0 ? ve(this, 0, s) : C.apply(this, arguments);
3975
3976
  }, u.prototype.toLocaleString = u.prototype.toString, u.prototype.equals = function(s) {
3976
3977
  if (!u.isBuffer(s)) throw new TypeError("Argument must be a Buffer");
3977
3978
  return this === s ? !0 : u.compare(this, s) === 0;
@@ -4074,7 +4075,7 @@ Rn.write = function(e, t, r, n, i, a) {
4074
4075
  return yt(qe(s), c, o, h);
4075
4076
  }
4076
4077
  function Te(c, s, o, h) {
4077
- return yt(kt(s), c, o, h);
4078
+ return yt(Ct(s), c, o, h);
4078
4079
  }
4079
4080
  function ze(c, s, o, h) {
4080
4081
  return yt(bt(s, c.length - o), c, o, h);
@@ -4180,7 +4181,7 @@ Rn.write = function(e, t, r, n, i, a) {
4180
4181
  h += String.fromCharCode(c[y]);
4181
4182
  return h;
4182
4183
  }
4183
- function Ce(c, s, o) {
4184
+ function ke(c, s, o) {
4184
4185
  const h = c.length;
4185
4186
  (!s || s < 0) && (s = 0), (!o || o < 0 || o > h) && (o = h);
4186
4187
  let y = "";
@@ -4583,7 +4584,7 @@ Rn.write = function(e, t, r, n, i, a) {
4583
4584
  o = c.charCodeAt(E), h = o >> 8, y = o % 256, x.push(y), x.push(h);
4584
4585
  return x;
4585
4586
  }
4586
- function kt(c) {
4587
+ function Ct(c) {
4587
4588
  return t.toByteArray(j(c));
4588
4589
  }
4589
4590
  function yt(c, s, o, h) {
@@ -4650,8 +4651,8 @@ function Tf() {
4650
4651
  Use Chrome, Firefox or Internet Explorer 11`);
4651
4652
  }
4652
4653
  var Pf = xe.Buffer, wr = Xe.crypto || Xe.msCrypto;
4653
- wr && wr.getRandomValues ? an.exports = Cf : an.exports = Tf;
4654
- function Cf(e, t) {
4654
+ wr && wr.getRandomValues ? an.exports = kf : an.exports = Tf;
4655
+ function kf(e, t) {
4655
4656
  if (e > Rf) throw new RangeError("requested too many random bytes");
4656
4657
  var r = Pf.allocUnsafe(e);
4657
4658
  if (e > 0)
@@ -4664,7 +4665,7 @@ function Cf(e, t) {
4664
4665
  t(null, r);
4665
4666
  }) : r;
4666
4667
  }
4667
- var kf = an.exports, un = { exports: {} };
4668
+ var Cf = an.exports, un = { exports: {} };
4668
4669
  typeof Object.create == "function" ? un.exports = function(t, r) {
4669
4670
  r && (t.super_ = r, t.prototype = Object.create(r.prototype, {
4670
4671
  constructor: {
@@ -4917,20 +4918,20 @@ function Hf() {
4917
4918
  function e(B, P) {
4918
4919
  var T = Object.keys(B);
4919
4920
  if (Object.getOwnPropertySymbols) {
4920
- var C = Object.getOwnPropertySymbols(B);
4921
- P && (C = C.filter(function(F) {
4921
+ var k = Object.getOwnPropertySymbols(B);
4922
+ P && (k = k.filter(function(F) {
4922
4923
  return Object.getOwnPropertyDescriptor(B, F).enumerable;
4923
- })), T.push.apply(T, C);
4924
+ })), T.push.apply(T, k);
4924
4925
  }
4925
4926
  return T;
4926
4927
  }
4927
4928
  function t(B) {
4928
4929
  for (var P = 1; P < arguments.length; P++) {
4929
4930
  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));
4931
+ P % 2 ? e(Object(T), !0).forEach(function(k) {
4932
+ r(B, k, T[k]);
4933
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(B, Object.getOwnPropertyDescriptors(T)) : e(Object(T)).forEach(function(k) {
4934
+ Object.defineProperty(B, k, Object.getOwnPropertyDescriptor(T, k));
4934
4935
  });
4935
4936
  }
4936
4937
  return B;
@@ -4944,8 +4945,8 @@ function Hf() {
4944
4945
  }
4945
4946
  function i(B, P) {
4946
4947
  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);
4948
+ var k = P[T];
4949
+ k.enumerable = k.enumerable || !1, k.configurable = !0, "value" in k && (k.writable = !0), Object.defineProperty(B, f(k.key), k);
4949
4950
  }
4950
4951
  }
4951
4952
  function a(B, P, T) {
@@ -4959,8 +4960,8 @@ function Hf() {
4959
4960
  if (typeof B != "object" || B === null) return B;
4960
4961
  var T = B[Symbol.toPrimitive];
4961
4962
  if (T !== void 0) {
4962
- var C = T.call(B, P || "default");
4963
- if (typeof C != "object") return C;
4963
+ var k = T.call(B, P || "default");
4964
+ if (typeof k != "object") return k;
4964
4965
  throw new TypeError("@@toPrimitive must return a primitive value.");
4965
4966
  }
4966
4967
  return (P === "string" ? String : Number)(B);
@@ -4976,20 +4977,20 @@ function Hf() {
4976
4977
  return a(B, [{
4977
4978
  key: "push",
4978
4979
  value: function(T) {
4979
- var C = {
4980
+ var k = {
4980
4981
  data: T,
4981
4982
  next: null
4982
4983
  };
4983
- this.length > 0 ? this.tail.next = C : this.head = C, this.tail = C, ++this.length;
4984
+ this.length > 0 ? this.tail.next = k : this.head = k, this.tail = k, ++this.length;
4984
4985
  }
4985
4986
  }, {
4986
4987
  key: "unshift",
4987
4988
  value: function(T) {
4988
- var C = {
4989
+ var k = {
4989
4990
  data: T,
4990
4991
  next: this.head
4991
4992
  };
4992
- this.length === 0 && (this.tail = C), this.head = C, ++this.length;
4993
+ this.length === 0 && (this.tail = k), this.head = k, ++this.length;
4993
4994
  }
4994
4995
  }, {
4995
4996
  key: "shift",
@@ -5008,23 +5009,23 @@ function Hf() {
5008
5009
  key: "join",
5009
5010
  value: function(T) {
5010
5011
  if (this.length === 0) return "";
5011
- for (var C = this.head, F = "" + C.data; C = C.next; ) F += T + C.data;
5012
+ for (var k = this.head, F = "" + k.data; k = k.next; ) F += T + k.data;
5012
5013
  return F;
5013
5014
  }
5014
5015
  }, {
5015
5016
  key: "concat",
5016
5017
  value: function(T) {
5017
5018
  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;
5019
+ for (var k = b.allocUnsafe(T >>> 0), F = this.head, L = 0; F; )
5020
+ A(F.data, k, L), L += F.data.length, F = F.next;
5021
+ return k;
5021
5022
  }
5022
5023
  // Consumes a specified amount of bytes or characters from the buffered data.
5023
5024
  }, {
5024
5025
  key: "consume",
5025
- value: function(T, C) {
5026
+ value: function(T, k) {
5026
5027
  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;
5028
+ 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
5029
  }
5029
5030
  }, {
5030
5031
  key: "first",
@@ -5035,11 +5036,11 @@ function Hf() {
5035
5036
  }, {
5036
5037
  key: "_getString",
5037
5038
  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));
5039
+ var k = this.head, F = 1, L = k.data;
5040
+ for (T -= L.length; k = k.next; ) {
5041
+ var C = k.data, O = T > C.length ? C.length : T;
5042
+ if (O === C.length ? L += C : L += C.slice(0, T), T -= O, T === 0) {
5043
+ O === C.length ? (++F, k.next ? this.head = k.next : this.head = this.tail = null) : (this.head = k, k.data = C.slice(O));
5043
5044
  break;
5044
5045
  }
5045
5046
  ++F;
@@ -5050,22 +5051,22 @@ function Hf() {
5050
5051
  }, {
5051
5052
  key: "_getBuffer",
5052
5053
  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));
5054
+ var k = b.allocUnsafe(T), F = this.head, L = 1;
5055
+ for (F.data.copy(k), T -= F.data.length; F = F.next; ) {
5056
+ var C = F.data, O = T > C.length ? C.length : T;
5057
+ if (C.copy(k, k.length - T, 0, O), T -= O, T === 0) {
5058
+ O === C.length ? (++L, F.next ? this.head = F.next : this.head = this.tail = null) : (this.head = F, F.data = C.slice(O));
5058
5059
  break;
5059
5060
  }
5060
5061
  ++L;
5061
5062
  }
5062
- return this.length -= L, C;
5063
+ return this.length -= L, k;
5063
5064
  }
5064
5065
  // Make sure the linked list only shows the minimal necessary information.
5065
5066
  }, {
5066
5067
  key: v,
5067
- value: function(T, C) {
5068
- return g(this, t(t({}, C), {}, {
5068
+ value: function(T, k) {
5069
+ return g(this, t(t({}, k), {}, {
5069
5070
  // Only inspect one level.
5070
5071
  depth: 0,
5071
5072
  // It should not recurse.
@@ -5233,7 +5234,7 @@ function vs() {
5233
5234
  function u(w) {
5234
5235
  return i.isBuffer(w) || w instanceof a;
5235
5236
  }
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;
5237
+ 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
5238
  de(M, n);
5238
5239
  function O() {
5239
5240
  }
@@ -5273,15 +5274,15 @@ function vs() {
5273
5274
  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
5275
  }
5275
5276
  M.prototype.pipe = function() {
5276
- k(this, new P());
5277
+ C(this, new P());
5277
5278
  };
5278
5279
  function $(w, _) {
5279
5280
  var R = new F();
5280
- k(w, R), process.nextTick(_, R);
5281
+ C(w, R), process.nextTick(_, R);
5281
5282
  }
5282
5283
  function se(w, _, R, D) {
5283
5284
  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;
5285
+ 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
5286
  }
5286
5287
  M.prototype.write = function(w, _, R) {
5287
5288
  var D = this._writableState, G = !1, d = !D.objectMode && u(w);
@@ -5290,7 +5291,7 @@ function vs() {
5290
5291
  this._writableState.corked++;
5291
5292
  }, M.prototype.uncork = function() {
5292
5293
  var w = this._writableState;
5293
- w.corked && (w.corked--, !w.writing && !w.corked && !w.bufferProcessing && w.bufferedRequest && Ce(this, w));
5294
+ w.corked && (w.corked--, !w.writing && !w.corked && !w.bufferProcessing && w.bufferedRequest && ke(this, w));
5294
5295
  }, M.prototype.setDefaultEncoding = function(_) {
5295
5296
  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
5297
  return this._writableState.defaultEncoding = _, this;
@@ -5340,7 +5341,7 @@ function vs() {
5340
5341
  _.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
5342
  }
5342
5343
  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, _));
5344
+ --_.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
5345
  }
5345
5346
  function Ee(w) {
5346
5347
  w.writing = !1, w.writecb = null, w.length -= w.writelen, w.writelen = 0;
@@ -5351,7 +5352,7 @@ function vs() {
5351
5352
  if (Ee(R), _) ve(w, R, D, _, G);
5352
5353
  else {
5353
5354
  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);
5355
+ !d && !R.corked && !R.bufferProcessing && R.bufferedRequest && ke(w, R), D ? process.nextTick(Pe, w, R, d, G) : Pe(w, R, d, G);
5355
5356
  }
5356
5357
  }
5357
5358
  function Pe(w, _, R, D) {
@@ -5360,7 +5361,7 @@ function vs() {
5360
5361
  function Ge(w, _) {
5361
5362
  _.length === 0 && _.needDrain && (_.needDrain = !1, w.emit("drain"));
5362
5363
  }
5363
- function Ce(w, _) {
5364
+ function ke(w, _) {
5364
5365
  _.bufferProcessing = !0;
5365
5366
  var R = _.bufferedRequest;
5366
5367
  if (w._writev && R && R.next) {
@@ -5398,7 +5399,7 @@ function vs() {
5398
5399
  }
5399
5400
  function Q(w, _) {
5400
5401
  w._final(function(R) {
5401
- _.pendingcb--, R && k(w, R), _.prefinished = !0, w.emit("prefinish"), Be(w, _);
5402
+ _.pendingcb--, R && C(w, R), _.prefinished = !0, w.emit("prefinish"), Be(w, _);
5402
5403
  });
5403
5404
  }
5404
5405
  function oe(w, _) {
@@ -5502,7 +5503,7 @@ function It() {
5502
5503
  }
5503
5504
  }), Yr;
5504
5505
  }
5505
- var xr = {}, Cn = xe.Buffer, fi = Cn.isEncoding || function(e) {
5506
+ var xr = {}, kn = xe.Buffer, fi = kn.isEncoding || function(e) {
5506
5507
  switch (e = "" + e, e && e.toLowerCase()) {
5507
5508
  case "hex":
5508
5509
  case "utf8":
@@ -5546,7 +5547,7 @@ function eu(e) {
5546
5547
  }
5547
5548
  function tu(e) {
5548
5549
  var t = eu(e);
5549
- if (typeof t != "string" && (Cn.isEncoding === fi || !fi(e))) throw new Error("Unknown encoding: " + e);
5550
+ if (typeof t != "string" && (kn.isEncoding === fi || !fi(e))) throw new Error("Unknown encoding: " + e);
5550
5551
  return t || e;
5551
5552
  }
5552
5553
  xr.StringDecoder = Qt;
@@ -5567,7 +5568,7 @@ function Qt(e) {
5567
5568
  this.write = lu, this.end = hu;
5568
5569
  return;
5569
5570
  }
5570
- this.lastNeed = 0, this.lastTotal = 0, this.lastChar = Cn.allocUnsafe(t);
5571
+ this.lastNeed = 0, this.lastTotal = 0, this.lastChar = kn.allocUnsafe(t);
5571
5572
  }
5572
5573
  Qt.prototype.write = function(e) {
5573
5574
  if (e.length === 0) return "";
@@ -5698,63 +5699,63 @@ function Es(e, t, r) {
5698
5699
  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
5700
  };
5700
5701
  }
5701
- var kn = Es, Xr, ci;
5702
+ var Cn = Es, Xr, ci;
5702
5703
  function yu() {
5703
5704
  if (ci) return Xr;
5704
5705
  ci = 1;
5705
5706
  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;
5707
+ function t(L, C, O) {
5708
+ return C = r(C), C in L ? Object.defineProperty(L, C, { value: O, enumerable: !0, configurable: !0, writable: !0 }) : L[C] = O, L;
5708
5709
  }
5709
5710
  function r(L) {
5710
- var k = n(L, "string");
5711
- return typeof k == "symbol" ? k : String(k);
5711
+ var C = n(L, "string");
5712
+ return typeof C == "symbol" ? C : String(C);
5712
5713
  }
5713
- function n(L, k) {
5714
+ function n(L, C) {
5714
5715
  if (typeof L != "object" || L === null) return L;
5715
5716
  var O = L[Symbol.toPrimitive];
5716
5717
  if (O !== void 0) {
5717
- var S = O.call(L, k || "default");
5718
+ var S = O.call(L, C || "default");
5718
5719
  if (typeof S != "object") return S;
5719
5720
  throw new TypeError("@@toPrimitive must return a primitive value.");
5720
5721
  }
5721
- return (k === "string" ? String : Number)(L);
5722
+ return (C === "string" ? String : Number)(L);
5722
5723
  }
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) {
5724
+ var i = Cn, a = Symbol("lastResolve"), f = Symbol("lastReject"), u = Symbol("error"), l = Symbol("ended"), b = Symbol("lastPromise"), m = Symbol("handlePromise"), g = Symbol("stream");
5725
+ function v(L, C) {
5725
5726
  return {
5726
5727
  value: L,
5727
- done: k
5728
+ done: C
5728
5729
  };
5729
5730
  }
5730
5731
  function A(L) {
5731
- var k = L[a];
5732
- if (k !== null) {
5732
+ var C = L[a];
5733
+ if (C !== null) {
5733
5734
  var O = L[g].read();
5734
- O !== null && (L[b] = null, L[a] = null, L[f] = null, k(v(O, !1)));
5735
+ O !== null && (L[b] = null, L[a] = null, L[f] = null, C(v(O, !1)));
5735
5736
  }
5736
5737
  }
5737
5738
  function B(L) {
5738
5739
  process.nextTick(A, L);
5739
5740
  }
5740
- function P(L, k) {
5741
+ function P(L, C) {
5741
5742
  return function(O, S) {
5742
5743
  L.then(function() {
5743
- if (k[l]) {
5744
+ if (C[l]) {
5744
5745
  O(v(void 0, !0));
5745
5746
  return;
5746
5747
  }
5747
- k[m](O, S);
5748
+ C[m](O, S);
5748
5749
  }, S);
5749
5750
  };
5750
5751
  }
5751
5752
  var T = Object.getPrototypeOf(function() {
5752
- }), C = Object.setPrototypeOf((e = {
5753
+ }), k = Object.setPrototypeOf((e = {
5753
5754
  get stream() {
5754
5755
  return this[g];
5755
5756
  },
5756
5757
  next: function() {
5757
- var k = this, O = this[u];
5758
+ var C = this, O = this[u];
5758
5759
  if (O !== null)
5759
5760
  return Promise.reject(O);
5760
5761
  if (this[l])
@@ -5762,7 +5763,7 @@ function yu() {
5762
5763
  if (this[g].destroyed)
5763
5764
  return new Promise(function($, se) {
5764
5765
  process.nextTick(function() {
5765
- k[u] ? se(k[u]) : $(v(void 0, !0));
5766
+ C[u] ? se(C[u]) : $(v(void 0, !0));
5766
5767
  });
5767
5768
  });
5768
5769
  var S = this[b], z;
@@ -5779,9 +5780,9 @@ function yu() {
5779
5780
  }, t(e, Symbol.asyncIterator, function() {
5780
5781
  return this;
5781
5782
  }), t(e, "return", function() {
5782
- var k = this;
5783
+ var C = this;
5783
5784
  return new Promise(function(O, S) {
5784
- k[g].destroy(null, function(z) {
5785
+ C[g].destroy(null, function(z) {
5785
5786
  if (z) {
5786
5787
  S(z);
5787
5788
  return;
@@ -5789,9 +5790,9 @@ function yu() {
5789
5790
  O(v(void 0, !0));
5790
5791
  });
5791
5792
  });
5792
- }), e), T), F = function(k) {
5793
- var O, S = Object.create(C, (O = {}, t(O, g, {
5794
- value: k,
5793
+ }), e), T), F = function(C) {
5794
+ var O, S = Object.create(k, (O = {}, t(O, g, {
5795
+ value: C,
5795
5796
  writable: !0
5796
5797
  }), t(O, a, {
5797
5798
  value: null,
@@ -5803,7 +5804,7 @@ function yu() {
5803
5804
  value: null,
5804
5805
  writable: !0
5805
5806
  }), t(O, l, {
5806
- value: k._readableState.endEmitted,
5807
+ value: C._readableState.endEmitted,
5807
5808
  writable: !0
5808
5809
  }), t(O, m, {
5809
5810
  value: function(M, $) {
@@ -5812,7 +5813,7 @@ function yu() {
5812
5813
  },
5813
5814
  writable: !0
5814
5815
  }), O));
5815
- return S[b] = null, i(k, function(z) {
5816
+ return S[b] = null, i(C, function(z) {
5816
5817
  if (z && z.code !== "ERR_STREAM_PREMATURE_CLOSE") {
5817
5818
  var M = S[f];
5818
5819
  M !== null && (S[b] = null, S[a] = null, S[f] = null, M(z)), S[u] = z;
@@ -5820,7 +5821,7 @@ function yu() {
5820
5821
  }
5821
5822
  var $ = S[a];
5822
5823
  $ !== 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;
5824
+ }), C.on("readable", B.bind(null, S)), S;
5824
5825
  };
5825
5826
  return Xr = F, Xr;
5826
5827
  }
@@ -5849,7 +5850,7 @@ function Bs() {
5849
5850
  var u = Pn, l;
5850
5851
  u && u.debuglog ? l = u.debuglog("stream") : l = function() {
5851
5852
  };
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;
5853
+ 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
5854
  de($, r);
5854
5855
  var O = m.errorOrDestroy, S = ["error", "close", "destroy", "pause", "resume"];
5855
5856
  function z(d, p, I) {
@@ -5894,20 +5895,20 @@ function Bs() {
5894
5895
  O(d, V);
5895
5896
  else if (j.objectMode || p && p.length > 0)
5896
5897
  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);
5898
+ j.endEmitted ? O(d, new k()) : Te(d, j, p, !0);
5898
5899
  else if (j.ended)
5899
5900
  O(d, new P());
5900
5901
  else {
5901
5902
  if (j.destroyed)
5902
5903
  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);
5904
+ 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
5905
  }
5905
- else U || (j.reading = !1, Ce(d, j));
5906
+ else U || (j.reading = !1, ke(d, j));
5906
5907
  }
5907
5908
  return !j.ended && (j.length < j.highWaterMark || j.length === 0);
5908
5909
  }
5909
5910
  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);
5911
+ 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
5912
  }
5912
5913
  function ze(d, p) {
5913
5914
  var I;
@@ -5959,7 +5960,7 @@ function Bs() {
5959
5960
  var p = d._readableState;
5960
5961
  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
5962
  }
5962
- function Ce(d, p) {
5963
+ function ke(d, p) {
5963
5964
  p.readingMore || (p.readingMore = !0, process.nextTick(je, d, p));
5964
5965
  }
5965
5966
  function je(d, p) {
@@ -5996,15 +5997,15 @@ function Bs() {
5996
5997
  }
5997
5998
  var bt = Q(I);
5998
5999
  d.on("drain", bt);
5999
- var kt = !1;
6000
+ var Ct = !1;
6000
6001
  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();
6002
+ 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
6003
  }
6003
6004
  I.on("data", Se);
6004
6005
  function Se(c) {
6005
6006
  l("ondata");
6006
6007
  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());
6008
+ 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
6009
  }
6009
6010
  function rt(c) {
6010
6011
  l("onerror", c), nt(), d.removeListener("error", rt), t(d, "error") === 0 && O(d, c);
@@ -6159,7 +6160,7 @@ function Bs() {
6159
6160
  }
6160
6161
  }
6161
6162
  typeof Symbol == "function" && ($.from = function(d, p) {
6162
- return k === void 0 && (k = gu()), k($, d, p);
6163
+ return C === void 0 && (C = gu()), C($, d, p);
6163
6164
  });
6164
6165
  function G(d, p) {
6165
6166
  for (var I = 0, U = d.length; I < U; I++)
@@ -6253,7 +6254,7 @@ function Tu(e, t, r, n) {
6253
6254
  var i = !1;
6254
6255
  e.on("close", function() {
6255
6256
  i = !0;
6256
- }), en === void 0 && (en = kn), en(e, {
6257
+ }), en === void 0 && (en = Cn), en(e, {
6257
6258
  readable: t,
6258
6259
  writable: r
6259
6260
  }, function(f) {
@@ -6275,13 +6276,13 @@ function bi(e) {
6275
6276
  function Pu(e, t) {
6276
6277
  return e.pipe(t);
6277
6278
  }
6278
- function Cu(e) {
6279
+ function ku(e) {
6279
6280
  return !e.length || typeof e[e.length - 1] != "function" ? pi : e.pop();
6280
6281
  }
6281
- function ku() {
6282
+ function Cu() {
6282
6283
  for (var e = arguments.length, t = new Array(e), r = 0; r < e; r++)
6283
6284
  t[r] = arguments[r];
6284
- var n = Cu(t);
6285
+ var n = ku(t);
6285
6286
  if (Array.isArray(t[0]) && (t = t[0]), t.length < 2)
6286
6287
  throw new Au("streams");
6287
6288
  var i, a = t.map(function(f, u) {
@@ -6292,9 +6293,9 @@ function ku() {
6292
6293
  });
6293
6294
  return t.reduce(Pu);
6294
6295
  }
6295
- var Lu = ku;
6296
+ var Lu = Cu;
6296
6297
  (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;
6298
+ 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
6299
  })(cn, cn.exports);
6299
6300
  var Rs = cn.exports, vr = xe.Buffer, Ts = Rs.Transform, Fu = de;
6300
6301
  function Ou(e, t) {
@@ -6350,44 +6351,44 @@ Ze.prototype._digest = function() {
6350
6351
  throw new Error("_digest is not implemented");
6351
6352
  };
6352
6353
  var Uu = Ze, Nu = de, Ps = Uu, Mu = xe.Buffer, Du = new Array(16);
6353
- function Cr() {
6354
+ function kr() {
6354
6355
  Ps.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878;
6355
6356
  }
6356
- Nu(Cr, Ps);
6357
- Cr.prototype._update = function() {
6357
+ Nu(kr, Ps);
6358
+ kr.prototype._update = function() {
6358
6359
  for (var e = Du, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
6359
6360
  var r = this._a, n = this._b, i = this._c, a = this._d;
6360
6361
  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
6362
  };
6362
- Cr.prototype._digest = function() {
6363
+ kr.prototype._digest = function() {
6363
6364
  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
6365
  var e = Mu.allocUnsafe(16);
6365
6366
  return e.writeInt32LE(this._a, 0), e.writeInt32LE(this._b, 4), e.writeInt32LE(this._c, 8), e.writeInt32LE(this._d, 12), e;
6366
6367
  };
6367
- function kr(e, t) {
6368
+ function Cr(e, t) {
6368
6369
  return e << t | e >>> 32 - t;
6369
6370
  }
6370
6371
  function pe(e, t, r, n, i, a, f) {
6371
- return kr(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
6372
+ return Cr(e + (t & r | ~t & n) + i + a | 0, f) + t | 0;
6372
6373
  }
6373
6374
  function be(e, t, r, n, i, a, f) {
6374
- return kr(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
6375
+ return Cr(e + (t & n | r & ~n) + i + a | 0, f) + t | 0;
6375
6376
  }
6376
6377
  function ye(e, t, r, n, i, a, f) {
6377
- return kr(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
6378
+ return Cr(e + (t ^ r ^ n) + i + a | 0, f) + t | 0;
6378
6379
  }
6379
6380
  function ge(e, t, r, n, i, a, f) {
6380
- return kr(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
6381
+ return Cr(e + (r ^ (t | ~n)) + i + a | 0, f) + t | 0;
6381
6382
  }
6382
- var $u = Cr, Er = xe.Buffer, Cs = Rs.Transform, Hu = de;
6383
+ var $u = kr, Er = xe.Buffer, ks = Rs.Transform, Hu = de;
6383
6384
  function zu(e, t) {
6384
6385
  if (!Er.isBuffer(e) && typeof e != "string")
6385
6386
  throw new TypeError(t + " must be a string or a buffer");
6386
6387
  }
6387
6388
  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;
6389
+ ks.call(this), this._block = Er.allocUnsafe(e), this._blockSize = e, this._blockOffset = 0, this._length = [0, 0, 0, 0], this._finalized = !1;
6389
6390
  }
6390
- Hu(et, Cs);
6391
+ Hu(et, ks);
6391
6392
  et.prototype._transform = function(e, t, r) {
6392
6393
  var n = null;
6393
6394
  try {
@@ -6432,7 +6433,7 @@ et.prototype.digest = function(e) {
6432
6433
  et.prototype._digest = function() {
6433
6434
  throw new Error("_digest is not implemented");
6434
6435
  };
6435
- var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
6436
+ var Gu = et, tn = Pt.Buffer, ju = de, Cs = Gu, Wu = new Array(16), $t = [
6436
6437
  0,
6437
6438
  1,
6438
6439
  2,
@@ -6758,9 +6759,9 @@ var Gu = et, tn = Pt.Buffer, ju = de, ks = Gu, Wu = new Array(16), $t = [
6758
6759
  11
6759
6760
  ], jt = [0, 1518500249, 1859775393, 2400959708, 2840853838], Wt = [1352829926, 1548603684, 1836072691, 2053994217, 0];
6760
6761
  function Lr() {
6761
- ks.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
6762
+ Cs.call(this, 64), this._a = 1732584193, this._b = 4023233417, this._c = 2562383102, this._d = 271733878, this._e = 3285377520;
6762
6763
  }
6763
- ju(Lr, ks);
6764
+ ju(Lr, Cs);
6764
6765
  Lr.prototype._update = function() {
6765
6766
  for (var e = Wu, t = 0; t < 16; ++t) e[t] = this._block.readInt32LE(t * 4);
6766
6767
  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 +6824,7 @@ Fr.prototype.digest = function(e) {
6823
6824
  Fr.prototype._update = function() {
6824
6825
  throw new Error("_update must be implemented by subclass");
6825
6826
  };
6826
- var Ct = Fr, Vu = de, Os = Ct, Ku = xe.Buffer, Yu = [
6827
+ var kt = Fr, Vu = de, Os = kt, Ku = xe.Buffer, Yu = [
6827
6828
  1518500249,
6828
6829
  1859775393,
6829
6830
  -1894007588,
@@ -6858,7 +6859,7 @@ Zt.prototype._hash = function() {
6858
6859
  var e = Ku.allocUnsafe(20);
6859
6860
  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
6861
  };
6861
- var ec = Zt, tc = de, Us = Ct, rc = xe.Buffer, nc = [
6862
+ var ec = Zt, tc = de, Us = kt, rc = xe.Buffer, nc = [
6862
6863
  1518500249,
6863
6864
  1859775393,
6864
6865
  -1894007588,
@@ -6896,7 +6897,7 @@ er.prototype._hash = function() {
6896
6897
  var e = rc.allocUnsafe(20);
6897
6898
  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
6899
  };
6899
- var uc = er, cc = de, Ns = Ct, lc = xe.Buffer, hc = [
6900
+ var uc = er, cc = de, Ns = kt, lc = xe.Buffer, hc = [
6900
6901
  1116352408,
6901
6902
  1899447441,
6902
6903
  3049323471,
@@ -7000,7 +7001,7 @@ tr.prototype._hash = function() {
7000
7001
  var e = lc.allocUnsafe(32);
7001
7002
  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
7003
  };
7003
- var Ms = tr, wc = de, xc = Ms, vc = Ct, Ec = xe.Buffer, Bc = new Array(64);
7004
+ var Ms = tr, wc = de, xc = Ms, vc = kt, Ec = xe.Buffer, Bc = new Array(64);
7004
7005
  function Or() {
7005
7006
  this.init(), this._w = Bc, vc.call(this, 64, 56);
7006
7007
  }
@@ -7012,7 +7013,7 @@ Or.prototype._hash = function() {
7012
7013
  var e = Ec.allocUnsafe(28);
7013
7014
  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
7015
  };
7015
- var Sc = Or, Ac = de, Ds = Ct, Ic = xe.Buffer, xi = [
7016
+ var Sc = Or, Ac = de, Ds = kt, Ic = xe.Buffer, xi = [
7016
7017
  1116352408,
7017
7018
  3609767458,
7018
7019
  1899447441,
@@ -7199,32 +7200,32 @@ function Tc(e, t) {
7199
7200
  function Pc(e, t) {
7200
7201
  return (e >>> 1 | t << 31) ^ (e >>> 8 | t << 24) ^ (e >>> 7 | t << 25);
7201
7202
  }
7202
- function Cc(e, t) {
7203
+ function kc(e, t) {
7203
7204
  return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ e >>> 6;
7204
7205
  }
7205
- function kc(e, t) {
7206
+ function Cc(e, t) {
7206
7207
  return (e >>> 19 | t << 13) ^ (t >>> 29 | e << 3) ^ (e >>> 6 | t << 26);
7207
7208
  }
7208
7209
  function ce(e, t) {
7209
7210
  return e >>> 0 < t >>> 0 ? 1 : 0;
7210
7211
  }
7211
7212
  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)
7213
+ 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
7214
  t[F] = e.readInt32BE(F * 4), t[F + 1] = e.readInt32BE(F * 4 + 4);
7214
7215
  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;
7216
+ var L = t[F - 30], C = t[F - 15 * 2 + 1], O = Tc(L, C), S = Pc(C, L);
7217
+ L = t[F - 2 * 2], C = t[F - 2 * 2 + 1];
7218
+ 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
7219
  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
7220
  }
7220
7221
  for (var Ee = 0; Ee < 160; Ee += 2) {
7221
7222
  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;
7223
+ 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
7224
  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;
7225
+ var R = ke + Pe | 0, D = Ge + tt + ce(R, ke) | 0;
7226
+ 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
7227
  }
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;
7228
+ 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
7229
  };
7229
7230
  rr.prototype._hash = function() {
7230
7231
  var e = Ic.allocUnsafe(64);
@@ -7233,7 +7234,7 @@ rr.prototype._hash = function() {
7233
7234
  }
7234
7235
  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
7236
  };
7236
- var $s = rr, Lc = de, Fc = $s, Oc = Ct, Uc = xe.Buffer, Nc = new Array(160);
7237
+ var $s = rr, Lc = de, Fc = $s, Oc = kt, Uc = xe.Buffer, Nc = new Array(160);
7237
7238
  function Ur() {
7238
7239
  this.init(), this._w = Nc, Oc.call(this, 128, 112);
7239
7240
  }
@@ -7261,27 +7262,27 @@ pt.sha256 = Ms;
7261
7262
  pt.sha384 = Mc;
7262
7263
  pt.sha512 = $s;
7263
7264
  var Dc = Ls.exports, Hs = xe.Buffer, zs = Pn.Transform, $c = xr.StringDecoder, Hc = de;
7264
- function ke(e) {
7265
+ function Ce(e) {
7265
7266
  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
7267
  }
7267
- Hc(ke, zs);
7268
- ke.prototype.update = function(e, t, r) {
7268
+ Hc(Ce, zs);
7269
+ Ce.prototype.update = function(e, t, r) {
7269
7270
  typeof e == "string" && (e = Hs.from(e, t));
7270
7271
  var n = this._update(e);
7271
7272
  return this.hashMode ? this : (r && (n = this._toString(n, r)), n);
7272
7273
  };
7273
- ke.prototype.setAutoPadding = function() {
7274
+ Ce.prototype.setAutoPadding = function() {
7274
7275
  };
7275
- ke.prototype.getAuthTag = function() {
7276
+ Ce.prototype.getAuthTag = function() {
7276
7277
  throw new Error("trying to get auth tag in unsupported state");
7277
7278
  };
7278
- ke.prototype.setAuthTag = function() {
7279
+ Ce.prototype.setAuthTag = function() {
7279
7280
  throw new Error("trying to set auth tag in unsupported state");
7280
7281
  };
7281
- ke.prototype.setAAD = function() {
7282
+ Ce.prototype.setAAD = function() {
7282
7283
  throw new Error("trying to set aad in unsupported state");
7283
7284
  };
7284
- ke.prototype._transform = function(e, t, r) {
7285
+ Ce.prototype._transform = function(e, t, r) {
7285
7286
  var n;
7286
7287
  try {
7287
7288
  this.hashMode ? this._update(e) : this.push(this._update(e));
@@ -7291,7 +7292,7 @@ ke.prototype._transform = function(e, t, r) {
7291
7292
  r(n);
7292
7293
  }
7293
7294
  };
7294
- ke.prototype._flush = function(e) {
7295
+ Ce.prototype._flush = function(e) {
7295
7296
  var t;
7296
7297
  try {
7297
7298
  this.push(this.__final());
@@ -7300,16 +7301,16 @@ ke.prototype._flush = function(e) {
7300
7301
  }
7301
7302
  e(t);
7302
7303
  };
7303
- ke.prototype._finalOrDigest = function(e) {
7304
+ Ce.prototype._finalOrDigest = function(e) {
7304
7305
  var t = this.__final() || Hs.alloc(0);
7305
7306
  return e && (t = this._toString(t, e, !0)), t;
7306
7307
  };
7307
- ke.prototype._toString = function(e, t, r) {
7308
+ Ce.prototype._toString = function(e, t, r) {
7308
7309
  if (this._decoder || (this._decoder = new $c(t), this._encoding = t), this._encoding !== t) throw new Error("can't switch encodings");
7309
7310
  var n = this._decoder.write(e);
7310
7311
  return r && (n += this._decoder.end()), n;
7311
7312
  };
7312
- var zc = ke, Gc = de, jc = $u, Wc = qu, qc = Dc, Gs = zc;
7313
+ var zc = Ce, Gc = de, jc = $u, Wc = qu, qc = Dc, Gs = zc;
7313
7314
  function Nr(e) {
7314
7315
  Gs.call(this, "digest"), this._hash = e;
7315
7316
  }
@@ -7340,12 +7341,12 @@ function Kc(e) {
7340
7341
  throw new TypeError("Expected Buffer");
7341
7342
  if (A.length === 0)
7342
7343
  return "";
7343
- for (var B = 0, P = 0, T = 0, C = A.length; T !== C && A[T] === 0; )
7344
+ for (var B = 0, P = 0, T = 0, k = A.length; T !== k && A[T] === 0; )
7344
7345
  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)
7346
+ for (var F = (k - T) * b + 1 >>> 0, L = new Uint8Array(F); T !== k; ) {
7347
+ for (var C = A[T], O = 0, S = F - 1; (C !== 0 || O < P) && S !== -1; S--, O++)
7348
+ C += 256 * L[S] >>> 0, L[S] = C % f >>> 0, C = C / f >>> 0;
7349
+ if (C !== 0)
7349
7350
  throw new Error("Non-zero carry");
7350
7351
  P = O, T++;
7351
7352
  }
@@ -7362,21 +7363,21 @@ function Kc(e) {
7362
7363
  return ur.alloc(0);
7363
7364
  for (var B = 0, P = 0, T = 0; A[B] === u; )
7364
7365
  P++, B++;
7365
- for (var C = (A.length - B) * l + 1 >>> 0, F = new Uint8Array(C); B < A.length; ) {
7366
+ for (var k = (A.length - B) * l + 1 >>> 0, F = new Uint8Array(k); B < A.length; ) {
7366
7367
  var L = t[A.charCodeAt(B)];
7367
7368
  if (L === 255)
7368
7369
  return;
7369
- for (var k = 0, O = C - 1; (L !== 0 || k < T) && O !== -1; O--, k++)
7370
+ for (var C = 0, O = k - 1; (L !== 0 || C < T) && O !== -1; O--, C++)
7370
7371
  L += f * F[O] >>> 0, F[O] = L % 256 >>> 0, L = L / 256 >>> 0;
7371
7372
  if (L !== 0)
7372
7373
  throw new Error("Non-zero carry");
7373
- T = k, B++;
7374
+ T = C, B++;
7374
7375
  }
7375
- for (var S = C - T; S !== C && F[S] === 0; )
7376
+ for (var S = k - T; S !== k && F[S] === 0; )
7376
7377
  S++;
7377
- var z = ur.allocUnsafe(P + (C - S));
7378
+ var z = ur.allocUnsafe(P + (k - S));
7378
7379
  z.fill(0, 0, P);
7379
- for (var M = P; S !== C; )
7380
+ for (var M = P; S !== k; )
7380
7381
  z[M++] = F[S++];
7381
7382
  return z;
7382
7383
  }
@@ -7665,7 +7666,7 @@ Object.defineProperty(St, "__esModule", { value: !0 });
7665
7666
  St.ECPairFactory = St.networks = void 0;
7666
7667
  const pn = At;
7667
7668
  St.networks = pn;
7668
- const _e = rs, fl = kf, Ii = ol, ul = Mr, nn = _e.typeforce.maybe(
7669
+ const _e = rs, fl = Cf, Ii = ol, ul = Mr, nn = _e.typeforce.maybe(
7669
7670
  _e.typeforce.compile({
7670
7671
  compressed: _e.maybe(_e.Boolean),
7671
7672
  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.94",
3
+ "version": "0.2.0-beta.96",
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.31",
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",