@readyio/react-native-wallet 0.1.37 → 0.1.38

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.
@@ -708,7 +708,7 @@ __d((function(e,s,t,a,d,i,n){d.exports=s(n[0]).registerAsset({__packager_asset:!
708
708
  __d((function(g,r,i,a,m,e,d){'use strict';m.exports=r(d[0])}),639,[165]);
709
709
  __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r(d[0])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[0])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[0])[n]}}))})),Object.keys(r(d[1])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[1])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[1])[n]}}))})),Object.keys(r(d[2])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[2])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[2])[n]}}))})),Object.keys(r(d[3])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[3])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[3])[n]}}))})),Object.keys(r(d[4])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[4])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[4])[n]}}))}))}),640,[641,2001,646,2002,2005]);
710
710
  __d((function(g,r,i,a,m,_e,d){Object.defineProperty(_e,"__esModule",{value:!0}),_e.tokenDataService=_e.TokenDataService=void 0;var e,t,n,o=r(d[0])(r(d[1])),s=r(d[0])(r(d[2])),u=r(d[0])(r(d[3])),c=r(d[0])(r(d[4])),l='token_data_service__custom_tokens',k=_e.TokenDataService=(0,c.default)((function e(){(0,u.default)(this,e),this.customTokens=[],this.tokenList=(0,r(d[5]).getFullTokenList)()}),[{key:"getAllTokens",value:function(){var e=this,t=[];return r(d[6]).SUPPORTED_CHAINS.forEach((function(n){if(e.tokenList[n.chainId]){var o=(0,r(d[7]).uniqBy)([].concat((0,s.default)(e.tokenList[n.chainId]),(0,s.default)(e.customTokens.filter((function(e){return e.chainId===n.chainId})))),(function(e){return e.address.toLowerCase()}));t=t.concat(o)}})),t}},{key:"getAllPopularTokens",value:function(){var e=this,t=[];return Object.keys(r(d[8]).POPULAR_TOKENS).forEach((function(n){r(d[8]).POPULAR_TOKENS[n].forEach((function(o){var s=e.getToken({chainId:n,address:o.address});s&&t.push(s)}))})),t}},{key:"getToken",value:function(e){var t,n,o=e.symbol,s=e.chainNumber,u=e.namespace,c=e.chainId,l=e.address;return!c&&s&&(c=(u||'eip155')+":"+s),o||l?((null==(t=l)?void 0:t.toLowerCase())!==r(d[8]).NULL_ADDRESS.toLowerCase()&&l!==r(d[8]).MAIN_COIN_ADDRESS||(l=c&&(null==(n=(0,r(d[9]).getNativeTokenMetadata)(c))?void 0:n.address)||r(d[8]).MAIN_COIN_ADDRESS),this.getAllTokens().find((function(e){var t=!0;return o&&(t=t&&e.symbol.toUpperCase()===o.toUpperCase()),l&&(t=('tron'===u||c.startsWith('tron:'))&&l.startsWith('0x')?t&&e.address.toLowerCase()===(0,r(d[9]).getTronAddressFromEvmAddress)(l).toLowerCase():t&&e.address.toLowerCase()===l.toLowerCase()),c&&(t=t&&e.chainId===c),t}))):null}},{key:"getUnknownToken",value:(n=(0,o.default)((function*(e){var t=e.chainNumber,n=e.namespace,o=e.address,s=e.dontSave,u=e.chainId;if(!u&&t&&(u=(n||'eip155')+":"+t),!u||!o)return null;try{var c=yield(0,r(d[9]).getTokenMetadataByAddress)(o,u);return c?(c.isCustomToken=!0,s||this.addCustomToken(c),c):null}catch(e){return null}})),function(e){return n.apply(this,arguments)})},{key:"isNativeToken",value:function(e,t){return(0,r(d[9]).isNativeToken)(e,t)}},{key:"addCustomToken",value:function(e){var t=this.customTokens.findIndex((function(t){return t.chainId===e.chainId&&t.address.toLowerCase()===e.address.toLowerCase()}));t<0?this.customTokens.push(e):this.customTokens[t]=e,(0,r(d[10]).save)(l,this.customTokens)}},{key:"removeCustomToken",value:function(e,t){this.customTokens=this.customTokens.filter((function(n){return!(n.chainId===t&&n.address.toLowerCase()===e.toLowerCase())})),(0,r(d[10]).save)(l,this.customTokens)}},{key:"loadCustomTokens",value:(t=(0,o.default)((function*(){var e=yield(0,r(d[10]).load)(l);e&&(this.customTokens=e.map((function(e){return Object.assign({},e,{isCustomToken:!0})})))})),function(){return t.apply(this,arguments)})},{key:"clearCustomTokens",value:(e=(0,o.default)((function*(){this.customTokens=[],(0,r(d[10]).save)(l,[])})),function(){return e.apply(this,arguments)})}]);_e.tokenDataService=new k}),641,[20,316,23,9,12,642,1979,1981,646,647,1982]);
