├── .gitignore ├── LICENSE ├── README.md ├── components ├── Footer.tsx ├── Loading.tsx ├── Modal.tsx ├── Navbar.tsx └── index.ts ├── constants └── index.ts ├── next-env.d.ts ├── next.config.js ├── package.json ├── pages ├── MainCard.tsx ├── _app.tsx ├── api │ └── hello.js └── index.tsx ├── postcss.config.js ├── public ├── BasicChannel.png ├── Crosschain.png ├── SpacefoldLogoPurple.png ├── connext-logo.png ├── favicon.ico ├── fonts │ ├── Proxima Nova Alt Bold.otf │ ├── Proxima Nova Alt Light.otf │ ├── Proxima Nova Alt Thin.otf │ ├── Proxima Nova Black.otf │ ├── Proxima Nova Bold.otf │ ├── Proxima Nova Extrabold.otf │ ├── Proxima Nova Regular.otf │ └── Proxima Nova Thin.otf ├── images │ ├── arbitrumBackground.png │ ├── brick.png │ ├── brickBackground.png │ ├── discord.svg │ ├── dropdown.gif │ ├── dropdownDisabled.png │ ├── ellipsis.gif │ ├── etcBackground.png │ ├── eth.png │ ├── ethBackground.png │ ├── loading.gif │ ├── maticBackground.png │ ├── moon.png │ ├── moonBackground.png │ ├── optimismBackground.png │ ├── rinkebyBackground.png │ ├── skaleBackground.png │ ├── spinningGear.gif │ ├── transfer.gif │ ├── transferDisabled.png │ └── xDaiBackground.png ├── logo.svg ├── logo192.png └── logo512.png ├── spacefoldlogopurple.png ├── styles ├── CardWindow.scss └── globals.scss ├── tailwind.config.js ├── tsconfig.json └── yarn.lock /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env.local 29 | .env.development.local 30 | .env.test.local 31 | .env.production.local 32 | 33 | # vercel 34 | .vercel 35 | .vscode 36 | .env 37 | 38 | # lock-file 39 | package-lock.json -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![alt text](https://github.com/connext/spacefold/blob/master/public/SpacefoldLogoPurple.png?raw=true) 2 | 3 | # Spacefold 4 | 5 | [Spacefold](https://spacefold.io) is a demo and reference implementation of instant cross-evm-chain communication using Connext! Spacefold was built as part of [The Great Reddit Scaling Bake-Off](https://www.reddit.com/r/ethereum/comments/hbjx25/the_great_reddit_scaling_bakeoff/) in July 2020. 6 | 7 | Here's [our official submission to the /r/ethereum subreddit](https://www.reddit.com/r/ethereum/comments/i1eooc/spacefold_connexts_submission_to_the_great_reddit/)! 8 | 9 | ### Quick Resources 10 | 11 | - You can read more about how to use Spacefold in [our announcement post](https://medium.com/connext/introducing-spacefold-d1c227a29d3) 12 | - Found a bug, want to learn more, or just say hello? [Join us in our discord](https://discord.gg/raNmNb5)! 13 | - Learn more about Connext through [our docs](https://docs.connext.network), and by checking out [our monorepo](https://github.com/connext/indra) 14 | 15 | ### Introduction: "Hold up, how does this meet the Reddit requirements outlined above"? 16 | 17 | Great question! It doesn't and it's not supposed to. 18 | 19 | [Connext](https://connext.network) is the protocol for programmable p2p micropayments. Connext lets users make unbreakable commitments to each other using _state channels_ - these commitments are effectively free to create and send, but must be backed by funds locked up on (any) chain. Unlike other scalability solutions to Ethereum, we're not a consensus system (a blockchain, rollup, etc.), but a point-to-point communication network that enables extremely high volume, private, ultra-cheap transfers (and other more complex commitments) baked directly into existing web paradigms like HTTP requests. 20 | 21 | One consequence of the above is that all actions taken within Connext are private to each user. This means that, while we can enable a high volume of Reddit Community Point _transfers_ at low cost, meeting Reddits requirements of scalably minting/burning their points can't be done in a way where subreddit users can actively monitor and interact with each others' balances. Those balances would be necessarily private. 22 | 23 | The reality is that every solution has its tradeoffs. Rather than building a custom independent submission, we decided to experiment with mitigating these tradeoffs by combining different existing solutions to make something even better. The biggest vector for improvement we see is the usability and interoperability of new scale-by-more-chains-based approaches like rollups/plasma/sidechains/sharding. 24 | 25 | Spacefold demonstrates how Connext can be used to build an **internet-of-l2-chains/shards**. Users can instantly and seamlessly transfer value between chains/shards, and eventually even make atomic cross-chain contract calls. Most importantly, this can happen in a way where users _dont need to know what chain/rollup/shard they are on to begin with_. 26 | 27 | ## Table of Contents 28 | 29 | 1. [Compatibility with Other Chains](https://github.com/connext/spacefold/blob/master/README.md#compatibility-with-other-chains) 30 | 31 | 2. [Running it Yourself](https://github.com/connext/spacefold/blob/master/README.md#run-it-yourself) 32 | 33 | a. [Setting Up the Demo Locally](https://github.com/connext/spacefold/blob/master/README.md#running-the-spacefold-demo-locally) 34 | 35 | b. [Running your own Connext Node on Multiple Chains](https://github.com/connext/spacefold/blob/master/README.md#running-your-own-connext-node-on-multiple-chains) 36 | 37 | 3. [How Does it Work?](https://github.com/connext/spacefold/blob/master/README.md#how-does-it-work) 38 | 39 | a. [Background on Connext](https://github.com/connext/spacefold/blob/master/README.md#a-quick-background-on-connext) 40 | 41 | b. [Cross-chain Transfers with Connext](https://github.com/connext/spacefold/blob/master/README.md#cross-chain-transfers-with-connext) 42 | 43 | c. [How Does it Scale?](https://github.com/connext/spacefold/blob/master/README.md#how-does-it-scale) 44 | 45 | 4. [Demo Implementation Details](https://github.com/connext/spacefold/blob/master/README.md#demo-implementation-details) 46 | 47 | 5. [Trust Assumptions and Other Considerations](https://github.com/connext/spacefold/blob/master/README.md#trust-assumptions-and-considerations) 48 | 49 | ## Compatibility with Other Chains 50 | 51 | In general, Connext can support any chain/l2/shard/rollup system that supports turing-complete computation. For limited cases, we may also be able to get away with non-turing-complete chains using a slightly different pattern for cross-chain transfers. 52 | 53 | While the above is true, in the ideal case (to avoid custom work), it's best for Connext to work with Ethereum-like systems (that run the EVM and support Solidity). Running Connext on anything else would likely require lots of custom work. 54 | 55 | To help with parsing out which solutions can and can't work with Connext, we've created a compatiblity table. **Note** this table is still a WIP while we get more information from teams. If you feel as though anything here was misrepresented, please submit an issue -- we're happy to amend! 56 | 57 | | Name | Type | EVM Compatible | Supports `Create2` | Included in demo | Notes | Verdict | 58 | | :-------: | :----------------: | :--------------: | :----------------: | :--------------: | --------------------------------------------------------------------------------------------------------------------- | ------- | 59 | | Matic | Plasma chain | ✔️ | ✔️ | ✔️ | | 😍 | 60 | | Optimism | ORU | ✔️ | ✔️ | ✔️ | | 😍 | 61 | | xDai | PoS Sidechain | ✔️ | ✔️ | ✔️ | | 😍 | 62 | | SKALE | Elastic Sidechains | ✔️ | ✔️ | Coming soon | | 😍 | 63 | | Arbitrum | ORU | ✔️ | ✔️ | Coming soon | | 😍 | 64 | | OMG | Plasma chain | ✔️ | 🤷 | | No confirmation from OMG team yet - we're assuming based on most plasma constructions | 🙂 | 65 | | Hubble | ORU | Can be supported | | | | 🙂 | 66 | | Fuel | ORU | Planned for v2 | | | While not currently supported, the Fuel team expressed interest in building support potentially earlier than their v2 | 🙂 | 67 | | Starkware | zkRU | ❌ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | 🤷/☹️ | 68 | | Loopring | zkRU | ❌ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | 🤷/☹️ | 69 | | zkSync | zkRU | ❌ | | | No confirmation from team yet, we're assuming based on current zkRU limitations | 🤷/☹️ | 70 | 71 | ## Run it Yourself 72 | 73 | ### Running the Spacefold Demo Locally 74 | 75 | The spacefold demo is pretty simple to run: 76 | 77 | ```bash 78 | git clone git@github.com:connext/spacefold.git 79 | cd spacefold 80 | ``` 81 | 82 | By default, the demo will point to a Connext node that we're hosting at https://node.spacefold.io. 83 | 84 | You'll need a few environment variables to start the demo. 85 | 86 | 1. `NEXT_PUBLIC_CHAIN_PROVIDERS=` -- JSON string to provide node URLs with chains, i.e. '{"4":"https://rinkeby.infura.io/v3/...","5":"https://goerli.infura.io/v3/...","42":"https://kovan.infura.io/v3/...","80001":"https://rpc-mumbai.matic.today"}' 87 | 88 | Then, 89 | 90 | ``` 91 | yarn && yarn dev 92 | ``` 93 | 94 | ### Running your own Connext Node on Multiple Chains 95 | 96 | Running your own Connext node locally is also pretty easy! 97 | 98 | ```bash 99 | git clone git@github.com:connext/vector.git 100 | cd vector 101 | make # this will take a while 102 | make start-trio 103 | ``` 104 | 105 | Please refer to our [docs](https://docs.connext.network) for more info, or ping us in our Discord! 106 | 107 | ## How does it work? 108 | 109 | ### A Quick Background on Connext 110 | 111 | Connext is a network of _state channels_. The core concept behind a channel is very simple: 112 | 113 | - Suppose you're paying your friend Bob for a metered service at the rate of \$1 every minute. 114 | - It would be silly to broadcast every transaction to the blockchain, you would incur lots of fees. At the same time, it also doesn't make sense to pay up front or pay at the end, as that would introduce new trust assumptions. 115 | - Instead, what you can do is send your funds to a 2/2 multisig controlled by you and Bob. Then, rather than sending onchain transactions, you can send Bob ever updating signatures which give Bob _the ability_ to withdraw up to a certain amount from the multisig. 116 | - Because Bob _can_ get his funds at any time using his unbreakable commitment from you, you complete a new payment to him every time you send a new signature. 117 | 118 | ![alt text](https://github.com/connext/spacefold/blob/master/public/BasicChannel.png?raw=true) 119 | 120 | Connext extends this concept in a couple of ways ways: 121 | 122 | 1. Updates within the channel can have any arbitrary conditionality to them. This means you could make your payments conditional upon Bob providing a proof of his work, or based on some real world event, or even based on the outcome of a chess game. 123 | 124 | 2. More importantly: the above paradigm requires you to deploy a new multisig with each new person you transact with. Using the conditionality described above, Connext instead lets you use your channel with Bob to atomically interact with anyone that Bob also has a channel with. For instance, you pay Bob $1, who pays Charlie $0.9999 (Bob takes a microfee), who pays Danielle \$0.9998 (Charlie takes a microfee). 125 | 126 | There's a lot more information available publicly on state channels, here are some great resources: 127 | 128 | - [State channels for babies](https://medium.com/connext/state-channels-for-babies-c39a8001d9af) 129 | - [Counterfactual for dummies](https://medium.com/blockchannel/counterfactual-for-dummies-part-1-8ff164f78540) 130 | - [EthHub](https://docs.ethhub.io/ethereum-roadmap/layer-2-scaling/state-channels/) 131 | 132 | ### Cross-chain Transfers with Connext 133 | 134 | One big hurdle that we encountered when building our network was the difficulty of managing interactions that could be on different chains or different currencies. This is why, in addition to the above we extend basic channels in another way: 135 | 136 | Because of the fact that channels are simple primitives and what links them together is _offchain_ communication, it's possible to transact to Danielle regardless of where Bob and Charlie's channels are or what currency they're using. This means you can pay Bob on Ethereum in Eth, who pays Charlie on Matic in MATIC, who pays Danielle on Arbitrum in aDai, who in turn calls the Uniswap contract running on Optimism on your behalf. This is best shown via the following diagram: 137 | 138 | ![alt text](https://github.com/connext/spacefold/blob/master/public/Crosschain.png?raw=true) 139 | 140 | ### How Does it Scale? 141 | 142 | What you're effectively doing above is freezing funds on an existing ledger and committing to peers that you will pay them out of those funds (sort of like the Gas Station Network, but no one actually _needs_ to submit the transactions to chain unless they want to). 143 | 144 | This means that some specific types of activities (anything that is point-to-point and doesn't require global consensus), you are now entirely unconstrained by the limitations of blockchains. Updates in state channels can happen as fast as HTTP messages because... well, they can literally be HTTP messages. 145 | 146 | There are of course some limitations, however, which are discussed later in this readme. 147 | 148 | ## Demo Implementation Details 149 | 150 | For the purposes of the demo, we've made some simplifying assumptions: 151 | 152 | 1. We mint for users using a faucet instead of letting them deposit their own assets. We found that the user experience of getting assets to different chains to test folding with was really poor and took away from the substance of the demo. If spacefold existed as a standalone production app, it would be much easier for users to get value to these other l2s in the first place. 🤔 153 | 154 | 2. For Optimism, we're using a temporary testnet chain hosted by the team themselves. At the moment, a public testnet does not exist. 155 | 156 | 3. Throughout the demo, we use a dummy ERC20 token with a 1:1 swap rate. We considered using Eth for some chains, but decided against it because then we would need to do lots of social verification in a short time to get Eth liquidity and our team only has so many twitter accounts. 157 | 158 | 4. We decided against showing mainnet in the demo -- at the time of writing, mainnet gas fees are at 62 gwei. While this code can definitely be run on mainnet, we thought that the it would be annoying for users who just want to understand how it works to have to wait several minutes for a faucet transaction. 159 | 160 | 5. There's a LOT more functionality that Connext enables. Even if you're using Connext primarily to bridge between chains, it can be **highly** cost effective to also use it to further reduce the costs of transfers of tokens like Community points. You can also do more complex constructions such as bounties, or token-proportional content investing. We've left these things out of the demo to specifically highlight the cross-chain functionality. 161 | 162 | ## Trust Assumptions and Considerations 163 | 164 | ### Trust Vectors 165 | 166 | Connext is _entirely_ noncustodial for users. No matter what happens, users are always able to withdraw their balance to whatever chain(s) they are actively participating in. 167 | 168 | This comes with a couple of caveats, however: 169 | 170 | 1. First, users need to hold their latest offchain state to withdraw with. This is typically referred to as the "data availability problem" for solutions like state channels and plasma (as contrasted to solutions that post data to chain -- i.e. rollups). In practice, we've found that this is actually not as big of a problem for users as people think it is, particularly if users are utilizing authenticated sessions. This data storage can also be easily decentralized and outsourced to remote backup providers to ensure user funds remain secure. 171 | 172 | 2. Second, users need to monitor the chain to respond to any potential disputes. This is a similar pattern to what users have to do for plasma and optimistic rollup chains. Similar to those approaches, monitoring the chain can be outsourced to third parties who do it as a service (typically referred to as Watchtowers). [We have an open source implementation of a watchtower module which can be dropped into any service](https://github.com/connext/indra/tree/staging/modules/watcher). 173 | 174 | Both of the above problems can be solved in pretty elegant ways in the long run. You can use watchtower pools to back up state -- these can utilize eventually-consistent persistent store systems like IPFS which take in anonymized data plus run our watcher interface. The pools can be held economically liable through value staked upfront on-chain, which is slashed upon pool misbehavior. 175 | 176 | In return for these caveats, channels give unparalleled UX. Unless all communication has broken down and you're actively in dispute, getting into and out of a channel is a single onchain transaction, which can also be **entirely gas abstracted** (as is the case with Connext). You can also onboard users to channels in sticky ways -- for instance, we support referral codes that implementers can create (or users can generate for each other) which create/fund a channel. 177 | 178 | ### Censorship 179 | 180 | Because state channel networks are _not consensus systems_ but are instead structurally similar to TCP/IP, the potential exists for censorship by intermediary routers. 181 | 182 | This is true in the current implementation of Connext which features a hub-and-spoke pattern over many single nodes. In the current construction, one "full node" provider connects to many users (running fully validating, but browser-compatible light nodes) and acts as the primary router. 183 | 184 | Our eventual goal is to move towards a pattern where routing nodes also all connect to each other. Then, censoring transactions becomes much much much tougher. Transfers can be routed over TOR using VPNs and pass through many routers before reaching a destination. They can also be broken up into many smaller transfers/updates which are all atomically routed over many different paths, exactly like how TCP works. 185 | 186 | ### Liquidity 187 | 188 | Effectively what you're doing with Connext is doing many many tiny swaps between linked channels when you route a transfer or make an update. These swaps require collateral to happen trustlessly. This means that routing nodes in Connext are also liquidity providers earning fees for their service. 189 | 190 | There's a lot of misinformation about the _amount_ and _extent_ to which liquidity is needed within channel networks. The reality is that it's very very hard to judge exactly how much, but as the network gets more connected and transaction volume increases, you start to see more and more transactions flowing in both directions within a routing channel. For each transfer, the node earns fees multiplicatively against the locked up collateral. From internal rough calculations made by some of our users the ROI generated here is _more than enough_ to offset liquidity costs and competitive with existing DeFi returns. 191 | 192 | Aside from the cost of liquidity, the base cost of transfers is equal to the cost of bandwidth. 193 | -------------------------------------------------------------------------------- /components/Footer.tsx: -------------------------------------------------------------------------------- 1 | import { Heart } from "react-feather"; 2 | export default function Footer() { 3 | return ( 4 | 10 | Made with by Connext 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /components/Loading.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { IMAGE_PATH } from "../constants"; 3 | 4 | export default function Loading({ initializing, message }) { 5 | const [imageLoaded, setImageLoaded] = useState(true); 6 | return ( 7 |
8 |
12 | loading setImageLoaded(false)} 18 | /> 19 |
20 |
{message}
21 |
22 | ); 23 | } 24 | -------------------------------------------------------------------------------- /components/Modal.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from "react"; 2 | import { ConnextModal } from "@connext/vector-modal"; 3 | import { Grid, Button, TextField, Select, MenuItem } from "@material-ui/core"; 4 | 5 | export default function Modal() { 6 | const [showModal, setShowModal] = useState(false); 7 | 8 | const [withdrawalAddress, setWithdrawalAddress] = useState(""); 9 | const [open, setOpen] = React.useState(false); 10 | const [injectedProvider, setInjectedProvider] = React.useState(); 11 | 12 | const chainConfig = process.env.NEXT_PUBLIC_CHAIN_PROVIDERS; 13 | const chainProviders = JSON.parse(chainConfig!); 14 | 15 | const handleChange = (event) => { 16 | setWithdrawalAddress(event.target.value); 17 | }; 18 | 19 | const handleSubmit = (values) => { 20 | const errors = { receiverAddress: "" }; 21 | if (!values.receiverAddress) { 22 | errors.receiverAddress = "Required"; 23 | } 24 | return errors; 25 | }; 26 | interface NETWORK { 27 | depositChainId: number; 28 | depositChainName: string; 29 | withdrawChainId: number; 30 | withdrawChainName: string; 31 | tokens: TOKEN[]; 32 | } 33 | interface TOKEN { 34 | name: string; 35 | depositAssetId: string; 36 | withdrawAssetId: string; 37 | } 38 | 39 | const GOERLI_MUMBAI_TOKENS: TOKEN[] = [ 40 | { 41 | name: "Test Token", 42 | depositAssetId: "0xbd69fC70FA1c3AED524Bb4E82Adc5fcCFFcD79Fa", 43 | withdrawAssetId: "0xfe4F5145f6e09952a5ba9e956ED0C25e3Fa4c7F1", 44 | }, 45 | ]; 46 | 47 | const MUMBAI_GOERLI_TOKENS: TOKEN[] = [ 48 | { 49 | name: "Test Token", 50 | depositAssetId: "0xfe4F5145f6e09952a5ba9e956ED0C25e3Fa4c7F1", 51 | withdrawAssetId: "0xbd69fC70FA1c3AED524Bb4E82Adc5fcCFFcD79Fa", 52 | }, 53 | ]; 54 | 55 | const RINKEBY_KOVAN_TOKENS: TOKEN[] = [ 56 | { 57 | name: "ETH", 58 | depositAssetId: "0x0000000000000000000000000000000000000000", 59 | withdrawAssetId: "0x0000000000000000000000000000000000000000", 60 | }, 61 | ]; 62 | 63 | const KOVAN_RINKEBY_TOKENS: TOKEN[] = [ 64 | { 65 | name: "ETH", 66 | depositAssetId: "0x0000000000000000000000000000000000000000", 67 | withdrawAssetId: "0x0000000000000000000000000000000000000000", 68 | }, 69 | ]; 70 | 71 | // const KOVAN_ARBITRUM_TOKENS: TOKEN[] = [ 72 | // { 73 | // name: "ETH", 74 | // depositAssetId: "0x0000000000000000000000000000000000000000", 75 | // withdrawAssetId: "0x0000000000000000000000000000000000000000", 76 | // }, 77 | // ]; 78 | 79 | // const ARBITRUM_KOVAN_TOKENS: TOKEN[] = [ 80 | // { 81 | // name: "ETH", 82 | // depositAssetId: "0x0000000000000000000000000000000000000000", 83 | // withdrawAssetId: "0x0000000000000000000000000000000000000000", 84 | // }, 85 | // ]; 86 | 87 | // const ETH_MATIC_TOKENS: TOKEN[] = [ 88 | // { 89 | // name: "Test Token", 90 | // depositAssetId: "0x9E86dd60e0B1e7e142F033d1BdEf734c6b3224Bb", 91 | // withdrawAssetId: "0x9E86dd60e0B1e7e142F033d1BdEf734c6b3224Bb", 92 | // }, 93 | // ]; 94 | 95 | // const MATIC_ETH_TOKENS: TOKEN[] = [ 96 | // { 97 | // name: "Test Token", 98 | // depositAssetId: "0x9E86dd60e0B1e7e142F033d1BdEf734c6b3224Bb", 99 | // withdrawAssetId: "0x9E86dd60e0B1e7e142F033d1BdEf734c6b3224Bb", 100 | // }, 101 | // ]; 102 | 103 | const networks: NETWORK[] = [ 104 | { 105 | depositChainId: 5, 106 | depositChainName: "Goerli Testnet", 107 | withdrawChainId: 80001, 108 | withdrawChainName: "Matic Testnet", 109 | tokens: GOERLI_MUMBAI_TOKENS, 110 | }, 111 | { 112 | depositChainId: 80001, 113 | depositChainName: "Matic Testnet", 114 | withdrawChainId: 5, 115 | withdrawChainName: "Goerli Testnet", 116 | tokens: MUMBAI_GOERLI_TOKENS, 117 | }, 118 | { 119 | depositChainId: 4, 120 | depositChainName: "Rinkeby Testnet", 121 | withdrawChainId: 42, 122 | withdrawChainName: "Kovan Testnet", 123 | tokens: RINKEBY_KOVAN_TOKENS, 124 | }, 125 | { 126 | depositChainId: 42, 127 | depositChainName: "Kovan Testnet", 128 | withdrawChainId: 4, 129 | withdrawChainName: "Rinkeby Testnet", 130 | tokens: KOVAN_RINKEBY_TOKENS, 131 | }, 132 | // { 133 | // depositChainId: 42, 134 | // depositChainName: "Kovan Testnet", 135 | // withdrawChainId: 79377087078960, 136 | // withdrawChainName: "Arbitrum Testnet V3", 137 | // tokens: KOVAN_ARBITRUM_TOKENS, 138 | // }, 139 | // { 140 | // depositChainId: 79377087078960, 141 | // depositChainName: "Arbitrum Testnet V3", 142 | // withdrawChainId: 42, 143 | // withdrawChainName: "Kovan Testnet", 144 | // tokens: ARBITRUM_KOVAN_TOKENS, 145 | // }, 146 | // { 147 | // depositChainId: 137, 148 | // depositChainName: "Matic Mainnet", 149 | // withdrawChainId: 1, 150 | // withdrawChainName: "ETH Mainnet", 151 | // tokens: MATIC_ETH_TOKENS, 152 | // }, 153 | // { 154 | // depositChainId: 1, 155 | // depositChainName: "ETH Mainnet", 156 | // withdrawChainId: 137, 157 | // withdrawChainName: "Matic Mainnet", 158 | // tokens: ETH_MATIC_TOKENS, 159 | // }, 160 | ]; 161 | 162 | const handleNetwork = (event) => { 163 | setChain(networks[event.target.value]); 164 | }; 165 | const handleClose = () => { 166 | setOpen(false); 167 | }; 168 | 169 | const handleOpen = () => { 170 | setOpen(true); 171 | }; 172 | 173 | const [chain, setChain] = useState(networks[0]); 174 | return ( 175 | <> 176 | 177 | 178 | 195 | 196 | 197 |
198 | 199 | 200 | 218 | 219 | 220 | 230 | 231 | 232 |
233 | 234 | 235 | 250 | 251 | 252 | 253 | setShowModal(false)} 262 | depositChainProvider={chainProviders[chain!.depositChainId]} 263 | withdrawChainProvider={chainProviders[chain!.withdrawChainId]} 264 | injectedProvider={injectedProvider} 265 | loginProvider={injectedProvider} 266 | /> 267 | 268 | ); 269 | } 270 | -------------------------------------------------------------------------------- /components/Navbar.tsx: -------------------------------------------------------------------------------- 1 | import { GitHub, Info, MessageCircle } from "react-feather"; 2 | 3 | export default function Navbar() { 4 | return ( 5 |
6 | 10 | 16 | Help 17 | 18 | 24 | GitHub 25 | 26 | 32 | Chat 33 | 34 |
35 | ); 36 | } 37 | -------------------------------------------------------------------------------- /components/index.ts: -------------------------------------------------------------------------------- 1 | import Loading from "./Loading"; 2 | import Navbar from "./Navbar"; 3 | import Footer from "./Footer"; 4 | import Modal from "./Modal"; 5 | 6 | export { Loading, Navbar, Footer, Modal }; 7 | -------------------------------------------------------------------------------- /constants/index.ts: -------------------------------------------------------------------------------- 1 | export const tokenSelectStyles = { 2 | control: (base: any) => ({ 3 | ...base, 4 | background: "transparent", 5 | border: "none", 6 | height: "40px!important", 7 | minHeight: "20px!important", 8 | // border: "1px solid #bbc0c5", 9 | fontSize: "20px", 10 | // padding: "6px 3px", 11 | display: "flex", 12 | flex: "0 0 auto", 13 | boxShadow: "none", 14 | cursor: "pointer", 15 | }), 16 | valueContainer: (base: any) => ({ 17 | ...base, 18 | justifyContent: "center", 19 | }), 20 | menu: (base: any) => ({ 21 | ...base, 22 | margin: 0, 23 | }), 24 | menuList: (base: any) => ({ 25 | ...base, 26 | maxHeight: "100%", 27 | }), 28 | option: (base: any) => ({ 29 | ...base, 30 | backgroundColor: "#FFFFFF", 31 | // color: "#505D68", 32 | maxheight: "20px", 33 | textAlign: "left", 34 | cursor: "pointer", 35 | }), 36 | indicatorSeparator: (base: any) => ({ 37 | width: 0, 38 | }), 39 | }; 40 | 41 | const networkIndicator = { 42 | fontStyle: "normal", 43 | fontWeight: "normal", 44 | fontSize: "0.625rem", 45 | lineHeight: "140%", 46 | display: "flex", 47 | alignItems: "center", 48 | }; 49 | 50 | export const networkSelectStyles = { 51 | control: (base: any) => ({ 52 | ...base, 53 | background: "transparent", 54 | minWidth: "20px", 55 | minHeight: "20px!important", 56 | border: "1px solid #bbc0c5", 57 | borderRadius: "16px", 58 | display: "flex", 59 | flex: "0 0 auto", 60 | boxShadow: "none", 61 | cursor: "pointer", 62 | }), 63 | valueContainer: (base: any) => ({ 64 | ...base, 65 | justifyContent: "center", 66 | }), 67 | menu: (base: any) => ({ 68 | ...base, 69 | // ...networkIndicator, 70 | margin: 0, 71 | }), 72 | menuList: (base: any) => ({ 73 | ...base, 74 | maxHeight: "100%", 75 | }), 76 | option: (base: any) => ({ 77 | ...base, 78 | backgroundColor: "#FFFFFF", 79 | maxheight: "20px", 80 | textAlign: "left", 81 | cursor: "pointer", 82 | }), 83 | indicatorSeparator: (base: any) => ({ 84 | width: 0, 85 | }), 86 | }; 87 | 88 | export const LOCAL_STORAGE_VERSION = "1"; 89 | export const MINIMUM_BALANCE = 0.001; 90 | 91 | export const CURRENT = { 92 | DEPOSIT: 0, 93 | TRANSFER: 1, 94 | WITHDRAW: 2, 95 | }; 96 | 97 | export interface STATUS_TYPE { 98 | WAIT: "wait"; 99 | PROCESS: "process"; 100 | FINISH: "finish"; 101 | ERROR: "error"; 102 | } 103 | 104 | export const STATUS: STATUS_TYPE = { 105 | WAIT: "wait", 106 | PROCESS: "process", 107 | FINISH: "finish", 108 | ERROR: "error", 109 | }; 110 | 111 | export interface TOKEN { 112 | name: string; 113 | icon: string; 114 | background: string; 115 | address: string; 116 | } 117 | 118 | export interface ENV { 119 | chainId: number; 120 | name: string; 121 | icon: string; 122 | tokens: TOKEN[]; 123 | color: string; 124 | ethProviderUrl: string; 125 | blockchainExplorerURL: string; 126 | } 127 | 128 | const RINKEBY_TOKENS: TOKEN[] = [ 129 | { 130 | name: "ETH", 131 | icon: "/images/eth.png", 132 | background: "/images/rinkebyBackground.png", 133 | address: "0x0000000000000000000000000000000000000000", 134 | }, 135 | // { 136 | // name: "MOON", 137 | // icon: "/images/moon.png", 138 | // background: "/images/rinkebyBackground.png", 139 | // address: "0x50C94BeCAd95bEe21aF226dc799365Ee6B134459", 140 | // }, 141 | ]; 142 | 143 | const KOVAN_TOKENS: TOKEN[] = [ 144 | { 145 | name: "ETH", 146 | icon: "/images/eth.png", 147 | background: "/images/rinkebyBackground.png", 148 | address: "0x0000000000000000000000000000000000000000", 149 | }, 150 | // { 151 | // name: "MOON", 152 | // icon: "/images/moon.png", 153 | // background: "/images/rinkebyBackground.png", 154 | // address: "0x50C94BeCAd95bEe21aF226dc799365Ee6B134459", 155 | // }, 156 | ]; 157 | 158 | const GOERLI_TOKENS: TOKEN[] = [ 159 | // { 160 | // name: "ETH", 161 | // icon: "/images/eth.png", 162 | // background: "/images/rinkebyBackground.png", 163 | // address: "0x0000000000000000000000000000000000000000", 164 | // }, 165 | { 166 | name: "DERC20", 167 | icon: "/images/moon.png", 168 | background: "/images/maticBackground.png", 169 | address: "0xbd69fC70FA1c3AED524Bb4E82Adc5fcCFFcD79Fa", 170 | }, 171 | // { 172 | // name: "MOON", 173 | // icon: "/images/moon.png", 174 | // background: "/images/rinkebyBackground.png", 175 | // address: "0x50C94BeCAd95bEe21aF226dc799365Ee6B134459", 176 | // }, 177 | ]; 178 | const MATIC_TOKENS: TOKEN[] = [ 179 | { 180 | name: "DERC20", 181 | icon: "/images/moon.png", 182 | background: "/images/maticBackground.png", 183 | address: "0xfe4F5145f6e09952a5ba9e956ED0C25e3Fa4c7F1", 184 | }, 185 | // { 186 | // name: "ETH", 187 | // icon: "/images/eth.png", 188 | // background: "/images/maticBackground.png", 189 | // address: "0x0000000000000000000000000000000000000000", 190 | // }, 191 | // { 192 | // name: "MOON", 193 | // icon: "/images/moon.png", 194 | // background: "/images/rinkebyBackground.png", 195 | // address: "0x50C94BeCAd95bEe21aF226dc799365Ee6B134459", 196 | // }, 197 | ]; 198 | 199 | export const ENVIRONMENT: ENV[] = [ 200 | { 201 | chainId: 5, 202 | name: "Goerli", 203 | tokens: GOERLI_TOKENS, 204 | icon: "/images/brickBackground.png", 205 | color: "#0091F2", 206 | ethProviderUrl: `https://goerli.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 207 | blockchainExplorerURL: `https://goerli.etherscan.io/tx/`, 208 | }, 209 | { 210 | chainId: 80001, 211 | name: "Matic Testnet", 212 | tokens: MATIC_TOKENS, 213 | icon: "/images/rinkebyBackground.png", 214 | color: "#2b6def", 215 | ethProviderUrl: `https://rpc-mumbai.matic.today`, 216 | blockchainExplorerURL: "https://mumbai-explorer.matic.today/tx/", 217 | }, 218 | { 219 | chainId: 4, 220 | name: "Rinkeby", 221 | tokens: RINKEBY_TOKENS, 222 | icon: "/images/brickBackground.png", 223 | color: "#EFC45C", 224 | ethProviderUrl: `https://rinkeby.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 225 | blockchainExplorerURL: `https://rinkeby.etherscan.io/tx/`, 226 | }, 227 | { 228 | chainId: 42, 229 | name: "Kovan", 230 | tokens: KOVAN_TOKENS, 231 | icon: "/images/rinkebyBackground.png", 232 | color: "#5b32a2", 233 | ethProviderUrl: `https://kovan.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 234 | blockchainExplorerURL: `https://kovan.etherscan.io/tx/`, 235 | }, 236 | ]; 237 | 238 | // local env 239 | // export const ENVIRONMENT: ENV[] = [ 240 | // { 241 | // chainId: 1337, 242 | // name: "Local 1337", 243 | // tokens: RINKEBY_TOKENS, 244 | // icon: "/images/brickBackground.png", 245 | // color: "#EFC45C", 246 | // ethProviderUrl: `http://localhost:8545`, 247 | // blockchainExplorerURL: "https://rinkeby.etherscan.io/tx/{TRANSACTION_HASH}", 248 | // }, 249 | // { 250 | // chainId: 1338, 251 | // name: "Local 1338", 252 | // tokens: KOVAN_TOKENS, 253 | // icon: "/images/rinkebyBackground.png", 254 | // color: "#5b32a2", 255 | // ethProviderUrl: `http://localhost:8546`, 256 | // blockchainExplorerURL: "https://kovan.etherscan.io/tx/{TRANSACTION_HASH}", 257 | // }, 258 | // ]; 259 | 260 | export const IMAGE_PATH = { 261 | icon: { 262 | eth: "/images/eth.png", 263 | moon: "/images/moon.png", 264 | brick: "/images/brick.png", 265 | }, 266 | background: { 267 | optimism: "/images/optimismBackground.png", 268 | rinkeby: "/images/rinkebyBackground.png", 269 | brick: "/images/brickBackground.png", 270 | skale: "/images/skaleBackground.png", 271 | xDai: "/images/xDaiBackground.png", 272 | matic: "/images/maticBackground.png", 273 | }, 274 | status: { 275 | transferDisabled: "/images/transferDisabled.png", 276 | dropdownDisabled: "/images/dropdownDisabled.png", 277 | }, 278 | gifs: { 279 | loading: "/images/loading.gif", 280 | transfer: "/images/transfer.gif", 281 | dropdown: "/images/dropdown.gif", 282 | spinningGear: "/images/spinningGear.gif", 283 | ellipsis: "/images/ellipsis.gif", 284 | }, 285 | }; 286 | 287 | export const TOKENS = { 288 | 4: { 289 | tokenName: "MOON", 290 | tokenIcon: IMAGE_PATH.icon.moon, 291 | tokenBackground: IMAGE_PATH.background.rinkeby, 292 | tokenAddress: "0x50C94BeCAd95bEe21aF226dc799365Ee6B134459", 293 | chainId: 4, 294 | name: "Rinkeby", 295 | color: "#EFC45C", 296 | ethProviderUrl: `https://rinkeby.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 297 | blockchainExplorerURL: "https://rinkeby.etherscan.io/tx/{TRANSACTION_HASH}", 298 | }, 299 | // 5: { 300 | // tokenName: "ETH", 301 | // tokenIcon: ethIcon, 302 | // tokenBackground: ethBackground, 303 | // tokenAddress: constants.AddressZero, 304 | // chainId: 5, 305 | // name: "Goerli", 306 | // color: "#0091F2", 307 | // ethProviderUrl: `https://goerli.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 308 | // blockchainExplorerURL: "https://goerli.etherscan.io/tx/{TRANSACTION_HASH}", 309 | // }, 310 | 42: { 311 | tokenName: "BRICK", 312 | tokenIcon: IMAGE_PATH.icon.brick, 313 | tokenBackground: IMAGE_PATH.background.brick, 314 | tokenAddress: "0x4d4deb65DBC13dE6811095baba7064B41A72D9Db", 315 | chainId: 42, 316 | name: "Kovan", 317 | color: "#5b32a2", 318 | ethProviderUrl: `https://kovan.infura.io/v3/${process.env.REACT_APP_INFURA_ID}`, 319 | blockchainExplorerURL: "https://kovan.etherscan.io/tx/{TRANSACTION_HASH}", 320 | }, 321 | // 61: { 322 | // tokenName: "TOKEN", 323 | // tokenIcon: ethIcon, 324 | // tokenBackground: ethBackground, 325 | // tokenAddress: "0xf502A7897a49A9daFa5542203746Bad6C6E86c11", 326 | // chainId: 61, 327 | // name: "ETC", 328 | // color: "#01C853", 329 | // ethProviderUrl: `https://www.ethercluster.com/etc`, 330 | // blockchainExplorerURL: 331 | // "https://blockscout.com/etc/mainnet/tx/{TRANSACTION_HASH}/token_transfers", 332 | // }, 333 | // 100: { 334 | // tokenName: "xBRICKS", 335 | // tokenIcon: brickIcon, 336 | // tokenBackground: xDaiBackground, 337 | // tokenAddress: "0xf502A7897a49A9daFa5542203746Bad6C6E86c11", 338 | // chainId: 100, 339 | // name: "xDAI", 340 | // color: "#01C853", 341 | // ethProviderUrl: `https://xdai.poanetwork.dev`, 342 | // blockchainExplorerURL: 343 | // "https://blockscout.com/poa/xdai/tx/{TRANSACTION_HASH}/token_transfers", 344 | // }, 345 | // 80001: { 346 | // tokenName: "mTOKEN", 347 | // tokenIcon: moonIcon, 348 | // tokenBackground: maticBackground, 349 | // tokenAddress: "0xf502A7897a49A9daFa5542203746Bad6C6E86c11", 350 | // chainId: 80001, 351 | // name: "Matic", 352 | // color: "#2b6def", 353 | // ethProviderUrl: `https://rpc-mumbai.matic.today`, 354 | // blockchainExplorerURL: 355 | // "https://mumbai-explorer.matic.today/tx/{TRANSACTION_HASH}/token_transfers", 356 | // }, 357 | // 346750: { 358 | // tokenName: "sTOKEN", 359 | // tokenIcon: ethIcon, 360 | // tokenBackground: skaleBackground, 361 | // tokenAddress: "0xf502A7897a49A9daFa5542203746Bad6C6E86c11", 362 | // chainId: 16, 363 | // name: "SKALE", 364 | // color: "#000000", 365 | // ethProviderUrl: `https://dev-testnet-v1-1.skalelabs.com`, 366 | // blockchainExplorerURL: null, 367 | // }, 368 | // 108: { 369 | // tokenName: "oMOON", 370 | // tokenIcon: moonIcon, 371 | // tokenBackground: optimismBackground, 372 | // tokenAddress: "0x9313b03453730D296EC4A62b6f3Fc758A9D1d199", 373 | // chainId: 108, 374 | // name: "Optimism", 375 | // color: "#F50025", 376 | // ethProviderUrl: `https://connext.optimism.io`, 377 | // blockchainExplorerURL: null, 378 | // }, 379 | }; 380 | -------------------------------------------------------------------------------- /next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | 3 | module.exports = { 4 | sassOptions: { 5 | includePaths: [path.join(__dirname, "styles")], 6 | }, 7 | webpack: (config, { isServer }) => { 8 | // Fixes npm packages that depend on `fs`, `net`, `express` module 9 | if (!isServer) { 10 | config.node = { 11 | fs: "empty", 12 | net: "empty", 13 | express: "empty", 14 | tls: "empty", 15 | }; 16 | } 17 | return config; 18 | }, 19 | }; 20 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "spacefold", 3 | "version": "0.2.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build && next export", 8 | "start": "next start" 9 | }, 10 | "dependencies": { 11 | "@connext/vector-modal": "1.0.6-beta.6", 12 | "@emotion/react": "^11.1.5", 13 | "@emotion/styled": "^11.1.5", 14 | "@material-ui/core": "^5.0.0-alpha.22", 15 | "framer-motion": "^4.1.3", 16 | "next": "^10.0.4", 17 | "react": "17.0.2", 18 | "react-dom": "17.0.2", 19 | "react-feather": "^2.0.9", 20 | "react-select": "^4.3.0", 21 | "sass": "^1.32.8" 22 | }, 23 | "devDependencies": { 24 | "@types/node": "^14.14.37", 25 | "@types/react": "^17.0.3", 26 | "autoprefixer": "^10.2.5", 27 | "postcss": "^8.2.10", 28 | "tailwindcss": "^2.1.1", 29 | "typescript": "^4.2.4" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /pages/MainCard.tsx: -------------------------------------------------------------------------------- 1 | import { Modal } from "../components"; 2 | 3 | export default function MainCard() { 4 | return ( 5 |
6 |
7 | 8 |
9 |
10 | ); 11 | } 12 | -------------------------------------------------------------------------------- /pages/_app.tsx: -------------------------------------------------------------------------------- 1 | import { AppProps } from "next/app"; 2 | import "../styles/globals.scss"; 3 | 4 | const MyApp: React.FC = ({ Component, pageProps }) => { 5 | return ; 6 | }; 7 | 8 | export default MyApp; -------------------------------------------------------------------------------- /pages/api/hello.js: -------------------------------------------------------------------------------- 1 | // Next.js API route support: https://nextjs.org/docs/api-routes/introduction 2 | 3 | export default (req, res) => { 4 | res.statusCode = 200 5 | res.json({ name: 'John Doe' }) 6 | } 7 | -------------------------------------------------------------------------------- /pages/index.tsx: -------------------------------------------------------------------------------- 1 | import Head from "next/head"; 2 | import { Loading, Navbar, Footer } from "../components"; 3 | import MainCard from "./MainCard"; 4 | import React, { useState, useEffect } from "react"; 5 | 6 | export default function Home() { 7 | const [initializing, setInitializing] = useState(true); 8 | const loadingMessage = "Welcome"; 9 | 10 | useEffect(() => { 11 | setInitializing(false); 12 | }, []); 13 | 14 | return ( 15 |
16 | 17 | Spacefold 18 | 19 | 20 | 21 | 22 | 23 |
24 |
25 | ); 26 | } 27 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: ['tailwindcss', 'autoprefixer'], 3 | } -------------------------------------------------------------------------------- /public/BasicChannel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/BasicChannel.png -------------------------------------------------------------------------------- /public/Crosschain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/Crosschain.png -------------------------------------------------------------------------------- /public/SpacefoldLogoPurple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/SpacefoldLogoPurple.png -------------------------------------------------------------------------------- /public/connext-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/connext-logo.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/favicon.ico -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Alt Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Alt Bold.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Alt Light.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Alt Light.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Alt Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Alt Thin.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Black.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Black.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Bold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Bold.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Extrabold.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Extrabold.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Regular.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Regular.otf -------------------------------------------------------------------------------- /public/fonts/Proxima Nova Thin.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/fonts/Proxima Nova Thin.otf -------------------------------------------------------------------------------- /public/images/arbitrumBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/arbitrumBackground.png -------------------------------------------------------------------------------- /public/images/brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/brick.png -------------------------------------------------------------------------------- /public/images/brickBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/brickBackground.png -------------------------------------------------------------------------------- /public/images/discord.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/images/dropdown.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/dropdown.gif -------------------------------------------------------------------------------- /public/images/dropdownDisabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/dropdownDisabled.png -------------------------------------------------------------------------------- /public/images/ellipsis.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/ellipsis.gif -------------------------------------------------------------------------------- /public/images/etcBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/etcBackground.png -------------------------------------------------------------------------------- /public/images/eth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/eth.png -------------------------------------------------------------------------------- /public/images/ethBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/ethBackground.png -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/maticBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/maticBackground.png -------------------------------------------------------------------------------- /public/images/moon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/moon.png -------------------------------------------------------------------------------- /public/images/moonBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/moonBackground.png -------------------------------------------------------------------------------- /public/images/optimismBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/optimismBackground.png -------------------------------------------------------------------------------- /public/images/rinkebyBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/rinkebyBackground.png -------------------------------------------------------------------------------- /public/images/skaleBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/skaleBackground.png -------------------------------------------------------------------------------- /public/images/spinningGear.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/spinningGear.gif -------------------------------------------------------------------------------- /public/images/transfer.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/transfer.gif -------------------------------------------------------------------------------- /public/images/transferDisabled.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/transferDisabled.png -------------------------------------------------------------------------------- /public/images/xDaiBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/images/xDaiBackground.png -------------------------------------------------------------------------------- /public/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/public/logo512.png -------------------------------------------------------------------------------- /spacefoldlogopurple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/connext/spacefold/50d3175d088f98c5275e84bb03c043c8037b7f87/spacefoldlogopurple.png -------------------------------------------------------------------------------- /styles/CardWindow.scss: -------------------------------------------------------------------------------- 1 | .home { 2 | flex-grow: 1; 3 | flex-shrink: 0; 4 | display: flex; 5 | flex-direction: column; 6 | align-items: center; 7 | justify-content: center; 8 | transition: background-color 0.2s ease; 9 | } 10 | 11 | .card { 12 | display: flex; 13 | flex-direction: column; 14 | width: 80%; 15 | max-width: 480px; 16 | background-color: #ffffff; 17 | border-radius: 5px; 18 | overflow: hidden; 19 | -webkit-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 20 | -moz-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 21 | box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 22 | } 23 | 24 | .bar { 25 | background-color: #f2f3f4; 26 | } 27 | 28 | @media screen and (max-width: 415px) { 29 | .exchange-padding { 30 | padding-left: 0 !important; 31 | padding-right: 0 !important; 32 | } 33 | } 34 | 35 | ::ng-deep .ant-tabs-nav { 36 | width: 100% !important; 37 | } 38 | 39 | .ant-tabs-nav-wrap { 40 | flex-flow: column; 41 | } 42 | .ant-tabs-tab { 43 | width: 100%; 44 | } 45 | 46 | ::ng-deep .ant-tabs-tab { 47 | flex: 1; 48 | text-align: center; 49 | } 50 | 51 | ::ng-deep .ant-tabs-nav > div:nth-of-type(1) { 52 | display: flex !important; 53 | width: 100% !important; 54 | } 55 | -------------------------------------------------------------------------------- /styles/globals.scss: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | @import "styles/CardWindow.scss"; 6 | 7 | @font-face { 8 | font-family: "Proxima Nova"; 9 | src: local("Proxima Nova"), 10 | url("/fonts/Proxima\ Nova\ Regular.otf") format("opentype"); 11 | } 12 | 13 | body { 14 | margin: 0; 15 | font-family: "Proxima Nova", sans-serif; 16 | -webkit-font-smoothing: antialiased; 17 | -moz-osx-font-smoothing: grayscale; 18 | } 19 | 20 | code { 21 | font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New", 22 | monospace; 23 | } 24 | 25 | button { 26 | border: none; 27 | cursor: pointer; 28 | } 29 | 30 | input:focus, 31 | select:focus, 32 | textarea:focus, 33 | button:focus { 34 | outline: none; 35 | } 36 | 37 | // app.scss 38 | 39 | .App { 40 | position: relative; 41 | display: flex; 42 | align-items: stretch; 43 | height: 100vh; 44 | background: #8047eb; 45 | } 46 | 47 | .More-Buttons { 48 | position: absolute; 49 | top: 20px; 50 | left: 20px; 51 | right: 20px; 52 | display: flex; 53 | align-items: center; 54 | justify-content: flex-end; 55 | z-index: 1000; 56 | } 57 | 58 | .More-Buttons a { 59 | background-color: #ffffff; 60 | border-radius: 10px; 61 | color: #7d17ea; 62 | border: none; 63 | font-size: 16px; 64 | font-weight: 600; 65 | padding: 15px 28px; 66 | margin: 0 12px; 67 | box-shadow: 0px 0px 12px rgba(95, 111, 119, 0.5); 68 | text-decoration: none; 69 | } 70 | 71 | .Github-Icon { 72 | font-size: 120%; 73 | color: #000000; 74 | margin-right: 5px; 75 | vertical-align: middle; 76 | } 77 | 78 | .Discord-Icon { 79 | font-size: 120%; 80 | color: #7289da; 81 | margin-right: 5px; 82 | vertical-align: middle; 83 | } 84 | 85 | .About-Icon { 86 | color: #000000; 87 | margin-right: 5px; 88 | vertical-align: middle; 89 | } 90 | 91 | .Main-Content { 92 | width: 100%; 93 | display: flex; 94 | flex-direction: row; 95 | align-items: stretch; 96 | } 97 | 98 | .Token { 99 | flex-grow: 1; 100 | flex-shrink: 0; 101 | display: flex; 102 | flex-direction: column; 103 | align-items: center; 104 | justify-content: center; 105 | transition: background-color 0.2s ease; 106 | } 107 | 108 | .Card-Header { 109 | background-color: #deebff; 110 | } 111 | 112 | .Card-Body { 113 | position: relative; 114 | padding-top: 24px; 115 | padding-bottom: 36px; 116 | padding-left: 56px; 117 | padding-right: 56px; 118 | display: flex; 119 | flex-direction: column; 120 | overflow-y: auto; 121 | } 122 | 123 | .Card-Token-Content { 124 | display: flex; 125 | align-items: stretch; 126 | } 127 | 128 | .Card-Image { 129 | width: 40%; 130 | flex: 1; 131 | opacity: 0.5; 132 | background-size: contain; 133 | background-repeat: no-repeat; 134 | } 135 | 136 | .Token-Select { 137 | padding: 12px 0px; 138 | font-size: 16px; 139 | font-weight: 600; 140 | } 141 | 142 | .Dropdown-Indicator { 143 | width: 18px; 144 | } 145 | 146 | .Dropdown-Indicator-Open { 147 | transform: rotate(180deg); 148 | } 149 | 150 | .Token-Balance { 151 | flex: 1; 152 | display: flex; 153 | align-items: flex-start; 154 | font-size: 32px; 155 | font-weight: 600; 156 | margin-right: 16px; 157 | margin-top: 24px; 158 | margin-bottom: 24px; 159 | } 160 | .Token-Balance-Numbers { 161 | display: flex; 162 | flex-direction: column; 163 | align-items: flex-start; 164 | } 165 | .Token-Balance-Current { 166 | white-space: nowrap; 167 | margin: 0; 168 | } 169 | .Token-Balance-Change { 170 | font-size: 12px; 171 | color: #7d17ea; 172 | margin: 0; 173 | } 174 | 175 | .Token-Balance img { 176 | height: 24px; 177 | width: 24px; 178 | margin-top: 6px; 179 | margin-right: 12px; 180 | } 181 | 182 | .Token-Name { 183 | margin-top: 12px; 184 | font-size: 14px; 185 | font-weight: normal; 186 | text-transform: uppercase; 187 | } 188 | 189 | .Card { 190 | display: flex; 191 | flex-direction: column; 192 | width: calc(100% - 64px - 102px); 193 | max-width: 420px; 194 | background-color: #ffffff; 195 | border-radius: 5px; 196 | overflow: hidden; 197 | -webkit-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 198 | -moz-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 199 | box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 200 | } 201 | 202 | .Token-Left .Card { 203 | border-top-left-radius: 20px; 204 | border-top-right-radius: 20px; 205 | border-bottom-left-radius: 20px; 206 | } 207 | 208 | .Token-Right .Card { 209 | border-bottom-right-radius: 20px; 210 | border-top-right-radius: 20px; 211 | border-bottom-left-radius: 20px; 212 | } 213 | 214 | .Tweet-Body { 215 | padding: 24px 56px; 216 | display: flex; 217 | flex-direction: column; 218 | text-align: left; 219 | } 220 | 221 | .Instructions { 222 | font-size: 14px; 223 | margin: 0 0 12px 0; 224 | } 225 | 226 | .Identifier { 227 | font-size: 12px; 228 | word-break: break-word; 229 | color: #788e99; 230 | margin: 0 0 12px 0; 231 | } 232 | 233 | .Action { 234 | color: #7d17ea; 235 | font-size: 18px; 236 | margin-bottom: 12px; 237 | } 238 | 239 | .URL-Input { 240 | padding: 8px; 241 | margin-bottom: 12px; 242 | border: none; 243 | background: #f4f5f7; 244 | border-bottom: 1px solid #202e66; 245 | } 246 | 247 | .Cancel { 248 | word-break: break-word; 249 | cursor: pointer; 250 | margin: 12px 0 0 0; 251 | text-align: center; 252 | } 253 | 254 | .First-Button { 255 | background-color: #7d17ea; 256 | color: white; 257 | font-size: 16px; 258 | font-weight: 600; 259 | border-radius: 16px; 260 | padding: 12px 32px; 261 | width: 100%; 262 | } 263 | 264 | .First-Button:disabled, 265 | .Send-Button:disabled { 266 | background: #b8c4d5; 267 | cursor: not-allowed; 268 | } 269 | .Minting-Button:disabled, 270 | .Sending-Button:disabled { 271 | cursor: not-allowed; 272 | } 273 | 274 | .Minting-Button, 275 | .Sending-Button { 276 | color: white; 277 | font-size: 16px; 278 | font-weight: 600; 279 | border-radius: 16px; 280 | padding: 12px 32px; 281 | background-color: #fca311; 282 | display: flex; 283 | align-items: center; 284 | justify-content: center; 285 | } 286 | 287 | .Minting-Button img, 288 | .Sending-Button img { 289 | height: 18px; 290 | margin: 0 4px; 291 | } 292 | 293 | .Ellipsis-Gif { 294 | height: 12px; 295 | margin-left: 2px; 296 | align-self: flex-end; 297 | } 298 | 299 | .Mint-Success { 300 | background-color: #fca311; 301 | } 302 | .Mint-Success:disabled { 303 | background-color: #fca311; 304 | } 305 | 306 | .Mint-Success i { 307 | margin-right: 8px; 308 | font-size: 14px; 309 | } 310 | 311 | .Send-Button { 312 | background-color: #7d17ea; 313 | color: #ffffff; 314 | font-size: 16px; 315 | font-weight: 600; 316 | border-radius: 16px; 317 | padding: 12px 32px; 318 | } 319 | 320 | .Send-Success { 321 | background-color: #fca311; 322 | } 323 | .Send-Success:disabled { 324 | background-color: #fca311; 325 | } 326 | 327 | .Send-Success i { 328 | margin-right: 8px; 329 | font-size: 14px; 330 | } 331 | 332 | .Send-Transaction-URL { 333 | color: gray; 334 | display: block; 335 | text-align: center; 336 | margin-top: 15px; 337 | } 338 | 339 | .Middle-Button-Container { 340 | width: 0; 341 | overflow: visible; 342 | z-index: 1; 343 | position: relative; 344 | } 345 | 346 | .Swap-Button { 347 | position: absolute; 348 | top: 50%; 349 | transform: translate(-50%, -50%); 350 | display: flex; 351 | flex-direction: column; 352 | align-items: center; 353 | justify-content: center; 354 | height: 112px; 355 | width: 112px; 356 | border-radius: 64px; 357 | padding: 8px; 358 | text-align: center; 359 | line-height: 20px; 360 | font-size: 16px; 361 | background-color: #7d17ea; 362 | color: #ffffff; 363 | z-index: 900; 364 | -webkit-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 365 | -moz-box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 366 | box-shadow: 0px 0px 30px rgba(95, 111, 119, 0.5); 367 | } 368 | 369 | .Swap-Button:disabled { 370 | cursor: not-allowed; 371 | background-color: #b8c4d5; 372 | } 373 | 374 | .Swap-Button img { 375 | height: 30px; 376 | } 377 | 378 | .Transferring-Circle { 379 | position: absolute; 380 | top: 50%; 381 | transform: translate(-50%, -50%); 382 | height: 112px; 383 | width: 112px; 384 | border-radius: 64px; 385 | background-color: #fcd116; 386 | overflow: hidden; 387 | } 388 | 389 | .Transferring-Circle img { 390 | width: 100%; 391 | height: 100%; 392 | } 393 | 394 | .Flip-Image img { 395 | transform: scaleX(-1); 396 | } 397 | 398 | .Transfer-Success { 399 | background-color: #fcd116; 400 | color: #2602ab; 401 | } 402 | .Transfer-Success:disabled { 403 | background-color: #fcd116; 404 | } 405 | 406 | .Transfer-Error { 407 | background-color: #b41f1f; 408 | } 409 | .Transfer-Error:disabled { 410 | background-color: #b41f1f; 411 | } 412 | 413 | .Footer { 414 | position: fixed; 415 | display: flex; 416 | justify-content: center; 417 | bottom: 0; 418 | width: 100%; 419 | background: #facd48; 420 | text-decoration: none; 421 | font-size: 16px; 422 | padding: 12px 0; 423 | margin: 0; 424 | cursor: pointer; 425 | text-align: center; 426 | color: black; 427 | } 428 | 429 | .Heart-Icon { 430 | margin-right: 5px; 431 | margin-left: 5px; 432 | color: #7d17ea; 433 | } 434 | 435 | @media screen and (max-width: 768px) { 436 | .More-Buttons { 437 | justify-content: center; 438 | } 439 | .More-Buttons a { 440 | padding: 8px 20px; 441 | text-align: center; 442 | } 443 | .More-Buttons a i { 444 | font-size: 200%; 445 | padding: 10px; 446 | margin: 0; 447 | } 448 | .Main-Content { 449 | flex-direction: column; 450 | } 451 | .Token-Left { 452 | padding-top: 120px; 453 | padding-bottom: 60px; 454 | } 455 | .Token-Right { 456 | padding-top: 60px; 457 | padding-bottom: 60px; 458 | } 459 | .Card { 460 | width: calc(100% - 48px - 102px); 461 | min-width: 200px; 462 | margin: 24px; 463 | } 464 | .Card-Image { 465 | display: none; 466 | } 467 | 468 | .Card-Token-Content { 469 | margin-bottom: 24px; 470 | } 471 | .Token-Balance { 472 | margin: 0; 473 | } 474 | .Middle-Button-Container { 475 | width: auto; 476 | height: 0; 477 | } 478 | .Swap-Button { 479 | width: 96px; 480 | height: 96px; 481 | font-size: 14px; 482 | top: 0; 483 | left: 50%; 484 | } 485 | .Transferring-Circle { 486 | width: 96px; 487 | height: 96px; 488 | top: 0; 489 | left: 50%; 490 | } 491 | .Footer { 492 | font-size: 12px; 493 | padding: 8px; 494 | } 495 | } 496 | 497 | button { 498 | outline: none; 499 | } 500 | 501 | @keyframes fadeOut { 502 | 0% { 503 | opacity: 1; 504 | visibility: visible; 505 | } 506 | 100% { 507 | opacity: 0; 508 | visibility: hidden; 509 | } 510 | } 511 | @-moz-keyframes fadeOut { 512 | 0% { 513 | opacity: 1; 514 | visibility: visible; 515 | } 516 | 100% { 517 | opacity: 0; 518 | visibility: hidden; 519 | } 520 | } 521 | @-webkit-keyframes fadeOut { 522 | 0% { 523 | opacity: 1; 524 | visibility: visible; 525 | } 526 | 100% { 527 | opacity: 0; 528 | visibility: hidden; 529 | } 530 | } 531 | @-ms-keyframes fadeOut { 532 | 0% { 533 | opacity: 1; 534 | visibility: visible; 535 | } 536 | 100% { 537 | opacity: 0; 538 | visibility: hidden; 539 | } 540 | } 541 | 542 | // loading.scss 543 | .Loading { 544 | position: fixed; 545 | top: 0; 546 | left: 0; 547 | width: 100vw; 548 | height: 100vh; 549 | display: flex; 550 | flex-direction: column; 551 | align-items: center; 552 | justify-content: center; 553 | background-color: rgba(244, 245, 247, 0.8); 554 | z-index: 999; 555 | } 556 | 557 | .Loading-fadeout { 558 | -moz-animation-name: fadeOut; 559 | -webkit-animation-name: fadeOut; 560 | -ms-animation-name: fadeOut; 561 | animation-name: fadeOut; 562 | -moz-animation-duration: 0.5s; 563 | -webkit-animation-duration: 0.5s; 564 | -ms-animation-duration: 0.5s; 565 | animation-duration: 0.5s; 566 | -moz-animation-fill-mode: forwards; 567 | -webkit-animation-fill-mode: forwards; 568 | -ms-animation-fill-mode: forwards; 569 | animation-fill-mode: forwards; 570 | } 571 | 572 | .Loading-Circle { 573 | height: 96px; 574 | width: 96px; 575 | border-radius: 64px; 576 | background-color: #fcd116; 577 | overflow: hidden; 578 | } 579 | 580 | .Loading-Circle img { 581 | width: 100%; 582 | height: 100%; 583 | } 584 | 585 | .Loading-Message { 586 | margin-top: 24px; 587 | font-size: 14px; 588 | } 589 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | important: true, 3 | purge: ['./components/**/*.{js,ts,jsx,tsx}', './pages/**/*.{js,ts,jsx,tsx}'], 4 | darkMode: 'media', // 'media' or 'class' 5 | theme: { 6 | extend: { 7 | colors: { 8 | 'accent-1': '#333', 9 | }, 10 | }, 11 | }, 12 | variants: { 13 | extend: {}, 14 | }, 15 | plugins: [], 16 | } 17 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "strict": false, 12 | "forceConsistentCasingInFileNames": true, 13 | "noEmit": true, 14 | "esModuleInterop": true, 15 | "module": "esnext", 16 | "moduleResolution": "node", 17 | "resolveJsonModule": true, 18 | "isolatedModules": true, 19 | "jsx": "preserve" 20 | }, 21 | "include": [ 22 | "next-env.d.ts", 23 | "**/*.ts", 24 | "**/*.tsx" 25 | ], 26 | "exclude": [ 27 | "node_modules" 28 | ] 29 | } 30 | --------------------------------------------------------------------------------