{"version":3,"sources":["components/claim-page.jsx","App.js","serviceWorker.js","index.js"],"names":["BACKEND_API2","MySwal","withReactContent","Swal","defaultState","activeUser","accountName","polygonAddress","isLoading","airdrop","lpAidrop","waitForTx","ClaimPage","props","claimAirdrop","a","setState","state","isAddress","msg","amount","claimed","pubKey","keys","message","sig","axios","post","account","resp","signMsg","data","signArbitrary","broadcast","params","eosname","publicKey","eosSig","response","fetchAirdropData","get","renderYUPClamAmmount","style","fontSize","color","renderLogoutBtn","ual","activeAuthenticator","logout","className","Button","variant","onClick","handleInputUpdate","event","target","value","renderAddrForm","marginLeft","marginRight","width","marginTop","marginBottom","Form","Group","controlId","Label","Control","type","name","onChange","rcp","JsonRpc","network","rpcEndpoints","protocol","host","port","updateAccountName","bind","renderModalButton","this","session","toLegacyString","Error","text","isSuc","fire","icon","title","Promise","resolve","setTimeout","getAccountName","showModal","padding","loggedIn","logoutBtn","modalButton","textAlign","paddingTop","Spinner","animation","renderClaimBtn","React","chainId","walletConfig","appName","wombat","Wombat","AppWithUAL","withUAL","claimPage","displayName","ualProviders","window","__wombat__","scatter","push","App","chains","authenticators","href","Boolean","location","hostname","match","ReactDOM","render","StrictMode","document","getElementById","navigator","serviceWorker","ready","then","registration","unregister","catch","error","console"],"mappings":"wvBAaMA,EAAe,qBAGfC,EAASC,IAAiBC,KAE1BC,EAAe,CACnBC,WAAY,KACZC,YAAa,GACbC,eAAgB,GAChBC,WAAW,EACXC,QAAS,GACTC,SAAU,GACVC,WAAW,GAGPC,E,kDAEJ,WAAYC,GAAQ,IAAD,8BACjB,cAAMA,IA8CRC,aA/CmB,sBA+CJ,oDAAAC,EAAA,yDACb,EAAKC,SAAS,CAAER,WAAW,IADd,EAEiC,EAAKS,MAA3CV,EAFK,EAELA,eAAgBG,EAFX,EAEWA,SAAUD,EAFrB,EAEqBA,QAE7BS,oBAAUX,GAJF,uBAKX,EAAKY,IAAI,uCAAwC,SACjD,EAAKH,SAAS,CAAER,WAAW,IANhB,0BAUiBE,E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U,OAAOnD,QAAQ,UAC1D8B,KAAKxC,uBACLwC,KAAKsB,iBAELN,S,GAtReO,aA4RT5F,IC9SF6D,EACb,CACEgC,QAAQ,mEACRpC,KAAM,cACNK,aAAc,CAAC,CACbC,SAAU,QACVC,KAAM,mBACNC,KAAM,SAKJ6B,EAAe,CACnBC,QAAS,8BAILC,EAAS,IAAIC,SAAO,CAACpC,GAAUiC,GAG/BI,EAAaC,kBAAQC,GAC3BF,EAAWG,YAAcP,EAAaC,QAEtC,IAAMO,EAAe,GACjBC,OAAOC,YAAcD,OAAOE,SAC9BH,EAAaI,KAAKV,GAgBLW,MAbf,WAEE,OACE,eAAC,cAAD,CAAaC,OAAQ,CAAC/C,GAAUgD,eAAgBP,EAAcP,QAASD,EAAaC,QAApF,UACA,cAACG,EAAD,IACA,oBAAGpE,MAAO,CAAEmB,UAAW,QAASsC,UAAU,UAA1C,2CAAmF,uBAAK,uBAAxF,eACkB,mBAAGuB,KAAK,4GAAR,oBADlB,IACiJ,8BChCjIC,QACW,cAA7BR,OAAOS,SAASC,UAEe,UAA7BV,OAAOS,SAASC,UAEhBV,OAAOS,SAASC,SAASC,MACvB,2DCZNC,IAASC,OACP,cAAC,IAAMC,WAAP,UACE,cAAC,EAAD,MAEFC,SAASC,eAAe,SDyHpB,kBAAmBC,WACrBA,UAAUC,cAAcC,MACrBC,MAAK,SAAAC,GACJA,EAAaC,gBAEdC,OAAM,SAAAC,GACLC,QAAQD,MAAMA,EAAMnH,c","file":"static/js/main.67e756d1.chunk.js","sourcesContent":["import { JsonRpc } from 'eosjs'\nimport * as React from 'react'\nimport Swal from 'sweetalert2'\nimport withReactContent from 'sweetalert2-react-content'\nimport Button from 'react-bootstrap/Button';\nimport Form from 'react-bootstrap/Form';\nimport Spinner from 'react-bootstrap/Spinner'\nimport { isAddress } from 'web3-utils'\nimport 'bootstrap/dist/css/bootstrap.min.css';\nimport './claim-page.css';\nimport { network } from '../App'\nimport axios from 'axios'\n\nconst BACKEND_API2 = 'https://api.yup.io'\n// const BACKEND_API = 'http://127.0.0.1:4001'\n \nconst MySwal = withReactContent(Swal)\n\nconst defaultState = {\n activeUser: null,\n accountName: '', \n polygonAddress: '',\n isLoading: false,\n airdrop: {},\n lpAidrop: {},\n waitForTx: false,\n}\n\nclass ClaimPage extends React.Component {\n\n constructor(props) {\n super(props)\n this.state = {\n ...defaultState,\n rcp: new JsonRpc(`${network.rpcEndpoints[0].protocol}://${network.rpcEndpoints[0].host}:${network.rpcEndpoints[0].port}`)\n }\n\n this.updateAccountName = this.updateAccountName.bind(this)\n this.claimAirdrop = this.claimAirdrop.bind(this)\n this.fetchAirdropData = this.fetchAirdropData.bind(this)\n this.renderModalButton = this.renderModalButton.bind(this)\n this.handleInputUpdate = this.handleInputUpdate.bind(this)\n this.renderAddrForm = this.renderAddrForm.bind(this)\n }\n \n // getWalletType(walletObj){\n // switch(walletObj.constructor.name){\n // // case 'AnchorUser':\n // // return 'AnchorUser'\n // case 'WombatUser':\n // return 'WombatUser'\n // default:\n // return 'Unkown'\n // }\n // }\n\n async getPublickey(type){\n const { activeUser } = this.state\n switch(type){\n case 'AnchorUser':\n return activeUser.session.publicKey.toLegacyString()\n case 'WombatUser':\n return activeUser.keys[0]\n default:\n throw new Error('Unkown wallet type')\n }\n }\n\n msg(text, type='success') {\n const isSuc = type === 'success'\n MySwal.fire({\n icon: isSuc ? 'success':'error',\n title: isSuc ? 'Success!':'Oops...',\n text\n });\n }\n\n claimAirdrop = async () => {\n this.setState({ isLoading: true })\n const { polygonAddress, lpAidrop, airdrop } = this.state\n \n if (!isAddress(polygonAddress)) {\n this.msg('Please enter a valid polygon address', 'error')\n this.setState({ isLoading: false })\n return\n }\n\n const hasAvailableLpAirdrop = lpAidrop.amount > 0 && !lpAidrop.claimed\n const hasAvailableAirdrop = airdrop.amount > 0 && !airdrop.claimed\n const { accountName, activeUser } = this.state;\n \n // const dummyTransact = {\n // actions:[\n // { account: 'yupyupyupyup',\n // name:'noop',\n // authorization: [ {actor:accountName, permission:activeUser.requestPermission }],\n // data:{ \n // }\n // }\n // ]\n // };\n\n\n let pubKey;\n try {\n pubKey = activeUser.keys[0]\n }catch(e){\n this.setState({ isLoading: false })\n if(e.message === 'Unkown wallet type'){\n this.msg('Please login with Wombat wallet', 'error')\n }else{\n this.msg('Please login with Wombat wallet', 'error')\n this.msg('Can not retrive the public key check you wallet is open', 'error')\n }\n return\n }\n let sig = ''\n // let txHash = ''\n // const isAnchor = this.getWalletType(activeUser) === 'AnchorUser'\n try{\n let signMsg\n try {\n const resp = await axios.post(`${BACKEND_API2}/eos-airdrop/challenge`, { account: accountName })\n signMsg = resp.data.data\n }catch(e){\n this.msg('Can not generate the auth msg', 'error')\n this.setState({ isLoading: false })\n return\n }\n sig = await activeUser.signArbitrary(pubKey, signMsg, 'claim-airdrop', {broadcast: true})\n }catch(e){\n this.msg('Can not sign the transaction', 'error')\n this.setState({ isLoading: false })\n return\n }\n const params = { polygonAddress, eosname: accountName, publicKey:pubKey, eosSig: sig }\n // if (txHash) params.txHash = txHash\n if (hasAvailableLpAirdrop || hasAvailableAirdrop || true) {\n try {\n const resp = await axios.post(`${BACKEND_API2}/eos-airdrop/claim`, params)\n this.msg(resp.data.message, 'success')\n } catch (err) {\n this.msg(err.response.data.message, 'error')\n }\n } else {\n this.msg('No available Airdrop to claim', 'error')\n }\n // if(isAnchor) this.setState({ waitForTx: false })\n this.setState({ isLoading: false })\n }\n\n fetchAirdropData = async () => {\n try {\n const { accountName } = this.state\n this.setState({ isLoading: true })\n const airdrop = (await axios.get(`${BACKEND_API2}/airdrop?eosname=${accountName}`)).data\n const lpAidrop = (await axios.get(`${BACKEND_API2}/lp-airdrop?eosname=${accountName}`)).data\n this.setState({ airdrop, lpAidrop})\n } catch (err) {\n this.msg('Something went wrong. Try again later.', 'error')\n }\n this.setState({ isLoading: false })\n }\n \n async componentDidUpdate() {\n const { ual: { activeUser } } = this.props\n if (activeUser && !this.state.activeUser) {\n this.setState({ activeUser }, this.updateAccountName)\n } else if (!activeUser && this.state.activeUser) {\n this.setState(defaultState)\n }\n }\n\n async componentDidMount() {\n let { activeUser } = this.state\n while(!activeUser){\n await new Promise(resolve => setTimeout(resolve, 100))\n activeUser = this.state.activeUser\n }\n await this.fetchAirdropData()\n }\n \n async updateAccountName() {\n try {\n const accountName = await this.state.activeUser.getAccountName()\n this.setState({ accountName })\n } catch (e) {\n }\n }\n\n renderYUPClamAmmount = () => {\n const { airdrop, lpAidrop, activeUser } = this.state\n if( !!activeUser ) {\n if(airdrop.claimed && lpAidrop.claimed){\n return
\n

You have claimed both Airdrops

\n
\n }\n else if (airdrop.amount > 0) {\n return (\n
\n { airdrop.claimed ?

You have claimed your YUP Airdrop

:

\n You have {airdrop.amount} YUP !

}\n { lpAidrop.amount > 0 ?\n lpAidrop.claimed ?

You have claimed your Lp Airdrop

:\n

You have {lpAidrop.amount} YUPETH !

\n : '' }\n

Claimby clicking the button below

\n
\n )\n } else {\n return (\n

You have no YUP! to claim

\n )\n }\n }\n }\n\n renderLogoutBtn = () => {\n const { ual: { activeUser, activeAuthenticator, logout } } = this.props\n if (!!activeUser && !!activeAuthenticator) {\n return (\n

\n \n

\n )\n }\n }\n \n renderModalButton() {\n return (\n

\n \n

\n )\n }\n \n handleInputUpdate = (event) => {\n this.setState({polygonAddress: event.target.value});\n }\n\n renderAddrForm = () => {\n const { ual: { activeUser, activeAuthenticator }, polygonAddress } = this.props\n if (!!activeUser && !!activeAuthenticator) {\n return(\n
\n
\n \n Polygon Address: \n \n \n
\n
\n )\n }\n }\n\n renderClaimBtn(){\n return(\n ( this.state.activeUser) ? \n

\n \n

\n :'')\n }\n\n render() {\n let modalButton = this.renderModalButton()\n let loggedIn = ''\n let logoutBtn = null\n \n const { ual: { activeUser } } = this.props\n const { accountName } = this.state\n modalButton = !activeUser && this.renderModalButton()\n logoutBtn = this.renderLogoutBtn()\n loggedIn = accountName ? `Logged in as ${accountName}` : ''\n \n\n return (\n
\n

Airdrop claim page YUP for EOS users without YUP account

\n Use this page to claim your migration airdop only if you don't have an YUP account.\n
\n {modalButton}\n

{loggedIn}

\n {this.renderAddrForm()}\n {/* this.state.waitForTx &&

Waiting for transaction confirmation...

*/}\n {this.state.isLoading && }\n {this.renderYUPClamAmmount()}\n {this.renderClaimBtn()}\n\n {logoutBtn}\n
\n )\n }\n}\n\nexport default ClaimPage;","import React from 'react';\nimport { UALProvider, withUAL } from 'ual-reactjs-renderer';\nimport { Wombat } from 'ual-wombat'\nimport { Anchor } from 'ual-anchor'\nimport claimPage from './components/claim-page';\n\n\n// deployed to netfly at\n// https://awesome-dubinsky-e8d22f.netlify.app/\n\nexport const network =\n{\n chainId:'aca376f206b8fc25a6ed44dbdc66547c36c6c33e3a119ffbeaef943642f0e906',\n name: 'EOS Mainnet',\n rpcEndpoints: [{\n protocol: 'https',\n host: 'eos.greymass.com',\n port: '443',\n }]\n}\n;\n \nconst walletConfig = {\n appName: 'EOS YUP AIRDROP CLAIM PAGE',\n}\n\n \nconst wombat = new Wombat([network], walletConfig);\n// const anchor = new Anchor([network], walletConfig);\n\nconst AppWithUAL = withUAL(claimPage);\nAppWithUAL.displayName = walletConfig.appName;\n\nconst ualProviders = [];\nif (window.__wombat__ && window.scatter){\n ualProviders.push(wombat);\n}\n\nfunction App() {\n \n return(\n \n \n