711
- __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeTokensRecord=e.getFullTokenList=e.EXTRA_TOKENS=void 0;var n,t=r(d[0])(r(d[1])),o=r(d[0])(r(d[2])),s=e.EXTRA_TOKENS=(n={},(0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)(n,r(d[3]).ChainId.BSC_TESTNET,[{address:'0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd',symbol:'WBNB',chainId:r(d[3]).ChainId.BSC_TESTNET,name:'Wrapped BNB',decimals:18}]),r(d[3]).ChainId.MAINNET,[]),r(d[3]).ChainId.GOERLI,[]),r(d[3]).ChainId.ARBITRUM_ONE,[]),r(d[3]).ChainId.OPTIMISM,[]),r(d[3]).ChainId.OPTIMISM_GOERLI,[]),r(d[3]).ChainId.POLYGON,[]),r(d[3]).ChainId.POLYGON_MUMBAI,[]),r(d[3]).ChainId.BSC,[]),r(d[3]).ChainId.CELO,[]),(0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)((0,o.default)(n,r(d[3]).ChainId.CELO_ALFAJORES,[]),r(d[3]).ChainId.SOLANA_MAINNET,[]),r(d[3]).ChainId.TRON_MAINNET,[]),r(d[3]).ChainId.TRON_TESTNET_SHASTA,[]),r(d[3]).ChainId.TRON_TESTNET_NILE,[]),r(d[3]).ChainId.ONUS_MAINNET,[{address:r(d[4]).MAIN_COIN_ADDRESS,symbol:'ONUS',chainId:r(d[3]).ChainId.ONUS_MAINNET,name:'ONUS',decimals:18,logo:'https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png?1696523773'}]),r(d[3]).ChainId.ONUS_TESTNET,[{address:r(d[4]).MAIN_COIN_ADDRESS,symbol:'ONUS',chainId:r(d[3]).ChainId.ONUS_TESTNET,name:'ONUS',decimals:18,logo:'https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png?1696523773'}]));Object.keys(s).forEach((function(n){var t=(0,r(d[5]).getNativeTokenMetadata)(n);t&&s[n].unshift(t)}));var N=e.mergeTokensRecord=function(n,o){var s={};function N(n,t){var o=new Map;for(var s of n)o.set(s.address.toLowerCase(),s);for(var N of t)o.set(N.address.toLowerCase(),N);return Array.from(o.values())}var I=new Set([].concat((0,t.default)(Object.keys(n)),(0,t.default)(Object.keys(o))));for(var T of I){var f=n[T]||[],l=o[T]||[];s[T]=N(f,l)}return s};e.getFullTokenList=function(){return N((0,r(d[5]).getTokenList)(),s)}}),642,[20,23,157,643,646,647]);
711
+ __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.mergeTokensRecord=e.getFullTokenList=e.EXTRA_TOKENS=void 0;var n,t=r(d[0])(r(d[1])),s=r(d[0])(r(d[2])),o=e.EXTRA_TOKENS=(n={},(0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)(n,r(d[3]).ChainId.BSC_TESTNET,[{address:'0xae13d989daC2f0dEbFf460aC112a837C89BAa7cd',symbol:'WBNB',chainId:r(d[3]).ChainId.BSC_TESTNET,name:'Wrapped BNB',decimals:18}]),r(d[3]).ChainId.MAINNET,[]),r(d[3]).ChainId.GOERLI,[]),r(d[3]).ChainId.ARBITRUM_ONE,[]),r(d[3]).ChainId.OPTIMISM,[]),r(d[3]).ChainId.OPTIMISM_GOERLI,[]),r(d[3]).ChainId.POLYGON,[]),r(d[3]).ChainId.POLYGON_MUMBAI,[]),r(d[3]).ChainId.BSC,[]),r(d[3]).ChainId.CELO,[]),(0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)((0,s.default)(n,r(d[3]).ChainId.CELO_ALFAJORES,[]),r(d[3]).ChainId.SOLANA_MAINNET,[]),r(d[3]).ChainId.TRON_MAINNET,[]),r(d[3]).ChainId.TRON_TESTNET_SHASTA,[]),r(d[3]).ChainId.TRON_TESTNET_NILE,[]),r(d[3]).ChainId.ONUS_MAINNET,[{address:r(d[4]).MAIN_COIN_ADDRESS,symbol:'ONUS',chainId:r(d[3]).ChainId.ONUS_MAINNET,name:'ONUS',decimals:18,logo:'https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png?1696523773'},{address:'0xa6b9579563A48a0540BB53853Ae0947972371169',symbol:'VNDC',chainId:r(d[3]).ChainId.ONUS_MAINNET,name:'VNDC',decimals:0,logo:'https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png?1696523773'}]),r(d[3]).ChainId.ONUS_TESTNET,[{address:r(d[4]).MAIN_COIN_ADDRESS,symbol:'ONUS',chainId:r(d[3]).ChainId.ONUS_TESTNET,name:'ONUS',decimals:18,logo:'https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png?1696523773'}]));Object.keys(o).forEach((function(n){var t=(0,r(d[5]).getNativeTokenMetadata)(n);t&&o[n].unshift(t)}));var N=e.mergeTokensRecord=function(n,s){var o={};function N(n,t){var s=new Map;for(var o of n)s.set(o.address.toLowerCase(),o);for(var N of t)s.set(N.address.toLowerCase(),N);return Array.from(s.values())}var I=new Set([].concat((0,t.default)(Object.keys(n)),(0,t.default)(Object.keys(s))));for(var T of I){var l=n[T]||[],f=s[T]||[];o[T]=N(l,f)}return o};e.getFullTokenList=function(){return N((0,r(d[5]).getTokenList)(),o)}}),642,[20,23,157,643,646,647]);
712
712
  __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r(d[0])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[0])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[0])[n]}}))})),Object.keys(r(d[1])).forEach((function(n){"default"!==n&&"__esModule"!==n&&(n in e&&e[n]===r(d[1])[n]||Object.defineProperty(e,n,{enumerable:!0,get:function(){return r(d[1])[n]}}))}))}),643,[644,645]);
