edge-currency-accountbased 2.2.4 → 2.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 +4 -0
- package/android/src/main/assets/edge-currency-accountbased/234.chunk.js +35 -0
- package/android/src/main/assets/edge-currency-accountbased/248.chunk.js +35 -0
- package/android/src/main/assets/edge-currency-accountbased/336.chunk.js +9 -0
- package/android/src/main/assets/edge-currency-accountbased/612.chunk.js +1 -0
- package/android/src/main/assets/edge-currency-accountbased/{945.chunk.js → 814.chunk.js} +8 -8
- package/android/src/main/assets/edge-currency-accountbased/935.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/94.chunk.js +8 -0
- package/android/src/main/assets/edge-currency-accountbased/algorand.chunk.js +2 -2
- package/android/src/main/assets/edge-currency-accountbased/bnb.chunk.js +4 -4
- package/android/src/main/assets/edge-currency-accountbased/edge-currency-accountbased.js +10 -10
- package/android/src/main/assets/edge-currency-accountbased/eos.chunk.js +12 -12
- package/android/src/main/assets/edge-currency-accountbased/ethereum.chunk.js +5 -5
- 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 +2 -2
- 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 +3 -3
- package/android/src/main/assets/edge-currency-accountbased/stellar.chunk.js +4 -4
- package/android/src/main/assets/edge-currency-accountbased/tezos.chunk.js +3 -3
- package/android/src/main/assets/edge-currency-accountbased/tron.chunk.js +1 -1
- package/android/src/main/assets/edge-currency-accountbased/zcash.chunk.js +2 -2
- package/lib/algorand/AlgorandEngine.js +46 -24
- package/lib/algorand/algorandInfo.js +8 -7
- package/lib/algorand/algorandTestnetInfo.js +8 -7
- package/lib/binance/BinanceEngine.js +19 -17
- package/lib/binance/binanceInfo.js +10 -7
- package/lib/common/types.js +10 -0
- package/lib/common/upgradeMemos.js +52 -0
- package/lib/common/utf8.js +32 -0
- package/lib/common/validateMemos.js +107 -0
- package/lib/eos/EosEngine.js +42 -41
- package/lib/eos/info/eosCommonInfo.js +10 -0
- package/lib/eos/info/eosInfo.js +15 -17
- package/lib/eos/info/telosInfo.js +15 -15
- package/lib/eos/info/waxInfo.js +15 -16
- package/lib/ethereum/EthereumEngine.js +13 -12
- package/lib/ethereum/EthereumNetwork.js +16 -14
- package/lib/ethereum/info/avalancheInfo.js +9 -7
- package/lib/ethereum/info/binancesmartchainInfo.js +9 -7
- package/lib/ethereum/info/celoInfo.js +9 -7
- package/lib/ethereum/info/ethDevInfo.js +9 -7
- package/lib/ethereum/info/ethereumCommonInfo.js +10 -0
- package/lib/ethereum/info/ethereumInfo.js +9 -7
- package/lib/ethereum/info/ethereumclassicInfo.js +9 -7
- package/lib/ethereum/info/ethereumpowInfo.js +9 -7
- package/lib/ethereum/info/fantomInfo.js +9 -7
- package/lib/ethereum/info/goerliInfo.js +9 -7
- package/lib/ethereum/info/kovanInfo.js +9 -7
- package/lib/ethereum/info/optimismInfo.js +9 -7
- package/lib/ethereum/info/polygonInfo.js +9 -7
- package/lib/ethereum/info/pulsechainInfo.js +9 -7
- package/lib/ethereum/info/rinkebyInfo.js +9 -7
- package/lib/ethereum/info/ropstenInfo.js +9 -7
- package/lib/ethereum/info/rskInfo.js +9 -7
- package/lib/ethereum/info/zksyncInfo.js +9 -7
- package/lib/filecoin/FilecoinEngine.js +21 -15
- package/lib/filecoin/filecoinInfo.js +5 -7
- package/lib/fio/FioEngine.js +25 -17
- package/lib/fio/fioInfo.js +8 -6
- package/lib/hedera/HederaEngine.js +22 -18
- package/lib/hedera/hederaInfo.js +11 -8
- package/lib/hedera/hederaTestnetInfo.js +6 -6
- package/lib/polkadot/PolkadotEngine.js +15 -9
- package/lib/polkadot/info/liberlandInfo.js +3 -2
- package/lib/polkadot/info/liberlandTestnetInfo.js +3 -2
- package/lib/polkadot/info/polkadotInfo.js +8 -5
- package/lib/ripple/RippleEngine.js +53 -75
- package/lib/ripple/rippleInfo.js +16 -8
- package/lib/solana/SolanaEngine.js +17 -12
- package/lib/solana/solanaInfo.js +9 -5
- package/lib/stellar/StellarEngine.js +31 -22
- package/lib/stellar/stellarInfo.js +16 -7
- package/lib/tezos/TezosEngine.js +17 -11
- package/lib/tezos/tezosInfo.js +8 -5
- package/lib/tron/TronEngine.js +85 -68
- package/lib/tron/tronInfo.js +8 -7
- package/lib/zcash/ZcashEngine.js +17 -19
- package/lib/zcash/piratechainInfo.js +8 -6
- package/lib/zcash/zcashInfo.js +7 -6
- package/package.json +2 -2
- package/android/src/main/assets/edge-currency-accountbased/124.chunk.js +0 -35
- package/android/src/main/assets/edge-currency-accountbased/223.chunk.js +0 -9
- package/android/src/main/assets/edge-currency-accountbased/650.chunk.js +0 -1
- package/android/src/main/assets/edge-currency-accountbased/689.chunk.js +0 -8
- package/android/src/main/assets/edge-currency-accountbased/826.chunk.js +0 -35
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkedge_currency_accountbased=self.webpackChunkedge_currency_accountbased||[]).push([[612],{84650:function(Z,$,T){T.d($,{P:function(){return u}});var D=T(77591),J=T.n(D),P=T(94935),g=T(20918),p=T(62177),b=T(76714),N=Object.defineProperty,H=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,K=Object.prototype.propertyIsEnumerable,B=(h,t,e)=>t in h?N(h,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):h[t]=e,S=(h,t)=>{for(var e in t||(t={}))A.call(t,e)&&B(h,e,t[e]);if(H)for(var e of H(t))K.call(t,e)&&B(h,e,t[e]);return h},m=(h,t,e)=>new Promise((s,o)=>{var l=f=>{try{w(e.next(f))}catch(x){o(x)}},a=f=>{try{w(e.throw(f))}catch(x){o(x)}},w=f=>f.done?s(f.value):Promise.resolve(f.value).then(l,a);w((e=e.apply(h,t)).next())});const R=1e4,U=1e3,k=3600*24;class u{constructor(t,e,s,o){this.allTokens=[],this.allTokensMap={},this.builtinTokens={},this.customTokens={},this.enabledTokenIds=[],this.enabledTokens=[];const{builtinTokens:l,currencyInfo:a}=t,{callbacks:w,customTokens:f,enabledTokenIds:x,log:C,walletLocalDisklet:_}=o;this.tools=e,this.log=C,this.warn=(E,j)=>this.log.warn(E+(0,b.HY)(j)),this.error=(E,j)=>this.log.error(E+(0,b.HY)(j)),this.engineOn=!1,this.addressesChecked=!1,this.tokenCheckBalanceStatus={},this.tokenCheckTransactionsStatus={},this.walletLocalDataDirty=!1,this.transactionsChangedArray=[],this.transactionList={},this.transactionListDirty=!1,this.transactionsLoaded=!1,this.txIdMap={},this.txIdList={},this.walletInfo=s,this.walletId=s.id,this.currencyInfo=a,this.timers={},this.otherData=void 0,this.minimumAddressBalance="0";const{currencyCode:O}=a;this.transactionList[O]=[],this.txIdMap[O]={},this.txIdList[O]=[],this.builtinTokens=l,this.changeCustomTokensSync(f),this.changeEnabledTokenIdsSync(x),o.userSettings!=null?this.currentSettings=o.userSettings:this.currentSettings=this.currencyInfo.defaultSettings,this.currencyEngineCallbacks=w,this.walletLocalDisklet=_,typeof this.walletInfo.keys.publicKey!="string"&&(this.walletInfo.keys.publicKey=s.keys.publicKey),this.walletLocalData={blockHeight:0,lastAddressQueryHeight:0,lastTransactionQueryHeight:{},lastTransactionDate:{},publicKey:"",totalBalances:{},lastCheckedTxsDropped:0,numUnconfirmedSpendTxs:0,numTransactions:{},unactivatedTokenIds:[],otherData:void 0},this.log(`Created Wallet Type ${this.walletInfo.type} for Currency Plugin ${this.currencyInfo.pluginId}`)}isSpendTx(t){if(t.nativeAmount!==""){if(t.nativeAmount.slice(0,1)==="-")return!0;if((0,D.gt)(t.nativeAmount,"0"))return!1}let e=!0;if(t.ourReceiveAddresses.length>0)for(const s of t.ourReceiveAddresses)s===this.walletLocalData.publicKey&&(e=!1);return e}setOtherData(t){throw new Error(`Unimplemented setOtherData for ${this.walletInfo.type}`)}loadTransactions(){return m(this,null,function*(){if(this.transactionsLoaded){this.log("Transactions already loaded");return}this.transactionsLoaded=!0;const t=this.walletLocalDisklet;let e;try{const a=yield t.getText(p.TD);e=JSON.parse(a)}catch{this.log("Could not load txidList file. Failure is ok on new device"),yield t.setText(p.TD,JSON.stringify(this.txIdList))}let s;try{const a=yield t.getText(p.DZ);s=JSON.parse(a)}catch{this.log("Could not load txidMap file. Failure is ok on new device"),yield t.setText(p.DZ,JSON.stringify(this.txIdMap))}let o;try{const a=yield t.getText(p.tC);o=JSON.parse(a)}catch(a){a.code==="ENOENT"?(this.log("Could not load transactionList file. Failure is ok on new device"),yield t.setText(p.tC,JSON.stringify(this.transactionList))):this.log.crash(a,this.walletLocalData)}let l=!0;for(const a of Object.keys(this.transactionList))if(this.transactionList[a]!=null&&this.transactionList[a].length>0){l=!1;break}if(l)this.transactionList=o!=null?o:this.transactionList,this.txIdList=e!=null?e:this.txIdList,this.txIdMap=s!=null?s:this.txIdMap;else if(o!=null)for(const a of Object.keys(o))for(const w of o[a])this.addTransaction(a,w);for(const a in this.transactionList)this.walletLocalData.numTransactions[a]=this.transactionList[a].length})}loadEngine(){return m(this,null,function*(){var t;const{walletInfo:e}=this,{currencyCode:s}=this.currencyInfo;this.walletInfo.keys.publicKey==null&&(this.walletInfo.keys.publicKey=e.keys.publicKey);const o=this.walletLocalDisklet;try{const l=yield o.getText(p.Pe);this.walletLocalData=(0,p.O2)(JSON.parse(l)),this.walletLocalData.publicKey=this.walletInfo.keys.publicKey}catch{try{this.log("No walletLocalData setup yet: Failure is ok"),this.walletLocalData=(0,p.O2)({}),this.walletLocalData.publicKey=this.walletInfo.keys.publicKey,yield o.setText(p.Pe,JSON.stringify(this.walletLocalData))}catch(a){throw this.error("Error writing to localDataStore. Engine not started: ",a),a}}this.setOtherData((t=this.walletLocalData.otherData)!=null?t:{}),this.walletLocalDataDirty=!(0,b.dQ)(this.otherData,this.walletLocalData.otherData),this.tokenCheckBalanceStatus[s]=0,this.tokenCheckTransactionsStatus[s]=0,this.doInitialBalanceCallback(),this.doInitialUnactivatedTokenIdsCallback()})}findTransaction(t,e){if(this.txIdMap[t]!=null){const s=this.txIdMap[t][e];if(typeof s=="number")return s}return-1}sortTxByDate(t,e){return e.date-t.date}addTransaction(t,e,s){this.log("executing addTransaction: ",e.txid),e.otherParams==null&&(e.otherParams={}),e.blockHeight<1&&(e.otherParams.lastSeenTime=s!=null?s:Math.round(Date.now()/1e3));const o=(0,b.f0)(e.txid),l=this.findTransaction(t,o);let a=!1;if(l===-1){if(this.isSpendTx(e)&&e.blockHeight===0&&(this.walletLocalData.numUnconfirmedSpendTxs++,this.walletLocalDataDirty=!0),a=!0,typeof this.transactionList[t]>"u")this.transactionList[t]=[];else if(this.transactionList[t].length>=U)return;this.transactionList[t].push(e),this.walletLocalData.numTransactions[t]=this.transactionList[t].length,this.walletLocalDataDirty=!0,this.transactionListDirty=!0,this.transactionsChangedArray.push(e),this.warn(`addTransaction new tx: ${e.txid}`)}else{const f=this.transactionList[t][l],{otherParams:x={}}=f,{otherParams:C={}}=e;(f.blockHeight<e.blockHeight||f.blockHeight===0&&e.blockHeight<0||f.blockHeight===e.blockHeight&&(f.networkFee!==e.networkFee||f.nativeAmount!==e.nativeAmount||x.lastSeenTime!==C.lastSeenTime||f.date!==e.date))&&(this.isSpendTx(e)&&e.blockHeight!==0&&f.blockHeight===0&&this.walletLocalData.numUnconfirmedSpendTxs--,f.date!==e.date&&(a=!0),this.warn(`addTransaction: update ${e.txid} height:${e.blockHeight}`),this.walletLocalDataDirty=!0,this.updateTransaction(t,e,l))}a&&this.sortTransactions(t)}sortTransactions(t){this.transactionList[t].sort(this.sortTxByDate);const e=[];let s=0;for(const o of this.transactionList[t])this.txIdMap[t]==null&&(this.txIdMap[t]={}),this.txIdMap[t][(0,b.f0)(o.txid)]=s,e.push((0,b.f0)(o.txid)),s++;this.txIdList[t]=e}checkDroppedTransactionsThrottled(){const t=Date.now()/1e3;t-this.walletLocalData.lastCheckedTxsDropped>k&&(this.checkDroppedTransactions(t),this.walletLocalData.lastCheckedTxsDropped=t,this.walletLocalDataDirty=!0,this.transactionsChangedArray.length>0&&(this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray),this.transactionsChangedArray=[]))}checkDroppedTransactions(t){let e=0;for(const s in this.transactionList)for(let o=0;o<this.transactionList[s].length;o++){const l=this.transactionList[s][o];if(l.blockHeight===0){const{otherParams:a={}}=l,w=a.lastSeenTime;t-w>k?(l.blockHeight=-1,l.nativeAmount="0",this.transactionsChangedArray.push(l)):this.isSpendTx(l)&&e++}}this.walletLocalData.numUnconfirmedSpendTxs=e,this.walletLocalDataDirty=!0}updateBalance(t,e){const s=this.walletLocalData.totalBalances[t];this.walletLocalData.totalBalances[t]==null&&(this.walletLocalData.totalBalances[t]="0"),(s==null||!(0,D.eq)(e,s))&&(this.walletLocalData.totalBalances[t]=e,this.walletLocalDataDirty=!0,this.warn(`${t}: token Address balance: ${e}`),this.currencyEngineCallbacks.onBalanceChanged(t,e)),this.tokenCheckBalanceStatus[t]=1,this.updateOnAddressesChecked()}updateTransaction(t,e,s){this.transactionList[t][s]=e,this.transactionListDirty=!0,this.transactionsChangedArray.push(e),this.warn(`updateTransaction: ${e.txid}`)}saveWalletLoop(){return m(this,null,function*(){const t=this.walletLocalDisklet,e=[];if(this.transactionListDirty){yield this.loadTransactions(),this.log("transactionListDirty. Saving...");let s=JSON.stringify(this.transactionList);e.push(t.setText(p.tC,s).catch(o=>{this.error("Error saving transactionList ",o)})),s=JSON.stringify(this.txIdList),e.push(t.setText(p.TD,s).catch(o=>{this.error("Error saving txIdList ",o)})),s=JSON.stringify(this.txIdMap),e.push(t.setText(p.DZ,s).catch(o=>{this.error("Error saving txIdMap ",o)})),yield Promise.all(e),this.transactionListDirty=!1}if(this.walletLocalDataDirty){this.log("walletLocalDataDirty. Saving..."),this.walletLocalData.otherData=this.otherData;const s=JSON.stringify(this.walletLocalData);yield t.setText(p.Pe,s).then(()=>{this.walletLocalDataDirty=!1}).catch(o=>{this.error("Error saving walletLocalData ",o)})}})}doInitialBalanceCallback(){var t;for(const e of this.enabledTokens)try{this.currencyEngineCallbacks.onBalanceChanged(e,(t=this.walletLocalData.totalBalances[e])!=null?t:"0")}catch(s){this.error(`doInitialBalanceCallback Error for currencyCode ${e}`,s)}}doInitialUnactivatedTokenIdsCallback(){try{this.walletLocalData.unactivatedTokenIds!=null&&this.walletLocalData.unactivatedTokenIds.length>0&&this.currencyEngineCallbacks.onUnactivatedTokenIdsChanged(this.walletLocalData.unactivatedTokenIds)}catch(t){this.error("doInitialUnactivatedTokenIdsCallback Error",t)}}addToLoop(t,e){return m(this,null,function*(){try{yield this[t]()}catch(s){this.error(`Error in Loop: ${t} `,s)}return this.engineOn&&(this.timers[t]=setTimeout(()=>{this.engineOn&&this.addToLoop(t,e).catch(s=>this.log(s.message))},e)),!0})}getTokenInfo(t){return this.allTokens.find(e=>e.currencyCode===t)}updateOnAddressesChecked(){var t,e;if(this.addressesChecked)return;const s=this.enabledTokens,o=1/s.length;let l=0,a=0;for(const w of s){const f=(t=this.tokenCheckBalanceStatus[w])!=null?t:0,x=(e=this.tokenCheckTransactionsStatus[w])!=null?e:0;l+=(f+x)/2*o,f===1&&x===1&&a++}a===s.length&&(l=1,this.addressesChecked=!0),this.log(`${this.walletId} syncRatio of: ${l}`),this.currencyEngineCallbacks.onAddressesChecked(l)}clearBlockchainCache(){return m(this,null,function*(){this.walletLocalData=(0,p.O2)({publicKey:this.walletLocalData.publicKey}),this.walletLocalDataDirty=!0,this.addressesChecked=!1,this.tokenCheckBalanceStatus={},this.tokenCheckTransactionsStatus={},this.transactionList={},this.txIdList={},this.txIdMap={},this.transactionListDirty=!0,this.setOtherData({}),yield this.saveWalletLoop()})}startEngine(){return m(this,null,function*(){this.addToLoop("saveWalletLoop",R).catch(()=>{})})}killEngine(){return m(this,null,function*(){this.engineOn=!1;for(const t in this.timers)clearTimeout(this.timers[t]);this.timers={}})}changeUserSettings(t){return m(this,null,function*(){this.currentSettings=t})}getBlockHeight(){return this.walletLocalData.blockHeight}changeCustomTokensSync(t){this.customTokens={};for(const e of Object.keys(t)){const s=t[e];try{(0,g.Rp)(s)}catch{this.log.warn(`Dropping custom token "${s.currencyCode}" / ${e}`);continue}this.customTokens[e]=s}this.allTokensMap=S(S({},this.customTokens),this.builtinTokens),this.allTokens=(0,g.ZS)(this.allTokensMap)}changeCustomTokens(t){return m(this,null,function*(){this.changeCustomTokensSync(t)})}changeEnabledTokenIdsSync(t){const{currencyCode:e}=this.currencyInfo,s=new Set,o=new Set;for(const l of t){const a=this.allTokensMap[l];a!=null&&(s.add(a.currencyCode),o.add(l))}this.enabledTokens=[...s,e],this.enabledTokenIds=[...o]}changeEnabledTokenIds(t){return m(this,null,function*(){this.changeEnabledTokenIdsSync(t)})}getBalance(t){const{currencyCode:e=this.currencyInfo.currencyCode}=t,s=this.walletLocalData.totalBalances[e];return s==null?"0":s}getNumTransactions(t){const{currencyCode:e=this.currencyInfo.currencyCode}=t;return this.walletLocalData.numTransactions[e]==null?0:this.walletLocalData.numTransactions[e]}getTransactions(t){return m(this,null,function*(){const{currencyCode:e=this.currencyInfo.currencyCode}=t;if(yield this.loadTransactions(),this.transactionList[e]==null)return[];let s=0,o=0;if(t===null)return this.transactionList[e].slice(0);t.startIndex!=null&&t.startIndex>0&&(s=t.startIndex,s>=this.transactionList[e].length&&(s=this.transactionList[e].length-1)),t.startEntries!=null&&t.startEntries>0&&(o=t.startEntries,o+s>this.transactionList[e].length&&(o=this.transactionList[e].length-s));let l=[];return o!==0?l=this.transactionList[e].slice(s,o+s):l=this.transactionList[e].slice(s),l})}getFreshAddress(t){return m(this,null,function*(){return{publicAddress:this.walletLocalData.publicKey}})}addGapLimitAddresses(t){return m(this,null,function*(){})}isAddressUsed(t){return m(this,null,function*(){return!1})}dumpData(){return m(this,null,function*(){return{walletId:this.walletId.split(" - ")[0],walletType:this.walletInfo.type,data:{pluginType:{pluginId:this.currencyInfo.pluginId},walletLocalData:this.walletLocalData}}})}makeSpendCheck(t){var e,s,o;const{skipChecks:l=!1}=t;for(const C of t.spendTargets)if(!l&&C.publicAddress===this.walletLocalData.publicKey)throw new P.l0;let a="";if(typeof t.currencyCode=="string"){if(a=t.currencyCode,a!==this.currencyInfo.currencyCode&&!this.enabledTokens.includes(a))throw new Error("Error: Token not supported or enabled")}else a=this.currencyInfo.currencyCode;const w=(e=this.walletLocalData.totalBalances[a])!=null?e:"0",f={};for(const C of t.spendTargets){const{nativeAmount:_}=C;_!=null&&(f[a]=(s=f[a])!=null?s:"0",f[a]=(0,D.add)(f[a],_))}for(const[C,_]of Object.entries(f)){const O=(o=this.walletLocalData.totalBalances[C])!=null?o:"0";if(!l&&(0,D.lt)(O,_))throw new P.C_}t.currencyCode=a;const x=(0,b.aL)(a,this.currencyInfo,this.allTokensMap);if(x==null)throw new Error("InternalErrorInvalidCurrencyCode");return{edgeSpendInfo:t,nativeBalance:w,currencyCode:a,denom:x,skipChecks:l}}checkRecipientMinimumBalance(t,e,s){return m(this,null,function*(){if((0,D.gte)(e,this.minimumAddressBalance))return;const o=yield t(s);if((0,D.lt)((0,D.add)(e,o),this.minimumAddressBalance)){const l=this.currencyInfo.denominations.find(w=>w.name===this.currencyInfo.currencyCode);if(l==null)throw new Error("Unknown denom");const a=(0,D.div)(this.minimumAddressBalance,l.multiplier);throw new Error(`Recipient address not activated. A minimum ${a} ${this.currencyInfo.currencyCode} transfer is required to send funds to this address`)}})}saveTx(t){return m(this,null,function*(){this.addTransaction(t.currencyCode,t),this.transactionsChangedArray.forEach(e=>this.warn(`executing back in saveTx and this.transactionsChangedArray is: ${(0,b.oX)(e)}`)),this.transactionsChangedArray.length>0&&this.currencyEngineCallbacks.onTransactionsChanged(this.transactionsChangedArray)})}resyncBlockchain(){return m(this,null,function*(){throw new Error("not implemented")})}makeSpend(t,e){return m(this,null,function*(){throw new Error("not implemented")})}signTx(t,e){return m(this,null,function*(){throw new Error("not implemented")})}broadcastTx(t,e){return m(this,null,function*(){throw new Error("not implemented")})}}},72681:function(Z,$,T){T.d($,{s:function(){return U}});var D=T(77591),J=T(82448),P=T(62177);function g(k,u){var h;const{memos:t=[]}=k,{displayName:e,memoMaxLength:s,memoMaxValue:o,memoOptions:l=[],multipleMemos:a=!1,memoType:w}=u,f=[...l];w==="text"&&f.push({type:"text",maxLength:s}),w==="number"&&f.push({type:"number",maxValue:o}),w==="hex"&&f.push({type:"hex",maxBytes:s==null?void 0:s/2});const{memoName:x="memo"}=(h=l[0])!=null?h:{};for(const C of t){const _=f.filter(E=>C.type===E.type);if(_.length<1)throw new Error(`${e} ${x}: cannot be type ${C.type}`);const O=_.map(E=>p(C,E)).find(E=>E!=null);if(O!=null)throw new Error(`${e} {memoName}: ${O}`)}if(!a&&t.length>1)throw new Error(`${e} only supports one ${x}`)}function p(k,u){if(u.type==="text"&&u.maxLength!=null&&k.value.length>u.maxLength)return`cannot be longer than ${u.maxLength}`;if(u.type==="number"){const h=(0,J.Vk)(P.jD)(k.value);if(h==null)return"is not a valid number";if(u.maxValue!=null&&(0,D.gt)(h,u.maxValue))return`cannot be greater than ${u.maxValue}`}if(u.type==="hex"){const h=(0,J.Vk)(P.rS)(k.value);if(h==null)return"is not valid hexadecimal";if(u.maxBytes!=null&&h.length>u.maxBytes)return`cannot be longer than ${u.maxBytes} bytes`;if(u.minBytes!=null&&h.length<u.minBytes)return`cannot be shorter than ${u.minBytes} bytes`}}var b=Object.defineProperty,N=Object.defineProperties,H=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,K=Object.prototype.hasOwnProperty,B=Object.prototype.propertyIsEnumerable,S=(k,u,h)=>u in k?b(k,u,{enumerable:!0,configurable:!0,writable:!0,value:h}):k[u]=h,m=(k,u)=>{for(var h in u||(u={}))K.call(u,h)&&S(k,h,u[h]);if(A)for(var h of A(u))B.call(u,h)&&S(k,h,u[h]);return k},R=(k,u)=>N(k,H(u));function U(k,u){var h,t;const{memoType:e}=u,s=[];if(e==="hex"||e==="number"||e==="text")for(const l of k.spendTargets)l.memo!=null?s.push({type:e,value:l.memo}):l.uniqueIdentifier!=null?s.push({type:e,value:l.uniqueIdentifier}):typeof((h=l.otherParams)==null?void 0:h.uniqueIdentifier)=="string"&&s.push({type:e,value:l.otherParams.uniqueIdentifier});for(const l of s)l.type==="hex"&&(l.value=l.value.replace(/^0x/i,""));const o=R(m({},k),{memos:(t=k.memos)!=null?t:s});return g(o,u),o}},76714:function(Z,$,T){T.d($,{$9:function(){return k},EE:function(){return O},HB:function(){return e},HY:function(){return j},KT:function(){return m},NC:function(){return K},QJ:function(){return a},Qs:function(){return u},Sy:function(){return N},Vs:function(){return l},Wp:function(){return s},X0:function(){return U},Xp:function(){return f},Y7:function(){return Q},Z8:function(){return R},aL:function(){return h},ah:function(){return B},dQ:function(){return V},f0:function(){return b},gc:function(){return S},jT:function(){return x},ml:function(){return o},nu:function(){return z},oX:function(){return _},sD:function(){return w},vq:function(){return A},zR:function(){return E}});var D=T(77591),J=T.n(D),P=T(48764),g=T(82448),p=(n,i,r)=>new Promise((c,y)=>{var L=v=>{try{I(r.next(v))}catch(M){y(M)}},d=v=>{try{I(r.throw(v))}catch(M){y(M)}},I=v=>v.done?c(v.value):Promise.resolve(v.value).then(L,d);I((r=r.apply(n,i)).next())});function b(n){return n.toLowerCase().replace("0x","")}function N(n){let i=n.length,r,c;for(;i!==0;)c=Math.floor(Math.random()*i),i-=1,r=n[i],n[i]=n[c],n[c]=r;return n}function H(n){return Object.keys(n).length!==0}function A(n){return/^[0-9A-F]+$/i.test(m(n))}function K(n){return(0,D.add)(n,"0",16)}function B(n){const i=n.replace("0x","");return P.Buffer.from(i,"hex")}function S(n,i){return 2*i-n.length>0?n.padStart(2*i,"0"):n}function m(n){return n.indexOf("0x")===0?n.substring(2):n}function R(n){const i=n.toLowerCase(),r=i.startsWith("0x")?i:`0x${i}`;return(0,D.add)(r,"0",10)}function U(n){return(0,D.add)(n,"0",16)}function k(n){return"0x"+P.Buffer.from(n).toString("hex")}function u(n,i,r){for(const c of i.denominations)if(c.name===n)return c;for(const c of r)for(const y of c.denominations)if(y.name===n)return y;for(const c of i.metaTokens)for(const y of c.denominations)if(y.name===n)return y}function h(n,i,r){for(const c of i.denominations)if(c.name===n)return c;for(const c of Object.keys(r)){const y=r[c];for(const L of y.denominations)if(L.name===n)return L}}const t=n=>p(void 0,null,function*(){return yield new Promise((i,r)=>setTimeout(r,n))}),e=n=>p(void 0,null,function*(){return yield new Promise(i=>setTimeout(i,n))});function s(n){return p(this,null,function*(){return yield new Promise((i,r)=>{let c=n.length;for(const y of n)y.then(L=>{i(L)},L=>{--c===0&&r(L)})})})}function o(n,i){return p(this,arguments,function*(r,c,y=r.length){const L={};return yield new Promise((d,I)=>{let v=0,M=0,F=!1;for(const G of r)G.then(X=>{const W=c(X);W!==void 0?(v++,L[W]!==void 0?L[W]++:L[W]=1,!F&&L[W]>=y&&(F=!0,d(X))):++M+v===r.length&&I(Error(`Could not resolve ${y} promises`))},X=>{++M+v===r.length&&I(X)})})})}function l(n,i){return p(this,arguments,function*(r,c,y=new Error(`Timeout of ${c}ms exceeded`)){return yield new Promise((L,d)=>{const I=setTimeout(()=>d(y),c);r.then(v=>{L(v),clearTimeout(I)},v=>{d(v),clearTimeout(I)})})})}function a(n,i=5e3){return p(this,null,function*(){let r=n.length;const c=[];for(const y of n){const L=c.length;c.push(y().catch(d=>{throw d.index=L,d})),r>1&&c.push(new Promise(d=>{e(i).then(()=>{d("async_waterfall_timed_out")})}));try{const d=yield Promise.race(c);if(d==="async_waterfall_timed_out"){const I=c.pop();I==null||I.then().catch(),--r}else return d}catch(d){const I=d.index;c.splice(I,1);const v=c.pop();if(v==null||v.then().catch(),--r,r===0)throw d}}})}function w(n,i){if(n.length<=i)return n;const r=[];for(let c=0;c<n.length&&r.length<i;++c){const y=(i-r.length)/(n.length-c);Math.random()<=y&&r.push(n[c])}return r}function f(n){const i=n.otherParams;if(i==null)throw new TypeError("Transaction is missing otherParams");return i}function x(){let n=!1;const i=[];return function(c){return p(this,null,function*(){n&&(yield new Promise(y=>i.push(()=>y(void 0))));try{return n=!0,yield c()}finally{n=!1;const y=i.shift();y!=null&&y()}})}}const C=(0,g.su)({txid:g.XC,spendTargets:(0,g.Zz)((0,g._2)((0,g.su)({currencyCode:g.XC,nativeAmount:g.XC,publicAddress:g.XC,uniqueIdentifier:(0,g.Zz)(g.XC)}))),signedTx:g.XC,otherParams:(0,g.Zz)((0,g.su)({gas:(0,g.Zz)(g.XC),gasPrice:(0,g.Zz)(g.XC),nonceUsed:(0,g.Zz)(g.XC)}))});function _(n){return JSON.stringify(C(n),null,2)}function O(n){const[i,r]=n.split("e");return r==null?n:(0,D.mul)(i,"1"+"0".repeat(parseInt(r))).toString()}function E(n){var i;return(i=n.fetchCors)!=null?i:n.fetch}function j(n){let i="";return n!=null&&(n.name!=null&&(i+=`${n.name} `),n.message!=null&&(i+=n.message)),i}function z(...n){const i={};for(const r of n)if(r!=null)for(const c of Object.keys(r))r[c]!=null&&(i[c]=i[c]!=null&&typeof r[c]=="object"?z(i[c],r[c]):r[c]);return i}function Q(n){const[i,r]=n.split(".");return r==null?i:parseInt(r[0])>=5?(0,D.add)(i,"1"):i}const q=n=>console.log(JSON.stringify(n,null,2));function V(n,i){if(typeof n!="object"||typeof i!="object"||n==null||i==null)return n===i;const r=Array.isArray(n),c=Array.isArray(i);if(r!==c)return!1;if(r){if(n.length!==i.length)return!1;for(let d=0;d<n.length;++d)if(!V(n[d],i[d]))return!1;return!0}const y=Object.getOwnPropertyNames(n).filter(d=>n[d]!==void 0),L=Object.getOwnPropertyNames(i).filter(d=>i[d]!==void 0);if(y.length!==L.length)return!1;for(const d of y)if(!Object.prototype.hasOwnProperty.call(i,d)||!V(n[d],i[d]))return!1;return!0}const Y=(n,i)=>{for(const r of Object.keys(n)){if(typeof n[r]=="object"){if(typeof i[r]!="object"||!Y(n[r],i[r]))return!1;continue}if(n[r]!==i[r])return!1}return!0}}}]);
|