Page works with this wallet:

\n    Wombat
\n

\n
\n\n );\n}\n\nexport default App;\n","// This optional code is used to register a service worker.\n// register() is not called by default.\n\n// This lets the app load faster on subsequent visits in production, and gives\n// it offline capabilities. However, it also means that developers (and users)\n// will only see deployed updates on subsequent visits to a page, after all the\n// existing tabs open on the page have been closed, since previously cached\n// resources are updated in the background.\n\n// To learn more about the benefits of this model and instructions on how to\n// opt-in, read https://bit.ly/CRA-PWA\n\nconst isLocalhost = Boolean(\n window.location.hostname === 'localhost' ||\n // [::1] is the IPv6 localhost address.\n window.location.hostname === '[::1]' ||\n // 127.0.0.0/8 are considered localhost for IPv4.\n window.location.hostname.match(\n /^127(?:\\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/\n )\n);\n\nexport function register(config) {\n if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {\n // The URL constructor is available in all browsers that support SW.\n const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);\n if (publicUrl.origin !== window.location.origin) {\n // Our service worker won't work if PUBLIC_URL is on a different origin\n // from what our page is served on. This might happen if a CDN is used to\n // serve assets; see https://github.com/facebook/create-react-app/issues/2374\n return;\n }\n\n window.addEventListener('load', () => {\n const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;\n\n if (isLocalhost) {\n // This is running on localhost. Let's check if a service worker still exists or not.\n checkValidServiceWorker(swUrl, config);\n\n // Add some additional logging to localhost, pointing developers to the\n // service worker/PWA documentation.\n navigator.serviceWorker.ready.then(() => {\n console.log(\n 'This web app is being served cache-first by a service ' +\n 'worker. To learn more, visit https://bit.ly/CRA-PWA'\n );\n });\n } else {\n // Is not localhost. Just register service worker\n registerValidSW(swUrl, config);\n }\n });\n }\n}\n\nfunction registerValidSW(swUrl, config) {\n navigator.serviceWorker\n .register(swUrl)\n .then(registration => {\n registration.onupdatefound = () => {\n const installingWorker = registration.installing;\n if (installingWorker == null) {\n return;\n }\n installingWorker.onstatechange = () => {\n if (installingWorker.state === 'installed') {\n if (navigator.serviceWorker.controller) {\n // At this point, the updated precached content has been fetched,\n // but the previous service worker will still serve the older\n // content until all client tabs are closed.\n console.log(\n 'New content is available and will be used when all ' +\n 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'\n );\n\n // Execute callback\n if (config && config.onUpdate) {\n config.onUpdate(registration);\n }\n } else {\n // At this point, everything has been precached.\n // It's the perfect time to display a\n // \"Content is cached for offline use.\" message.\n console.log('Content is cached for offline use.');\n\n // Execute callback\n if (config && config.onSuccess) {\n config.onSuccess(registration);\n }\n }\n }\n };\n };\n })\n .catch(error => {\n console.error('Error during service worker registration:', error);\n });\n}\n\nfunction checkValidServiceWorker(swUrl, config) {\n // Check if the service worker can be found. If it can't reload the page.\n fetch(swUrl, {\n headers: { 'Service-Worker': 'script' },\n })\n .then(response => {\n // Ensure service worker exists, and that we really are getting a JS file.\n const contentType = response.headers.get('content-type');\n if (\n response.status === 404 ||\n (contentType != null && contentType.indexOf('javascript') === -1)\n ) {\n // No service worker found. Probably a different app. Reload the page.\n navigator.serviceWorker.ready.then(registration => {\n registration.unregister().then(() => {\n window.location.reload();\n });\n });\n } else {\n // Service worker found. Proceed as normal.\n registerValidSW(swUrl, config);\n }\n })\n .catch(() => {\n console.log(\n 'No internet connection found. App is running in offline mode.'\n );\n });\n}\n\nexport function unregister() {\n if ('serviceWorker' in navigator) {\n navigator.serviceWorker.ready\n .then(registration => {\n registration.unregister();\n })\n .catch(error => {\n console.error(error.message);\n });\n }\n}\n","import React from 'react';\nimport ReactDOM from 'react-dom';\nimport './index.css';\nimport App from './App';\nimport * as serviceWorker from './serviceWorker';\n\nReactDOM.render(\n \n \n ,\n document.getElementById('root')\n);\n\n// If you want your app to work offline and load faster, you can change\n// unregister() to register() below. Note this comes with some pitfalls.\n// Learn more about service workers: https://bit.ly/CRA-PWA\nserviceWorker.unregister();\n"],"sourceRoot":""}