713
713
  __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.L2_CHAIN_IDS=e.L1_CHAIN_IDS=e.ChainNamespace=e.ChainLayer=e.ChainId=e.CHAIN_INFO=void 0,e.getChainInfo=function(n){if(l.hasOwnProperty(n))return l[n];return},e.getChainReference=function(n){if(!l.hasOwnProperty(n))return;var o=n.split(':');if(2!=o.length)return;return o[1]};var n,o,t,s,c=r(d[0])(r(d[1]));!(function(n){n.eip155="eip155",n.tron="tron",n.solana="solana"})(o||(e.ChainNamespace=o={})),(function(n){n[n.L1=1]="L1",n[n.L2=2]="L2"})(t||(e.ChainLayer=t={})),(function(n){n.MAINNET="eip155:1",n.GOERLI="eip155:5",n.POLYGON="eip155:137",n.POLYGON_MUMBAI="eip155:80001",n.BSC="eip155:56",n.BSC_TESTNET="eip155:97",n.TRON_MAINNET="tron:728126428",n.TRON_TESTNET_SHASTA="tron:2494104990",n.TRON_TESTNET_NILE="tron:3448148188",n.SOLANA_MAINNET="solana:1399811149",n.ONUS_MAINNET="eip155:1975",n.ONUS_TESTNET="eip155:1945",n.ARBITRUM_ONE="eip155:42161",n.OPTIMISM="eip155:10",n.OPTIMISM_GOERLI="eip155:420",n.CELO="eip155:42220",n.CELO_ALFAJORES="eip155:44787"})(s||(e.ChainId=s={}));e.L1_CHAIN_IDS=[s.MAINNET,s.BSC,s.CELO,s.TRON_MAINNET,s.SOLANA_MAINNET,s.GOERLI,s.BSC_TESTNET,s.CELO_ALFAJORES,s.TRON_TESTNET_SHASTA,s.TRON_TESTNET_NILE],e.L2_CHAIN_IDS=[s.POLYGON,s.ONUS_MAINNET,s.ONUS_TESTNET,s.ARBITRUM_ONE,s.OPTIMISM,s.POLYGON_MUMBAI,s.OPTIMISM_GOERLI];var l=e.CHAIN_INFO=(n={},(0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)(n,s.MAINNET,{chainNamespace:o.eip155,chainLayer:t.L1,docs:'https://docs.ready.io/',explorer:'https://etherscan.io/',infoLink:'https://info.ready.io/#/',name:'ethereum',label:'Ethereum',nativeCurrency:{name:'Ethereum',symbol:'ETH',decimals:18,logo:"https://icons.openocean.finance/1/0x0000000000000000000000000000000000000000?h=20&w=20"}}),s.GOERLI,{chainNamespace:o.eip155,chainLayer:t.L1,docs:'https://docs.ready.io/',explorer:'https://goerli.etherscan.io/',infoLink:'https://info.ready.io/#/',name:'goerli',label:'G\xf6rli',nativeCurrency:{name:'G\xf6rli Ether',symbol:'g\xf6rETH',decimals:18}}),s.OPTIMISM,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:15e5,bridge:'https://app.optimism.io/bridge',defaultListUrl:r(d[2]).OPTIMISM_TOKEN_LIST,docs:'https://optimism.io/',explorer:'https://optimistic.etherscan.io/',infoLink:'https://info.ready.io/#/optimism/',name:'optimism',label:'Optimism',statusPage:'https://optimism.io/status',helpCenterUrl:'https://help.ready.io',nativeCurrency:{name:'Ether',symbol:'ETH',decimals:18}}),s.OPTIMISM_GOERLI,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:15e5,bridge:'https://app.optimism.io/bridge',defaultListUrl:r(d[2]).OPTIMISM_TOKEN_LIST,docs:'https://optimism.io/',explorer:'https://goerli-optimism.etherscan.io/',infoLink:'https://info.ready.io/#/optimism/',name:'optimism-goerli',label:'Optimism G\xf6rli',statusPage:'https://optimism.io/status',helpCenterUrl:'https://help.ready.io/',nativeCurrency:{name:'Optimism Goerli Ether',symbol:'g\xf6rOpETH',decimals:18}}),s.ARBITRUM_ONE,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:6e5,bridge:'https://bridge.arbitrum.io/',docs:'https://offchainlabs.com/',explorer:'https://arbiscan.io/',infoLink:'https://info.ready.io/#/arbitrum',name:'arbitrum',label:'Arbitrum',defaultListUrl:r(d[2]).ARBITRUM_TOKEN_LIST,helpCenterUrl:'https://help.ready.io',nativeCurrency:{name:'Ether',symbol:'ETH',decimals:18}}),s.POLYGON,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:6e5,bridge:'https://wallet.polygon.technology/login',docs:'https://polygon.io/',explorer:'https://polygonscan.com/',infoLink:'https://info.ready.io/#/polygon/',name:'polygon',label:'Polygon',nativeCurrency:{name:'Matic Token',symbol:'MATIC',decimals:18,address:"0x0000000000000000000000000000000000001010",logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/3890.png"}}),s.POLYGON_MUMBAI,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:6e5,bridge:'https://wallet.polygon.technology/bridge',docs:'https://polygon.io/',explorer:'https://mumbai.polygonscan.com/',infoLink:'https://info.ready.io/#/polygon/',name:'polygon-mumbai',label:'Polygon Mumbai',shortLabel:'Mumbai',nativeCurrency:{name:'Matic Token',symbol:'MATIC',decimals:18,address:"0x0000000000000000000000000000000000001010"}}),s.BSC,{chainNamespace:o.eip155,chainLayer:t.L1,docs:'https://docs.ready.io/',explorer:'https://bscscan.com/',infoLink:'https://info.ready.io/',name:'bsc',label:'Binance Smart Chain',shortLabel:'BSC',nativeCurrency:{name:'Binance Coin',symbol:'BNB',decimals:18,logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png"}}),s.BSC_TESTNET,{chainNamespace:o.eip155,chainLayer:t.L1,docs:'https://docs.ready.io/',explorer:'https://testnet.bscscan.com/',infoLink:'https://info.ready.io/',name:'bsc-testnet',label:'Binance Smart Chain Testnet',shortLabel:'BSC Testnet',nativeCurrency:{name:'Binance Coin',symbol:'BNB',decimals:18,logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/1839.png"}}),s.CELO,{chainNamespace:o.eip155,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,bridge:'https://www.portalbridge.com/#/transfer',docs:'https://docs.celo.org/',explorer:'https://celoscan.io/',infoLink:'https://info.ready.io/#/celo',name:'celo',label:'Celo',nativeCurrency:{name:'Celo',symbol:'CELO',decimals:18},defaultListUrl:r(d[2]).CELO_TOKEN_LIST}),(0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)((0,c.default)(n,s.CELO_ALFAJORES,{chainNamespace:o.eip155,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,bridge:'https://www.portalbridge.com/#/transfer',docs:'https://docs.celo.org/',explorer:'https://alfajores-blockscout.celo-testnet.org/',infoLink:'https://info.ready.io/#/celo',name:'celo-alfajores',label:'Celo Alfajores',nativeCurrency:{name:'Celo',symbol:'CELO',decimals:18}}),s.SOLANA_MAINNET,{chainNamespace:o.solana,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://explorer.solana.com',infoLink:'',name:'solana-mainnet',label:'Solana',nativeCurrency:{name:'Solana',symbol:'SOL',decimals:6}}),s.TRON_MAINNET,{chainNamespace:o.tron,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://tronscan.org/',infoLink:'',name:'tron',label:'Tron',nativeCurrency:{name:'TRON',symbol:'TRX',decimals:6,address:'0',logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png"}}),s.TRON_TESTNET_SHASTA,{chainNamespace:o.tron,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://shasta.tronscan.org',infoLink:'',name:'tron-shasta',label:'Tron Shasta',nativeCurrency:{name:'TRON',symbol:'TRX',decimals:6,address:'0',logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png"}}),s.TRON_TESTNET_NILE,{chainNamespace:o.tron,chainLayer:t.L1,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://nile.tronscan.org',infoLink:'',name:'tron',label:'Tron Nile',nativeCurrency:{name:'TRON',symbol:'TRX',decimals:6,address:'0',logo:"https://s2.coinmarketcap.com/static/img/coins/64x64/1958.png"}}),s.ONUS_MAINNET,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://explorer.onuschain.io/',infoLink:'',name:'ONUS Chain',label:'ONUS Chain',nativeCurrency:{name:'ONUS',symbol:'ONUS',decimals:18,logo:"https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png"}}),s.ONUS_TESTNET,{chainNamespace:o.eip155,chainLayer:t.L2,blockWaitMsBeforeWarning:6e5,docs:'',explorer:'https://explorer-testnet.onuschain.io/',infoLink:'',name:'ONUS Chain Testnet',label:'ONUS Chain Testnet',nativeCurrency:{name:'ONUS',symbol:'ONUS',decimals:18,logo:"https://assets.coingecko.com/coins/images/24599/large/ONUS_200.png"}}))}),644,[20,157,645]);
714
714
  __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.OPTIMISM_TOKEN_LIST=e.DEFAULT_NATIVE_CURRENCY_ADDRESS=e.DEFAULT_ERC20_DECIMALS=e.CELO_TOKEN_LIST=e.ARBITRUM_TOKEN_LIST=void 0;e.DEFAULT_ERC20_DECIMALS=18,e.DEFAULT_NATIVE_CURRENCY_ADDRESS='0x0000000000000000000000000000000000000000',e.OPTIMISM_TOKEN_LIST='https://static.optimism.io/optimism.tokenlist.json',e.ARBITRUM_TOKEN_LIST='https://bridge.arbitrum.io/token-list-42161.json',e.CELO_TOKEN_LIST='https://celo-org.github.io/celo-token-list/celo.tokenlist.json'}),645,[]);
