edge-currency-accountbased 3.2.7 → 3.3.0
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/CHANGELOG.md +8 -0
- package/android/src/main/assets/edge-currency-accountbased/4843.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/7428.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/algorand.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/axelar.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +7 -7
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +6 -6
- package/android/src/main/assets/edge-currency-accountbased/filecoin.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/fio.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/hedera.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/polkadot.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/ripple.chunk.js +5 -5
- package/android/src/main/assets/edge-currency-accountbased/solana.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +3 -3
- package/lib/algorand/AlgorandEngine.js +7 -1
- package/lib/binance/BinanceEngine.js +2 -0
- package/lib/common/CurrencyEngine.js +1 -0
- package/lib/cosmos/CosmosEngine.js +5 -2
- package/lib/eos/EosEngine.js +32 -8
- package/lib/ethereum/EthereumEngine.js +2 -1
- package/lib/ethereum/EthereumNetwork.js +0 -97
- package/lib/ethereum/ethereumTypes.js +0 -32
- package/lib/ethereum/info/arbitrumInfo.js +0 -1
- package/lib/ethereum/info/avalancheInfo.js +0 -1
- package/lib/ethereum/info/baseInfo.js +0 -1
- package/lib/ethereum/info/binancesmartchainInfo.js +0 -1
- package/lib/ethereum/info/celoInfo.js +0 -1
- package/lib/ethereum/info/ethDevInfo.js +0 -5
- package/lib/ethereum/info/ethereumInfo.js +0 -5
- package/lib/ethereum/info/ethereumclassicInfo.js +0 -1
- package/lib/ethereum/info/ethereumpowInfo.js +0 -1
- package/lib/ethereum/info/fantomInfo.js +0 -1
- package/lib/ethereum/info/filecoinFevmCalibrationInfo.js +0 -1
- package/lib/ethereum/info/filecoinFevmInfo.js +0 -1
- package/lib/ethereum/info/goerliInfo.js +0 -5
- package/lib/ethereum/info/kovanInfo.js +0 -5
- package/lib/ethereum/info/optimismInfo.js +0 -1
- package/lib/ethereum/info/polygonInfo.js +0 -1
- package/lib/ethereum/info/pulsechainInfo.js +0 -1
- package/lib/ethereum/info/rinkebyInfo.js +0 -5
- package/lib/ethereum/info/ropstenInfo.js +0 -5
- package/lib/ethereum/info/rskInfo.js +0 -1
- package/lib/ethereum/info/zksyncInfo.js +0 -1
- package/lib/ethereum/networkAdapters/EvmScanAdapter.js +9 -1
- package/lib/ethereum/networkAdapters/FilfoxAdapter.js +1 -0
- package/lib/ethereum/networkAdapters/PulsechainScanAdapter.js +9 -1
- package/lib/filecoin/FilecoinEngine.js +7 -1
- package/lib/filecoin/filecoinTypes.js +8 -0
- package/lib/fio/FioEngine.js +3 -0
- package/lib/hedera/HederaEngine.js +2 -0
- package/lib/piratechain/PiratechainEngine.js +2 -0
- package/lib/polkadot/PolkadotEngine.js +4 -2
- package/lib/ripple/RippleEngine.js +6 -1
- package/lib/solana/SolanaEngine.js +2 -0
- package/lib/stellar/StellarEngine.js +2 -0
- package/lib/tezos/TezosEngine.js +2 -0
- package/lib/tron/TronEngine.js +14 -1
- package/lib/zcash/ZcashEngine.js +2 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 3.3.0 (2024-03-25)
|
|
6
|
+
|
|
7
|
+
- changed: Upgrade edge-core-js to v1.14.0
|
|
8
|
+
|
|
9
|
+
## 3.2.8 (2024-03-22)
|
|
10
|
+
|
|
11
|
+
- fixed: Added initOptions to FilecoinEngine for GLIF API key to fix sync issues
|
|
12
|
+
|
|
5
13
|
## 3.2.7 (2024-03-21)
|
|
6
14
|
|
|
7
15
|
- changed: Use EIP-4844 fee calculation for Optimism and Base
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[4843],{79014:function(V,H,c){"use strict";c.d(H,{Q:function(){return N},k:function(){return b}});var w=c(77591),x=c.n(w),L=c(24350),O=c(84564),z=c.n(O),B=c(76714),g=Object.defineProperty,U=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,A=(a,f,p)=>f in a?g(a,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):a[f]=p,C=(a,f)=>{for(var p in f||(f={}))F.call(f,p)&&A(a,p,f[p]);if(U)for(var p of U(f))M.call(f,p)&&A(a,p,f[p]);return a};function b(a,f,p,m,S=[]){const d=C({},z()(f,{},!0)),D=f.startsWith(`${a.pluginId}://`);if(d.protocol!=null&&(d.protocol=d.protocol.replace(":","")),d.protocol!=null&&d.protocol!==""&&!p[d.protocol])throw new Error(`Uri protocol '${d.protocol}' is not supported for ${a.pluginId}.`);if(d.host===""&&d.pathname==="")throw new Error("Path and host not found in uri.");const v={publicAddress:d.host!==""?d.host:d.pathname.split("/")[0]},K=d.query.label,P=d.query.message,y=d.query.category;(K!=null||P!=null||y!=null||D)&&(v.metadata={},v.metadata.name=K,v.metadata.notes=P,v.metadata.category=y,v.metadata.gateway=D!=null?D:!1);const E=d.query.amount;if(E!=null&&typeof E=="string"){m==null&&(m=a.currencyCode);const k=(0,B.Qs)(m!=null?m:"",a,S);if(k==null)throw new Error("InternalErrorInvalidCurrencyCode");let T=(0,w.mul)(E,k.multiplier);T=(0,w.toFixed)(T,0,0),v.nativeAmount=T,v.currencyCode=m}return{edgeParsedUri:v,parsedUri:d}}function N(a,f,p){if(a.publicAddress==null)throw new Error("InvalidPublicAddressError");if(p==null&&a.label==null&&a.message==null)return a.publicAddress;{let m="";p!=null&&(m+="amount="+p+"&"),(a.label!=null||a.message!=null)&&(typeof a.label=="string"&&(m+="label="+a.label+"&"),typeof a.message=="string"&&(m+="message="+a.message+"&")),m=m.substr(0,m.length-1);const S={scheme:f,path:a.publicAddress,query:m};return(0,L.qC)(S)}}},80504:function(V,H,c){"use strict";c.r(H),c.d(H,{PiratechainTools:function(){return W},makeCurrencyEngine:function(){return T},makeCurrencyTools:function(){return _}});var w=c(77591),x=c(2153),L=c(48764),O=c(62177),z=c(79014),B=c(76714),g=c(82448);const U=(0,g.su)({first:g.mH,last:g.mH}),F=(0,g.su)({alias:(0,g.Vk)(g.XC),blockRange:(0,g.Vk)(U,()=>({first:0,last:0}))}),M=(0,g.su)({birthdayHeight:g.mH,publicKey:g.XC}),A=(0,O.jd)(M),C=l=>{const t=(0,g.su)({[`${l}Mnemonic`]:g.XC,[`${l}BirthdayHeight`]:g.mH});return(0,g.W1)(e=>{const n=t(e);return{mnemonic:n[`${l}Mnemonic`],birthdayHeight:n[`${l}BirthdayHeight`]}},e=>({[`${l}Mnemonic`]:e.mnemonic,[`${l}BirthdayHeight`]:e.birthdayHeight}))};var b=c(94935),N=c(79325),a=c(84650),f=c(72681),p=Object.defineProperty,m=Object.getOwnPropertySymbols,S=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,$=Reflect.get,v=(l,t,e)=>t in l?p(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,K=(l,t)=>{for(var e in t||(t={}))d.call(t,e)&&v(l,e,t[e]);if(m)for(var e of m(t))D.call(t,e)&&v(l,e,t[e]);return l},P=(l,t,e)=>$(S(l),e,t),y=(l,t,e)=>new Promise((n,r)=>{var o=s=>{try{h(e.next(s))}catch(u){r(u)}},i=s=>{try{h(e.throw(s))}catch(u){r(u)}},h=s=>s.done?n(s.value):Promise.resolve(s.value).then(o,i);h((e=e.apply(l,t)).next())});const E=3e4;class k extends a.P{constructor(t,e,n,r,o){super(t,e,n,r);const{networkInfo:i}=t;this.pluginId=this.currencyInfo.pluginId,this.networkInfo=i,this.makeSynchronizer=o,this.queryMutex=!1,this.started=!1,this.progressRatio=0}setOtherData(t){this.otherData=F(t)}initData(){const{birthdayHeight:t}=this.initializer;this.otherData.blockRange.first===0&&(this.otherData.blockRange={first:t,last:t}),this.initialNumBlocksToDownload=-1,this.synchronizerStatus="DISCONNECTED",this.availableZatoshi="0"}initSubscriptions(){this.synchronizer!=null&&(this.synchronizer.on("update",t=>y(this,null,function*(){const{lastDownloadedHeight:e,scanProgress:n,networkBlockHeight:r}=t;this.onUpdateBlockHeight(r),this.onUpdateProgress(e,n,r),yield this.queryAll()})),this.synchronizer.on("statusChanged",t=>y(this,null,function*(){this.synchronizerStatus=t.name,yield this.queryAll()})))}queryAll(){return y(this,null,function*(){if(this.lastUpdateFromSynchronizer=Date.now(),!this.queryMutex){this.queryMutex=!0;try{yield this.queryBalance(),yield this.queryTransactions(),this.onUpdateTransactions()}catch{}this.queryMutex=!1}})}onUpdateBlockHeight(t){this.walletLocalData.blockHeight!==t&&(this.walletLocalData.blockHeight=t,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onBlockHeightChanged(this.walletLocalData.blockHeight))}onUpdateTransactions(){this.transactionsChangedArray.length>0&&(this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[])}onUpdateProgress(t,e,n){if(!this.addressesChecked&&!this.isSynced()){const r=e*.99,o=e*.8;this.tokenCheckBalanceStatus[this.currencyInfo.currencyCode]=r/100,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=o/100;const i=(r+o)/2;i>this.progressRatio&&(this.progressRatio=i,this.log.warn(`Scan and download progress: ${Math.floor(i)}%`),this.updateOnAddressesChecked())}}bumpSynchronizer(){return y(this,null,function*(){var t;this.isSynced()||this.lastUpdateFromSynchronizer==null||Date.now()<this.lastUpdateFromSynchronizer+E||(this.log.warn("Haven't heard from the synchronizer in a while. Applying the Fonzie Method..."),yield(t=this.synchronizer)==null?void 0:t.stop(),this.stopSyncing!=null&&(yield this.stopSyncing(5e3),this.stopSyncing=void 0),this.log.warn("\u{1F44D} Ayyy \u{1F44D}"),this.lastUpdateFromSynchronizer=void 0)})}startEngine(){return y(this,null,function*(){this.engineOn=!0,this.started=!0,this.addToLoop("bumpSynchronizer",E).catch(()=>{}),yield P(k.prototype,this,"startEngine").call(this)})}isSynced(){return this.synchronizerStatus==="SYNCED"}queryBalance(){return y(this,null,function*(){if(!(!this.isSynced()||this.synchronizer==null))try{const t=yield this.synchronizer.getBalance();if(t.totalZatoshi==="-1")return;this.availableZatoshi=t.availableZatoshi,this.updateBalance(this.currencyInfo.currencyCode,t.totalZatoshi)}catch(t){this.warn("Failed to update balances",t),this.updateBalance(this.currencyInfo.currencyCode,"0")}})}queryTransactions(){return y(this,null,function*(){if(this.synchronizer!=null)try{let t=this.otherData.blockRange.first,e=this.otherData.blockRange.last;for(;this.isSynced()&&e<=this.walletLocalData.blockHeight;){if((yield this.synchronizer.getTransactions({first:t,last:e})).forEach(r=>this.processTransaction(r)),e===this.walletLocalData.blockHeight){t=this.walletLocalData.blockHeight,this.walletLocalDataDirty=!0,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=1,this.updateOnAddressesChecked();break}t=e+1,e=e+this.networkInfo.transactionQueryLimit<this.walletLocalData.blockHeight?e+this.networkInfo.transactionQueryLimit:this.walletLocalData.blockHeight,this.otherData.blockRange={first:t,last:e},this.walletLocalDataDirty=!0}}catch(t){this.error(`Error querying ${this.currencyInfo.currencyCode} transactions `,t)}})}processTransaction(t){let e=t.value;const n=[];t.toAddress!=null?e=`-${(0,w.add)(e,this.networkInfo.defaultNetworkFee)}`:n.push(this.walletInfo.keys.publicKey);const r=t.memos.filter(i=>i!=="").map(i=>({memoName:"memo",type:"text",value:i})),o={blockHeight:t.minedHeight,currencyCode:this.currencyInfo.currencyCode,date:t.blockTimeInSeconds,isSend:e.startsWith("-"),memos:r,nativeAmount:e,networkFee:this.networkInfo.defaultNetworkFee,otherParams:{},ourReceiveAddresses:n,signedTx:"",txid:t.rawTransactionId,walletId:this.walletId};this.addTransaction(this.currencyInfo.currencyCode,o)}syncNetwork(t){return y(this,null,function*(){if(!this.started)return 1e3;const e=C(this.currencyInfo.pluginId)(t==null?void 0:t.privateKeys),{rpcNode:n}=this.networkInfo;return this.initializer=K({mnemonicSeed:e.mnemonic,birthdayHeight:e.birthdayHeight,alias:N.YU.stringify(N.US.parse(this.walletId))},n),this.synchronizer=yield this.makeSynchronizer(this.initializer),this.initData(),this.initSubscriptions(),yield new Promise(r=>{this.stopSyncing=r})})}killEngine(){return y(this,null,function*(){var t;this.started=!1,this.stopSyncing!=null&&(yield this.stopSyncing(1e3),this.stopSyncing=void 0),yield(t=this.synchronizer)==null?void 0:t.stop(),yield P(k.prototype,this,"killEngine").call(this)})}clearBlockchainCache(){return y(this,null,function*(){yield P(k.prototype,this,"clearBlockchainCache").call(this)})}resyncBlockchain(){return y(this,null,function*(){var t;yield P(k.prototype,this,"killEngine").call(this),yield this.clearBlockchainCache(),yield this.startEngine(),(t=this.synchronizer)==null||t.rescan().catch(e=>this.warn("resyncBlockchain failed: ",e)),this.initData(),this.progressRatio=0,this.synchronizerStatus="SYNCING"})}getMaxSpendable(){return y(this,null,function*(){const t=(0,w.sub)(this.availableZatoshi,this.networkInfo.defaultNetworkFee);if((0,w.lte)(t,"0"))throw new b.C_;return t})}makeSpend(t){return y(this,null,function*(){var e;if(t=(0,f.s)(t,this.currencyInfo),!this.isSynced())throw new Error("Cannot spend until wallet is synced");const{edgeSpendInfo:n,currencyCode:r}=this.makeSpendCheck(t),{memos:o=[]}=n,i=n.spendTargets[0],{publicAddress:h,nativeAmount:s}=i;if(h==null)throw new Error("makeSpend Missing publicAddress");if(s==null)throw new b.$D;if((0,w.eq)(s,"0"))throw new b.$D;const u=(0,w.add)(s,this.networkInfo.defaultNetworkFee);if((0,w.gt)(u,(e=this.walletLocalData.totalBalances[this.currencyInfo.currencyCode])!=null?e:"0"))throw new b.C_;if((0,w.gt)(u,this.availableZatoshi))throw new b.C_("Amount exceeds available balance");const R=(0,w.mul)(u,"-1");return{blockHeight:0,currencyCode:r,date:0,isSend:!0,memos:o,nativeAmount:R,networkFee:this.networkInfo.defaultNetworkFee,ourReceiveAddresses:[],signedTx:"",txid:"",walletId:this.walletId}})}signTx(t){return y(this,null,function*(){return t})}broadcastTx(t,e){return y(this,null,function*(){var n;if(this.synchronizer==null)throw new Error("Synchronizer undefined");const{memos:r}=t,o=C(this.pluginId)(e==null?void 0:e.privateKeys);if(t.spendTargets==null||t.spendTargets.length!==1)throw new Error("Invalid spend targets");const i=((n=r[0])==null?void 0:n.type)==="text"?r[0].value:"",h=t.spendTargets[0],s={zatoshi:(0,w.sub)((0,w.abs)(t.nativeAmount),t.networkFee),toAddress:h.publicAddress,memo:i,fromAccountIndex:0,mnemonicSeed:o.mnemonic};try{const u=yield this.synchronizer.sendToAddress(s);t.txid=u.txId,t.signedTx=u.raw,t.date=Date.now()/1e3,this.warn(`SUCCESS broadcastTx
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[4843],{79014:function(V,H,c){"use strict";c.d(H,{Q:function(){return N},k:function(){return b}});var w=c(77591),x=c.n(w),L=c(24350),O=c(84564),z=c.n(O),B=c(76714),g=Object.defineProperty,U=Object.getOwnPropertySymbols,F=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable,A=(a,f,p)=>f in a?g(a,f,{enumerable:!0,configurable:!0,writable:!0,value:p}):a[f]=p,C=(a,f)=>{for(var p in f||(f={}))F.call(f,p)&&A(a,p,f[p]);if(U)for(var p of U(f))M.call(f,p)&&A(a,p,f[p]);return a};function b(a,f,p,m,S=[]){const d=C({},z()(f,{},!0)),D=f.startsWith(`${a.pluginId}://`);if(d.protocol!=null&&(d.protocol=d.protocol.replace(":","")),d.protocol!=null&&d.protocol!==""&&!p[d.protocol])throw new Error(`Uri protocol '${d.protocol}' is not supported for ${a.pluginId}.`);if(d.host===""&&d.pathname==="")throw new Error("Path and host not found in uri.");const v={publicAddress:d.host!==""?d.host:d.pathname.split("/")[0]},K=d.query.label,P=d.query.message,y=d.query.category;(K!=null||P!=null||y!=null||D)&&(v.metadata={},v.metadata.name=K,v.metadata.notes=P,v.metadata.category=y,v.metadata.gateway=D!=null?D:!1);const E=d.query.amount;if(E!=null&&typeof E=="string"){m==null&&(m=a.currencyCode);const k=(0,B.Qs)(m!=null?m:"",a,S);if(k==null)throw new Error("InternalErrorInvalidCurrencyCode");let T=(0,w.mul)(E,k.multiplier);T=(0,w.toFixed)(T,0,0),v.nativeAmount=T,v.currencyCode=m}return{edgeParsedUri:v,parsedUri:d}}function N(a,f,p){if(a.publicAddress==null)throw new Error("InvalidPublicAddressError");if(p==null&&a.label==null&&a.message==null)return a.publicAddress;{let m="";p!=null&&(m+="amount="+p+"&"),(a.label!=null||a.message!=null)&&(typeof a.label=="string"&&(m+="label="+a.label+"&"),typeof a.message=="string"&&(m+="message="+a.message+"&")),m=m.substr(0,m.length-1);const S={scheme:f,path:a.publicAddress,query:m};return(0,L.qC)(S)}}},80504:function(V,H,c){"use strict";c.r(H),c.d(H,{PiratechainTools:function(){return W},makeCurrencyEngine:function(){return T},makeCurrencyTools:function(){return _}});var w=c(77591),x=c(2153),L=c(48764),O=c(62177),z=c(79014),B=c(76714),g=c(82448);const U=(0,g.su)({first:g.mH,last:g.mH}),F=(0,g.su)({alias:(0,g.Vk)(g.XC),blockRange:(0,g.Vk)(U,()=>({first:0,last:0}))}),M=(0,g.su)({birthdayHeight:g.mH,publicKey:g.XC}),A=(0,O.jd)(M),C=l=>{const t=(0,g.su)({[`${l}Mnemonic`]:g.XC,[`${l}BirthdayHeight`]:g.mH});return(0,g.W1)(e=>{const n=t(e);return{mnemonic:n[`${l}Mnemonic`],birthdayHeight:n[`${l}BirthdayHeight`]}},e=>({[`${l}Mnemonic`]:e.mnemonic,[`${l}BirthdayHeight`]:e.birthdayHeight}))};var b=c(94935),N=c(79325),a=c(84650),f=c(72681),p=Object.defineProperty,m=Object.getOwnPropertySymbols,S=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable,$=Reflect.get,v=(l,t,e)=>t in l?p(l,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):l[t]=e,K=(l,t)=>{for(var e in t||(t={}))d.call(t,e)&&v(l,e,t[e]);if(m)for(var e of m(t))D.call(t,e)&&v(l,e,t[e]);return l},P=(l,t,e)=>$(S(l),e,t),y=(l,t,e)=>new Promise((n,r)=>{var o=s=>{try{h(e.next(s))}catch(u){r(u)}},i=s=>{try{h(e.throw(s))}catch(u){r(u)}},h=s=>s.done?n(s.value):Promise.resolve(s.value).then(o,i);h((e=e.apply(l,t)).next())});const E=3e4;class k extends a.P{constructor(t,e,n,r,o){super(t,e,n,r);const{networkInfo:i}=t;this.pluginId=this.currencyInfo.pluginId,this.networkInfo=i,this.makeSynchronizer=o,this.queryMutex=!1,this.started=!1,this.progressRatio=0}setOtherData(t){this.otherData=F(t)}initData(){const{birthdayHeight:t}=this.initializer;this.otherData.blockRange.first===0&&(this.otherData.blockRange={first:t,last:t}),this.initialNumBlocksToDownload=-1,this.synchronizerStatus="DISCONNECTED",this.availableZatoshi="0"}initSubscriptions(){this.synchronizer!=null&&(this.synchronizer.on("update",t=>y(this,null,function*(){const{lastDownloadedHeight:e,scanProgress:n,networkBlockHeight:r}=t;this.onUpdateBlockHeight(r),this.onUpdateProgress(e,n,r),yield this.queryAll()})),this.synchronizer.on("statusChanged",t=>y(this,null,function*(){this.synchronizerStatus=t.name,yield this.queryAll()})))}queryAll(){return y(this,null,function*(){if(this.lastUpdateFromSynchronizer=Date.now(),!this.queryMutex){this.queryMutex=!0;try{yield this.queryBalance(),yield this.queryTransactions(),this.onUpdateTransactions()}catch{}this.queryMutex=!1}})}onUpdateBlockHeight(t){this.walletLocalData.blockHeight!==t&&(this.walletLocalData.blockHeight=t,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onBlockHeightChanged(this.walletLocalData.blockHeight))}onUpdateTransactions(){this.transactionsChangedArray.length>0&&(this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[])}onUpdateProgress(t,e,n){if(!this.addressesChecked&&!this.isSynced()){const r=e*.99,o=e*.8;this.tokenCheckBalanceStatus[this.currencyInfo.currencyCode]=r/100,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=o/100;const i=(r+o)/2;i>this.progressRatio&&(this.progressRatio=i,this.log.warn(`Scan and download progress: ${Math.floor(i)}%`),this.updateOnAddressesChecked())}}bumpSynchronizer(){return y(this,null,function*(){var t;this.isSynced()||this.lastUpdateFromSynchronizer==null||Date.now()<this.lastUpdateFromSynchronizer+E||(this.log.warn("Haven't heard from the synchronizer in a while. Applying the Fonzie Method..."),yield(t=this.synchronizer)==null?void 0:t.stop(),this.stopSyncing!=null&&(yield this.stopSyncing(5e3),this.stopSyncing=void 0),this.log.warn("\u{1F44D} Ayyy \u{1F44D}"),this.lastUpdateFromSynchronizer=void 0)})}startEngine(){return y(this,null,function*(){this.engineOn=!0,this.started=!0,this.addToLoop("bumpSynchronizer",E).catch(()=>{}),yield P(k.prototype,this,"startEngine").call(this)})}isSynced(){return this.synchronizerStatus==="SYNCED"}queryBalance(){return y(this,null,function*(){if(!(!this.isSynced()||this.synchronizer==null))try{const t=yield this.synchronizer.getBalance();if(t.totalZatoshi==="-1")return;this.availableZatoshi=t.availableZatoshi,this.updateBalance(this.currencyInfo.currencyCode,t.totalZatoshi)}catch(t){this.warn("Failed to update balances",t),this.updateBalance(this.currencyInfo.currencyCode,"0")}})}queryTransactions(){return y(this,null,function*(){if(this.synchronizer!=null)try{let t=this.otherData.blockRange.first,e=this.otherData.blockRange.last;for(;this.isSynced()&&e<=this.walletLocalData.blockHeight;){if((yield this.synchronizer.getTransactions({first:t,last:e})).forEach(r=>this.processTransaction(r)),e===this.walletLocalData.blockHeight){t=this.walletLocalData.blockHeight,this.walletLocalDataDirty=!0,this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=1,this.updateOnAddressesChecked();break}t=e+1,e=e+this.networkInfo.transactionQueryLimit<this.walletLocalData.blockHeight?e+this.networkInfo.transactionQueryLimit:this.walletLocalData.blockHeight,this.otherData.blockRange={first:t,last:e},this.walletLocalDataDirty=!0}}catch(t){this.error(`Error querying ${this.currencyInfo.currencyCode} transactions `,t)}})}processTransaction(t){let e=t.value;const n=[];t.toAddress!=null?e=`-${(0,w.add)(e,this.networkInfo.defaultNetworkFee)}`:n.push(this.walletInfo.keys.publicKey);const r=t.memos.filter(i=>i!=="").map(i=>({memoName:"memo",type:"text",value:i})),o={blockHeight:t.minedHeight,currencyCode:this.currencyInfo.currencyCode,date:t.blockTimeInSeconds,isSend:e.startsWith("-"),memos:r,nativeAmount:e,networkFee:this.networkInfo.defaultNetworkFee,otherParams:{},ourReceiveAddresses:n,signedTx:"",tokenId:null,txid:t.rawTransactionId,walletId:this.walletId};this.addTransaction(this.currencyInfo.currencyCode,o)}syncNetwork(t){return y(this,null,function*(){if(!this.started)return 1e3;const e=C(this.currencyInfo.pluginId)(t==null?void 0:t.privateKeys),{rpcNode:n}=this.networkInfo;return this.initializer=K({mnemonicSeed:e.mnemonic,birthdayHeight:e.birthdayHeight,alias:N.YU.stringify(N.US.parse(this.walletId))},n),this.synchronizer=yield this.makeSynchronizer(this.initializer),this.initData(),this.initSubscriptions(),yield new Promise(r=>{this.stopSyncing=r})})}killEngine(){return y(this,null,function*(){var t;this.started=!1,this.stopSyncing!=null&&(yield this.stopSyncing(1e3),this.stopSyncing=void 0),yield(t=this.synchronizer)==null?void 0:t.stop(),yield P(k.prototype,this,"killEngine").call(this)})}clearBlockchainCache(){return y(this,null,function*(){yield P(k.prototype,this,"clearBlockchainCache").call(this)})}resyncBlockchain(){return y(this,null,function*(){var t;yield P(k.prototype,this,"killEngine").call(this),yield this.clearBlockchainCache(),yield this.startEngine(),(t=this.synchronizer)==null||t.rescan().catch(e=>this.warn("resyncBlockchain failed: ",e)),this.initData(),this.progressRatio=0,this.synchronizerStatus="SYNCING"})}getMaxSpendable(){return y(this,null,function*(){const t=(0,w.sub)(this.availableZatoshi,this.networkInfo.defaultNetworkFee);if((0,w.lte)(t,"0"))throw new b.C_;return t})}makeSpend(t){return y(this,null,function*(){var e;if(t=(0,f.s)(t,this.currencyInfo),!this.isSynced())throw new Error("Cannot spend until wallet is synced");const{edgeSpendInfo:n,currencyCode:r}=this.makeSpendCheck(t),{memos:o=[]}=n,i=n.spendTargets[0],{publicAddress:h,nativeAmount:s}=i;if(h==null)throw new Error("makeSpend Missing publicAddress");if(s==null)throw new b.$D;if((0,w.eq)(s,"0"))throw new b.$D;const u=(0,w.add)(s,this.networkInfo.defaultNetworkFee);if((0,w.gt)(u,(e=this.walletLocalData.totalBalances[this.currencyInfo.currencyCode])!=null?e:"0"))throw new b.C_;if((0,w.gt)(u,this.availableZatoshi))throw new b.C_("Amount exceeds available balance");const R=(0,w.mul)(u,"-1");return{blockHeight:0,currencyCode:r,date:0,isSend:!0,memos:o,nativeAmount:R,networkFee:this.networkInfo.defaultNetworkFee,ourReceiveAddresses:[],signedTx:"",tokenId:null,txid:"",walletId:this.walletId}})}signTx(t){return y(this,null,function*(){return t})}broadcastTx(t,e){return y(this,null,function*(){var n;if(this.synchronizer==null)throw new Error("Synchronizer undefined");const{memos:r}=t,o=C(this.pluginId)(e==null?void 0:e.privateKeys);if(t.spendTargets==null||t.spendTargets.length!==1)throw new Error("Invalid spend targets");const i=((n=r[0])==null?void 0:n.type)==="text"?r[0].value:"",h=t.spendTargets[0],s={zatoshi:(0,w.sub)((0,w.abs)(t.nativeAmount),t.networkFee),toAddress:h.publicAddress,memo:i,fromAccountIndex:0,mnemonicSeed:o.mnemonic};try{const u=yield this.synchronizer.sendToAddress(s);t.txid=u.txId,t.signedTx=u.raw,t.date=Date.now()/1e3,this.warn(`SUCCESS broadcastTx
|
|
2
2
|
${(0,B.oX)(t)}`)}catch(u){throw this.warn("FAILURE broadcastTx failed: ",u),u}return t})}getFreshAddress(){return y(this,null,function*(){if(this.synchronizer==null)throw new Error("Synchronizer undefined");return{publicAddress:(yield this.synchronizer.deriveUnifiedAddress()).saplingAddress}})}}function T(l,t,e,n){return y(this,null,function*(){const r=A(e),{makeSynchronizer:o}=l.nativeIo["edge-currency-accountbased"].piratechain,i=new k(l,t,r,n,o);return yield i.loadEngine(),i})}var I=(l,t,e)=>new Promise((n,r)=>{var o=s=>{try{h(e.next(s))}catch(u){r(u)}},i=s=>{try{h(e.throw(s))}catch(u){r(u)}},h=s=>s.done?n(s.value):Promise.resolve(s.value).then(o,i);h((e=e.apply(l,t)).next())});class W{constructor(t){const{builtinTokens:e,currencyInfo:n,io:r,networkInfo:o}=t;this.builtinTokens=e,this.currencyInfo=n,this.io=r,this.networkInfo=o;const i=t.nativeIo["edge-currency-accountbased"];if(i==null)throw new Error("Need opts");const{Tools:h}=i.piratechain;this.nativeTools=h}getDisplayPrivateKey(t){return I(this,null,function*(){const{pluginId:e}=this.currencyInfo;return C(e)(t.keys).mnemonic})}getDisplayPublicKey(t){return I(this,null,function*(){const{keys:e}=A(t);return e.publicKey})}getNewWalletBirthdayBlockheight(){return I(this,null,function*(){try{return yield this.nativeTools.getBirthdayHeight(this.networkInfo.rpcNode.defaultHost,this.networkInfo.rpcNode.defaultPort)}catch{return this.networkInfo.defaultBirthday}})}isValidAddress(t){return I(this,null,function*(){return yield this.nativeTools.isValidAddress(t)})}importPrivateKey(t){return I(this,arguments,function*(e,n={}){const{pluginId:r}=this.currencyInfo,o=(0,x.validateMnemonic)(e);if(e.split(" ").length!==24)throw new Error("Mnemonic must be 24 words");if(!o)throw new Error(`Invalid ${this.currencyInfo.currencyCode} mnemonic`);const i=yield this.getNewWalletBirthdayBlockheight();let h=i;const{birthdayHeight:s}=n;if(s!=null){(0,O.jD)(s);const u=parseInt(s);if(u>i)throw new Error("InvalidBirthdayHeight");h=u}return{[`${r}Mnemonic`]:e,[`${r}BirthdayHeight`]:h}})}createPrivateKey(t){return I(this,null,function*(){if(t!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const e=L.Buffer.from(this.io.random(32)).toString("hex"),n=(0,x.entropyToMnemonic)(e);return yield this.importPrivateKey(n)})}checkPublicKey(t){return I(this,null,function*(){try{return M(t),!0}catch{return!1}})}derivePublicKey(t){return I(this,null,function*(){const{pluginId:e}=this.currencyInfo,n=C(e)(t.keys);if(t.type!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const r=n.mnemonic;if(typeof r!="string")throw new Error("InvalidMnemonic");const o=yield this.nativeTools.deriveViewingKey(r,this.networkInfo.rpcNode.networkName);return{birthdayHeight:n.birthdayHeight,publicKey:o}})}parseUri(t,e,n){return I(this,null,function*(){const{pluginId:r}=this.currencyInfo,o={[r]:!0},{edgeParsedUri:i,edgeParsedUri:{publicAddress:h}}=(0,z.k)(this.currencyInfo,t,o,e!=null?e:this.currencyInfo.currencyCode,n);if(h==null||!(yield this.isValidAddress(h)))throw new Error("InvalidPublicAddressError");return i})}encodeUri(t){return I(this,arguments,function*(e,n=[]){const{pluginId:r}=this.currencyInfo,{nativeAmount:o,currencyCode:i,publicAddress:h}=e;if(!(yield this.isValidAddress(h)))throw new Error("InvalidPublicAddressError");let s;if(o!=null){const R=(0,B.Qs)(i!=null?i:this.currencyInfo.currencyCode,this.currencyInfo,n);if(R==null)throw new Error("InternalErrorInvalidCurrencyCode");s=(0,w.div)(o,R.multiplier,18)}return(0,z.Q)(e,`${r}`,s)})}}function _(l){return I(this,null,function*(){return new W(l)})}},52361:function(){},94616:function(){}}]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[7428],{79742:function(
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[7428],{79742:function(ur,l){"use strict";l.byteLength=s,l.toByteArray=E,l.fromByteArray=j;for(var I=[],c=[],t=typeof Uint8Array<"u"?Uint8Array:Array,_="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",x=0,U=_.length;x<U;++x)I[x]=_[x],c[_.charCodeAt(x)]=x;c["-".charCodeAt(0)]=62,c["_".charCodeAt(0)]=63;function h(d){var f=d.length;if(f%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var g=d.indexOf("=");g===-1&&(g=f);var L=g===f?0:4-g%4;return[g,L]}function s(d){var f=h(d),g=f[0],L=f[1];return(g+L)*3/4-L}function N(d,f,g){return(f+g)*3/4-g}function E(d){var f,g=h(d),L=g[0],S=g[1],A=new t(N(d,L,S)),v=0,M=S>0?L-4:L,b;for(b=0;b<M;b+=4)f=c[d.charCodeAt(b)]<<18|c[d.charCodeAt(b+1)]<<12|c[d.charCodeAt(b+2)]<<6|c[d.charCodeAt(b+3)],A[v++]=f>>16&255,A[v++]=f>>8&255,A[v++]=f&255;return S===2&&(f=c[d.charCodeAt(b)]<<2|c[d.charCodeAt(b+1)]>>4,A[v++]=f&255),S===1&&(f=c[d.charCodeAt(b)]<<10|c[d.charCodeAt(b+1)]<<4|c[d.charCodeAt(b+2)]>>2,A[v++]=f>>8&255,A[v++]=f&255),A}function O(d){return I[d>>18&63]+I[d>>12&63]+I[d>>6&63]+I[d&63]}function k(d,f,g){for(var L,S=[],A=f;A<g;A+=3)L=(d[A]<<16&16711680)+(d[A+1]<<8&65280)+(d[A+2]&255),S.push(O(L));return S.join("")}function j(d){for(var f,g=d.length,L=g%3,S=[],A=16383,v=0,M=g-L;v<M;v+=A)S.push(k(d,v,v+A>M?M:v+A));return L===1?(f=d[g-1],S.push(I[f>>2]+I[f<<4&63]+"==")):L===2&&(f=(d[g-2]<<8)+d[g-1],S.push(I[f>>10]+I[f>>4&63]+I[f<<2&63]+"=")),S.join("")}},48764:function(ur,l,I){"use strict";/*!
|
|
2
2
|
* The buffer module from node.js, for the browser.
|
|
3
3
|
*
|
|
4
4
|
* @author Feross Aboukhadijeh <https://feross.org>
|
|
5
5
|
* @license MIT
|
|
6
|
-
*/const c=I(79742),t=I(80645),_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;l.Buffer=s,l.SlowBuffer=A,l.INSPECT_MAX_BYTES=50;const x=2147483647;l.kMaxLength=x,s.TYPED_ARRAY_SUPPORT=U(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function U(){try{const e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function h(e){if(e>x)throw new RangeError('The value "'+e+'" is invalid for option "size"');const r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,n){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return k(e)}return N(e,r,n)}s.poolSize=8192;function N(e,r,n){if(typeof e=="string")return j(e,r);if(ArrayBuffer.isView(e))return f(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(W(e,ArrayBuffer)||e&&W(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(W(e,SharedArrayBuffer)||e&&W(e.buffer,SharedArrayBuffer)))return g(e,r,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return s.from(o,r,n);const i=L(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,n){return N(e,r,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function E(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function O(e,r,n){return E(e),e<=0?h(e):r!==void 0?typeof n=="string"?h(e).fill(r,n):h(e).fill(r):h(e)}s.alloc=function(e,r,n){return O(e,r,n)};function k(e){return E(e),h(e<0?0:S(e)|0)}s.allocUnsafe=function(e){return k(e)},s.allocUnsafeSlow=function(e){return k(e)};function j(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const n=v(e,r)|0;let o=h(n);const i=o.write(e,r);return i!==n&&(o=o.slice(0,i)),o}function d(e){const r=e.length<0?0:S(e.length)|0,n=h(r);for(let o=0;o<r;o+=1)n[o]=e[o]&255;return n}function f(e){if(W(e,Uint8Array)){const r=new Uint8Array(e);return g(r.buffer,r.byteOffset,r.byteLength)}return d(e)}function g(e,r,n){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return r===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,r):o=new Uint8Array(e,r,n),Object.setPrototypeOf(o,s.prototype),o}function L(e){if(s.isBuffer(e)){const r=S(e.length)|0,n=h(r);return n.length===0||e.copy(n,0,0,r),n}if(e.length!==void 0)return typeof e.length!="number"||ar(e.length)?h(0):d(e);if(e.type==="Buffer"&&Array.isArray(e.data))return d(e.data)}function S(e){if(e>=x)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+x.toString(16)+" bytes");return e|0}function A(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype},s.compare=function(r,n){if(W(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),W(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(r)||!s.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let o=r.length,i=n.length;for(let a=0,u=Math.min(o,i);a<u;++a)if(r[a]!==n[a]){o=r[a],i=n[a];break}return o<i?-1:i<o?1:0},s.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let o;if(n===void 0)for(n=0,o=0;o<r.length;++o)n+=r[o].length;const i=s.allocUnsafe(n);let a=0;for(o=0;o<r.length;++o){let u=r[o];if(W(u,Uint8Array))a+u.length>i.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(i,a)):Uint8Array.prototype.set.call(i,u,a);else if(s.isBuffer(u))u.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=u.length}return i};function v(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||W(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ir(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return Or(e).length;default:if(i)return o?-1:ir(e).length;r=(""+r).toLowerCase(),i=!0}}s.byteLength=v;function M(e,r,n){let o=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return yr(this,r,n);case"utf8":case"utf-8":return X(this,r,n);case"ascii":return fr(this,r,n);case"latin1":case"binary":return tr(this,r,n);case"base64":return J(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return dr(this,r,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}s.prototype._isBuffer=!0;function b(e,r,n){const o=e[r];e[r]=e[n],e[n]=o}s.prototype.swap16=function(){const r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)b(this,n,n+1);return this},s.prototype.swap32=function(){const r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)b(this,n,n+3),b(this,n+1,n+2);return this},s.prototype.swap64=function(){const r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)b(this,n,n+7),b(this,n+1,n+6),b(this,n+2,n+5),b(this,n+3,n+4);return this},s.prototype.toString=function(){const r=this.length;return r===0?"":arguments.length===0?X(this,0,r):M.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0},s.prototype.inspect=function(){let r="";const n=l.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},_&&(s.prototype[_]=s.prototype.inspect),s.prototype.compare=function(r,n,o,i,a){if(W(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),o===void 0&&(o=r?r.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||o>r.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=o)return 0;if(i>=a)return-1;if(n>=o)return 1;if(n>>>=0,o>>>=0,i>>>=0,a>>>=0,this===r)return 0;let u=a-i,m=o-n;const T=Math.min(u,m),P=this.slice(i,a),R=r.slice(n,o);for(let C=0;C<T;++C)if(P[C]!==R[C]){u=P[C],m=R[C];break}return u<m?-1:m<u?1:0};function G(e,r,n,o,i){if(e.length===0)return-1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,ar(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof r=="string"&&(r=s.from(r,o)),s.isBuffer(r))return r.length===0?-1:q(e,r,n,o,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):q(e,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function q(e,r,n,o,i){let a=1,u=e.length,m=r.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||r.length<2)return-1;a=2,u/=2,m/=2,n/=2}function T(R,C){return a===1?R[C]:R.readUInt16BE(C*a)}let P;if(i){let R=-1;for(P=n;P<u;P++)if(T(e,P)===T(r,R===-1?0:P-R)){if(R===-1&&(R=P),P-R+1===m)return R*a}else R!==-1&&(P-=P-R),R=-1}else for(n+m>u&&(n=u-m),P=n;P>=0;P--){let R=!0;for(let C=0;C<m;C++)if(T(e,P+C)!==T(r,C)){R=!1;break}if(R)return P}return-1}s.prototype.includes=function(r,n,o){return this.indexOf(r,n,o)!==-1},s.prototype.indexOf=function(r,n,o){return G(this,r,n,o,!0)},s.prototype.lastIndexOf=function(r,n,o){return G(this,r,n,o,!1)};function Q(e,r,n,o){n=Number(n)||0;const i=e.length-n;o?(o=Number(o),o>i&&(o=i)):o=i;const a=r.length;o>a/2&&(o=a/2);let u;for(u=0;u<o;++u){const m=parseInt(r.substr(u*2,2),16);if(ar(m))return u;e[n+u]=m}return u}function ur(e,r,n,o){return rr(ir(r,e.length-n),e,n,o)}function lr(e,r,n,o){return rr(Pr(r),e,n,o)}function hr(e,r,n,o){return rr(Or(r),e,n,o)}function pr(e,r,n,o){return rr(Sr(r,e.length-n),e,n,o)}s.prototype.write=function(r,n,o,i){if(n===void 0)i="utf8",o=this.length,n=0;else if(o===void 0&&typeof n=="string")i=n,o=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(o)?(o=o>>>0,i===void 0&&(i="utf8")):(i=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const a=this.length-n;if((o===void 0||o>a)&&(o=a),r.length>0&&(o<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let u=!1;for(;;)switch(i){case"hex":return Q(this,r,n,o);case"utf8":case"utf-8":return ur(this,r,n,o);case"ascii":case"latin1":case"binary":return lr(this,r,n,o);case"base64":return hr(this,r,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return pr(this,r,n,o);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function J(e,r,n){return r===0&&n===e.length?c.fromByteArray(e):c.fromByteArray(e.slice(r,n))}function X(e,r,n){n=Math.min(e.length,n);const o=[];let i=r;for(;i<n;){const a=e[i];let u=null,m=a>239?4:a>223?3:a>191?2:1;if(i+m<=n){let T,P,R,C;switch(m){case 1:a<128&&(u=a);break;case 2:T=e[i+1],(T&192)===128&&(C=(a&31)<<6|T&63,C>127&&(u=C));break;case 3:T=e[i+1],P=e[i+2],(T&192)===128&&(P&192)===128&&(C=(a&15)<<12|(T&63)<<6|P&63,C>2047&&(C<55296||C>57343)&&(u=C));break;case 4:T=e[i+1],P=e[i+2],R=e[i+3],(T&192)===128&&(P&192)===128&&(R&192)===128&&(C=(a&15)<<18|(T&63)<<12|(P&63)<<6|R&63,C>65535&&C<1114112&&(u=C))}}u===null?(u=65533,m=1):u>65535&&(u-=65536,o.push(u>>>10&1023|55296),u=56320|u&1023),o.push(u),i+=m}return er(o)}const nr=4096;function er(e){const r=e.length;if(r<=nr)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<r;)n+=String.fromCharCode.apply(String,e.slice(o,o+=nr));return n}function fr(e,r,n){let o="";n=Math.min(e.length,n);for(let i=r;i<n;++i)o+=String.fromCharCode(e[i]&127);return o}function tr(e,r,n){let o="";n=Math.min(e.length,n);for(let i=r;i<n;++i)o+=String.fromCharCode(e[i]);return o}function yr(e,r,n){const o=e.length;(!r||r<0)&&(r=0),(!n||n<0||n>o)&&(n=o);let i="";for(let a=r;a<n;++a)i+=Fr[e[a]];return i}function dr(e,r,n){const o=e.slice(r,n);let i="";for(let a=0;a<o.length-1;a+=2)i+=String.fromCharCode(o[a]+o[a+1]*256);return i}s.prototype.slice=function(r,n){const o=this.length;r=~~r,n=n===void 0?o:~~n,r<0?(r+=o,r<0&&(r=0)):r>o&&(r=o),n<0?(n+=o,n<0&&(n=0)):n>o&&(n=o),n<r&&(n=r);const i=this.subarray(r,n);return Object.setPrototypeOf(i,s.prototype),i};function D(e,r,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>n)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r],a=1,u=0;for(;++u<n&&(a*=256);)i+=this[r+u]*a;return i},s.prototype.readUintBE=s.prototype.readUIntBE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r+--n],a=1;for(;n>0&&(a*=256);)i+=this[r+--n]*a;return i},s.prototype.readUint8=s.prototype.readUInt8=function(r,n){return r=r>>>0,n||D(r,1,this.length),this[r]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||D(r,2,this.length),this[r]|this[r+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||D(r,2,this.length),this[r]<<8|this[r+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||D(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},s.prototype.readBigUInt64LE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,a=this[++r]+this[++r]*2**8+this[++r]*2**16+o*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))}),s.prototype.readBigUInt64BE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],a=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+o;return(BigInt(i)<<BigInt(32))+BigInt(a)}),s.prototype.readIntLE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r],a=1,u=0;for(;++u<n&&(a*=256);)i+=this[r+u]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*n)),i},s.prototype.readIntBE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=n,a=1,u=this[r+--i];for(;i>0&&(a*=256);)u+=this[r+--i]*a;return a*=128,u>=a&&(u-=Math.pow(2,8*n)),u},s.prototype.readInt8=function(r,n){return r=r>>>0,n||D(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},s.prototype.readInt16LE=function(r,n){r=r>>>0,n||D(r,2,this.length);const o=this[r]|this[r+1]<<8;return o&32768?o|4294901760:o},s.prototype.readInt16BE=function(r,n){r=r>>>0,n||D(r,2,this.length);const o=this[r+1]|this[r]<<8;return o&32768?o|4294901760:o},s.prototype.readInt32LE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},s.prototype.readInt32BE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},s.prototype.readBigInt64LE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(o<<24);return(BigInt(i)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),s.prototype.readBigInt64BE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+o)}),s.prototype.readFloatLE=function(r,n){return r=r>>>0,n||D(r,4,this.length),t.read(this,r,!0,23,4)},s.prototype.readFloatBE=function(r,n){return r=r>>>0,n||D(r,4,this.length),t.read(this,r,!1,23,4)},s.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||D(r,8,this.length),t.read(this,r,!0,52,8)},s.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||D(r,8,this.length),t.read(this,r,!1,52,8)};function K(e,r,n,o,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<a)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,n,o,i){if(r=+r,n=n>>>0,o=o>>>0,!i){const m=Math.pow(2,8*o)-1;K(this,r,n,o,m,0)}let a=1,u=0;for(this[n]=r&255;++u<o&&(a*=256);)this[n+u]=r/a&255;return n+o},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,n,o,i){if(r=+r,n=n>>>0,o=o>>>0,!i){const m=Math.pow(2,8*o)-1;K(this,r,n,o,m,0)}let a=o-1,u=1;for(this[n+a]=r&255;--a>=0&&(u*=256);)this[n+a]=r/u&255;return n+o},s.prototype.writeUint8=s.prototype.writeUInt8=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,1,255,0),this[n]=r&255,n+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function wr(e,r,n,o,i){Ir(r,o,i,e,n,7);let a=Number(r&BigInt(4294967295));e[n++]=a,a=a>>8,e[n++]=a,a=a>>8,e[n++]=a,a=a>>8,e[n++]=a;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[n++]=u,u=u>>8,e[n++]=u,u=u>>8,e[n++]=u,u=u>>8,e[n++]=u,n}function Er(e,r,n,o,i){Ir(r,o,i,e,n,7);let a=Number(r&BigInt(4294967295));e[n+7]=a,a=a>>8,e[n+6]=a,a=a>>8,e[n+5]=a,a=a>>8,e[n+4]=a;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[n+3]=u,u=u>>8,e[n+2]=u,u=u>>8,e[n+1]=u,u=u>>8,e[n]=u,n+8}s.prototype.writeBigUInt64LE=Y(function(r,n=0){return wr(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Y(function(r,n=0){return Er(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(r,n,o,i){if(r=+r,n=n>>>0,!i){const T=Math.pow(2,8*o-1);K(this,r,n,o,T-1,-T)}let a=0,u=1,m=0;for(this[n]=r&255;++a<o&&(u*=256);)r<0&&m===0&&this[n+a-1]!==0&&(m=1),this[n+a]=(r/u>>0)-m&255;return n+o},s.prototype.writeIntBE=function(r,n,o,i){if(r=+r,n=n>>>0,!i){const T=Math.pow(2,8*o-1);K(this,r,n,o,T-1,-T)}let a=o-1,u=1,m=0;for(this[n+a]=r&255;--a>=0&&(u*=256);)r<0&&m===0&&this[n+a+1]!==0&&(m=1),this[n+a]=(r/u>>0)-m&255;return n+o},s.prototype.writeInt8=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},s.prototype.writeInt16LE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeInt16BE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeInt32LE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},s.prototype.writeInt32BE=function(r,n,o){return r=+r,n=n>>>0,o||K(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},s.prototype.writeBigInt64LE=Y(function(r,n=0){return wr(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Y(function(r,n=0){return Er(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function gr(e,r,n,o,i,a){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function Br(e,r,n,o,i){return r=+r,n=n>>>0,i||gr(e,r,n,4,34028234663852886e22,-34028234663852886e22),t.write(e,r,n,o,23,4),n+4}s.prototype.writeFloatLE=function(r,n,o){return Br(this,r,n,!0,o)},s.prototype.writeFloatBE=function(r,n,o){return Br(this,r,n,!1,o)};function mr(e,r,n,o,i){return r=+r,n=n>>>0,i||gr(e,r,n,8,17976931348623157e292,-17976931348623157e292),t.write(e,r,n,o,52,8),n+8}s.prototype.writeDoubleLE=function(r,n,o){return mr(this,r,n,!0,o)},s.prototype.writeDoubleBE=function(r,n,o){return mr(this,r,n,!1,o)},s.prototype.copy=function(r,n,o,i){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(o||(o=0),!i&&i!==0&&(i=this.length),n>=r.length&&(n=r.length),n||(n=0),i>0&&i<o&&(i=o),i===o||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-n<i-o&&(i=r.length-n+o);const a=i-o;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,o,i):Uint8Array.prototype.set.call(r,this.subarray(o,i),n),a},s.prototype.fill=function(r,n,o,i){if(typeof r=="string"){if(typeof n=="string"?(i=n,n=0,o=this.length):typeof o=="string"&&(i=o,o=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){const u=r.charCodeAt(0);(i==="utf8"&&u<128||i==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<o)throw new RangeError("Out of range index");if(o<=n)return this;n=n>>>0,o=o===void 0?this.length:o>>>0,r||(r=0);let a;if(typeof r=="number")for(a=n;a<o;++a)this[a]=r;else{const u=s.isBuffer(r)?r:s.from(r,i),m=u.length;if(m===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(a=0;a<o-n;++a)this[a+n]=u[a%m]}return this};const z={};function or(e,r,n){z[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}or("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),or("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),or("ERR_OUT_OF_RANGE",function(e,r,n){let o=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=br(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=br(i)),i+="n"),o+=` It must be ${r}. Received ${i}`,o},RangeError);function br(e){let r="",n=e.length;const o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)r=`_${e.slice(n-3,n)}${r}`;return`${e.slice(0,n)}${r}`}function xr(e,r,n){H(r,"offset"),(e[r]===void 0||e[r+n]===void 0)&&Z(r,e.length-(n+1))}function Ir(e,r,n,o,i,a){if(e>n||e<r){const u=typeof r=="bigint"?"n":"";let m;throw a>3?r===0||r===BigInt(0)?m=`>= 0${u} and < 2${u} ** ${(a+1)*8}${u}`:m=`>= -(2${u} ** ${(a+1)*8-1}${u}) and < 2 ** ${(a+1)*8-1}${u}`:m=`>= ${r}${u} and <= ${n}${u}`,new z.ERR_OUT_OF_RANGE("value",m,e)}xr(o,i,a)}function H(e,r){if(typeof e!="number")throw new z.ERR_INVALID_ARG_TYPE(r,"number",e)}function Z(e,r,n){throw Math.floor(e)!==e?(H(e,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",e)):r<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,e)}const Cr=/[^+/0-9A-Za-z-_]/g;function Ar(e){if(e=e.split("=")[0],e=e.trim().replace(Cr,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ir(e,r){r=r||1/0;let n;const o=e.length;let i=null;const a=[];for(let u=0;u<o;++u){if(n=e.charCodeAt(u),n>55295&&n<57344){if(!i){if(n>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(u+1===o){(r-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(r-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(r-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((r-=1)<0)break;a.push(n)}else if(n<2048){if((r-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function Pr(e){const r=[];for(let n=0;n<e.length;++n)r.push(e.charCodeAt(n)&255);return r}function Sr(e,r){let n,o,i;const a=[];for(let u=0;u<e.length&&!((r-=2)<0);++u)n=e.charCodeAt(u),o=n>>8,i=n%256,a.push(i),a.push(o);return a}function Or(e){return c.toByteArray(Ar(e))}function rr(e,r,n,o){let i;for(i=0;i<o&&!(i+n>=r.length||i>=e.length);++i)r[i+n]=e[i];return i}function W(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function ar(e){return e!==e}const Fr=function(){const e="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){const o=n*16;for(let i=0;i<16;++i)r[o+i]=e[n]+e[i]}return r}();function Y(e){return typeof BigInt>"u"?_r:e}function _r(){throw new Error("BigInt not supported")}},18595:function(cr,l,I){"use strict";var c;c={value:!0};var t=I(47630),_=I(55352);const x=t.asCodec(B=>_.base16.parse(t.asString(B)),B=>_.base16.stringify(B).toLowerCase()),U=t.asCodec(B=>_.base32.parse(t.asString(B),{loose:!0}),B=>_.base32.stringify(B,{pad:!1})),h=t.asCodec(B=>_.base64.parse(t.asString(B)),B=>_.base64.stringify(B)),s=t.asObject({voucherId:t.asString,activates:t.asDate,created:t.asDate,ip:t.asString,ipDescription:t.asString,deviceDescription:t.asOptional(t.asString)}),N=t.asObject({min_length:t.asNumber,category:t.asValue("address","must","numeric","recovery2","string"),question:t.asString}),E=t.asObject({encryptionType:t.asNumber,data_base64:h,iv_hex:x}),O=t.asObject({salt_hex:x,n:t.asNumber,r:t.asNumber,p:t.asNumber}),k=t.asObject({loginRequest:t.asOptional(t.asObject({appId:t.asString}).withRest),publicKey:h,timeout:t.asOptional(t.asNumber)}).withRest,j=t.asObject({publicKey:h,box:E}),d=t.asArray(h),f=t.asObject({data:t.asUnknown,challengeId:t.asOptional(t.asString),deviceDescription:t.asOptional(t.asString),otp:t.asOptional(t.asString),syncToken:t.asOptional(t.asString),voucherId:t.asOptional(t.asString),voucherAuth:t.asOptional(h),loginId:t.asOptional(h),loginAuth:t.asOptional(h),userId:t.asOptional(h),passwordAuth:t.asOptional(h),pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),recovery2Id:t.asOptional(h),recovery2Auth:t.asOptional(d),loginIds:t.asOptional(t.asArray(h)),otpResetAuth:t.asOptional(t.asString),did:t.asOptional(t.asString),l1:t.asOptional(h),lp1:t.asOptional(h),lpin1:t.asOptional(h),lra1:t.asOptional(h),recoveryAuth:t.asOptional(h)}),g=t.asObject({results:t.asOptional(t.asUnknown),status_code:t.asNumber,message:t.asString}),L=t.asObject({otpTimeout:t.asOptional(t.asNumber,7*24*60*60),otpKey:U}),S=t.asObject({passwordAuth:h,passwordAuthBox:E,passwordAuthSnrp:O,passwordBox:E,passwordKeySnrp:O}),A=t.asObject({pin2Id:h}),v=t.asObject({pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),pin2Box:t.asOptional(E),pin2KeyBox:t.asOptional(E),pin2TextBox:E}),M=t.asObject({recovery2Id:h}),b=t.asObject({recovery2Id:h,recovery2Auth:d,recovery2Box:E,recovery2KeyBox:E,question2Box:E}),G=t.asObject({loginAuthBox:E,loginAuth:h}),q=t.asObject({userId:h,userTextBox:E}),Q=t.asObject({approvedVouchers:t.asOptional(t.asArray(t.asString)),rejectedVouchers:t.asOptional(t.asArray(t.asString))}),ur=t.asObject({keyBoxes:t.asArray(E),newSyncKeys:t.asOptional(t.asArray(t.asString),()=>[])}),lr=t.asObject({appId:t.asString,loginId:h,parentBox:t.asOptional(E)}),hr=t.asObject({challengeId:t.asString,challengeUri:t.asString}),pr=t.asObject({request:k,replies:t.asArray(j)}),J=t.asValue(!0),X=t.asObject({appId:t.asString,created:t.asDate,loginId:h,syncToken:t.asOptional(t.asString),children:t.asOptional(t.asArray(B=>X(B))),parentBox:t.asOptional(E),otpKey:t.asOptional(t.asEither(J,U)),otpResetDate:t.asOptional(t.asDate),otpTimeout:t.asOptional(t.asNumber),passwordAuthBox:t.asOptional(E),passwordAuthSnrp:t.asOptional(O),passwordBox:t.asOptional(t.asEither(J,E)),passwordKeySnrp:t.asOptional(O),pin2Box:t.asOptional(t.asEither(J,E)),pin2KeyBox:t.asOptional(E),pin2TextBox:t.asOptional(E),question2Box:t.asOptional(E),recovery2Box:t.asOptional(t.asEither(J,E)),recovery2KeyBox:t.asOptional(E),loginAuthBox:t.asOptional(E),userId:t.asOptional(h),userTextBox:t.asOptional(E),pendingVouchers:t.asOptional(t.asArray(s),()=>[]),keyBoxes:t.asOptional(t.asArray(E)),mnemonicBox:t.asOptional(E),rootKeyBox:t.asOptional(E),syncKeyBox:t.asOptional(E)}),nr=t.asArray(t.asObject({loginId:h,otpResetPending:t.asOptional(t.asBoolean,!1),pendingVouchers:t.asOptional(t.asArray(s),()=>[]),recovery2Corrupt:t.asOptional(t.asBoolean,!1)})),er=t.asObject({login_id:t.asOptional(h),otp_reset_auth:t.asOptional(t.asString),otp_timeout_date:t.asOptional(t.asDate),reason:t.asOptional(t.asValue("ip","otp"),"otp"),voucher_activates:t.asOptional(t.asDate),voucher_auth:t.asOptional(h),voucher_id:t.asOptional(t.asString)}),fr=t.asObject({otpResetDate:t.asDate}),tr=t.asObject({wait_seconds:t.asOptional(t.asNumber)}),yr=t.asArray(N),dr=t.asObject({question2Box:E}),D=t.asObject({loginId:h,passwordAuthSnrp:t.asOptional(O),questionBox:t.asOptional(E),questionKeySnrp:t.asOptional(O),recoveryAuthSnrp:t.asOptional(O)}),K=t.uncleaner(E),wr=t.uncleaner(j),Er=t.uncleaner(k),gr=t.uncleaner(f),Br=t.uncleaner(g),mr=t.uncleaner(L),z=t.uncleaner(S),or=t.uncleaner(A),br=t.uncleaner(v),xr=t.uncleaner(M),Ir=t.uncleaner(b),H=t.uncleaner(G),Z=t.uncleaner(q),Cr=t.uncleaner(Q),Ar=t.uncleaner(ur),ir=t.uncleaner(lr),Pr=t.uncleaner(hr),Sr=t.uncleaner(pr),Or=t.uncleaner(X),rr=t.uncleaner(nr),W=t.uncleaner(er),ar=t.uncleaner(fr),Fr=t.uncleaner(tr),Y=t.uncleaner(yr),_r=t.uncleaner(dr),e=t.uncleaner(D);function r(B){const{currencyInfo:p,allTokens:y}=B;let w=B.tokenId;w==null&&B.currencyCode!=null&&B.currencyCode!==p.currencyCode&&(w=Object.keys(y).find($=>y[$].currencyCode===B.currencyCode));const{currencyCode:F}=w==null?p:y[w];return{currencyCode:F,tokenId:w}}function n(B,p="Login requires a CAPTCHA"){if(!(this instanceof n))throw new TypeError("Class constructor ChallengeError cannot be invoked without 'new'");var y;function w(F){return y=new Error(F),Object.defineProperty(y,"constructor",{value:n,configurable:!0,writable:!0}),y}return w(p),y.name="ChallengeError",y.challengeId=B.challengeId,y.challengeUri=B.challengeUri,y}function o(B="Please send a larger amount"){if(!(this instanceof o))throw new TypeError("Class constructor DustSpendError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:o,configurable:!0,writable:!0}),p}return y(B),p.name="DustSpendError",p}function i(B={}){if(!(this instanceof i))throw new TypeError("Class constructor InsufficientFundsError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:i,configurable:!0,writable:!0}),p}if(typeof B=="string")B.length>5?y(B):(y(`Insufficient ${B}`),p.currencyCode=B);else{const{currencyCode:w,networkFee:F}=B;y(`Insufficient ${w!=null?w:"funds"}`),p.currencyCode=w,p.networkFee=F}return p.name="InsufficientFundsError",p}function a(B="Cannot reach the network"){if(!(this instanceof a))throw new TypeError("Class constructor NetworkError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:a,configurable:!0,writable:!0}),p}return y(B),p.name="NetworkError",p}function u(B="Unable to create zero-amount transaction."){if(!(this instanceof u))throw new TypeError("Class constructor NoAmountSpecifiedError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:u,configurable:!0,writable:!0}),p}return y(B),p.name="NoAmountSpecifiedError",p}function m(B="The application is too old. Please upgrade."){if(!(this instanceof m))throw new TypeError("Class constructor ObsoleteApiError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:m,configurable:!0,writable:!0}),p}return y(B),p.name="ObsoleteApiError",p}function T(B,p="Invalid OTP token"){if(!(this instanceof T))throw new TypeError("Class constructor OtpError cannot be invoked without 'new'");var y;function w($){return y=new Error($),Object.defineProperty(y,"constructor",{value:T,configurable:!0,writable:!0}),y}w(p),y.name="OtpError",y.reason="otp";const F=t.asMaybe(er)(B);if(F!=null)return F.login_id!=null&&(y.loginId=_.base64.stringify(F.login_id)),y.resetToken=F.otp_reset_auth,y.reason=F.reason,y.resetDate=F.otp_timeout_date,y.voucherActivates=F.voucher_activates,F.voucher_auth!=null&&(y.voucherAuth=_.base64.stringify(F.voucher_auth)),y.voucherId=F.voucher_id,y}function P(B,p="Invalid password"){if(!(this instanceof P))throw new TypeError("Class constructor PasswordError cannot be invoked without 'new'");var y;function w($){return y=new Error($),Object.defineProperty(y,"constructor",{value:P,configurable:!0,writable:!0}),y}w(p),y.name="PasswordError";const F=t.asMaybe(tr)(B);if(F!=null)return y.wait=F.wait_seconds,y}function R(B="Not enough confirmed funds"){if(!(this instanceof R))throw new TypeError("Class constructor PendingFundsError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:R,configurable:!0,writable:!0}),p}return y(B),p.name="PendingFundsError",p}function C(B="Wallets can not be the same currency"){if(!(this instanceof C))throw new TypeError("Class constructor SameCurrencyError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:C,configurable:!0,writable:!0}),p}return y(B),p.name="SameCurrencyError",p}function Ur(B="Spending to self"){if(!(this instanceof Ur))throw new TypeError("Class constructor SpendToSelfError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:Ur,configurable:!0,writable:!0}),p}return y(B),p.name="SpendToSelfError",p}function Tr(B,p,y="from"){if(!(this instanceof Tr))throw new TypeError("Class constructor SwapAboveLimitError cannot be invoked without 'new'");var w;function F($){return w=new Error($),Object.defineProperty(w,"constructor",{value:Tr,configurable:!0,writable:!0}),w}return F("Amount is too high"),w.name="SwapAboveLimitError",w.pluginId=B.pluginId,w.nativeMax=p,w.direction=y,w}function Rr(B,p,y="from"){if(!(this instanceof Rr))throw new TypeError("Class constructor SwapBelowLimitError cannot be invoked without 'new'");var w;function F($){return w=new Error($),Object.defineProperty(w,"constructor",{value:Rr,configurable:!0,writable:!0}),w}return F("Amount is too low"),w.name="SwapBelowLimitError",w.pluginId=B.pluginId,w.nativeMin=p,w.direction=y,w}function kr(B,p,y){if(!(this instanceof kr))throw new TypeError("Class constructor SwapCurrencyError cannot be invoked without 'new'");var w;function F($){return w=new Error($),Object.defineProperty(w,"constructor",{value:kr,configurable:!0,writable:!0}),w}if(typeof p=="string")y=y!=null?y:"unknown",F(`${B.displayName} does not support ${p} to ${y}`),w.name="SwapCurrencyError",w.pluginId=B.pluginId,w.fromCurrency=p,w.toCurrency=y;else{const $=r({allTokens:p.fromWallet.currencyConfig.allTokens,currencyInfo:p.fromWallet.currencyInfo,currencyCode:p.fromCurrencyCode,tokenId:p.fromTokenId}),sr=r({allTokens:p.toWallet.currencyConfig.allTokens,currencyInfo:p.toWallet.currencyInfo,currencyCode:p.toCurrencyCode,tokenId:p.toTokenId}),on=$.tokenId==null?$.currencyCode:`${$.currencyCode} (${$.tokenId})`,an=sr.tokenId==null?sr.currencyCode:`${sr.currencyCode} (${sr.tokenId})`;F(`${B.displayName} does not support ${on} to ${an}`),w.name="SwapCurrencyError",w.pluginId=B.pluginId,w.fromCurrency=$.currencyCode,w.fromTokenId=$.tokenId,w.toCurrency=sr.currencyCode,w.toTokenId=sr.tokenId}return w}function Lr(B,p){if(!(this instanceof Lr))throw new TypeError("Class constructor SwapPermissionError cannot be invoked without 'new'");var y;function w(F){return y=new Error(F),Object.defineProperty(y,"constructor",{value:Lr,configurable:!0,writable:!0}),y}return p!=null?w(p):w("You are not allowed to make this trade"),y.name="SwapPermissionError",y.pluginId=B.pluginId,y.reason=p,y}function vr(B="Invalid username"){if(!(this instanceof vr))throw new TypeError("Class constructor UsernameError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:vr,configurable:!0,writable:!0}),p}return y(B),p.name="UsernameError",p}function V(B){return function(y){if(y instanceof Error&&y.name===B)return y}}const Dr=V("ChallengeError"),Nr=V("DustSpendError"),jr=V("InsufficientFundsError"),$r=V("NetworkError"),Kr=V("NoAmountSpecifiedError"),Vr=V("ObsoleteApiError"),qr=V("OtpError"),Gr=V("PasswordError"),Wr=V("PendingFundsError"),Yr=V("SameCurrencyError"),zr=V("SpendToSelfError"),Hr=V("SwapAboveLimitError"),Qr=V("SwapBelowLimitError"),Zr=V("SwapCurrencyError"),Jr=V("SwapPermissionError"),nn=V("UsernameError"),Xr=t.asObject(E),rn=t.asObject({loginId:h,voucherAuth:h,voucherId:t.asString,created:t.asDate,activates:t.asDate,status:t.asValue("pending","approved","rejected"),ip:t.asString,ipDescription:t.asString,deviceDescription:t.asOptional(t.asString)}),Mr=t.asObject({appId:t.asString,created:t.asOptional(t.asDate,()=>new Date),loginId:h,children:t.asOptional(t.asArray(B=>Mr(B)),()=>[]),parentBox:t.asOptional(E),parentId:()=>{},otpKey:t.asOptional(U),otpResetAuth:t.asOptional(t.asString),otpResetDate:t.asOptional(t.asDate),otpTimeout:t.asOptional(t.asNumber),passwordAuth:t.asOptional(h),passwordAuthBox:t.asOptional(E),passwordAuthSnrp:t.asOptional(O),passwordBox:t.asOptional(E),passwordKeySnrp:t.asOptional(O),pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),pin2Box:t.asOptional(E),pin2KeyBox:t.asOptional(E),pin2TextBox:t.asOptional(E),recovery2Id:t.asOptional(h),recovery2Auth:t.asOptional(d),question2Box:t.asOptional(E),recovery2Box:t.asOptional(E),recovery2KeyBox:t.asOptional(E),loginAuth:t.asOptional(h),loginAuthBox:t.asOptional(E),userId:t.asOptional(h),userTextBox:t.asOptional(E),keyBoxes:t.asOptional(t.asArray(E),()=>[]),mnemonicBox:t.asOptional(E),rootKeyBox:t.asOptional(E),syncKeyBox:t.asOptional(E),vouchers:t.asOptional(t.asArray(rn),()=>[]),pinBox:t.asOptional(E),pinId:t.asOptional(t.asString),pinKeyBox:t.asOptional(E)}),en=t.uncleaner(Mr),tn=t.uncleaner(Xr);l.lJ=n,l.Yy=o,l.C_=i,l.F7=a,l.$D=u,l.D1=m,l.XH=T,l.Yr=P,l.Vq=R,l.AQ=C,l.l0=Ur,l.I9=Tr,l.q0=Rr,l.Iz=kr,l.d2=Lr,l.cI=vr,l.rS=x,l.rZ=U,l._y=h,l.Uk=hr,l.zr=L,l.lK=S,l.t3=A,l.Bp=v,l.bt=M,l.D0=b,l.gN=G,l.oN=q,l.xK=Q,l.mm=ur,l.jS=lr,l.Ei=E,l.NF=j,l.Nz=k,l.OU=Mr,l.mG=s,l.TU=Xr,l.Ko=O,l.EG=rn,l.$5=pr,l.dg=X,l.Wo=f,l.zB=g,l.aQ=Dr,l.y$=Nr,l.X7=jr,l.g4=$r,l.xz=Kr,l.fT=Vr,l.zQ=qr,l.sl=Gr,l.mc=Wr,l.q=Yr,l.SS=zr,l.Yl=Hr,l.Gq=Qr,l.UW=Zr,l.J_=Jr,l.L=nn,l.pZ=nr,l.gd=er,l.IW=fr,l.j5=tr,l.ph=yr,l.BB=d,l.gg=dr,l.v0=D,l.O5=Pr,l.qF=mr,l.Mu=z,l.c4=or,l.kd=br,l.JC=xr,l.hf=Ir,l.aD=H,l.Yn=Z,l.E3=Cr,l.xc=Ar,l.Ml=ir,l.ZT=K,l.Lh=wr,l.wN=Er,l.yd=en,l.zP=tn,l.i5=Sr,l.YU=Or,l.it=gr,l.Ho=Br,l.lG=rr,l.xP=W,l.KG=ar,l.Iq=Fr,l.i7=Y,l.zi=_r,l.iZ=e},80645:function(cr,l){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */l.read=function(I,c,t,_,x){var U,h,s=x*8-_-1,N=(1<<s)-1,E=N>>1,O=-7,k=t?x-1:0,j=t?-1:1,d=I[c+k];for(k+=j,U=d&(1<<-O)-1,d>>=-O,O+=s;O>0;U=U*256+I[c+k],k+=j,O-=8);for(h=U&(1<<-O)-1,U>>=-O,O+=_;O>0;h=h*256+I[c+k],k+=j,O-=8);if(U===0)U=1-E;else{if(U===N)return h?NaN:(d?-1:1)*(1/0);h=h+Math.pow(2,_),U=U-E}return(d?-1:1)*h*Math.pow(2,U-_)},l.write=function(I,c,t,_,x,U){var h,s,N,E=U*8-x-1,O=(1<<E)-1,k=O>>1,j=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=_?0:U-1,f=_?1:-1,g=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(s=isNaN(c)?1:0,h=O):(h=Math.floor(Math.log(c)/Math.LN2),c*(N=Math.pow(2,-h))<1&&(h--,N*=2),h+k>=1?c+=j/N:c+=j*Math.pow(2,1-k),c*N>=2&&(h++,N/=2),h+k>=O?(s=0,h=O):h+k>=1?(s=(c*N-1)*Math.pow(2,x),h=h+k):(s=c*Math.pow(2,k-1)*Math.pow(2,x),h=0));x>=8;I[t+d]=s&255,d+=f,s/=256,x-=8);for(h=h<<x|s,E+=x;E>0;I[t+d]=h&255,d+=f,h/=256,E-=8);I[t+d-f]|=g*128}},55352:function(cr,l){"use strict";Object.defineProperty(l,"__esModule",{value:!0});function I(d,f,g){var L;if(g===void 0&&(g={}),!f.codes){f.codes={};for(var S=0;S<f.chars.length;++S)f.codes[f.chars[S]]=S}if(!g.loose&&d.length*f.bits&7)throw new SyntaxError("Invalid padding");for(var A=d.length;d[A-1]==="=";)if(--A,!g.loose&&!((d.length-A)*f.bits&7))throw new SyntaxError("Invalid padding");for(var v=new((L=g.out)!=null?L:Uint8Array)(A*f.bits/8|0),M=0,b=0,G=0,q=0;q<A;++q){var Q=f.codes[d[q]];if(Q===void 0)throw new SyntaxError("Invalid character "+d[q]);b=b<<f.bits|Q,M+=f.bits,M>=8&&(M-=8,v[G++]=255&b>>M)}if(M>=f.bits||255&b<<8-M)throw new SyntaxError("Unexpected end of data");return v}function c(d,f,g){g===void 0&&(g={});for(var L=g,S=L.pad,A=S===void 0?!0:S,v=(1<<f.bits)-1,M="",b=0,G=0,q=0;q<d.length;++q)for(G=G<<8|255&d[q],b+=8;b>f.bits;)b-=f.bits,M+=f.chars[v&G>>b];if(b&&(M+=f.chars[v&G<<f.bits-b]),A)for(;M.length*f.bits&7;)M+="=";return M}var t={chars:"0123456789ABCDEF",bits:4},_={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},x={chars:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bits:5},U={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},h={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},s={parse:function(f,g){return I(f.toUpperCase(),t,g)},stringify:function(f,g){return c(f,t,g)}},N={parse:function(f,g){return g===void 0&&(g={}),I(g.loose?f.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):f,_,g)},stringify:function(f,g){return c(f,_,g)}},E={parse:function(f,g){return I(f,x,g)},stringify:function(f,g){return c(f,x,g)}},O={parse:function(f,g){return I(f,U,g)},stringify:function(f,g){return c(f,U,g)}},k={parse:function(f,g){return I(f,h,g)},stringify:function(f,g){return c(f,h,g)}},j={parse:I,stringify:c};l.base16=s,l.base32=N,l.base32hex=E,l.base64=O,l.base64url=k,l.codec=j},94935:function(cr,l,I){"use strict";I.d(l,{$D:function(){return h},C_:function(){return x},l0:function(){return j}});var c=I(18595);const t=c.lJ,_=c.Yy,x=c.C_,U=c.F7,h=c.$D,s=c.D1,N=c.XH,E=c.Yr,O=c.Vq,k=c.AQ,j=c.l0,d=c.I9,f=c.q0,g=c.Iz,L=c.d2,S=c.cI,A=c.rS,v=c.rZ,M=c._y,b=c.Uk,G=c.zr,q=c.lK,Q=c.t3,ur=c.Bp,lr=c.bt,hr=c.D0,pr=c.gN,J=c.oN,X=c.xK,nr=c.mm,er=c.jS,fr=c.Ei,tr=c.NF,yr=c.Nz,dr=c.OU,D=c.mG,K=c.TU,wr=c.Ko,Er=c.EG,gr=c.$5,Br=c.dg,mr=c.Wo,z=c.zB,or=c.aQ,br=c.y$,xr=c.X7,Ir=c.g4,H=c.xz,Z=c.fT,Cr=c.zQ,Ar=c.sl,ir=c.mc,Pr=c.q,Sr=c.SS,Or=c.Yl,rr=c.Gq,W=c.UW,ar=c.J_,Fr=c.L,Y=c.pZ,_r=c.gd,e=c.IW,r=c.j5,n=c.ph,o=c.BB,i=c.gg,a=c.v0,u=c.O5,m=c.qF,T=c.Mu,P=c.c4,R=c.kd,C=c.JC,Ur=c.hf,Tr=c.aD,Rr=c.Yn,kr=c.E3,Lr=c.xc,vr=c.Ml,V=c.ZT,Dr=c.Lh,Nr=c.wN,jr=c.yd,$r=c.zP,Kr=c.i5,Vr=c.YU,qr=c.it,Gr=c.Ho,Wr=c.lG,Yr=c.xP,zr=c.KG,Hr=c.Iq,Qr=c.i7,Zr=c.zi,Jr=c.iZ}}]);
|
|
6
|
+
*/const c=I(79742),t=I(80645),_=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;l.Buffer=s,l.SlowBuffer=A,l.INSPECT_MAX_BYTES=50;const x=2147483647;l.kMaxLength=x,s.TYPED_ARRAY_SUPPORT=U(),!s.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function U(){try{const e=new Uint8Array(1),r={foo:function(){return 42}};return Object.setPrototypeOf(r,Uint8Array.prototype),Object.setPrototypeOf(e,r),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(!!s.isBuffer(this))return this.byteOffset}});function h(e){if(e>x)throw new RangeError('The value "'+e+'" is invalid for option "size"');const r=new Uint8Array(e);return Object.setPrototypeOf(r,s.prototype),r}function s(e,r,n){if(typeof e=="number"){if(typeof r=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return k(e)}return N(e,r,n)}s.poolSize=8192;function N(e,r,n){if(typeof e=="string")return j(e,r);if(ArrayBuffer.isView(e))return f(e);if(e==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(G(e,SharedArrayBuffer)||e&&G(e.buffer,SharedArrayBuffer)))return g(e,r,n);if(typeof e=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const o=e.valueOf&&e.valueOf();if(o!=null&&o!==e)return s.from(o,r,n);const i=L(e);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]=="function")return s.from(e[Symbol.toPrimitive]("string"),r,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}s.from=function(e,r,n){return N(e,r,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function E(e){if(typeof e!="number")throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function O(e,r,n){return E(e),e<=0?h(e):r!==void 0?typeof n=="string"?h(e).fill(r,n):h(e).fill(r):h(e)}s.alloc=function(e,r,n){return O(e,r,n)};function k(e){return E(e),h(e<0?0:S(e)|0)}s.allocUnsafe=function(e){return k(e)},s.allocUnsafeSlow=function(e){return k(e)};function j(e,r){if((typeof r!="string"||r==="")&&(r="utf8"),!s.isEncoding(r))throw new TypeError("Unknown encoding: "+r);const n=v(e,r)|0;let o=h(n);const i=o.write(e,r);return i!==n&&(o=o.slice(0,i)),o}function d(e){const r=e.length<0?0:S(e.length)|0,n=h(r);for(let o=0;o<r;o+=1)n[o]=e[o]&255;return n}function f(e){if(G(e,Uint8Array)){const r=new Uint8Array(e);return g(r.buffer,r.byteOffset,r.byteLength)}return d(e)}function g(e,r,n){if(r<0||e.byteLength<r)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<r+(n||0))throw new RangeError('"length" is outside of buffer bounds');let o;return r===void 0&&n===void 0?o=new Uint8Array(e):n===void 0?o=new Uint8Array(e,r):o=new Uint8Array(e,r,n),Object.setPrototypeOf(o,s.prototype),o}function L(e){if(s.isBuffer(e)){const r=S(e.length)|0,n=h(r);return n.length===0||e.copy(n,0,0,r),n}if(e.length!==void 0)return typeof e.length!="number"||sr(e.length)?h(0):d(e);if(e.type==="Buffer"&&Array.isArray(e.data))return d(e.data)}function S(e){if(e>=x)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+x.toString(16)+" bytes");return e|0}function A(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==s.prototype},s.compare=function(r,n){if(G(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),G(n,Uint8Array)&&(n=s.from(n,n.offset,n.byteLength)),!s.isBuffer(r)||!s.isBuffer(n))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===n)return 0;let o=r.length,i=n.length;for(let a=0,u=Math.min(o,i);a<u;++a)if(r[a]!==n[a]){o=r[a],i=n[a];break}return o<i?-1:i<o?1:0},s.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(r,n){if(!Array.isArray(r))throw new TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return s.alloc(0);let o;if(n===void 0)for(n=0,o=0;o<r.length;++o)n+=r[o].length;const i=s.allocUnsafe(n);let a=0;for(o=0;o<r.length;++o){let u=r[o];if(G(u,Uint8Array))a+u.length>i.length?(s.isBuffer(u)||(u=s.from(u)),u.copy(i,a)):Uint8Array.prototype.set.call(i,u,a);else if(s.isBuffer(u))u.copy(i,a);else throw new TypeError('"list" argument must be an Array of Buffers');a+=u.length}return i};function v(e,r){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if(typeof e!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,o=arguments.length>2&&arguments[2]===!0;if(!o&&n===0)return 0;let i=!1;for(;;)switch(r){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return ar(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return n*2;case"hex":return n>>>1;case"base64":return xr(e).length;default:if(i)return o?-1:ar(e).length;r=(""+r).toLowerCase(),i=!0}}s.byteLength=v;function M(e,r,n){let o=!1;if((r===void 0||r<0)&&(r=0),r>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,r>>>=0,n<=r))return"";for(e||(e="utf8");;)switch(e){case"hex":return dr(this,r,n);case"utf8":case"utf-8":return rr(this,r,n);case"ascii":return yr(this,r,n);case"latin1":case"binary":return or(this,r,n);case"base64":return X(this,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return wr(this,r,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}s.prototype._isBuffer=!0;function b(e,r,n){const o=e[r];e[r]=e[n],e[n]=o}s.prototype.swap16=function(){const r=this.length;if(r%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let n=0;n<r;n+=2)b(this,n,n+1);return this},s.prototype.swap32=function(){const r=this.length;if(r%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let n=0;n<r;n+=4)b(this,n,n+3),b(this,n+1,n+2);return this},s.prototype.swap64=function(){const r=this.length;if(r%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let n=0;n<r;n+=8)b(this,n,n+7),b(this,n+1,n+6),b(this,n+2,n+5),b(this,n+3,n+4);return this},s.prototype.toString=function(){const r=this.length;return r===0?"":arguments.length===0?rr(this,0,r):M.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(r){if(!s.isBuffer(r))throw new TypeError("Argument must be a Buffer");return this===r?!0:s.compare(this,r)===0},s.prototype.inspect=function(){let r="";const n=l.INSPECT_MAX_BYTES;return r=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(r+=" ... "),"<Buffer "+r+">"},_&&(s.prototype[_]=s.prototype.inspect),s.prototype.compare=function(r,n,o,i,a){if(G(r,Uint8Array)&&(r=s.from(r,r.offset,r.byteLength)),!s.isBuffer(r))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(n===void 0&&(n=0),o===void 0&&(o=r?r.length:0),i===void 0&&(i=0),a===void 0&&(a=this.length),n<0||o>r.length||i<0||a>this.length)throw new RangeError("out of range index");if(i>=a&&n>=o)return 0;if(i>=a)return-1;if(n>=o)return 1;if(n>>>=0,o>>>=0,i>>>=0,a>>>=0,this===r)return 0;let u=a-i,m=o-n;const T=Math.min(u,m),P=this.slice(i,a),R=r.slice(n,o);for(let C=0;C<T;++C)if(P[C]!==R[C]){u=P[C],m=R[C];break}return u<m?-1:m<u?1:0};function q(e,r,n,o,i){if(e.length===0)return-1;if(typeof n=="string"?(o=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,sr(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof r=="string"&&(r=s.from(r,o)),s.isBuffer(r))return r.length===0?-1:V(e,r,n,o,i);if(typeof r=="number")return r=r&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,r,n):Uint8Array.prototype.lastIndexOf.call(e,r,n):V(e,[r],n,o,i);throw new TypeError("val must be string, number or Buffer")}function V(e,r,n,o,i){let a=1,u=e.length,m=r.length;if(o!==void 0&&(o=String(o).toLowerCase(),o==="ucs2"||o==="ucs-2"||o==="utf16le"||o==="utf-16le")){if(e.length<2||r.length<2)return-1;a=2,u/=2,m/=2,n/=2}function T(R,C){return a===1?R[C]:R.readUInt16BE(C*a)}let P;if(i){let R=-1;for(P=n;P<u;P++)if(T(e,P)===T(r,R===-1?0:P-R)){if(R===-1&&(R=P),P-R+1===m)return R*a}else R!==-1&&(P-=P-R),R=-1}else for(n+m>u&&(n=u-m),P=n;P>=0;P--){let R=!0;for(let C=0;C<m;C++)if(T(e,P+C)!==T(r,C)){R=!1;break}if(R)return P}return-1}s.prototype.includes=function(r,n,o){return this.indexOf(r,n,o)!==-1},s.prototype.indexOf=function(r,n,o){return q(this,r,n,o,!0)},s.prototype.lastIndexOf=function(r,n,o){return q(this,r,n,o,!1)};function Q(e,r,n,o){n=Number(n)||0;const i=e.length-n;o?(o=Number(o),o>i&&(o=i)):o=i;const a=r.length;o>a/2&&(o=a/2);let u;for(u=0;u<o;++u){const m=parseInt(r.substr(u*2,2),16);if(sr(m))return u;e[n+u]=m}return u}function lr(e,r,n,o){return nr(ar(r,e.length-n),e,n,o)}function hr(e,r,n,o){return nr(Sr(r),e,n,o)}function pr(e,r,n,o){return nr(xr(r),e,n,o)}function fr(e,r,n,o){return nr(Fr(r,e.length-n),e,n,o)}s.prototype.write=function(r,n,o,i){if(n===void 0)i="utf8",o=this.length,n=0;else if(o===void 0&&typeof n=="string")i=n,o=this.length,n=0;else if(isFinite(n))n=n>>>0,isFinite(o)?(o=o>>>0,i===void 0&&(i="utf8")):(i=o,o=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const a=this.length-n;if((o===void 0||o>a)&&(o=a),r.length>0&&(o<0||n<0)||n>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let u=!1;for(;;)switch(i){case"hex":return Q(this,r,n,o);case"utf8":case"utf-8":return lr(this,r,n,o);case"ascii":case"latin1":case"binary":return hr(this,r,n,o);case"base64":return pr(this,r,n,o);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return fr(this,r,n,o);default:if(u)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),u=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function X(e,r,n){return r===0&&n===e.length?c.fromByteArray(e):c.fromByteArray(e.slice(r,n))}function rr(e,r,n){n=Math.min(e.length,n);const o=[];let i=r;for(;i<n;){const a=e[i];let u=null,m=a>239?4:a>223?3:a>191?2:1;if(i+m<=n){let T,P,R,C;switch(m){case 1:a<128&&(u=a);break;case 2:T=e[i+1],(T&192)===128&&(C=(a&31)<<6|T&63,C>127&&(u=C));break;case 3:T=e[i+1],P=e[i+2],(T&192)===128&&(P&192)===128&&(C=(a&15)<<12|(T&63)<<6|P&63,C>2047&&(C<55296||C>57343)&&(u=C));break;case 4:T=e[i+1],P=e[i+2],R=e[i+3],(T&192)===128&&(P&192)===128&&(R&192)===128&&(C=(a&15)<<18|(T&63)<<12|(P&63)<<6|R&63,C>65535&&C<1114112&&(u=C))}}u===null?(u=65533,m=1):u>65535&&(u-=65536,o.push(u>>>10&1023|55296),u=56320|u&1023),o.push(u),i+=m}return tr(o)}const er=4096;function tr(e){const r=e.length;if(r<=er)return String.fromCharCode.apply(String,e);let n="",o=0;for(;o<r;)n+=String.fromCharCode.apply(String,e.slice(o,o+=er));return n}function yr(e,r,n){let o="";n=Math.min(e.length,n);for(let i=r;i<n;++i)o+=String.fromCharCode(e[i]&127);return o}function or(e,r,n){let o="";n=Math.min(e.length,n);for(let i=r;i<n;++i)o+=String.fromCharCode(e[i]);return o}function dr(e,r,n){const o=e.length;(!r||r<0)&&(r=0),(!n||n<0||n>o)&&(n=o);let i="";for(let a=r;a<n;++a)i+=_r[e[a]];return i}function wr(e,r,n){const o=e.slice(r,n);let i="";for(let a=0;a<o.length-1;a+=2)i+=String.fromCharCode(o[a]+o[a+1]*256);return i}s.prototype.slice=function(r,n){const o=this.length;r=~~r,n=n===void 0?o:~~n,r<0?(r+=o,r<0&&(r=0)):r>o&&(r=o),n<0?(n+=o,n<0&&(n=0)):n>o&&(n=o),n<r&&(n=r);const i=this.subarray(r,n);return Object.setPrototypeOf(i,s.prototype),i};function D(e,r,n){if(e%1!==0||e<0)throw new RangeError("offset is not uint");if(e+r>n)throw new RangeError("Trying to access beyond buffer length")}s.prototype.readUintLE=s.prototype.readUIntLE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r],a=1,u=0;for(;++u<n&&(a*=256);)i+=this[r+u]*a;return i},s.prototype.readUintBE=s.prototype.readUIntBE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r+--n],a=1;for(;n>0&&(a*=256);)i+=this[r+--n]*a;return i},s.prototype.readUint8=s.prototype.readUInt8=function(r,n){return r=r>>>0,n||D(r,1,this.length),this[r]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(r,n){return r=r>>>0,n||D(r,2,this.length),this[r]|this[r+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(r,n){return r=r>>>0,n||D(r,2,this.length),this[r]<<8|this[r+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(r,n){return r=r>>>0,n||D(r,4,this.length),(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},s.prototype.readBigUInt64LE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24,a=this[++r]+this[++r]*2**8+this[++r]*2**16+o*2**24;return BigInt(i)+(BigInt(a)<<BigInt(32))}),s.prototype.readBigUInt64BE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=n*2**24+this[++r]*2**16+this[++r]*2**8+this[++r],a=this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+o;return(BigInt(i)<<BigInt(32))+BigInt(a)}),s.prototype.readIntLE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=this[r],a=1,u=0;for(;++u<n&&(a*=256);)i+=this[r+u]*a;return a*=128,i>=a&&(i-=Math.pow(2,8*n)),i},s.prototype.readIntBE=function(r,n,o){r=r>>>0,n=n>>>0,o||D(r,n,this.length);let i=n,a=1,u=this[r+--i];for(;i>0&&(a*=256);)u+=this[r+--i]*a;return a*=128,u>=a&&(u-=Math.pow(2,8*n)),u},s.prototype.readInt8=function(r,n){return r=r>>>0,n||D(r,1,this.length),this[r]&128?(255-this[r]+1)*-1:this[r]},s.prototype.readInt16LE=function(r,n){r=r>>>0,n||D(r,2,this.length);const o=this[r]|this[r+1]<<8;return o&32768?o|4294901760:o},s.prototype.readInt16BE=function(r,n){r=r>>>0,n||D(r,2,this.length);const o=this[r+1]|this[r]<<8;return o&32768?o|4294901760:o},s.prototype.readInt32LE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},s.prototype.readInt32BE=function(r,n){return r=r>>>0,n||D(r,4,this.length),this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},s.prototype.readBigInt64LE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=this[r+4]+this[r+5]*2**8+this[r+6]*2**16+(o<<24);return(BigInt(i)<<BigInt(32))+BigInt(n+this[++r]*2**8+this[++r]*2**16+this[++r]*2**24)}),s.prototype.readBigInt64BE=Y(function(r){r=r>>>0,H(r,"offset");const n=this[r],o=this[r+7];(n===void 0||o===void 0)&&Z(r,this.length-8);const i=(n<<24)+this[++r]*2**16+this[++r]*2**8+this[++r];return(BigInt(i)<<BigInt(32))+BigInt(this[++r]*2**24+this[++r]*2**16+this[++r]*2**8+o)}),s.prototype.readFloatLE=function(r,n){return r=r>>>0,n||D(r,4,this.length),t.read(this,r,!0,23,4)},s.prototype.readFloatBE=function(r,n){return r=r>>>0,n||D(r,4,this.length),t.read(this,r,!1,23,4)},s.prototype.readDoubleLE=function(r,n){return r=r>>>0,n||D(r,8,this.length),t.read(this,r,!0,52,8)},s.prototype.readDoubleBE=function(r,n){return r=r>>>0,n||D(r,8,this.length),t.read(this,r,!1,52,8)};function $(e,r,n,o,i,a){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<a)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(r,n,o,i){if(r=+r,n=n>>>0,o=o>>>0,!i){const m=Math.pow(2,8*o)-1;$(this,r,n,o,m,0)}let a=1,u=0;for(this[n]=r&255;++u<o&&(a*=256);)this[n+u]=r/a&255;return n+o},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(r,n,o,i){if(r=+r,n=n>>>0,o=o>>>0,!i){const m=Math.pow(2,8*o)-1;$(this,r,n,o,m,0)}let a=o-1,u=1;for(this[n+a]=r&255;--a>=0&&(u*=256);)this[n+a]=r/u&255;return n+o},s.prototype.writeUint8=s.prototype.writeUInt8=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,1,255,0),this[n]=r&255,n+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,2,65535,0),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,2,65535,0),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,4,4294967295,0),this[n+3]=r>>>24,this[n+2]=r>>>16,this[n+1]=r>>>8,this[n]=r&255,n+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,4,4294967295,0),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4};function Er(e,r,n,o,i){Or(r,o,i,e,n,7);let a=Number(r&BigInt(4294967295));e[n++]=a,a=a>>8,e[n++]=a,a=a>>8,e[n++]=a,a=a>>8,e[n++]=a;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[n++]=u,u=u>>8,e[n++]=u,u=u>>8,e[n++]=u,u=u>>8,e[n++]=u,n}function gr(e,r,n,o,i){Or(r,o,i,e,n,7);let a=Number(r&BigInt(4294967295));e[n+7]=a,a=a>>8,e[n+6]=a,a=a>>8,e[n+5]=a,a=a>>8,e[n+4]=a;let u=Number(r>>BigInt(32)&BigInt(4294967295));return e[n+3]=u,u=u>>8,e[n+2]=u,u=u>>8,e[n+1]=u,u=u>>8,e[n]=u,n+8}s.prototype.writeBigUInt64LE=Y(function(r,n=0){return Er(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeBigUInt64BE=Y(function(r,n=0){return gr(this,r,n,BigInt(0),BigInt("0xffffffffffffffff"))}),s.prototype.writeIntLE=function(r,n,o,i){if(r=+r,n=n>>>0,!i){const T=Math.pow(2,8*o-1);$(this,r,n,o,T-1,-T)}let a=0,u=1,m=0;for(this[n]=r&255;++a<o&&(u*=256);)r<0&&m===0&&this[n+a-1]!==0&&(m=1),this[n+a]=(r/u>>0)-m&255;return n+o},s.prototype.writeIntBE=function(r,n,o,i){if(r=+r,n=n>>>0,!i){const T=Math.pow(2,8*o-1);$(this,r,n,o,T-1,-T)}let a=o-1,u=1,m=0;for(this[n+a]=r&255;--a>=0&&(u*=256);)r<0&&m===0&&this[n+a+1]!==0&&(m=1),this[n+a]=(r/u>>0)-m&255;return n+o},s.prototype.writeInt8=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,1,127,-128),r<0&&(r=255+r+1),this[n]=r&255,n+1},s.prototype.writeInt16LE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,2,32767,-32768),this[n]=r&255,this[n+1]=r>>>8,n+2},s.prototype.writeInt16BE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,2,32767,-32768),this[n]=r>>>8,this[n+1]=r&255,n+2},s.prototype.writeInt32LE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,4,2147483647,-2147483648),this[n]=r&255,this[n+1]=r>>>8,this[n+2]=r>>>16,this[n+3]=r>>>24,n+4},s.prototype.writeInt32BE=function(r,n,o){return r=+r,n=n>>>0,o||$(this,r,n,4,2147483647,-2147483648),r<0&&(r=4294967295+r+1),this[n]=r>>>24,this[n+1]=r>>>16,this[n+2]=r>>>8,this[n+3]=r&255,n+4},s.prototype.writeBigInt64LE=Y(function(r,n=0){return Er(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),s.prototype.writeBigInt64BE=Y(function(r,n=0){return gr(this,r,n,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Br(e,r,n,o,i,a){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function mr(e,r,n,o,i){return r=+r,n=n>>>0,i||Br(e,r,n,4,34028234663852886e22,-34028234663852886e22),t.write(e,r,n,o,23,4),n+4}s.prototype.writeFloatLE=function(r,n,o){return mr(this,r,n,!0,o)},s.prototype.writeFloatBE=function(r,n,o){return mr(this,r,n,!1,o)};function br(e,r,n,o,i){return r=+r,n=n>>>0,i||Br(e,r,n,8,17976931348623157e292,-17976931348623157e292),t.write(e,r,n,o,52,8),n+8}s.prototype.writeDoubleLE=function(r,n,o){return br(this,r,n,!0,o)},s.prototype.writeDoubleBE=function(r,n,o){return br(this,r,n,!1,o)},s.prototype.copy=function(r,n,o,i){if(!s.isBuffer(r))throw new TypeError("argument should be a Buffer");if(o||(o=0),!i&&i!==0&&(i=this.length),n>=r.length&&(n=r.length),n||(n=0),i>0&&i<o&&(i=o),i===o||r.length===0||this.length===0)return 0;if(n<0)throw new RangeError("targetStart out of bounds");if(o<0||o>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),r.length-n<i-o&&(i=r.length-n+o);const a=i-o;return this===r&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(n,o,i):Uint8Array.prototype.set.call(r,this.subarray(o,i),n),a},s.prototype.fill=function(r,n,o,i){if(typeof r=="string"){if(typeof n=="string"?(i=n,n=0,o=this.length):typeof o=="string"&&(i=o,o=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!s.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(r.length===1){const u=r.charCodeAt(0);(i==="utf8"&&u<128||i==="latin1")&&(r=u)}}else typeof r=="number"?r=r&255:typeof r=="boolean"&&(r=Number(r));if(n<0||this.length<n||this.length<o)throw new RangeError("Out of range index");if(o<=n)return this;n=n>>>0,o=o===void 0?this.length:o>>>0,r||(r=0);let a;if(typeof r=="number")for(a=n;a<o;++a)this[a]=r;else{const u=s.isBuffer(r)?r:s.from(r,i),m=u.length;if(m===0)throw new TypeError('The value "'+r+'" is invalid for argument "value"');for(a=0;a<o-n;++a)this[a+n]=u[a%m]}return this};const z={};function ir(e,r,n){z[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:r.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}ir("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),ir("ERR_INVALID_ARG_TYPE",function(e,r){return`The "${e}" argument must be of type number. Received type ${typeof r}`},TypeError),ir("ERR_OUT_OF_RANGE",function(e,r,n){let o=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=Ir(String(n)):typeof n=="bigint"&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=Ir(i)),i+="n"),o+=` It must be ${r}. Received ${i}`,o},RangeError);function Ir(e){let r="",n=e.length;const o=e[0]==="-"?1:0;for(;n>=o+4;n-=3)r=`_${e.slice(n-3,n)}${r}`;return`${e.slice(0,n)}${r}`}function Cr(e,r,n){H(r,"offset"),(e[r]===void 0||e[r+n]===void 0)&&Z(r,e.length-(n+1))}function Or(e,r,n,o,i,a){if(e>n||e<r){const u=typeof r=="bigint"?"n":"";let m;throw a>3?r===0||r===BigInt(0)?m=`>= 0${u} and < 2${u} ** ${(a+1)*8}${u}`:m=`>= -(2${u} ** ${(a+1)*8-1}${u}) and < 2 ** ${(a+1)*8-1}${u}`:m=`>= ${r}${u} and <= ${n}${u}`,new z.ERR_OUT_OF_RANGE("value",m,e)}Cr(o,i,a)}function H(e,r){if(typeof e!="number")throw new z.ERR_INVALID_ARG_TYPE(r,"number",e)}function Z(e,r,n){throw Math.floor(e)!==e?(H(e,n),new z.ERR_OUT_OF_RANGE(n||"offset","an integer",e)):r<0?new z.ERR_BUFFER_OUT_OF_BOUNDS:new z.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${r}`,e)}const Ar=/[^+/0-9A-Za-z-_]/g;function Pr(e){if(e=e.split("=")[0],e=e.trim().replace(Ar,""),e.length<2)return"";for(;e.length%4!==0;)e=e+"=";return e}function ar(e,r){r=r||1/0;let n;const o=e.length;let i=null;const a=[];for(let u=0;u<o;++u){if(n=e.charCodeAt(u),n>55295&&n<57344){if(!i){if(n>56319){(r-=3)>-1&&a.push(239,191,189);continue}else if(u+1===o){(r-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(r-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(r-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if((r-=1)<0)break;a.push(n)}else if(n<2048){if((r-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((r-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((r-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw new Error("Invalid code point")}return a}function Sr(e){const r=[];for(let n=0;n<e.length;++n)r.push(e.charCodeAt(n)&255);return r}function Fr(e,r){let n,o,i;const a=[];for(let u=0;u<e.length&&!((r-=2)<0);++u)n=e.charCodeAt(u),o=n>>8,i=n%256,a.push(i),a.push(o);return a}function xr(e){return c.toByteArray(Pr(e))}function nr(e,r,n,o){let i;for(i=0;i<o&&!(i+n>=r.length||i>=e.length);++i)r[i+n]=e[i];return i}function G(e,r){return e instanceof r||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===r.name}function sr(e){return e!==e}const _r=function(){const e="0123456789abcdef",r=new Array(256);for(let n=0;n<16;++n){const o=n*16;for(let i=0;i<16;++i)r[o+i]=e[n]+e[i]}return r}();function Y(e){return typeof BigInt>"u"?Ur:e}function Ur(){throw new Error("BigInt not supported")}},18595:function(ur,l,I){"use strict";var c;c={value:!0};var t=I(47630),_=I(55352);const x=t.asCodec(B=>_.base16.parse(t.asString(B)),B=>_.base16.stringify(B).toLowerCase()),U=t.asCodec(B=>_.base32.parse(t.asString(B),{loose:!0}),B=>_.base32.stringify(B,{pad:!1})),h=t.asCodec(B=>_.base64.parse(t.asString(B)),B=>_.base64.stringify(B)),s=t.asObject({voucherId:t.asString,activates:t.asDate,created:t.asDate,ip:t.asString,ipDescription:t.asString,deviceDescription:t.asOptional(t.asString)}),N=t.asObject({min_length:t.asNumber,category:t.asValue("address","must","numeric","recovery2","string"),question:t.asString}),E=t.asObject({encryptionType:t.asNumber,data_base64:h,iv_hex:x}),O=t.asObject({salt_hex:x,n:t.asNumber,r:t.asNumber,p:t.asNumber}),k=t.asObject({loginRequest:t.asOptional(t.asObject({appId:t.asString}).withRest),publicKey:h,timeout:t.asOptional(t.asNumber)}).withRest,j=t.asObject({publicKey:h,box:E}),d=t.asArray(h),f=t.asObject({data:t.asUnknown,challengeId:t.asOptional(t.asString),deviceDescription:t.asOptional(t.asString),otp:t.asOptional(t.asString),syncToken:t.asOptional(t.asString),voucherId:t.asOptional(t.asString),voucherAuth:t.asOptional(h),loginId:t.asOptional(h),loginAuth:t.asOptional(h),userId:t.asOptional(h),passwordAuth:t.asOptional(h),pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),recovery2Id:t.asOptional(h),recovery2Auth:t.asOptional(d),loginIds:t.asOptional(t.asArray(h)),otpResetAuth:t.asOptional(t.asString),did:t.asOptional(t.asString),l1:t.asOptional(h),lp1:t.asOptional(h),lpin1:t.asOptional(h),lra1:t.asOptional(h),recoveryAuth:t.asOptional(h)}),g=t.asObject({results:t.asOptional(t.asUnknown),status_code:t.asNumber,message:t.asString}),L=t.asObject({otpTimeout:t.asOptional(t.asNumber,7*24*60*60),otpKey:U}),S=t.asObject({passwordAuth:h,passwordAuthBox:E,passwordAuthSnrp:O,passwordBox:E,passwordKeySnrp:O}),A=t.asObject({pin2Id:h}),v=t.asObject({pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),pin2Box:t.asOptional(E),pin2KeyBox:t.asOptional(E),pin2TextBox:E}),M=t.asObject({recovery2Id:h}),b=t.asObject({recovery2Id:h,recovery2Auth:d,recovery2Box:E,recovery2KeyBox:E,question2Box:E}),q=t.asObject({loginAuthBox:E,loginAuth:h}),V=t.asObject({userId:h,userTextBox:E}),Q=t.asObject({approvedVouchers:t.asOptional(t.asArray(t.asString)),rejectedVouchers:t.asOptional(t.asArray(t.asString))}),lr=t.asObject({keyBoxes:t.asArray(E),newSyncKeys:t.asOptional(t.asArray(t.asString),()=>[])}),hr=t.asObject({appId:t.asString,loginId:h,parentBox:t.asOptional(E)}),pr=t.asObject({challengeId:t.asString,challengeUri:t.asString}),fr=t.asObject({request:k,replies:t.asArray(j)}),X=t.asValue(!0),rr=t.asObject({appId:t.asString,created:t.asDate,loginId:h,syncToken:t.asOptional(t.asString),children:t.asOptional(t.asArray(B=>rr(B))),parentBox:t.asOptional(E),otpKey:t.asOptional(t.asEither(X,U)),otpResetDate:t.asOptional(t.asDate),otpTimeout:t.asOptional(t.asNumber),passwordAuthBox:t.asOptional(E),passwordAuthSnrp:t.asOptional(O),passwordBox:t.asOptional(t.asEither(X,E)),passwordKeySnrp:t.asOptional(O),pin2Box:t.asOptional(t.asEither(X,E)),pin2KeyBox:t.asOptional(E),pin2TextBox:t.asOptional(E),question2Box:t.asOptional(E),recovery2Box:t.asOptional(t.asEither(X,E)),recovery2KeyBox:t.asOptional(E),loginAuthBox:t.asOptional(E),userId:t.asOptional(h),userTextBox:t.asOptional(E),pendingVouchers:t.asOptional(t.asArray(s),()=>[]),keyBoxes:t.asOptional(t.asArray(E)),mnemonicBox:t.asOptional(E),rootKeyBox:t.asOptional(E),syncKeyBox:t.asOptional(E)}),er=t.asArray(t.asObject({loginId:h,otpResetPending:t.asOptional(t.asBoolean,!1),pendingVouchers:t.asOptional(t.asArray(s),()=>[]),recovery2Corrupt:t.asOptional(t.asBoolean,!1)})),tr=t.asObject({login_id:t.asOptional(h),otp_reset_auth:t.asOptional(t.asString),otp_timeout_date:t.asOptional(t.asDate),reason:t.asOptional(t.asValue("ip","otp"),"otp"),voucher_activates:t.asOptional(t.asDate),voucher_auth:t.asOptional(h),voucher_id:t.asOptional(t.asString)}),yr=t.asObject({otpResetDate:t.asDate}),or=t.asObject({wait_seconds:t.asOptional(t.asNumber)}),dr=t.asArray(N),wr=t.asObject({question2Box:E}),D=t.asObject({loginId:h,passwordAuthSnrp:t.asOptional(O),questionBox:t.asOptional(E),questionKeySnrp:t.asOptional(O),recoveryAuthSnrp:t.asOptional(O)}),$=t.uncleaner(E),Er=t.uncleaner(j),gr=t.uncleaner(k),Br=t.uncleaner(f),mr=t.uncleaner(g),br=t.uncleaner(L),z=t.uncleaner(S),ir=t.uncleaner(A),Ir=t.uncleaner(v),Cr=t.uncleaner(M),Or=t.uncleaner(b),H=t.uncleaner(q),Z=t.uncleaner(V),Ar=t.uncleaner(Q),Pr=t.uncleaner(lr),ar=t.uncleaner(hr),Sr=t.uncleaner(pr),Fr=t.uncleaner(fr),xr=t.uncleaner(rr),nr=t.uncleaner(er),G=t.uncleaner(tr),sr=t.uncleaner(yr),_r=t.uncleaner(or),Y=t.uncleaner(dr),Ur=t.uncleaner(wr),e=t.uncleaner(D);function r(B){const{currencyInfo:p,allTokens:y}=B;let w=B.tokenId;w===void 0&&B.currencyCode!=null&&B.currencyCode!==p.currencyCode&&(w=Object.keys(y).find(W=>y[W].currencyCode===B.currencyCode));const{currencyCode:F}=w==null?p:y[w];return{currencyCode:F,tokenId:w}}function n(B,p="Login requires a CAPTCHA"){if(!(this instanceof n))throw new TypeError("Class constructor ChallengeError cannot be invoked without 'new'");var y;function w(F){return y=new Error(F),Object.defineProperty(y,"constructor",{value:n,configurable:!0,writable:!0}),y}return w(p),y.name="ChallengeError",y.challengeId=B.challengeId,y.challengeUri=B.challengeUri,y}function o(B="Please send a larger amount"){if(!(this instanceof o))throw new TypeError("Class constructor DustSpendError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:o,configurable:!0,writable:!0}),p}return y(B),p.name="DustSpendError",p}function i(B={}){if(!(this instanceof i))throw new TypeError("Class constructor InsufficientFundsError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:i,configurable:!0,writable:!0}),p}if(typeof B=="string")B.length>5?y(B):(y(`Insufficient ${B}`),p.currencyCode=B);else{const{currencyCode:w,networkFee:F}=B;y(`Insufficient ${w!=null?w:"funds"}`),p.currencyCode=w,p.networkFee=F}return p.name="InsufficientFundsError",p}function a(B="Cannot reach the network"){if(!(this instanceof a))throw new TypeError("Class constructor NetworkError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:a,configurable:!0,writable:!0}),p}return y(B),p.name="NetworkError",p}function u(B="Unable to create zero-amount transaction."){if(!(this instanceof u))throw new TypeError("Class constructor NoAmountSpecifiedError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:u,configurable:!0,writable:!0}),p}return y(B),p.name="NoAmountSpecifiedError",p}function m(B="The application is too old. Please upgrade."){if(!(this instanceof m))throw new TypeError("Class constructor ObsoleteApiError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:m,configurable:!0,writable:!0}),p}return y(B),p.name="ObsoleteApiError",p}function T(B,p="Invalid OTP token"){if(!(this instanceof T))throw new TypeError("Class constructor OtpError cannot be invoked without 'new'");var y;function w(W){return y=new Error(W),Object.defineProperty(y,"constructor",{value:T,configurable:!0,writable:!0}),y}w(p),y.name="OtpError",y.reason="otp";const F=t.asMaybe(tr)(B);if(F!=null)return F.login_id!=null&&(y.loginId=_.base64.stringify(F.login_id)),y.resetToken=F.otp_reset_auth,y.reason=F.reason,y.resetDate=F.otp_timeout_date,y.voucherActivates=F.voucher_activates,F.voucher_auth!=null&&(y.voucherAuth=_.base64.stringify(F.voucher_auth)),y.voucherId=F.voucher_id,y}function P(B,p="Invalid password"){if(!(this instanceof P))throw new TypeError("Class constructor PasswordError cannot be invoked without 'new'");var y;function w(W){return y=new Error(W),Object.defineProperty(y,"constructor",{value:P,configurable:!0,writable:!0}),y}w(p),y.name="PasswordError";const F=t.asMaybe(or)(B);if(F!=null)return y.wait=F.wait_seconds,y}function R(B="Not enough confirmed funds"){if(!(this instanceof R))throw new TypeError("Class constructor PendingFundsError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:R,configurable:!0,writable:!0}),p}return y(B),p.name="PendingFundsError",p}function C(B="Wallets can not be the same currency"){if(!(this instanceof C))throw new TypeError("Class constructor SameCurrencyError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:C,configurable:!0,writable:!0}),p}return y(B),p.name="SameCurrencyError",p}function Tr(B="Spending to self"){if(!(this instanceof Tr))throw new TypeError("Class constructor SpendToSelfError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:Tr,configurable:!0,writable:!0}),p}return y(B),p.name="SpendToSelfError",p}function Rr(B,p,y="from"){if(!(this instanceof Rr))throw new TypeError("Class constructor SwapAboveLimitError cannot be invoked without 'new'");var w;function F(W){return w=new Error(W),Object.defineProperty(w,"constructor",{value:Rr,configurable:!0,writable:!0}),w}return F("Amount is too high"),w.name="SwapAboveLimitError",w.pluginId=B.pluginId,w.nativeMax=p,w.direction=y,w}function kr(B,p,y="from"){if(!(this instanceof kr))throw new TypeError("Class constructor SwapBelowLimitError cannot be invoked without 'new'");var w;function F(W){return w=new Error(W),Object.defineProperty(w,"constructor",{value:kr,configurable:!0,writable:!0}),w}return F("Amount is too low"),w.name="SwapBelowLimitError",w.pluginId=B.pluginId,w.nativeMin=p,w.direction=y,w}function Lr(B,p,y){var W,en;if(!(this instanceof Lr))throw new TypeError("Class constructor SwapCurrencyError cannot be invoked without 'new'");var w;function F(J){return w=new Error(J),Object.defineProperty(w,"constructor",{value:Lr,configurable:!0,writable:!0}),w}if(typeof p=="string")y=y!=null?y:"unknown",F(`${B.displayName} does not support ${p} to ${y}`),w.name="SwapCurrencyError",w.pluginId=B.pluginId,w.fromCurrency=p,w.toCurrency=y;else{const J=r({allTokens:p.fromWallet.currencyConfig.allTokens,currencyInfo:p.fromWallet.currencyInfo,currencyCode:p.fromCurrencyCode,tokenId:p.fromTokenId}),cr=r({allTokens:p.toWallet.currencyConfig.allTokens,currencyInfo:p.toWallet.currencyInfo,currencyCode:p.toCurrencyCode,tokenId:p.toTokenId}),sn=J.tokenId==null?J.currencyCode:`${J.currencyCode} (${J.tokenId})`,cn=cr.tokenId==null?cr.currencyCode:`${cr.currencyCode} (${cr.tokenId})`;F(`${B.displayName} does not support ${sn} to ${cn}`),w.name="SwapCurrencyError",w.pluginId=B.pluginId,w.fromCurrency=J.currencyCode,w.fromTokenId=(W=J.tokenId)!=null?W:null,w.toCurrency=cr.currencyCode,w.toTokenId=(en=cr.tokenId)!=null?en:null}return w}function vr(B,p){if(!(this instanceof vr))throw new TypeError("Class constructor SwapPermissionError cannot be invoked without 'new'");var y;function w(F){return y=new Error(F),Object.defineProperty(y,"constructor",{value:vr,configurable:!0,writable:!0}),y}return p!=null?w(p):w("You are not allowed to make this trade"),y.name="SwapPermissionError",y.pluginId=B.pluginId,y.reason=p,y}function Mr(B="Invalid username"){if(!(this instanceof Mr))throw new TypeError("Class constructor UsernameError cannot be invoked without 'new'");var p;function y(w){return p=new Error(w),Object.defineProperty(p,"constructor",{value:Mr,configurable:!0,writable:!0}),p}return y(B),p.name="UsernameError",p}function K(B){return function(y){if(y instanceof Error&&y.name===B)return y}}const Nr=K("ChallengeError"),jr=K("DustSpendError"),$r=K("InsufficientFundsError"),Kr=K("NetworkError"),Vr=K("NoAmountSpecifiedError"),qr=K("ObsoleteApiError"),Gr=K("OtpError"),Wr=K("PasswordError"),Yr=K("PendingFundsError"),zr=K("SameCurrencyError"),Hr=K("SpendToSelfError"),Qr=K("SwapAboveLimitError"),Zr=K("SwapBelowLimitError"),Jr=K("SwapCurrencyError"),Xr=K("SwapPermissionError"),tn=K("UsernameError"),rn=t.asObject(E),nn=t.asObject({loginId:h,voucherAuth:h,voucherId:t.asString,created:t.asDate,activates:t.asDate,status:t.asValue("pending","approved","rejected"),ip:t.asString,ipDescription:t.asString,deviceDescription:t.asOptional(t.asString)}),Dr=t.asObject({appId:t.asString,created:t.asOptional(t.asDate,()=>new Date),loginId:h,children:t.asOptional(t.asArray(B=>Dr(B)),()=>[]),parentBox:t.asOptional(E),parentId:()=>{},otpKey:t.asOptional(U),otpResetAuth:t.asOptional(t.asString),otpResetDate:t.asOptional(t.asDate),otpTimeout:t.asOptional(t.asNumber),passwordAuth:t.asOptional(h),passwordAuthBox:t.asOptional(E),passwordAuthSnrp:t.asOptional(O),passwordBox:t.asOptional(E),passwordKeySnrp:t.asOptional(O),pin2Id:t.asOptional(h),pin2Auth:t.asOptional(h),pin2Box:t.asOptional(E),pin2KeyBox:t.asOptional(E),pin2TextBox:t.asOptional(E),recovery2Id:t.asOptional(h),recovery2Auth:t.asOptional(d),question2Box:t.asOptional(E),recovery2Box:t.asOptional(E),recovery2KeyBox:t.asOptional(E),loginAuth:t.asOptional(h),loginAuthBox:t.asOptional(E),userId:t.asOptional(h),userTextBox:t.asOptional(E),keyBoxes:t.asOptional(t.asArray(E),()=>[]),mnemonicBox:t.asOptional(E),rootKeyBox:t.asOptional(E),syncKeyBox:t.asOptional(E),vouchers:t.asOptional(t.asArray(nn),()=>[]),pinBox:t.asOptional(E),pinId:t.asOptional(t.asString),pinKeyBox:t.asOptional(E)}),on=t.uncleaner(Dr),an=t.uncleaner(rn);l.lJ=n,l.Yy=o,l.C_=i,l.F7=a,l.$D=u,l.D1=m,l.XH=T,l.Yr=P,l.Vq=R,l.AQ=C,l.l0=Tr,l.I9=Rr,l.q0=kr,l.Iz=Lr,l.d2=vr,l.cI=Mr,l.rS=x,l.rZ=U,l._y=h,l.Uk=pr,l.zr=L,l.lK=S,l.t3=A,l.Bp=v,l.bt=M,l.D0=b,l.gN=q,l.oN=V,l.xK=Q,l.mm=lr,l.jS=hr,l.Ei=E,l.NF=j,l.Nz=k,l.OU=Dr,l.mG=s,l.TU=rn,l.Ko=O,l.EG=nn,l.$5=fr,l.dg=rr,l.Wo=f,l.zB=g,l.aQ=Nr,l.y$=jr,l.X7=$r,l.g4=Kr,l.xz=Vr,l.fT=qr,l.zQ=Gr,l.sl=Wr,l.mc=Yr,l.q=zr,l.SS=Hr,l.Yl=Qr,l.Gq=Zr,l.UW=Jr,l.J_=Xr,l.L=tn,l.pZ=er,l.gd=tr,l.IW=yr,l.j5=or,l.ph=dr,l.BB=d,l.gg=wr,l.v0=D,l.O5=Sr,l.qF=br,l.Mu=z,l.c4=ir,l.kd=Ir,l.JC=Cr,l.hf=Or,l.aD=H,l.Yn=Z,l.E3=Ar,l.xc=Pr,l.Ml=ar,l.ZT=$,l.Lh=Er,l.wN=gr,l.yd=on,l.zP=an,l.i5=Fr,l.YU=xr,l.it=Br,l.Ho=mr,l.lG=nr,l.xP=G,l.KG=sr,l.Iq=_r,l.i7=Y,l.zi=Ur,l.iZ=e},80645:function(ur,l){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */l.read=function(I,c,t,_,x){var U,h,s=x*8-_-1,N=(1<<s)-1,E=N>>1,O=-7,k=t?x-1:0,j=t?-1:1,d=I[c+k];for(k+=j,U=d&(1<<-O)-1,d>>=-O,O+=s;O>0;U=U*256+I[c+k],k+=j,O-=8);for(h=U&(1<<-O)-1,U>>=-O,O+=_;O>0;h=h*256+I[c+k],k+=j,O-=8);if(U===0)U=1-E;else{if(U===N)return h?NaN:(d?-1:1)*(1/0);h=h+Math.pow(2,_),U=U-E}return(d?-1:1)*h*Math.pow(2,U-_)},l.write=function(I,c,t,_,x,U){var h,s,N,E=U*8-x-1,O=(1<<E)-1,k=O>>1,j=x===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=_?0:U-1,f=_?1:-1,g=c<0||c===0&&1/c<0?1:0;for(c=Math.abs(c),isNaN(c)||c===1/0?(s=isNaN(c)?1:0,h=O):(h=Math.floor(Math.log(c)/Math.LN2),c*(N=Math.pow(2,-h))<1&&(h--,N*=2),h+k>=1?c+=j/N:c+=j*Math.pow(2,1-k),c*N>=2&&(h++,N/=2),h+k>=O?(s=0,h=O):h+k>=1?(s=(c*N-1)*Math.pow(2,x),h=h+k):(s=c*Math.pow(2,k-1)*Math.pow(2,x),h=0));x>=8;I[t+d]=s&255,d+=f,s/=256,x-=8);for(h=h<<x|s,E+=x;E>0;I[t+d]=h&255,d+=f,h/=256,E-=8);I[t+d-f]|=g*128}},55352:function(ur,l){"use strict";Object.defineProperty(l,"__esModule",{value:!0});function I(d,f,g){var L;if(g===void 0&&(g={}),!f.codes){f.codes={};for(var S=0;S<f.chars.length;++S)f.codes[f.chars[S]]=S}if(!g.loose&&d.length*f.bits&7)throw new SyntaxError("Invalid padding");for(var A=d.length;d[A-1]==="=";)if(--A,!g.loose&&!((d.length-A)*f.bits&7))throw new SyntaxError("Invalid padding");for(var v=new((L=g.out)!=null?L:Uint8Array)(A*f.bits/8|0),M=0,b=0,q=0,V=0;V<A;++V){var Q=f.codes[d[V]];if(Q===void 0)throw new SyntaxError("Invalid character "+d[V]);b=b<<f.bits|Q,M+=f.bits,M>=8&&(M-=8,v[q++]=255&b>>M)}if(M>=f.bits||255&b<<8-M)throw new SyntaxError("Unexpected end of data");return v}function c(d,f,g){g===void 0&&(g={});for(var L=g,S=L.pad,A=S===void 0?!0:S,v=(1<<f.bits)-1,M="",b=0,q=0,V=0;V<d.length;++V)for(q=q<<8|255&d[V],b+=8;b>f.bits;)b-=f.bits,M+=f.chars[v&q>>b];if(b&&(M+=f.chars[v&q<<f.bits-b]),A)for(;M.length*f.bits&7;)M+="=";return M}var t={chars:"0123456789ABCDEF",bits:4},_={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bits:5},x={chars:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bits:5},U={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bits:6},h={chars:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bits:6},s={parse:function(f,g){return I(f.toUpperCase(),t,g)},stringify:function(f,g){return c(f,t,g)}},N={parse:function(f,g){return g===void 0&&(g={}),I(g.loose?f.toUpperCase().replace(/0/g,"O").replace(/1/g,"L").replace(/8/g,"B"):f,_,g)},stringify:function(f,g){return c(f,_,g)}},E={parse:function(f,g){return I(f,x,g)},stringify:function(f,g){return c(f,x,g)}},O={parse:function(f,g){return I(f,U,g)},stringify:function(f,g){return c(f,U,g)}},k={parse:function(f,g){return I(f,h,g)},stringify:function(f,g){return c(f,h,g)}},j={parse:I,stringify:c};l.base16=s,l.base32=N,l.base32hex=E,l.base64=O,l.base64url=k,l.codec=j},94935:function(ur,l,I){"use strict";I.d(l,{$D:function(){return h},C_:function(){return x},l0:function(){return j}});var c=I(18595);const t=c.lJ,_=c.Yy,x=c.C_,U=c.F7,h=c.$D,s=c.D1,N=c.XH,E=c.Yr,O=c.Vq,k=c.AQ,j=c.l0,d=c.I9,f=c.q0,g=c.Iz,L=c.d2,S=c.cI,A=c.rS,v=c.rZ,M=c._y,b=c.Uk,q=c.zr,V=c.lK,Q=c.t3,lr=c.Bp,hr=c.bt,pr=c.D0,fr=c.gN,X=c.oN,rr=c.xK,er=c.mm,tr=c.jS,yr=c.Ei,or=c.NF,dr=c.Nz,wr=c.OU,D=c.mG,$=c.TU,Er=c.Ko,gr=c.EG,Br=c.$5,mr=c.dg,br=c.Wo,z=c.zB,ir=c.aQ,Ir=c.y$,Cr=c.X7,Or=c.g4,H=c.xz,Z=c.fT,Ar=c.zQ,Pr=c.sl,ar=c.mc,Sr=c.q,Fr=c.SS,xr=c.Yl,nr=c.Gq,G=c.UW,sr=c.J_,_r=c.L,Y=c.pZ,Ur=c.gd,e=c.IW,r=c.j5,n=c.ph,o=c.BB,i=c.gg,a=c.v0,u=c.O5,m=c.qF,T=c.Mu,P=c.c4,R=c.kd,C=c.JC,Tr=c.hf,Rr=c.aD,kr=c.Yn,Lr=c.E3,vr=c.xc,Mr=c.Ml,K=c.ZT,Nr=c.Lh,jr=c.wN,$r=c.yd,Kr=c.zP,Vr=c.i5,qr=c.YU,Gr=c.it,Wr=c.Ho,Yr=c.lG,zr=c.xP,Hr=c.KG,Qr=c.Iq,Zr=c.i7,Jr=c.zi,Xr=c.iZ}}]);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[7741],{37011:function(se,X,y){"use strict";y.r(X),y.d(X,{AlgorandTools:function(){return de},makeCurrencyEngine:function(){return Ee},makeCurrencyTools:function(){return De}});var T=y(88814),h=y(77591),E=y(20918),b=y(79014),I=y(76714),e=y(82448),L=y(62177);const Q=(0,e.su)({latestRound:(0,e.Vk)(e.mH,0),latestTxid:(0,e.Vk)(e.XC,"")}),J=(0,e.su)({amount:e.mH,assets:(0,e._2)((0,e.su)({amount:e.mH,"asset-id":e.mH})),"min-balance":e.mH,round:e.mH}),Y=(0,e.su)({"confirmed-round":e.mH,fee:e.mH,"first-valid":e.mH,id:e.XC,note:(0,e.Zz)(e.XC),"round-time":e.mH,sender:e.XC,"tx-type":e.XC}).withRest,_=(0,e.Wf)("pay"),G=(0,e.su)({"payment-transaction":(0,e.su)({amount:e.mH,"close-amount":e.mH,receiver:e.XC}),"tx-type":_}),ee=(0,e.Wf)("axfer"),te=(0,e.su)({"asset-transfer-transaction":(0,e.su)({amount:e.mH,"asset-id":e.mH,receiver:e.XC}),"tx-type":ee}),f=(0,e.su)({"confirmed-round":e.mH,fee:e.mH,"first-valid":e.mH,note:(0,e.Zz)(e.XC),"round-time":e.mH,sender:e.XC,"tx-type":e.XC}).withRest,v=(0,e.Wf)("appl"),k=(0,e.su)({"inner-txns":(0,e.Zz)((0,e._2)(f)),"tx-type":v}).withRest,A=(0,e.su)({"current-round":e.mH,"next-token":(0,e.Zz)(e.XC),transactions:(0,e._2)(Y)}),$=(0,e.su)({flatFee:e.jK,fee:e.mH,firstRound:e.mH,lastRound:e.mH,genesisID:e.XC,genesisHash:e.XC}),g=(0,e.su)({type:e.XC}).withRest,N=(0,e.su)({encodedTx:e.XC,recipient:(0,e.Zz)(e.XC)}),me=(0,e.su)({type:_,to:e.XC,amount:e.mH}).withRest,S=(0,e.Vk)((0,e.su)({fee:(0,e.Zz)(e.XC)}),{fee:void 0}),Z=(0,e.Vk)((0,e.su)({contractAddress:L.jD})),z=L.BQ,F=p=>{const t=(0,e.su)({[`${p}Mnemonic`]:e.XC});return(0,e.W1)(n=>({mnemonic:t(n)[`${p}Mnemonic`]}),n=>({[`${p}Mnemonic`]:n.mnemonic}))},j=(0,e.su)({id:(0,e._C)(e.XC,e.mH),method:(0,e.Wf)("algo_signTxn"),params:(0,e.vq)((0,e.vq)((0,e.su)({txn:e.XC,message:(0,e.Zz)(e.XC)})))}),V=(0,e.su)({id:e.mH,jsonrpc:(0,e.Wf)("2.0"),method:(0,e.Wf)("algo_signTxn"),params:(0,e.vq)((0,e._2)((0,e.su)({txn:e.XC,message:(0,e.Zz)(e.XC)})))}).withRest;var B=y(94935),U=y(79325),pe=y(84650),oe=y(72681),ae=y(99599),ge=Object.defineProperty,we=Object.defineProperties,Te=Object.getOwnPropertyDescriptors,ie=Object.getOwnPropertySymbols,Ie=Object.getPrototypeOf,ve=Object.prototype.hasOwnProperty,ke=Object.prototype.propertyIsEnumerable,Ce=Reflect.get,ce=(p,t,n)=>t in p?ge(p,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):p[t]=n,q=(p,t)=>{for(var n in t||(t={}))ve.call(t,n)&&ce(p,n,t[n]);if(ie)for(var n of ie(t))ke.call(t,n)&&ce(p,n,t[n]);return p},xe=(p,t)=>we(p,Te(t)),Ae=(p,t,n)=>Ce(Ie(p),n,t),m=(p,t,n)=>new Promise((s,c)=>{var o=r=>{try{i(n.next(r))}catch(u){c(u)}},a=r=>{try{i(n.throw(r))}catch(u){c(u)}},i=r=>r.done?s(r.value):Promise.resolve(r.value).then(o,a);i((n=n.apply(p,t)).next())});const{Algodv2:ne,Indexer:Pe}=T.ZP,le=5e3,be=3e3;class re extends pe.P{constructor(t,n,s,c){super(t,n,s,c),this.getRecipientBalance=o=>m(this,null,function*(){try{return(yield this.fetchAccountInfo(o)).amount.toString()}catch{return this.minimumAddressBalance}}),this.engineGetActivationAssets=o=>m(this,null,function*(){return{assetOptions:[{paymentWalletId:this.walletId,currencyPluginId:this.currencyInfo.pluginId}]}}),this.engineActivateWallet=o=>m(this,[o],function*({activateTokenIds:a,paymentTokenId:i,paymentWallet:r}){var u;if(a==null)throw new Error(`Must specify activateTokenIds for ${this.currencyInfo.currencyCode}`);if(i!=null)throw new Error(`Must activate with ${this.currencyInfo.currencyCode}`);if((r==null?void 0:r.id)!==this.walletId)throw new Error("Must pay with same wallet you are activating token with");const d=this.networkInfo.minimumTxFee.toFixed();let l="0";const C=[];for(const P of a){if(this.allTokensMap[P]==null)throw new Error(`Invalid tokenId to activate ${P}`);const R={currencyCode:this.allTokensMap[P].currencyCode,skipChecks:!0,spendTargets:[{publicAddress:this.walletInfo.keys.publicKey,nativeAmount:"0"}]};try{const O=yield this.makeSpend(R);l=(0,h.add)(l,(u=O.parentNetworkFee)!=null?u:d)}catch{l=(0,h.add)(l,d)}C.push(R)}return{paymentWalletId:this.walletId,fromNativeAmount:"0",networkFee:{nativeAmount:l,currencyPluginId:this.currencyInfo.pluginId},approve:(...P)=>m(this,[...P],function*(R={}){const{metadata:O}=R,w=[];for(const x of C){const K=yield this.makeSpend(x);K.metadata=q({},O);let D=yield r.signTx(K);D=yield r.broadcastTx(D),w.push(D),yield r.saveTx(D)}return{transactions:w}}),close:()=>m(this,null,function*(){})}}),this.networkInfo=t.networkInfo,this.queryTxMutex=(0,I.jT)(),this.suggestedTransactionParams={flatFee:!1,fee:0,firstRound:0,lastRound:0,genesisID:this.networkInfo.genesisID,genesisHash:this.networkInfo.genesisHash},this.minimumAddressBalance=this.networkInfo.minimumAddressBalance,this.totalReserve=this.minimumAddressBalance,this.otherMethods={parseWalletConnectV2Payload:o=>m(this,null,function*(){try{const i=V(o).params[0][0],r=(0,T.wj)(U.US.parse(i.txn)),u=r.amount!=null?r.amount.toString():"0",d=r.fee.toFixed();let l=null;if(r.type==="axfer"){const C=r.assetIndex.toString();if(this.allTokensMap[C]==null)throw new Error("Unrecognized token");l=C}return{nativeAmount:u,networkFee:d,tokenId:l}}catch(a){throw this.warn("Wallet connect call_request ",a),a}})}}setOtherData(t){this.otherData=Q(t)}fetchAccountInfo(t){return m(this,null,function*(){return yield(0,I.QJ)(this.networkInfo.algodServers.map(n=>()=>m(this,null,function*(){const c=yield new ne("",n,"").accountInformation(t).do();return J(c)})))})}queryBalance(){return m(this,null,function*(){try{const t=yield this.fetchAccountInfo(this.walletLocalData.publicKey),{assets:n,amount:s,"min-balance":c,round:o}=t;this.totalReserve=c.toString();const a=[];for(const i of this.enabledTokens)if(i===this.currencyInfo.currencyCode)this.updateBalance(this.currencyInfo.currencyCode,s.toString());else{const r=Object.keys(this.allTokensMap).find(d=>this.allTokensMap[d].currencyCode===i);if(r==null){this.updateBalance(i,"0");continue}const u=n.find(d=>d["asset-id"].toFixed()===r);if(u==null){a.push(r),this.updateBalance(i,"0");continue}this.updateBalance(i,u.amount.toString())}o>this.walletLocalData.blockHeight&&(this.walletLocalData.blockHeight=o,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onBlockHeightChanged(this.walletLocalData.blockHeight)),(0,I.dQ)(a,this.walletLocalData.unactivatedTokenIds)||(this.walletLocalData.unactivatedTokenIds=a,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onUnactivatedTokenIdsChanged(this.walletLocalData.unactivatedTokenIds))}catch(t){this.log.warn("queryBalance Error ",t)}})}queryTransactionParams(){return m(this,null,function*(){try{const t=yield(0,I.QJ)(this.networkInfo.algodServers.map(n=>()=>m(this,null,function*(){const c=yield new ne("",n,"").getTransactionParams().do(),o=$(c);if(o.genesisHash!==this.networkInfo.genesisHash)throw new Error("Server genesisHash mismatch");return o})));this.suggestedTransactionParams=t}catch(t){this.log.warn("queryTransactionParams error:",t)}})}processAlgorandTransaction(t){const{"confirmed-round":n,"round-time":s,"tx-type":c,fee:o,id:a,note:i,sender:r}=t;let u,d,l,C,M=!1;const P=[];switch(c){case"pay":{const{amount:w,receiver:x}=G(t)["payment-transaction"];if(d=w.toString(),l=o.toString(),r===this.walletInfo.keys.publicKey)d=`-${(0,h.add)(d,l)}`,M=!0;else if(x===this.walletInfo.keys.publicKey)l="0",P.push(this.walletInfo.keys.publicKey);else return;u=this.currencyInfo.currencyCode;break}case"axfer":{const{amount:w,"asset-id":x,receiver:K}=te(t)["asset-transfer-transaction"];if(d=w.toString(),l="0",r===this.walletInfo.keys.publicKey)d=`-${d}`,C=o.toString(),M=!0;else if(K===this.walletInfo.keys.publicKey)P.push(this.walletInfo.keys.publicKey);else return;const D=this.allTokensMap[x];if(D==null)return;u=D.currencyCode;break}case"appl":{const{"inner-txns":w=[]}=k(t);if(w.forEach(x=>this.processAlgorandTransaction(xe(q({},x),{id:a}))),d="0",l=o.toString(),r===this.walletInfo.keys.publicKey)d=`-${(0,h.add)(d,l)}`,M=!0;else return;u=this.currencyInfo.currencyCode;break}default:return}const R=[];if(i!=null){const w=U.US.parse(i);try{R.push({memoName:"note",type:"text",value:ae.K.stringify(w)})}catch{R.push({memoName:"note",type:"hex",value:U.YU.stringify(w).toLowerCase()})}}const O={blockHeight:n,currencyCode:u,date:s,isSend:M,memos:R,nativeAmount:d,networkFee:l,ourReceiveAddresses:P,parentNetworkFee:C,signedTx:"",txid:a,walletId:this.walletId};this.addTransaction(this.currencyInfo.currencyCode,O)}queryTransactions(){return m(this,null,function*(){return yield this.queryTxMutex(()=>m(this,null,function*(){return yield this.queryTransactionsInner()}))})}queryTransactionsInner(){return m(this,null,function*(){const t=this.otherData.latestRound;let n,s=this.otherData.latestRound,c=0,o,a=!0;do{const i=yield(0,I.QJ)(this.networkInfo.indexerServers.map(l=>()=>m(this,null,function*(){const M=yield new Pe({},l,"").lookupAccountTransactions(this.walletLocalData.publicKey).minRound(t).nextToken(o!=null?o:"").do();return A(M)}))),{"next-token":r,transactions:u}=i;if(u.length===0)break;for(const l of u){if(n==null&&(n=l.id,s=l["confirmed-round"]),c=l["confirmed-round"],l.id===this.otherData.latestTxid){a=!1;break}try{this.processAlgorandTransaction(l)}catch(C){this.log.warn("processAlgorandTransaction error:",C)}}s=s!=null?s:this.walletLocalData.blockHeight;const d=(s-c)/(s-t);this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=d,this.updateOnAddressesChecked(),o=r}while(o!=null&&a);n!=null&&this.otherData.latestTxid!==n&&(this.otherData.latestTxid=n,this.otherData.latestRound=s,this.walletLocalDataDirty=!0);for(const i of this.enabledTokens)this.tokenCheckTransactionsStatus[i]=1;this.updateOnAddressesChecked(),this.transactionsChangedArray.length>0&&(this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[])})}startEngine(){return m(this,null,function*(){this.engineOn=!0,this.addToLoop("queryBalance",le).catch(()=>{}),this.addToLoop("queryTransactionParams",le).catch(()=>{}),this.addToLoop("queryTransactions",be).catch(()=>{}),yield Ae(re.prototype,this,"startEngine").call(this)})}resyncBlockchain(){return m(this,null,function*(){yield this.killEngine(),yield this.clearBlockchainCache(),yield this.startEngine()})}calcFee(t){const n=t.estimateSize();return Math.max(this.suggestedTransactionParams.fee*n,this.networkInfo.minimumTxFee).toString()}getMaxSpendable(t){return m(this,null,function*(){t=(0,oe.s)(t,this.currencyInfo);let n=this.getBalance({currencyCode:t.currencyCode});if(t.currencyCode===this.currencyInfo.currencyCode&&(n=(0,h.sub)(n,this.totalReserve)),t.spendTargets[0].publicAddress==null)throw new Error("makeSpend Missing publicAddress");const{customNetworkFee:c}=t;let a=S(c).fee;a==null&&(t.spendTargets[0].nativeAmount="1",a=(yield this.makeSpend(t)).networkFee);const i=(r,u)=>m(this,null,function*(){const d=(0,h.sub)(u,r);if((0,h.lte)(d,"1"))return r;const l=(0,h.add)(r,(0,h.div)(d,"2"));t.spendTargets[0].nativeAmount=l;const C=(0,h.add)(l,a!=null?a:this.networkInfo.minimumTxFee.toString());return(0,h.gt)(C,n)?yield i(r,l):yield i(l,u)});return yield i("0",(0,h.add)(n,"1"))})}makeSpend(t){return m(this,null,function*(){var n,s,c,o;t=(0,oe.s)(t,this.currencyInfo);const{edgeSpendInfo:a,currencyCode:i,nativeBalance:r}=this.makeSpendCheck(t),{memos:u=[]}=a,d=(0,h.sub)(this.getBalance({currencyCode:this.currencyInfo.currencyCode}),this.totalReserve);if(a.spendTargets.length!==1)throw new Error("Error: only one output allowed");const{nativeAmount:l,publicAddress:C}=a.spendTargets[0];if(C==null)throw new Error("makeSpend Missing publicAddress");if(l==null)throw new B.$D;const{type:M}=(n=(0,e.Vk)(g)(a.otherParams))!=null?n:{type:i===this.currencyInfo.currencyCode?"pay":"axfer"},P=((s=u[0])==null?void 0:s.type)==="text"?ae.K.parse(u[0].value):void 0,{customNetworkFee:R}=a,O=S(R).fee;let w,x=l,K="0",D,W,he;switch(M){case"pay":{if(w=T.ZP.makePaymentTxnWithSuggestedParamsFromObject({to:C,from:this.walletInfo.keys.publicKey,amount:BigInt(l),note:P,suggestedParams:q({},this.suggestedTransactionParams)}),W=O!=null?O:this.calcFee(w),K=W,x=`-${(0,h.add)(x,K)}`,he=C,(0,h.gt)((0,h.abs)(x),d))throw new B.C_;break}case"axfer":{const fe=Object.keys(this.allTokensMap).find(Re=>this.allTokensMap[Re].currencyCode===i);if(fe==null)throw new Error("Unrecognized asset");const ye=Z((o=(c=this.allTokensMap)==null?void 0:c[fe])==null?void 0:o.networkLocation);if(ye==null)throw new Error("Unrecognized asset");if(w=T.ZP.makeAssetTransferTxnWithSuggestedParamsFromObject({assetIndex:parseInt(ye.contractAddress),to:C,from:this.walletInfo.keys.publicKey,amount:BigInt(l),note:P,suggestedParams:q({},this.suggestedTransactionParams)}),W=O!=null?O:this.calcFee(w),x=`-${x}`,D=W,(0,h.gt)(D,d))throw new B.C_({currencyCode:this.currencyInfo.currencyCode,networkFee:W});if((0,h.gt)((0,h.abs)(x),r))throw new B.C_;break}default:throw new Error("Unrecognized transaction type")}w.flatFee=!0,w.fee=parseInt(W);const Me={encodedTx:U.YU.stringify((0,T.nJ)(w)),recipient:he};return{blockHeight:0,currencyCode:i,date:0,isSend:!0,memos:u,nativeAmount:x,networkFee:K,otherParams:Me,ourReceiveAddresses:[],parentNetworkFee:D,signedTx:"",txid:"",walletId:this.walletId}})}signMessage(t,n){return m(this,null,function*(){const s=F(this.currencyInfo.pluginId)(n),c=(0,T.wj)(U.US.parse(t)),o=T.ZP.mnemonicToSecretKey(s.mnemonic),a=c.signTxn(o.sk);return U.US.stringify(a)})}signTx(t,n){return m(this,null,function*(){const{encodedTx:s,recipient:c}=N((0,I.Xp)(t)),o=(0,T.wj)(Uint8Array.from(U.YU.parse(s)));c!=null&&(yield this.checkRecipientMinimumBalance(this.getRecipientBalance,o.amount.toString(),c));const a=F(this.currencyInfo.pluginId)(n),i=T.ZP.mnemonicToSecretKey(a.mnemonic),r=o.signTxn(i.sk),u=U.YU.stringify(r);return t.signedTx=u,t})}broadcastTx(t){return m(this,null,function*(){const n=Uint8Array.from(U.YU.parse(t.signedTx));try{const{txId:s}=yield(0,I.QJ)(this.networkInfo.algodServers.map(c=>()=>m(this,null,function*(){return yield new ne("",c,"").sendRawTransaction(n).do()})));t.txid=s,t.date=Date.now()/1e3}catch(s){throw this.warn("FAILURE broadcastTx failed: ",s),s}return this.warn(`SUCCESS broadcastTx
|
|
2
|
-
${(0,I.oX)(t)}`),t})}}function
|
|
1
|
+
(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[7741],{37011:function(oe,X,f){"use strict";f.r(X),f.d(X,{AlgorandTools:function(){return he},makeCurrencyEngine:function(){return Se},makeCurrencyTools:function(){return Me}});var T=f(88814),d=f(77591),E=f(20918),b=f(79014),I=f(76714),e=f(82448),L=f(62177);const j=(0,e.su)({latestRound:(0,e.Vk)(e.mH,0),latestTxid:(0,e.Vk)(e.XC,"")}),Y=(0,e.su)({amount:e.mH,assets:(0,e._2)((0,e.su)({amount:e.mH,"asset-id":e.mH})),"min-balance":e.mH,round:e.mH}),G=(0,e.su)({"confirmed-round":e.mH,fee:e.mH,"first-valid":e.mH,id:e.XC,note:(0,e.Zz)(e.XC),"round-time":e.mH,sender:e.XC,"tx-type":e.XC}).withRest,$=(0,e.Wf)("pay"),ee=(0,e.su)({"payment-transaction":(0,e.su)({amount:e.mH,"close-amount":e.mH,receiver:e.XC}),"tx-type":$}),te=(0,e.Wf)("axfer"),ne=(0,e.su)({"asset-transfer-transaction":(0,e.su)({amount:e.mH,"asset-id":e.mH,receiver:e.XC}),"tx-type":te}),h=(0,e.su)({"confirmed-round":e.mH,fee:e.mH,"first-valid":e.mH,note:(0,e.Zz)(e.XC),"round-time":e.mH,sender:e.XC,"tx-type":e.XC}).withRest,v=(0,e.Wf)("appl"),k=(0,e.su)({"inner-txns":(0,e.Zz)((0,e._2)(h)),"tx-type":v}).withRest,A=(0,e.su)({"current-round":e.mH,"next-token":(0,e.Zz)(e.XC),transactions:(0,e._2)(G)}),N=(0,e.su)({flatFee:e.jK,fee:e.mH,firstRound:e.mH,lastRound:e.mH,genesisID:e.XC,genesisHash:e.XC}),w=(0,e.su)({type:e.XC}).withRest,Z=(0,e.su)({encodedTx:e.XC,recipient:(0,e.Zz)(e.XC)}),pe=(0,e.su)({type:$,to:e.XC,amount:e.mH}).withRest,S=(0,e.Vk)((0,e.su)({fee:(0,e.Zz)(e.XC)}),{fee:void 0}),z=(0,e.Vk)((0,e.su)({contractAddress:L.jD})),Q=L.BQ,F=m=>{const t=(0,e.su)({[`${m}Mnemonic`]:e.XC});return(0,e.W1)(n=>({mnemonic:t(n)[`${m}Mnemonic`]}),n=>({[`${m}Mnemonic`]:n.mnemonic}))},V=(0,e.su)({id:(0,e._C)(e.XC,e.mH),method:(0,e.Wf)("algo_signTxn"),params:(0,e.vq)((0,e.vq)((0,e.su)({txn:e.XC,message:(0,e.Zz)(e.XC)})))}),q=(0,e.su)({id:e.mH,jsonrpc:(0,e.Wf)("2.0"),method:(0,e.Wf)("algo_signTxn"),params:(0,e.vq)((0,e._2)((0,e.su)({txn:e.XC,message:(0,e.Zz)(e.XC)})))}).withRest;var B=f(94935),R=f(79325),ge=f(84650),ae=f(72681),ie=f(99599),we=Object.defineProperty,Te=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,ce=Object.getOwnPropertySymbols,ve=Object.getPrototypeOf,ke=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,xe=Reflect.get,le=(m,t,n)=>t in m?we(m,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):m[t]=n,J=(m,t)=>{for(var n in t||(t={}))ke.call(t,n)&&le(m,n,t[n]);if(ce)for(var n of ce(t))Ce.call(t,n)&&le(m,n,t[n]);return m},Ae=(m,t)=>Te(m,Ie(t)),Pe=(m,t,n)=>xe(ve(m),n,t),y=(m,t,n)=>new Promise((s,c)=>{var o=r=>{try{i(n.next(r))}catch(u){c(u)}},a=r=>{try{i(n.throw(r))}catch(u){c(u)}},i=r=>r.done?s(r.value):Promise.resolve(r.value).then(o,a);i((n=n.apply(m,t)).next())});const{Algodv2:re,Indexer:be}=T.ZP,ue=5e3,Ee=3e3;class se extends ge.P{constructor(t,n,s,c){super(t,n,s,c),this.getRecipientBalance=o=>y(this,null,function*(){try{return(yield this.fetchAccountInfo(o)).amount.toString()}catch{return this.minimumAddressBalance}}),this.engineGetActivationAssets=o=>y(this,null,function*(){return{assetOptions:[{paymentWalletId:this.walletId,currencyPluginId:this.currencyInfo.pluginId}]}}),this.engineActivateWallet=o=>y(this,[o],function*({activateTokenIds:a,paymentTokenId:i,paymentWallet:r}){var u;if(a==null)throw new Error(`Must specify activateTokenIds for ${this.currencyInfo.currencyCode}`);if(i!=null)throw new Error(`Must activate with ${this.currencyInfo.currencyCode}`);if((r==null?void 0:r.id)!==this.walletId)throw new Error("Must pay with same wallet you are activating token with");const p=this.networkInfo.minimumTxFee.toFixed();let l="0";const g=[];for(const P of a){if(this.allTokensMap[P]==null)throw new Error(`Invalid tokenId to activate ${P}`);const D={currencyCode:this.allTokensMap[P].currencyCode,skipChecks:!0,spendTargets:[{publicAddress:this.walletInfo.keys.publicKey,nativeAmount:"0"}]};try{const O=yield this.makeSpend(D);l=(0,d.add)(l,(u=O.parentNetworkFee)!=null?u:p)}catch{l=(0,d.add)(l,p)}g.push(D)}return{paymentWalletId:this.walletId,fromNativeAmount:"0",networkFee:{nativeAmount:l,currencyPluginId:this.currencyInfo.pluginId},approve:(...P)=>y(this,[...P],function*(D={}){const{metadata:O}=D,H=[];for(const C of g){const x=yield this.makeSpend(C);x.metadata=J({},O);let M=yield r.signTx(x);M=yield r.broadcastTx(M),H.push(M),yield r.saveTx(M)}return{transactions:H}}),close:()=>y(this,null,function*(){})}}),this.networkInfo=t.networkInfo,this.queryTxMutex=(0,I.jT)(),this.suggestedTransactionParams={flatFee:!1,fee:0,firstRound:0,lastRound:0,genesisID:this.networkInfo.genesisID,genesisHash:this.networkInfo.genesisHash},this.minimumAddressBalance=this.networkInfo.minimumAddressBalance,this.totalReserve=this.minimumAddressBalance,this.otherMethods={parseWalletConnectV2Payload:o=>y(this,null,function*(){try{const i=q(o).params[0][0],r=(0,T.wj)(R.US.parse(i.txn)),u=r.amount!=null?r.amount.toString():"0",p=r.fee.toFixed();let l=null;if(r.type==="axfer"){const g=r.assetIndex.toString();if(this.allTokensMap[g]==null)throw new Error("Unrecognized token");l=g}return{nativeAmount:u,networkFee:p,tokenId:l}}catch(a){throw this.warn("Wallet connect call_request ",a),a}})}}setOtherData(t){this.otherData=j(t)}fetchAccountInfo(t){return y(this,null,function*(){return yield(0,I.QJ)(this.networkInfo.algodServers.map(n=>()=>y(this,null,function*(){const c=yield new re("",n,"").accountInformation(t).do();return Y(c)})))})}queryBalance(){return y(this,null,function*(){try{const t=yield this.fetchAccountInfo(this.walletLocalData.publicKey),{assets:n,amount:s,"min-balance":c,round:o}=t;this.totalReserve=c.toString();const a=[];for(const i of this.enabledTokens)if(i===this.currencyInfo.currencyCode)this.updateBalance(this.currencyInfo.currencyCode,s.toString());else{const r=Object.keys(this.allTokensMap).find(p=>this.allTokensMap[p].currencyCode===i);if(r==null){this.updateBalance(i,"0");continue}const u=n.find(p=>p["asset-id"].toFixed()===r);if(u==null){a.push(r),this.updateBalance(i,"0");continue}this.updateBalance(i,u.amount.toString())}o>this.walletLocalData.blockHeight&&(this.walletLocalData.blockHeight=o,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onBlockHeightChanged(this.walletLocalData.blockHeight)),(0,I.dQ)(a,this.walletLocalData.unactivatedTokenIds)||(this.walletLocalData.unactivatedTokenIds=a,this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onUnactivatedTokenIdsChanged(this.walletLocalData.unactivatedTokenIds))}catch(t){this.log.warn("queryBalance Error ",t)}})}queryTransactionParams(){return y(this,null,function*(){try{const t=yield(0,I.QJ)(this.networkInfo.algodServers.map(n=>()=>y(this,null,function*(){const c=yield new re("",n,"").getTransactionParams().do(),o=N(c);if(o.genesisHash!==this.networkInfo.genesisHash)throw new Error("Server genesisHash mismatch");return o})));this.suggestedTransactionParams=t}catch(t){this.log.warn("queryTransactionParams error:",t)}})}processAlgorandTransaction(t){const{"confirmed-round":n,"round-time":s,"tx-type":c,fee:o,id:a,note:i,sender:r}=t;let u,p,l,g,K,P=!1;const D=[];switch(c){case"pay":{const{amount:C,receiver:x}=ee(t)["payment-transaction"];if(l=C.toString(),g=o.toString(),r===this.walletInfo.keys.publicKey)l=`-${(0,d.add)(l,g)}`,P=!0;else if(x===this.walletInfo.keys.publicKey)g="0",D.push(this.walletInfo.keys.publicKey);else return;u=this.currencyInfo.currencyCode,p=null;break}case"axfer":{const{amount:C,"asset-id":x,receiver:M}=ne(t)["asset-transfer-transaction"];if(l=C.toString(),g="0",r===this.walletInfo.keys.publicKey)l=`-${l}`,K=o.toString(),P=!0;else if(M===this.walletInfo.keys.publicKey)D.push(this.walletInfo.keys.publicKey);else return;const W=this.allTokensMap[x];if(W==null)return;u=W.currencyCode,p=x.toString();break}case"appl":{const{"inner-txns":C=[]}=k(t);if(C.forEach(x=>this.processAlgorandTransaction(Ae(J({},x),{id:a}))),l="0",g=o.toString(),r===this.walletInfo.keys.publicKey)l=`-${(0,d.add)(l,g)}`,P=!0;else return;u=this.currencyInfo.currencyCode,p=null;break}default:return}const O=[];if(i!=null){const C=R.US.parse(i);try{O.push({memoName:"note",type:"text",value:ie.K.stringify(C)})}catch{O.push({memoName:"note",type:"hex",value:R.YU.stringify(C).toLowerCase()})}}const H={blockHeight:n,currencyCode:u,date:s,isSend:P,memos:O,nativeAmount:l,networkFee:g,ourReceiveAddresses:D,parentNetworkFee:K,signedTx:"",tokenId:p,txid:a,walletId:this.walletId};this.addTransaction(this.currencyInfo.currencyCode,H)}queryTransactions(){return y(this,null,function*(){return yield this.queryTxMutex(()=>y(this,null,function*(){return yield this.queryTransactionsInner()}))})}queryTransactionsInner(){return y(this,null,function*(){const t=this.otherData.latestRound;let n,s=this.otherData.latestRound,c=0,o,a=!0;do{const i=yield(0,I.QJ)(this.networkInfo.indexerServers.map(l=>()=>y(this,null,function*(){const K=yield new be({},l,"").lookupAccountTransactions(this.walletLocalData.publicKey).minRound(t).nextToken(o!=null?o:"").do();return A(K)}))),{"next-token":r,transactions:u}=i;if(u.length===0)break;for(const l of u){if(n==null&&(n=l.id,s=l["confirmed-round"]),c=l["confirmed-round"],l.id===this.otherData.latestTxid){a=!1;break}try{this.processAlgorandTransaction(l)}catch(g){this.log.warn("processAlgorandTransaction error:",g)}}s=s!=null?s:this.walletLocalData.blockHeight;const p=(s-c)/(s-t);this.tokenCheckTransactionsStatus[this.currencyInfo.currencyCode]=p,this.updateOnAddressesChecked(),o=r}while(o!=null&&a);n!=null&&this.otherData.latestTxid!==n&&(this.otherData.latestTxid=n,this.otherData.latestRound=s,this.walletLocalDataDirty=!0);for(const i of this.enabledTokens)this.tokenCheckTransactionsStatus[i]=1;this.updateOnAddressesChecked(),this.transactionsChangedArray.length>0&&(this.walletLocalDataDirty=!0,this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[])})}startEngine(){return y(this,null,function*(){this.engineOn=!0,this.addToLoop("queryBalance",ue).catch(()=>{}),this.addToLoop("queryTransactionParams",ue).catch(()=>{}),this.addToLoop("queryTransactions",Ee).catch(()=>{}),yield Pe(se.prototype,this,"startEngine").call(this)})}resyncBlockchain(){return y(this,null,function*(){yield this.killEngine(),yield this.clearBlockchainCache(),yield this.startEngine()})}calcFee(t){const n=t.estimateSize();return Math.max(this.suggestedTransactionParams.fee*n,this.networkInfo.minimumTxFee).toString()}getMaxSpendable(t){return y(this,null,function*(){t=(0,ae.s)(t,this.currencyInfo);let n=this.getBalance({currencyCode:t.currencyCode});if(t.currencyCode===this.currencyInfo.currencyCode&&(n=(0,d.sub)(n,this.totalReserve)),t.spendTargets[0].publicAddress==null)throw new Error("makeSpend Missing publicAddress");const{customNetworkFee:c}=t;let a=S(c).fee;a==null&&(t.spendTargets[0].nativeAmount="1",a=(yield this.makeSpend(t)).networkFee);const i=(r,u)=>y(this,null,function*(){const p=(0,d.sub)(u,r);if((0,d.lte)(p,"1"))return r;const l=(0,d.add)(r,(0,d.div)(p,"2"));t.spendTargets[0].nativeAmount=l;const g=(0,d.add)(l,a!=null?a:this.networkInfo.minimumTxFee.toString());return(0,d.gt)(g,n)?yield i(r,l):yield i(l,u)});return yield i("0",(0,d.add)(n,"1"))})}makeSpend(t){return y(this,null,function*(){var n,s,c,o;t=(0,ae.s)(t,this.currencyInfo);const{edgeSpendInfo:a,currencyCode:i,nativeBalance:r}=this.makeSpendCheck(t),{memos:u=[]}=a,p=(0,d.sub)(this.getBalance({currencyCode:this.currencyInfo.currencyCode}),this.totalReserve);if(a.spendTargets.length!==1)throw new Error("Error: only one output allowed");const{nativeAmount:l,publicAddress:g}=a.spendTargets[0];if(g==null)throw new Error("makeSpend Missing publicAddress");if(l==null)throw new B.$D;const{type:K}=(n=(0,e.Vk)(w)(a.otherParams))!=null?n:{type:i===this.currencyInfo.currencyCode?"pay":"axfer"},P=((s=u[0])==null?void 0:s.type)==="text"?ie.K.parse(u[0].value):void 0,{customNetworkFee:D,tokenId:O}=a,H=S(D).fee;let C,x=l,M="0",W,_,fe;switch(K){case"pay":{if(C=T.ZP.makePaymentTxnWithSuggestedParamsFromObject({to:g,from:this.walletInfo.keys.publicKey,amount:BigInt(l),note:P,suggestedParams:J({},this.suggestedTransactionParams)}),_=H!=null?H:this.calcFee(C),M=_,x=`-${(0,d.add)(x,M)}`,fe=g,(0,d.gt)((0,d.abs)(x),p))throw new B.C_;break}case"axfer":{const ye=Object.keys(this.allTokensMap).find(Ue=>this.allTokensMap[Ue].currencyCode===i);if(ye==null)throw new Error("Unrecognized asset");const me=z((o=(c=this.allTokensMap)==null?void 0:c[ye])==null?void 0:o.networkLocation);if(me==null)throw new Error("Unrecognized asset");if(C=T.ZP.makeAssetTransferTxnWithSuggestedParamsFromObject({assetIndex:parseInt(me.contractAddress),to:g,from:this.walletInfo.keys.publicKey,amount:BigInt(l),note:P,suggestedParams:J({},this.suggestedTransactionParams)}),_=H!=null?H:this.calcFee(C),x=`-${x}`,W=_,(0,d.gt)(W,p))throw new B.C_({currencyCode:this.currencyInfo.currencyCode,networkFee:_});if((0,d.gt)((0,d.abs)(x),r))throw new B.C_;break}default:throw new Error("Unrecognized transaction type")}C.flatFee=!0,C.fee=parseInt(_);const Re={encodedTx:R.YU.stringify((0,T.nJ)(C)),recipient:fe};return{blockHeight:0,currencyCode:i,date:0,isSend:!0,memos:u,nativeAmount:x,networkFee:M,otherParams:Re,ourReceiveAddresses:[],parentNetworkFee:W,signedTx:"",tokenId:O!=null?O:null,txid:"",walletId:this.walletId}})}signMessage(t,n){return y(this,null,function*(){const s=F(this.currencyInfo.pluginId)(n),c=(0,T.wj)(R.US.parse(t)),o=T.ZP.mnemonicToSecretKey(s.mnemonic),a=c.signTxn(o.sk);return R.US.stringify(a)})}signTx(t,n){return y(this,null,function*(){const{encodedTx:s,recipient:c}=Z((0,I.Xp)(t)),o=(0,T.wj)(Uint8Array.from(R.YU.parse(s)));c!=null&&(yield this.checkRecipientMinimumBalance(this.getRecipientBalance,o.amount.toString(),c));const a=F(this.currencyInfo.pluginId)(n),i=T.ZP.mnemonicToSecretKey(a.mnemonic),r=o.signTxn(i.sk),u=R.YU.stringify(r);return t.signedTx=u,t})}broadcastTx(t){return y(this,null,function*(){const n=Uint8Array.from(R.YU.parse(t.signedTx));try{const{txId:s}=yield(0,I.QJ)(this.networkInfo.algodServers.map(c=>()=>y(this,null,function*(){return yield new re("",c,"").sendRawTransaction(n).do()})));t.txid=s,t.date=Date.now()/1e3}catch(s){throw this.warn("FAILURE broadcastTx failed: ",s),s}return this.warn(`SUCCESS broadcastTx
|
|
2
|
+
${(0,I.oX)(t)}`),t})}}function Se(m,t,n,s){return y(this,null,function*(){const c=Q(n),o=new se(m,t,c,s);return yield o.loadEngine(),o})}var Oe=f(48764).Buffer,U=(m,t,n)=>new Promise((s,c)=>{var o=r=>{try{i(n.next(r))}catch(u){c(u)}},a=r=>{try{i(n.throw(r))}catch(u){c(u)}},i=r=>r.done?s(r.value):Promise.resolve(r.value).then(o,a);i((n=n.apply(m,t)).next())});const{isValidAddress:de,mnemonicFromSeed:De}=T.ZP;class he{constructor(t){const{builtinTokens:n,currencyInfo:s,io:c}=t;this.io=c,this.currencyInfo=s,this.builtinTokens=n}getDisplayPrivateKey(t){return U(this,null,function*(){const{pluginId:n}=this.currencyInfo;return F(n)(t.keys).mnemonic})}getDisplayPublicKey(t){return U(this,null,function*(){const{keys:n}=Q(t);return n.publicKey})}importPrivateKey(t){return U(this,null,function*(){const{pluginId:n}=this.currencyInfo;return T.ZP.mnemonicToSecretKey(t),{[`${n}Mnemonic`]:t}})}createPrivateKey(t){return U(this,null,function*(){if(t!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const n=Oe.from(this.io.random(32)),s=De(n);return yield this.importPrivateKey(s)})}derivePublicKey(t){return U(this,null,function*(){const{pluginId:n}=this.currencyInfo;if(t.type!==this.currencyInfo.walletType)throw new Error("InvalidWalletType");const s=F(n)(t.keys);return{publicKey:T.ZP.mnemonicToSecretKey(s.mnemonic).addr}})}parseUri(t,n,s){return U(this,null,function*(){const{pluginId:c}=this.currencyInfo,o={[c]:!0},{parsedUri:a,edgeParsedUri:i}=(0,b.k)(this.currencyInfo,t,o,n!=null?n:this.currencyInfo.currencyCode,s);let r="";if(i.publicAddress!=null&&(r=i.publicAddress),!de(r))throw new Error("InvalidPublicAddressError");return i.uniqueIdentifier=a.query.memo,i})}encodeUri(t){return U(this,arguments,function*(n,s=[]){const{pluginId:c}=this.currencyInfo,{nativeAmount:o,currencyCode:a,publicAddress:i}=n;if(!de(i))throw new Error("InvalidPublicAddressError");let r;if(typeof o=="string"){const p=(0,I.Qs)(a!=null?a:this.currencyInfo.currencyCode,this.currencyInfo,s);if(p==null)throw new Error("InternalErrorInvalidCurrencyCode");r=(0,d.div)(o,p.multiplier,18)}return(0,b.Q)(n,c,r)})}getTokenId(t){return U(this,null,function*(){(0,E.Rp)(t);const n=z(t.networkLocation);if(n==null)throw new Error("ErrorInvalidContractAddress");return n.contractAddress})}}function Me(m){return U(this,null,function*(){return new he(m)})}},79014:function(oe,X,f){"use strict";f.d(X,{Q:function(){return ne},k:function(){return te}});var T=f(77591),d=f.n(T),E=f(24350),b=f(84564),I=f.n(b),e=f(76714),L=Object.defineProperty,j=Object.getOwnPropertySymbols,Y=Object.prototype.hasOwnProperty,G=Object.prototype.propertyIsEnumerable,$=(h,v,k)=>v in h?L(h,v,{enumerable:!0,configurable:!0,writable:!0,value:k}):h[v]=k,ee=(h,v)=>{for(var k in v||(v={}))Y.call(v,k)&&$(h,k,v[k]);if(j)for(var k of j(v))G.call(v,k)&&$(h,k,v[k]);return h};function te(h,v,k,A,N=[]){const w=ee({},I()(v,{},!0)),Z=v.startsWith(`${h.pluginId}://`);if(w.protocol!=null&&(w.protocol=w.protocol.replace(":","")),w.protocol!=null&&w.protocol!==""&&!k[w.protocol])throw new Error(`Uri protocol '${w.protocol}' is not supported for ${h.pluginId}.`);if(w.host===""&&w.pathname==="")throw new Error("Path and host not found in uri.");const S={publicAddress:w.host!==""?w.host:w.pathname.split("/")[0]},z=w.query.label,Q=w.query.message,F=w.query.category;(z!=null||Q!=null||F!=null||Z)&&(S.metadata={},S.metadata.name=z,S.metadata.notes=Q,S.metadata.category=F,S.metadata.gateway=Z!=null?Z:!1);const V=w.query.amount;if(V!=null&&typeof V=="string"){A==null&&(A=h.currencyCode);const q=(0,e.Qs)(A!=null?A:"",h,N);if(q==null)throw new Error("InternalErrorInvalidCurrencyCode");let B=(0,T.mul)(V,q.multiplier);B=(0,T.toFixed)(B,0,0),S.nativeAmount=B,S.currencyCode=A}return{edgeParsedUri:S,parsedUri:w}}function ne(h,v,k){if(h.publicAddress==null)throw new Error("InvalidPublicAddressError");if(k==null&&h.label==null&&h.message==null)return h.publicAddress;{let A="";k!=null&&(A+="amount="+k+"&"),(h.label!=null||h.message!=null)&&(typeof h.label=="string"&&(A+="label="+h.label+"&"),typeof h.message=="string"&&(A+="message="+h.message+"&")),A=A.substr(0,A.length-1);const N={scheme:v,path:h.publicAddress,query:A};return(0,E.qC)(N)}}},99599:function(oe,X,f){"use strict";f.d(X,{K:function(){return T}});const T={parse(d){const E=encodeURI(d),b=new Uint8Array(E.length);let I=0;for(let e=0;e<E.length;++e){const L=E.charCodeAt(e);L===37?(b[I++]=parseInt(E.slice(e+1,e+3),16),e+=2):b[I++]=L}return b.subarray(0,I)},stringify(d){let E="";for(let b=0;b<d.length;++b){const I=d[b];E+="%"+(I>>4).toString(16)+(I&15).toString(16)}return decodeURIComponent(E)}}},55024:function(){}}]);
|