comit-network / app Goto Github PK
View Code? Open in Web Editor NEWMoved to
Home Page: https://github.com/comit-network/taker-ui
License: MIT License
Moved to
Home Page: https://github.com/comit-network/taker-ui
License: MIT License
Sideshift and Uniswap are examples of similar interfaces.
This task covers extending the base app with a page for users to swap between BTC and DAI.
Definition of Done
There are lot of issues with the Electron project, ranging from environment issues to issues installing dependencies. This is due to how the JS desktop app architecture relies on different main and renderer processes as well as other cross-platform considerations around native modules.
In 'Balances.tsx' component, use useReducer
, createContext
, useContext
and providers to extract out wallet state for easier use and clearer dataflow.
Add an input form for users to select which Maker to trade with
EDIT: Might be obsolete with decentralized orderbook
Running:
yarn cross-env DEBUG_PROD=true yarn start
Should start the production build of the app, however it results in an error:
init.ts:204 Unable to load preload script: /Users/yos/work/comit-app/app/dist/renderer.prod.js
(anonymous) @ init.ts:204
init.ts:205 Error: An error occurred. See https://github.com/styled-components/styled-components/blob/master/packages/styled-components/src/utils/errors.md#6 for more information.
at new t (styled-components.esm.js:205)
at styled-components.esm.js:480
at me (styled-components.esm.js:804)
at e.makeTag (styled-components.esm.js:1023)
at e.getTagForId (styled-components.esm.js:1041)
at e.deferredInject (styled-components.esm.js:1081)
at new e (styled-components.esm.js:2256)
at ft (styled-components.esm.js:2300)
at Object.<anonymous> (index.es.js:2738)
at Object../node_modules/rimble-ui/dist/index.es.js (/Users/yos/work/comit-app/app/dist/renderer.prod.js:15)
Use url instead of id
self
property on the swap object'Swaps are Stateful
swap
into state.
findSwapById
, retrieveSwapById
useInterval
is limited to calling fetchDetails()
When following the readme instructions I am getting an error to install the taker. Are you aware of this issue?
โถ cd ./app
โถ yarn
yarn install v1.22.4
[1/4] ๐ Resolving packages...
[2/4] ๐ Fetching packages...
[3/4] ๐ Linking dependencies...
[4/4] ๐จ Building fresh packages...
$ yarn electron-rebuild
yarn run v1.22.4
$ node -r ../internals/scripts/BabelRegister.js ../internals/scripts/ElectronRebuild.js
internal/modules/cjs/loader.js:985
throw err;
^
Error: Cannot find module '@babel/register'
Require stack:
- /Users/froyer/src/comit-network/app/internals/scripts/BabelRegister.js
- internal/preload
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
at Function.Module._load (internal/modules/cjs/loader.js:864:27)
at Module.require (internal/modules/cjs/loader.js:1044:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object.<anonymous> (/Users/froyer/src/comit-network/app/internals/scripts/BabelRegister.js:3:1)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Module.require (internal/modules/cjs/loader.js:1044:19) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/froyer/src/comit-network/app/internals/scripts/BabelRegister.js',
'internal/preload'
]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
When calling the comitClient.retrieveSwapById
, sometimes we come across the following issue that halts the entire swap:
[warning] (net) Peer disconnected with requested blocks.
[warning] (net) Resending sync...
[warning] (net) Peer disconnected with requested blocks.
[warning] (net) Resending sync...
[warning] (net) Peer disconnected with requested blocks.
[warning] (net) Resending sync...
Only restarting comit-scripts
appears to resolve this issue.
MakerService
In case polling breaks or there is an issue in the transaction, users should be able to trigger the next step manually. Showing buttons of what the taker app on your behalf may also help UX.
This is also necessary for Ledger support, since users will have to approve every transaction manually.
The frontend application is a desktop visual interface that allows users to swap between cryptoassets. Sideshift and Uniswap are examples of similar interfaces.
The frontend stack is:
This task covers the initial setup and configuration for a React.js-based desktop app with Electron.
Definition of Done
On HomePage
, we should refactor the Maker info
, swaps
, and rate
into a single encapsulated hook.
https://github.com/unlock-protocol/unlock/blob/master/unlock-app/src/hooks/useMembers.js#L113-L115
The Node.js backend API is responsible for making BTC-DAI offers for the user and proceed with the swap if someone takes the offer from the desktop client.
This task implements:
I'm not yet clear of which of the functionality is already implemented by the SDK and which needs to be implemented.
Definition of Done
TODOs
EthereumWallet
SDK interface under the hood to evaluate integration with Ledger / other wallets./src/bitcoind
/ ./src/bitcoin-cli stop
InMemoryBitcoinWallet
config parameters https://github.com/bcoin-org/bcoin/blob/master/docs/README.mdcnd
locally.env
in its proper directory under maker/
~/.create-comit-app/env
is bad DX, is there a way to configure where the env should live? Right now, developers cannot use comit-scripts
for anything other than running the example.comit-scripts
, see below specTODOs Phase 2
GET /
(root) to display maker info e.g. peerId
, addresshint
for Frontend Taker to use to createSwap
GET /swaps
to return maker.comitClient.getNewSwaps()
taker.comitClient.sendSwap
to be confirmed, andmakerSwapHandle.accept(...)
takerSwapHandle.fund(...)
to be confirmed, andmakerSwapHandle.fund(...)
takerSwapHandle.redeem(...)
to be confirmed, and call:makerSwapHandle.redeem
SwapForm
submit should createSwap
and,sendSwap
SwapList
component for HomePage
SwapDetailsPage
to display status and info of a single swap and perform next steps
useEffect
? Or manual / user-initiated?makerSwapHandle.accept(...)
to be confirmed, and call:takerSwapHandle.deploy(...)
takerSwapHandle.fund(...)
makerSwapHandle.fund(...)
to be confirmed, and call:takerSwapHandle.redeem
makerSwapHandle.redeem(...)
to be confirmed, and:master
runTakerNextStep
and parseTakerSwapStatus
Open Questions
Swap
objectrunTakerNextStep
and parseTakerSwapStatus
https://github.com/davidkpiano/xstate/tree/master/packages/xstate-fsm
For some reason, the taker consistently fails to execute the last transaction of swap.redeem
. This step happens after all other transactions has been completed and the maker has redeemed.
The transaction simply times out with no error message.
The current app fully implements the 'happy path', but the refund and expiry flow is not yet implemented.
Under this flow, the user is prompted with buttons on what to do next. Users would be able to trigger the next step manually.
next()
that returns the action, do we need a function that returns info about the next paths to display it?The Node.js backend API is responsible for making BTC-DAI offers for the user and proceed with the swap if someone takes the offer from the desktop client.
This task should implement the following behaviour:
Definition of Done
Refactor rate fetching into a hook that allows refreshing to latest rate.
Eventually, we want to split the Maker backend and Taker app to separate repos.
Code that can be shared between the two should be kept as modular as possible.
Implement the backend Node.js service that will act as a counterparty. It implements the maker side of the SDK negotiation protocol by making offers and proceed with the swap if someone takes the offer from the desktop client.
-- /
| - maker/ (backend)
|- package.json
|- app/ (frontend)
|- package.json
This task covers just the setup and configuration, as well as integrating it with the Electron app. At minimum, the Electron app should be able to communicate with it. Starting the Electron app should also start this backend.
Defition of Done
Fix Electron release build pipelines issues to make it directly executable.
https://github.com/electron-react-boilerplate/electron-react-boilerplate
electron-react-boilerplate/electron-react-boilerplate#400
package-ci
is failing.As development goes on:
Collated feedback so far:
create-comit-app
documentation do not explain anything about the API surface. https://comit.network/docs/getting-started/create-comit-appcomit-scripts
, and what nodes / infrastructure the developer needs to execute a COMIT swap (e.g. what nodes, how many nodes, other recommendations.)InMemoryBitcoinWallet
and EthereumWallet
? Users should be able to just use bcoin
or ethers.js
directly.InMemoryBitcoinWallet
just BitcoinWallet
?--
createActor
idempotent and generate the same peerId every time it's called? If so, 'create' may not be the best name for it because create
is usually not idempotent.swap.fetchDetails
.getNewSwaps
and getOngoingSwaps
and getDoneSwaps
? We may want to make it clear for developers what the corresponding statuses mean.getSwaps({ status: ...})
that accept filtering arguments? By default, it can return all swaps regardless of status.Swap
and its properties?
peerId
?alpha
and beta
correspond to? Why not maker
and taker
?swap.fetchDetails()
return SwapDetails
instead of SwapProperties
directly? The SwapDetails
interface seems to only contain a single properties
attribute. In we can simplify this, perhaps swap.getProperties()
would be a better name..toJSON()
for ease of transport over HTTP.redeem
, refund
etc means nothing to third-party developers unless we explain how it relates to what they're trying to do - which is to swap assets across chains.EXPIRED
status?deploy
and fund
steps be done in a single transaction?Use reducer pattern to encapsulate more robust loading and error flags flags when fetching data from maker backend. This should be applied to all data fetching hooks.
EDIT: This should be encapsulated in a custom useFetch
hook.
https://electron-react-boilerplate.js.org/docs
TODO: Fix Electron
comit-app-regen
comit-sdk
***bn.js
[email protected]
TODO: comit-app-regen -> taker-ui
electron-store
and settings page insteadyarn add rimble-ui styled-components
once chakra migration is completed~/.create-comit-app/env
contents0.14.0
, so the downgrade is temporaryInMemoryBitcoinWallet
to BitcoindWallet
Users should not be able to submit a swap if they have insufficient balance. The app should validate against this before sendSwap
.
Note: Implement in SwapForm.validateForm()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.