@@ -2216,7 +2216,7 @@ __d((function(g,r,_i,a,m,_e,d){
2216
2216
  * http://adamwdraper.github.com/Numeral-js/
2217
2217
  */
2218
2218
  var e,t;e=this,t=function(){var e,t,n,i,o,l={},u={},s={currentLocale:'en',zeroFormat:null,nullFormat:null,defaultFormat:'0,0',scalePercentBy100:!0},c={currentLocale:s.currentLocale,zeroFormat:s.zeroFormat,nullFormat:s.nullFormat,defaultFormat:s.defaultFormat,scalePercentBy100:s.scalePercentBy100};function f(e,t){this._input=e,this._value=t}return(e=function(n){var i,o,u,s;if(e.isNumeral(n))i=n.value();else if(0===n||void 0===n)i=0;else if(null===n||t.isNaN(n))i=null;else if('string'==typeof n)if(c.zeroFormat&&n===c.zeroFormat)i=0;else if(c.nullFormat&&n===c.nullFormat||!n.replace(/[^0-9]+/g,'').length)i=null;else{for(o in l)if((s='function'==typeof l[o].regexps.unformat?l[o].regexps.unformat():l[o].regexps.unformat)&&n.match(s)){u=l[o].unformat;break}i=(u=u||e._.stringToNumber)(n)}else i=Number(n)||null;return new f(n,i)}).version='2.0.6',e.isNumeral=function(e){return e instanceof f},e._=t={numberToFormat:function(t,n,i){var o,l,s,c,f,h,b,p,v=u[e.options.currentLocale],_=!1,y=!1,F='',x=1e12,w=1e9,B=1e6,N='',M=!1;if(t=t||0,s=Math.abs(t),e._.includes(n,'(')?(_=!0,n=n.replace(/[\(|\)]/g,'')):(e._.includes(n,'+')||e._.includes(n,'-'))&&(h=e._.includes(n,'+')?n.indexOf('+'):t<0?n.indexOf('-'):-1,n=n.replace(/[\+|\-]/g,'')),e._.includes(n,'a')&&(l=!!(l=n.match(/a(k|m|b|t)?/))&&l[1],e._.includes(n,' a')&&(F=' '),n=n.replace(new RegExp(F+'a[kmbt]?'),''),s>=x&&!l||'t'===l?(F+=v.abbreviations.trillion,t/=x):s<x&&s>=w&&!l||'b'===l?(F+=v.abbreviations.billion,t/=w):s<w&&s>=B&&!l||'m'===l?(F+=v.abbreviations.million,t/=B):(s<B&&s>=1e3&&!l||'k'===l)&&(F+=v.abbreviations.thousand,t/=1e3)),e._.includes(n,'[.]')&&(y=!0,n=n.replace('[.]','.')),c=t.toString().split('.')[0],f=n.split('.')[1],b=n.indexOf(','),o=(n.split('.')[0].split(',')[0].match(/0/g)||[]).length,f?(e._.includes(f,'[')?(f=(f=f.replace(']','')).split('['),N=e._.toFixed(t,f[0].length+f[1].length,i,f[1].length)):N=e._.toFixed(t,f.length,i),c=N.split('.')[0],N=e._.includes(N,'.')?v.delimiters.decimal+N.split('.')[1]:'',y&&0===Number(N.slice(1))&&(N='')):c=e._.toFixed(t,0,i),F&&!l&&Number(c)>=1e3&&F!==v.abbreviations.trillion)switch(c=String(Number(c)/1e3),F){case v.abbreviations.thousand:F=v.abbreviations.million;break;case v.abbreviations.million:F=v.abbreviations.billion;break;case v.abbreviations.billion:F=v.abbreviations.trillion}if(e._.includes(c,'-')&&(c=c.slice(1),M=!0),c.length<o)for(var T=o-c.length;T>0;T--)c='0'+c;return b>-1&&(c=c.toString().replace(/(\d)(?=(\d{3})+(?!\d))/g,'$1'+v.delimiters.thousands)),0===n.indexOf('.')&&(c=''),p=c+N+(F||''),_?p=(_&&M?'(':'')+p+(_&&M?')':''):h>=0?p=0===h?(M?'-':'+')+p:p+(M?'-':'+'):M&&(p='-'+p),p},stringToNumber:function(e){var t,n,i,o=u[c.currentLocale],l=e,s={thousand:3,million:6,billion:9,trillion:12};if(c.zeroFormat&&e===c.zeroFormat)n=0;else if(c.nullFormat&&e===c.nullFormat||!e.replace(/[^0-9]+/g,'').length)n=null;else{for(t in n=1,'.'!==o.delimiters.decimal&&(e=e.replace(/\./g,'').replace(o.delimiters.decimal,'.')),s)if(i=new RegExp('[^a-zA-Z]'+o.abbreviations[t]+'(?:\\)|(\\'+o.currency.symbol+')?(?:\\))?)?$'),l.match(i)){n*=Math.pow(10,s[t]);break}n*=(e.split('-').length+Math.min(e.split('(').length-1,e.split(')').length-1))%2?1:-1,e=e.replace(/[^0-9\.]+/g,''),n*=Number(e)}return n},isNaN:(function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t})((function(e){return'number'==typeof e&&isNaN(e)})),includes:function(e,t){return-1!==e.indexOf(t)},insert:function(e,t,n){return e.slice(0,n)+t+e.slice(n)},reduce:function(e,t){if(null===this)throw new TypeError('Array.prototype.reduce called on null or undefined');if('function'!=typeof t)throw new TypeError(t+' is not a function');var n,i=Object(e),o=i.length>>>0,l=0;if(3===arguments.length)n=arguments[2];else{for(;l<o&&!(l in i);)l++;if(l>=o)throw new TypeError('Reduce of empty array with no initial value');n=i[l++]}for(;l<o;l++)l in i&&(n=t(n,i[l],l,i));return n},multiplier:function(e){var t=e.toString().split('.');return t.length<2?1:Math.pow(10,t[1].length)},correctionFactor:function(){return Array.prototype.slice.call(arguments).reduce((function(e,n){var i=t.multiplier(n);return e>i?e:i}),1)},toFixed:function(e,t,n,i){var o,l,u,s,c=e.toString().split('.'),f=t-(i||0);return o=2===c.length?Math.min(Math.max(c[1].length,f),t):f,u=Math.pow(10,o),s=(n(e+'e+'+o)/u).toFixed(o),i>t-o&&(l=new RegExp('\\.?0{1,'+(i-(t-o))+'}$'),s=s.replace(l,'')),s}},e.options=c,e.formats=l,e.locales=u,e.locale=function(e){return e&&(c.currentLocale=e.toLowerCase()),c.currentLocale},e.localeData=function(e){if(!e)return u[c.currentLocale];if(e=e.toLowerCase(),!u[e])throw new Error('Unknown locale : '+e);return u[e]},e.reset=function(){for(var e in s)c[e]=s[e]},e.zeroFormat=function(e){c.zeroFormat='string'==typeof e?e:null},e.nullFormat=function(e){c.nullFormat='string'==typeof e?e:null},e.defaultFormat=function(e){c.defaultFormat='string'==typeof e?e:'0.0'},e.register=function(e,t,n){if(t=t.toLowerCase(),this[e+'s'][t])throw new TypeError(t+' '+e+' already registered.');return this[e+'s'][t]=n,n},e.validate=function(t,n){var i,o,l,u,s,c,f,h;if('string'!=typeof t&&(t+='',console.warn&&console.warn('Numeral.js: Value is not string. It has been co-erced to: ',t)),(t=t.trim()).match(/^\d+$/))return!0;if(''===t)return!1;try{f=e.localeData(n)}catch(t){f=e.localeData(e.locale())}return l=f.currency.symbol,s=f.abbreviations,i=f.delimiters.decimal,o='.'===f.delimiters.thousands?'\\.':f.delimiters.thousands,!(null!==(h=t.match(/^[^\d]+/))&&(t=t.substr(1),h[0]!==l)||null!==(h=t.match(/[^\d]+$/))&&(t=t.slice(0,-1),h[0]!==s.thousand&&h[0]!==s.million&&h[0]!==s.billion&&h[0]!==s.trillion)||(c=new RegExp(o+'{2}'),t.match(/[^\d.,]/g)||(u=t.split(i)).length>2||(u.length<2?!u[0].match(/^\d+.*\d$/)||u[0].match(c):1===u[0].length?!u[0].match(/^\d+$/)||u[0].match(c)||!u[1].match(/^\d+$/):!u[0].match(/^\d+.*\d$/)||u[0].match(c)||!u[1].match(/^\d+$/))))},e.fn=f.prototype={clone:function(){return e(this)},format:function(t,n){var i,o,u,s=this._value,f=t||c.defaultFormat;if(n=n||Math.round,0===s&&null!==c.zeroFormat)o=c.zeroFormat;else if(null===s&&null!==c.nullFormat)o=c.nullFormat;else{for(i in l)if(f.match(l[i].regexps.format)){u=l[i].format;break}o=(u=u||e._.numberToFormat)(s,f,n)}return o},value:function(){return this._value},input:function(){return this._input},set:function(e){return this._value=Number(e),this},add:function(e){var n=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([this._value,e],(function(e,t,i,o){return e+Math.round(n*t)}),0)/n,this},subtract:function(e){var n=t.correctionFactor.call(null,this._value,e);return this._value=t.reduce([e],(function(e,t,i,o){return e-Math.round(n*t)}),Math.round(this._value*n))/n,this},multiply:function(e){return this._value=t.reduce([this._value,e],(function(e,n,i,o){var l=t.correctionFactor(e,n);return Math.round(e*l)*Math.round(n*l)/Math.round(l*l)}),1),this},divide:function(e){return this._value=t.reduce([this._value,e],(function(e,n,i,o){var l=t.correctionFactor(e,n);return Math.round(e*l)/Math.round(n*l)})),this},difference:function(t){return Math.abs(e(this._value).subtract(t).value())}},e.register('locale','en',{delimiters:{thousands:',',decimal:'.'},abbreviations:{thousand:'k',million:'m',billion:'b',trillion:'t'},ordinal:function(e){var t=e%10;return 1==~~(e%100/10)?'th':1===t?'st':2===t?'nd':3===t?'rd':'th'},currency:{symbol:'$'}}),e.register('format','bps',{regexps:{format:/(BPS)/,unformat:/(BPS)/},format:function(t,n,i){var o,l=e._.includes(n,' BPS')?' ':'';return t*=1e4,n=n.replace(/\s?BPS/,''),o=e._.numberToFormat(t,n,i),e._.includes(o,')')?((o=o.split('')).splice(-1,0,l+'BPS'),o=o.join('')):o=o+l+'BPS',o},unformat:function(t){return+(1e-4*e._.stringToNumber(t)).toFixed(15)}}),i={base:1024,suffixes:['B','KiB','MiB','GiB','TiB','PiB','EiB','ZiB','YiB']},o='('+(o=(n={base:1e3,suffixes:['B','KB','MB','GB','TB','PB','EB','ZB','YB']}).suffixes.concat(i.suffixes.filter((function(e){return n.suffixes.indexOf(e)<0}))).join('|')).replace('B','B(?!PS)')+')',e.register('format','bytes',{regexps:{format:/([0\s]i?b)/,unformat:new RegExp(o)},format:function(t,o,l){var u,s,c,f=e._.includes(o,'ib')?i:n,h=e._.includes(o,' b')||e._.includes(o,' ib')?' ':'';for(o=o.replace(/\s?i?b/,''),u=0;u<=f.suffixes.length;u++)if(s=Math.pow(f.base,u),c=Math.pow(f.base,u+1),null===t||0===t||t>=s&&t<c){h+=f.suffixes[u],s>0&&(t/=s);break}return e._.numberToFormat(t,o,l)+h},unformat:function(t){var o,l,u=e._.stringToNumber(t);if(u){for(o=n.suffixes.length-1;o>=0;o--){if(e._.includes(t,n.suffixes[o])){l=Math.pow(n.base,o);break}if(e._.includes(t,i.suffixes[o])){l=Math.pow(i.base,o);break}}u*=l||1}return u}}),e.register('format','currency',{regexps:{format:/(\$)/},format:function(t,n,i){var o,l,u=e.locales[e.options.currentLocale],s={before:n.match(/^([\+|\-|\(|\s|\$]*)/)[0],after:n.match(/([\+|\-|\)|\s|\$]*)$/)[0]};for(n=n.replace(/\s?\$\s?/,''),o=e._.numberToFormat(t,n,i),t>=0?(s.before=s.before.replace(/[\-\(]/,''),s.after=s.after.replace(/[\-\)]/,'')):t<0&&!e._.includes(s.before,'-')&&!e._.includes(s.before,'(')&&(s.before='-'+s.before),l=0;l<s.before.length;l++)switch(s.before[l]){case'$':o=e._.insert(o,u.currency.symbol,l);break;case' ':o=e._.insert(o,' ',l+u.currency.symbol.length-1)}for(l=s.after.length-1;l>=0;l--)switch(s.after[l]){case'$':o=l===s.after.length-1?o+u.currency.symbol:e._.insert(o,u.currency.symbol,-(s.after.length-(1+l)));break;case' ':o=l===s.after.length-1?o+' ':e._.insert(o,' ',-(s.after.length-(1+l)+u.currency.symbol.length-1))}return o}}),e.register('format','exponential',{regexps:{format:/(e\+|e-)/,unformat:/(e\+|e-)/},format:function(t,n,i){var o=('number'!=typeof t||e._.isNaN(t)?'0e+0':t.toExponential()).split('e');return n=n.replace(/e[\+|\-]{1}0/,''),e._.numberToFormat(Number(o[0]),n,i)+'e'+o[1]},unformat:function(t){var n=e._.includes(t,'e+')?t.split('e+'):t.split('e-'),i=Number(n[0]),o=Number(n[1]);return o=e._.includes(t,'e-')?o*=-1:o,e._.reduce([i,Math.pow(10,o)],(function(t,n,i,o){var l=e._.correctionFactor(t,n);return t*l*(n*l)/(l*l)}),1)}}),e.register('format','ordinal',{regexps:{format:/(o)/},format:function(t,n,i){var o=e.locales[e.options.currentLocale],l=e._.includes(n,' o')?' ':'';return n=n.replace(/\s?o/,''),l+=o.ordinal(t),e._.numberToFormat(t,n,i)+l}}),e.register('format','percentage',{regexps:{format:/(%)/,unformat:/(%)/},format:function(t,n,i){var o,l=e._.includes(n,' %')?' ':'';return e.options.scalePercentBy100&&(t*=100),n=n.replace(/\s?\%/,''),o=e._.numberToFormat(t,n,i),e._.includes(o,')')?((o=o.split('')).splice(-1,0,l+'%'),o=o.join('')):o=o+l+'%',o},unformat:function(t){var n=e._.stringToNumber(t);return e.options.scalePercentBy100?.01*n:n}}),e.register('format','time',{regexps:{format:/(:)/,unformat:/(:)/},format:function(e,t,n){var i=Math.floor(e/60/60),o=Math.floor((e-60*i*60)/60),l=Math.round(e-60*i*60-60*o);return i+':'+(o<10?'0'+o:o)+':'+(l<10?'0'+l:l)},unformat:function(e){var t=e.split(':'),n=0;return 3===t.length?(n+=60*Number(t[0])*60,n+=60*Number(t[1]),n+=Number(t[2])):2===t.length&&(n+=60*Number(t[0]),n+=Number(t[1])),Number(n)}}),e},'function'==typeof define&&define.amd?define(t):'object'==typeof m&&m.exports?m.exports=t():e.numeral=t()}),2004,[]);
2219
- __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.tokenRateService=void 0;var t,n,u,c,l,s,o,h,f,y,v,p=r(d[0])(r(d[1])),k=r(d[0])(r(d[2])),C=r(d[0])(r(d[3])),H=r(d[0])(r(d[4])),S=r(d[0])(r(d[5])),T=r(d[0])(r(d[6])),F=new T.default({concurrency:1}),b=(0,H.default)((function t(){(0,C.default)(this,t),this.rates=new Map,this.currencyRate=new Map}),[{key:"getValueDisplayForCurrency",value:function(t,n,u){var c={value:t,display:""+t+n};switch(n){case'usd':c.value=t&&t.replaceAll(',',''),c.display="$"+r(d[7]).BlockChainUtils.toFixed(t,6);break;case'vnd':var l=r(d[7]).BlockChainUtils.toFixed(t,0);'0'===l&&(0,S.default)(t).isGreaterThan(0)&&(l='1'),c.value=t&&t.replaceAll(',',''),c.display="\u20ab"+r(d[7]).BlockChainUtils.toFixed(l.replaceAll(',',''),0)}return c}},{key:"toUsd",value:(v=(0,k.default)((function*(t,n){var u=this.getFromCache(n),c=u.rate,l=u.outdated;return c&&!l||(c=(yield this.getAllFromServices([n]))[0].usd),(0,S.default)(c||'0').multipliedBy(t).toString(10)})),function(t,n){return v.apply(this,arguments)})},{key:"toCurrencyValue",value:(y=(0,k.default)((function*(t,n,u){var c=yield Promise.all([this.toUsd(t,n),this.getCurrencyRate(u)]),l=(0,p.default)(c,2),s=l[0],o=l[1],h=(0,S.default)(s).div(o).toString(10),f=this.getValueDisplayForCurrency(h,u);return{value:f.value,valueText:f.display}})),function(t,n,u){return y.apply(this,arguments)})},{key:"toTokenAmount",value:(f=(0,k.default)((function*(t,n,u){var c=yield Promise.all([this.toUsd('1',n),this.getCurrencyRate(u)]),l=(0,p.default)(c,2),s=l[0],o=l[1];return(0,S.default)(t).multipliedBy(o).div(s).toString(10)})),function(t,n,u){return f.apply(this,arguments)})},{key:"getRateBetweenTokens",value:(h=(0,k.default)((function*(t,n){var u=yield this.allToUsd([Object.assign({},t,{value:'1'}),Object.assign({},n,{value:'1'})]),c=(0,p.default)(u,2),l=c[0],s=c[1];return(0,S.default)(l.rate).div(s.rate).toString(10)})),function(t,n){return h.apply(this,arguments)})},{key:"getChange24Hr",value:(o=(0,k.default)((function*(t){var n=this.getFromCache(t),u=n.change24Hr,c=n.outdated;return u&&!c||(u=(yield this.getAllFromServices([t]))[0].change24Hr),u})),function(t){return o.apply(this,arguments)})},{key:"allToUsd",value:(s=(0,k.default)((function*(t){var n=this,u=t.map((function(t){return Object.assign({},t,{usd:'',rate:'',change24Hr:''})})),c=[];return u.forEach((function(t){var u=n.getFromCache(t);t.rate=u.rate,t.change24Hr=u.change24Hr,u.rate&&!u.outdated||c.push(t)})),c.length&&(yield this.getAllFromServices(c)).forEach((function(t){var n=u.find((function(n){return n.address===t.address&&n.chainId===t.chainId}));n&&(n.rate=t.usd,n.change24Hr=t.change24Hr)})),u.map((function(t){t.usd=(0,S.default)(t.value).multipliedBy(t.rate).toString(10)})),u})),function(t){return s.apply(this,arguments)})},{key:"allToCurrencyValue",value:(l=(0,k.default)((function*(t,n){var u=this,c=yield Promise.all([this.allToUsd(t),this.getCurrencyRate(n)]),l=(0,p.default)(c,2),s=l[0],o=l[1];return s.map((function(t){var c=(0,S.default)(t.usd).div(o).toString(10),l=u.getValueDisplayForCurrency(c,n);return Object.assign({},t,{currencyValue:l.value,currencyValueText:l.display})}))})),function(t,n){return l.apply(this,arguments)})},{key:"getCurrencyRateSync",value:function(t){if('usd'===t)return'1';var n=this.currencyRate.get(t);if(n)return n;if('vnd'===t)return'0.000039';throw Error("Currency "+t+" is not supported")}},{key:"generateCacheKey",value:function(t){return t.chainId+"-"+t.address}},{key:"getAllFromServices",value:(c=(0,k.default)((function*(t){var n=this,u=function(t){return[r(d[8]).ChainId.ONUS_MAINNET,r(d[8]).ChainId.ONUS_TESTNET].includes(t.chainId)},c=t.filter((function(t){return u(t)&&!n.isVndc(t)})),l=t.filter((function(t){return!u(t)})),s=t.filter((function(t){return n.isVndc(t)})),o=yield Promise.all([this.getAllFromService(l,'coingecko'),this.getAllFromService(c,'onus'),this.getVndcTokensRate(s)]),h=(0,p.default)(o,3),f=h[0],y=h[1],v=h[2];return f.concat(y).concat(v)})),function(t){return c.apply(this,arguments)})},{key:"getAllFromService",value:(u=(0,k.default)((function*(t,n){var u=this,c=t.map((function(t){return Object.assign({},t,{usd:'',change24Hr:''})}));if(!c.length)return c;try{var l='onus'===n?yield r(d[9]).onusService.getPrice(t):yield r(d[10]).coinGeckoService.getPrice(t),s=Date.now();c.forEach((function(t,n){t.usd=l[n].usd,t.change24Hr=l[n].change24Hr,u.addToCache(t,{lastCheck:s,usd:t.usd,change24Hr:t.change24Hr})}))}catch(t){r(d[11]).Logger.debug(t)}return c})),function(t,n){return u.apply(this,arguments)})},{key:"getVndcTokensRate",value:(n=(0,k.default)((function*(t){var n=this,u=t.map((function(t){return Object.assign({},t,{usd:'',change24Hr:''})}));if(!u.length)return u;try{var c=yield this.getCurrencyRate('vnd'),l=Date.now();u.forEach((function(t){t.usd=c,t.change24Hr='0',n.addToCache(t,{lastCheck:l,usd:t.usd,change24Hr:t.change24Hr})}))}catch(t){r(d[11]).Logger.debug(t)}return u})),function(t){return n.apply(this,arguments)})},{key:"getFromCache",value:function(t){var n=this.generateCacheKey(t);if(!this.rates.has(n))return{rate:null,change24Hr:null};var u=this.rates.get(n);return u.lastCheck+6e5<=Date.now()?{rate:u.usd,change24Hr:u.change24Hr,outdated:!0}:{rate:u.usd,change24Hr:u.change24Hr}}},{key:"addToCache",value:function(t,n){this.rates.set(this.generateCacheKey(t),n)}},{key:"isVndc",value:function(t){return t.chainId===r(d[8]).ChainId.ONUS_MAINNET&&['0xc1d3a18c32c42d5c033c2d4bfc151db8fd2c9d81','0x896585574785474c800ab2031ac0c2daad6f32a6','0x6e02d0447e1f05baeeda9a306207a530f97aba27'].includes(t.address.toLowerCase())}},{key:"getCurrencyRate",value:(t=(0,k.default)((function*(t){var n=this;return'usd'===t?'1':F.add((0,k.default)((function*(){var u=n.currencyRate.get(t);if(u)return u;var c='';if('vnd'!==t)throw Error("Currency "+t+" is not supported");var l=yield r(d[12]).coinGeckoDataApi.getUsdVsCurrency('vnd');if('ok'===l.kind){var s=(0,S.default)(1).div(l.data);s.isNaN()||(c=s.toFixed(6,1))}return c||(c='0.000039'),n.currencyRate.set(t,c),c})))})),function(n){return t.apply(this,arguments)})}]);e.tokenRateService=new b}),2005,[20,34,316,9,12,1102,2006,2003,647,2012,2014,1993,2019]);
2219
+ __d((function(g,r,i,a,m,e,d){Object.defineProperty(e,"__esModule",{value:!0}),e.tokenRateService=void 0;var t,n,u,c,l,s,o,h,f,y,v,p=r(d[0])(r(d[1])),k=r(d[0])(r(d[2])),C=r(d[0])(r(d[3])),H=r(d[0])(r(d[4])),S=r(d[0])(r(d[5])),T=r(d[0])(r(d[6])),b=new T.default({concurrency:1}),F=(0,H.default)((function t(){(0,C.default)(this,t),this.rates=new Map,this.currencyRate=new Map}),[{key:"getValueDisplayForCurrency",value:function(t,n,u){var c={value:t,display:""+t+n};switch(n){case'usd':c.value=t&&t.replaceAll(',',''),c.display="$"+r(d[7]).BlockChainUtils.toFixed(t,6);break;case'vnd':var l=r(d[7]).BlockChainUtils.toFixed(t,0);'0'===l&&(0,S.default)(t).isGreaterThan(0)&&(l='1'),c.value=t&&t.replaceAll(',',''),c.display="\u20ab"+r(d[7]).BlockChainUtils.toFixed(l.replaceAll(',',''),0)}return c}},{key:"toUsd",value:(v=(0,k.default)((function*(t,n){var u=this.getFromCache(n),c=u.rate,l=u.outdated;return c&&!l||(c=(yield this.getAllFromServices([n]))[0].usd),(0,S.default)(c||'0').multipliedBy(t).toString(10)})),function(t,n){return v.apply(this,arguments)})},{key:"toCurrencyValue",value:(y=(0,k.default)((function*(t,n,u){var c=yield Promise.all([this.toUsd(t,n),this.getCurrencyRate(u)]),l=(0,p.default)(c,2),s=l[0],o=l[1],h=(0,S.default)(s).div(o).toString(10),f=this.getValueDisplayForCurrency(h,u);return{value:f.value,valueText:f.display}})),function(t,n,u){return y.apply(this,arguments)})},{key:"toTokenAmount",value:(f=(0,k.default)((function*(t,n,u){var c=yield Promise.all([this.toUsd('1',n),this.getCurrencyRate(u)]),l=(0,p.default)(c,2),s=l[0],o=l[1];return(0,S.default)(t).multipliedBy(o).div(s).toString(10)})),function(t,n,u){return f.apply(this,arguments)})},{key:"getRateBetweenTokens",value:(h=(0,k.default)((function*(t,n){var u=yield this.allToUsd([Object.assign({},t,{value:'1'}),Object.assign({},n,{value:'1'})]),c=(0,p.default)(u,2),l=c[0],s=c[1];return(0,S.default)(l.rate).div(s.rate).toString(10)})),function(t,n){return h.apply(this,arguments)})},{key:"getChange24Hr",value:(o=(0,k.default)((function*(t){var n=this.getFromCache(t),u=n.change24Hr,c=n.outdated;return u&&!c||(u=(yield this.getAllFromServices([t]))[0].change24Hr),u})),function(t){return o.apply(this,arguments)})},{key:"allToUsd",value:(s=(0,k.default)((function*(t){var n=this,u=t.map((function(t){return Object.assign({},t,{usd:'',rate:'',change24Hr:''})})),c=[];return u.forEach((function(t){var u=n.getFromCache(t);t.rate=u.rate,t.change24Hr=u.change24Hr,u.rate&&!u.outdated||c.push(t)})),c.length&&(yield this.getAllFromServices(c)).forEach((function(t){var n=u.find((function(n){return n.address===t.address&&n.chainId===t.chainId}));n&&(n.rate=t.usd,n.change24Hr=t.change24Hr)})),u.map((function(t){t.usd=(0,S.default)(t.value).multipliedBy(t.rate).toString(10)})),u})),function(t){return s.apply(this,arguments)})},{key:"allToCurrencyValue",value:(l=(0,k.default)((function*(t,n){var u=this,c=yield Promise.all([this.allToUsd(t),this.getCurrencyRate(n)]),l=(0,p.default)(c,2),s=l[0],o=l[1];return s.map((function(t){var c=(0,S.default)(t.usd).div(o).toString(10),l=u.getValueDisplayForCurrency(c,n);return Object.assign({},t,{currencyValue:l.value,currencyValueText:l.display})}))})),function(t,n){return l.apply(this,arguments)})},{key:"getCurrencyRateSync",value:function(t){if('usd'===t)return'1';var n=this.currencyRate.get(t);if(n)return n;if('vnd'===t)return'0.000039';throw Error("Currency "+t+" is not supported")}},{key:"generateCacheKey",value:function(t){return t.chainId+"-"+t.address}},{key:"getAllFromServices",value:(c=(0,k.default)((function*(t){var n=this,u=function(t){return[r(d[8]).ChainId.ONUS_MAINNET,r(d[8]).ChainId.ONUS_TESTNET].includes(t.chainId)},c=t.filter((function(t){return u(t)&&!n.isVndc(t)})),l=t.filter((function(t){return!u(t)})),s=t.filter((function(t){return n.isVndc(t)})),o=yield Promise.all([this.getAllFromService(l,'coingecko'),this.getAllFromService(c,'onus'),this.getVndcTokensRate(s)]),h=(0,p.default)(o,3),f=h[0],y=h[1],v=h[2];return f.concat(y).concat(v)})),function(t){return c.apply(this,arguments)})},{key:"getAllFromService",value:(u=(0,k.default)((function*(t,n){var u=this,c=t.map((function(t){return Object.assign({},t,{usd:'',change24Hr:''})}));if(!c.length)return c;try{var l='onus'===n?yield r(d[9]).onusService.getPrice(t):yield r(d[10]).coinGeckoService.getPrice(t),s=Date.now();c.forEach((function(t,n){t.usd=l[n].usd,t.change24Hr=l[n].change24Hr,u.addToCache(t,{lastCheck:s,usd:t.usd,change24Hr:t.change24Hr})}))}catch(t){r(d[11]).Logger.debug(t)}return c})),function(t,n){return u.apply(this,arguments)})},{key:"getVndcTokensRate",value:(n=(0,k.default)((function*(t){var n=this,u=t.map((function(t){return Object.assign({},t,{usd:'',change24Hr:''})}));if(!u.length)return u;try{var c=yield this.getCurrencyRate('vnd'),l=Date.now();u.forEach((function(t){t.usd=c,t.change24Hr='0',n.addToCache(t,{lastCheck:l,usd:t.usd,change24Hr:t.change24Hr})}))}catch(t){r(d[11]).Logger.debug(t)}return u})),function(t){return n.apply(this,arguments)})},{key:"getFromCache",value:function(t){var n=this.generateCacheKey(t);if(!this.rates.has(n))return{rate:null,change24Hr:null};var u=this.rates.get(n);return u.lastCheck+6e5<=Date.now()?{rate:u.usd,change24Hr:u.change24Hr,outdated:!0}:{rate:u.usd,change24Hr:u.change24Hr}}},{key:"addToCache",value:function(t,n){this.rates.set(this.generateCacheKey(t),n)}},{key:"isVndc",value:function(t){return t.chainId===r(d[8]).ChainId.ONUS_MAINNET&&['0xc1d3a18c32c42d5c033c2d4bfc151db8fd2c9d81','0x896585574785474c800ab2031ac0c2daad6f32a6','0x6e02d0447e1f05baeeda9a306207a530f97aba27','0xa6b9579563a48a0540bb53853ae0947972371169'].includes(t.address.toLowerCase())}},{key:"getCurrencyRate",value:(t=(0,k.default)((function*(t){var n=this;return'usd'===t?'1':b.add((0,k.default)((function*(){var u=n.currencyRate.get(t);if(u)return u;var c='';if('vnd'!==t)throw Error("Currency "+t+" is not supported");var l=yield r(d[12]).coinGeckoDataApi.getUsdVsCurrency('vnd');if('ok'===l.kind){var s=(0,S.default)(1).div(l.data);s.isNaN()||(c=s.toFixed(6,1))}return c||(c='0.000039'),n.currencyRate.set(t,c),c})))})),function(n){return t.apply(this,arguments)})}]);e.tokenRateService=new F}),2005,[20,34,316,9,12,1102,2006,2003,647,2012,2014,1993,2019]);
2220
2220
  __d((function(g,r,i,a,m,_e,d){"use strict";function e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(e=function(){return!!t})()}Object.defineProperty(_e,"__esModule",{value:!0});var t=function(){},n=new(r(d[2]).TimeoutError),o=(function(o){function u(n){var o,s,l,v,c,_,h,f;if(r(d[3])(this,u),_=this,h=u,h=r(d[0])(h),(o=r(d[1])(_,e()?Reflect.construct(h,f||[],r(d[0])(_).constructor):h.apply(_,f)))._intervalCount=0,o._intervalEnd=0,o._pendingCount=0,o._resolveEmpty=t,o._resolveIdle=t,!('number'==typeof(n=Object.assign({carryoverConcurrencyCount:!1,intervalCap:1/0,interval:0,concurrency:1/0,autoStart:!0,queueClass:r(d[4]).default},n)).intervalCap&&n.intervalCap>=1))throw new TypeError("Expected `intervalCap` to be a number from 1 and up, got `"+(null!==(l=null===(s=n.intervalCap)||void 0===s?void 0:s.toString())&&void 0!==l?l:'')+"` ("+typeof n.intervalCap+")");if(void 0===n.interval||!(Number.isFinite(n.interval)&&n.interval>=0))throw new TypeError("Expected `interval` to be a finite number >= 0, got `"+(null!==(c=null===(v=n.interval)||void 0===v?void 0:v.toString())&&void 0!==c?c:'')+"` ("+typeof n.interval+")");return o._carryoverConcurrencyCount=n.carryoverConcurrencyCount,o._isIntervalIgnored=n.intervalCap===1/0||0===n.interval,o._intervalCap=n.intervalCap,o._interval=n.interval,o._queue=new n.queueClass,o._queueClass=n.queueClass,o.concurrency=n.concurrency,o._timeout=n.timeout,o._throwOnTimeout=!0===n.throwOnTimeout,o._isPaused=!1===n.autoStart,o}return r(d[5])(u,o),r(d[6])(u,[{key:"_doesIntervalAllowAnother",get:function(){return this._isIntervalIgnored||this._intervalCount<this._intervalCap}},{key:"_doesConcurrentAllowAnother",get:function(){return this._pendingCount<this._concurrency}},{key:"_next",value:function(){this._pendingCount--,this._tryToStartAnother(),this.emit('next')}},{key:"_resolvePromises",value:function(){this._resolveEmpty(),this._resolveEmpty=t,0===this._pendingCount&&(this._resolveIdle(),this._resolveIdle=t,this.emit('idle'))}},{key:"_onResumeInterval",value:function(){this._onInterval(),this._initializeIntervalIfNeeded(),this._timeoutId=void 0}},{key:"_isIntervalPaused",value:function(){var e=this,t=Date.now();if(void 0===this._intervalId){var n=this._intervalEnd-t;if(!(n<0))return void 0===this._timeoutId&&(this._timeoutId=setTimeout((function(){e._onResumeInterval()}),n)),!0;this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0}return!1}},{key:"_tryToStartAnother",value:function(){if(0===this._queue.size)return this._intervalId&&clearInterval(this._intervalId),this._intervalId=void 0,this._resolvePromises(),!1;if(!this._isPaused){var e=!this._isIntervalPaused();if(this._doesIntervalAllowAnother&&this._doesConcurrentAllowAnother){var t=this._queue.dequeue();return!!t&&(this.emit('active'),t(),e&&this._initializeIntervalIfNeeded(),!0)}}return!1}},{key:"_initializeIntervalIfNeeded",value:function(){var e=this;this._isIntervalIgnored||void 0!==this._intervalId||(this._intervalId=setInterval((function(){e._onInterval()}),this._interval),this._intervalEnd=Date.now()+this._interval)}},{key:"_onInterval",value:function(){0===this._intervalCount&&0===this._pendingCount&&this._intervalId&&(clearInterval(this._intervalId),this._intervalId=void 0),this._intervalCount=this._carryoverConcurrencyCount?this._pendingCount:0,this._processQueue()}},{key:"_processQueue",value:function(){for(;this._tryToStartAnother(););}},{key:"concurrency",get:function(){return this._concurrency},set:function(e){if(!('number'==typeof e&&e>=1))throw new TypeError("Expected `concurrency` to be a number from 1 and up, got `"+e+"` ("+typeof e+")");this._concurrency=e,this._processQueue()}},{key:"add",value:(c=r(d[7])((function*(e){var t=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(u,s){var l,v=(l=r(d[7])((function*(){t._pendingCount++,t._intervalCount++;try{var l=void 0===t._timeout&&void 0===o.timeout?e():r(d[2]).default(Promise.resolve(e()),void 0===o.timeout?t._timeout:o.timeout,(function(){(void 0===o.throwOnTimeout?t._throwOnTimeout:o.throwOnTimeout)&&s(n)}));u(yield l)}catch(e){s(e)}t._next()})),function(){return l.apply(this,arguments)});t._queue.enqueue(v,o),t._tryToStartAnother(),t.emit('add')}))})),function(e){return c.apply(this,arguments)})},{key:"addAll",value:(v=r(d[7])((function*(e,t){var n,o=this;return Promise.all(e.map((n=r(d[7])((function*(e){return o.add(e,t)})),function(e){return n.apply(this,arguments)})))})),function(e,t){return v.apply(this,arguments)})},{key:"start",value:function(){return this._isPaused?(this._isPaused=!1,this._processQueue(),this):this}},{key:"pause",value:function(){this._isPaused=!0}},{key:"clear",value:function(){this._queue=new this._queueClass}},{key:"onEmpty",value:(l=r(d[7])((function*(){var e=this;if(0!==this._queue.size)return new Promise((function(t){var n=e._resolveEmpty;e._resolveEmpty=function(){n(),t()}}))})),function(){return l.apply(this,arguments)})},{key:"onIdle",value:(s=r(d[7])((function*(){var e=this;if(0!==this._pendingCount||0!==this._queue.size)return new Promise((function(t){var n=e._resolveIdle;e._resolveIdle=function(){n(),t()}}))})),function(){return s.apply(this,arguments)})},{key:"size",get:function(){return this._queue.size}},{key:"sizeBy",value:function(e){return this._queue.filter(e).length}},{key:"pending",get:function(){return this._pendingCount}},{key:"isPaused",get:function(){return this._isPaused}},{key:"timeout",get:function(){return this._timeout},set:function(e){this._timeout=e}}]);var s,l,v,c})(r(d[8]));_e.default=o}),2006,[3,4,2007,9,2009,10,12,316,2011]);
2221
2221
  __d((function(g,r,i,a,m,_e,d){'use strict';function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}var e=(function(e){function n(e){var o,c,u,f;return r(d[2])(this,n),c=this,u=n,f=[e],u=r(d[0])(u),(o=r(d[1])(c,t()?Reflect.construct(u,f||[],r(d[0])(c).constructor):u.apply(c,f))).name='TimeoutError',o}return r(d[3])(n,e),r(d[4])(n)})(r(d[5])(Error)),n=function(t,n,o){return new Promise((function(c,u){if('number'!=typeof n||n<0)throw new TypeError('Expected `milliseconds` to be a positive number');if(n!==1/0){var f=setTimeout((function(){if('function'!=typeof o){var f=o instanceof Error?o:new e('string'==typeof o?o:"Promise timed out after "+n+" milliseconds");'function'==typeof t.cancel&&t.cancel(),u(f)}else try{c(o())}catch(t){u(t)}}),n);r(d[6])(t.then(c,u),(function(){clearTimeout(f)}))}else c(t)}))};m.exports=n,m.exports.default=n,m.exports.TimeoutError=e}),2007,[3,4,9,10,12,63,2008]);
2222
2222
  __d((function(g,r,i,a,m,e,d){'use strict';m.exports=function(n,t){return t=t||function(){},n.then((function(n){return new Promise((function(n){n(t())})).then((function(){return n}))}),(function(n){return new Promise((function(n){n(t())})).then((function(){throw n}))}))}}),2008,[]);
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@readyio/react-native-wallet",
3
- "version": "0.1.37",
3
+ "version": "0.1.38",
4
4
  "description": "React native ready wallet sdk for integrate with react native app",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",