comit-network / ambrosia Goto Github PK
View Code? Open in Web Editor NEWUI for trading in the COMIT network
License: Apache License 2.0
UI for trading in the COMIT network
License: Apache License 2.0
Pitch
https://3.basecamp.com/4403044/buckets/16930224/messages/2632331598
TODOs
useEthereumWallet
to use settings
store instead of env varsApp.tsx
We've worked on the app but have yet to test it with users. We want to ship the app to the mainnet and test with users to get feedback. However before we can do that, we need to implement the following:
1. External Provider Support in SDK https://github.com/comit-network/app/issues/9
Related SDK issue: comit-network/comit-js-sdk#154
The current BitcoinWallet
and EthereumWallet
provided by the SDK doesn't let us use the Ledger.
Other cross-chain libraries support external wallets using the Provider
standard. More details: https://github.com/liquality/chainabstractionlayer
This is still open, early research. I'm not yet certain what needs to be done here, but I think following the Provider
standard should give us a modular and extensible wallet support.
2. Fix Electron build pipeline comit-network/app#19
We use Electron to build desktop apps. There's currently a native modules issue that's breaking the build pipeline. Until this is fixed, we can't generate cross-platform application executables.
3. Mainnet Node Infrastructure
The app uses local nodes for testing, but we can't use comit-scripts
for production. Before we can package our desktop app, we need to figure out the mainnet node infrastructure:
As a start, we can first allow users to have the create-comit-app
example run on mainnet.
4. Deploy and Host Maker backend
Blocker: Mainnet Node infrastructure must be complete before we can deploy a Maker service.
The fixed maker service needs to be deployed and hosted somewhere. This is fairly straightforward.
We should also split the Maker service and the Taker app to separate repos at this point comit-network/app#37
Overview
As of 0.17.0 release, InMemoryBitcoinWallet is no more.
https://github.com/comit-network/comit-js-sdk/blob/dev/CHANGELOG.md
We want to update https://github.com/comit-network/taker-ui/blob/master/app/hooks/useBitcoinWallet.tsx#L33-L42 to use the new SDK Wallet.
You can see https://github.com/comit-network/taker-ui/blob/master/app/hooks/useEthereumWallet.tsx#L33-L37 for a working Ethereum wallet example.
Currently the whole comit-sdk
folder was added to the eslintignore
files.
Remove that entry and fix the linting problems.
Overview
Run yarn lint
and yarn tsc
.
You should see some lint / typescript warnings. Fix them until the warnings go away.
Fixing some (you don't have to fix all of them) of these issues should give you an opportunity to get an overview of the project.
TODOs
yarn lint
yarn tsc
@yosriady commented on Mon May 25 2020
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
@yosriady commented on Tue Jun 09 2020
Electron Recovery Plan:
electron-webpack-quickstart
@yosriady commented on Tue Jun 09 2020
Error details: https://gist.github.com/yosriady/a8313b4a7f42ff5e5c5bc3adaa98026c
echo $(brew --prefix openssl)/include
/usr/local/opt/[email protected]/include
OpenSSL 1.0.2t 10 Sep 2019 (/usr/local/opt/openssl -> /usr/local/Cellar/openssl/1.0.2t)
@yosriady commented on Wed Jun 10 2020
Fatal error: 'openssl/aes.h' file not found
https://travis-ci.com/github/yosriady/comit-app-regen/jobs/346519135@yosriady commented on Wed Jun 10 2020
Note: To be done after orderbook + swap is done - i.e. end to end from getting order of maker to finish the swap with the maker.
Depends on this to be fixed: comit-network/create-comit-app#778
Also depends on releasing create-comit-app so all the fixes done on the way are in (e.g. Derivation path print fix, see: https://github.com/comit-network/create-comit-app/tree/wallet-descriptor-fix)
Basically do this in package.json
of the app:
{
...
"scripts": {
...
"start-env": "comit-scripts start-env"
},
...
"dev-dependencies": {
"comit-scripts": "^0.9.0",
}
}
Then just use yarn start-env
in the app. No create-comit-app no more.
Upgrade to the latest COMIT SDK.
Documentation is non-existent, so you'll have to dig through the code.
When (Bitcoin) wallet initialization encounters an error we just bubble the error up (just visible in console).
Better error handling, better user experience.
Have a look at https://reactjs.org/docs/error-boundaries.html
Consider introducing boundaries for wallet initialization. Might want to use this more for other problems.
We want to support external wallets, but the current SDK doesn't provide support for it. To add external wallet support, we will likely need to update the SDK ComitClient
to support providers. However, how this looks is not yet 'shaped up'.
Provide a document in coblox/spikes repo that summarises the approaches used in the blockchain ecosystem to support a variety of wallets for Ethereum and Bitcoin.
The document is structured as a Shape Up pitch: https://basecamp.com/shapeup/1.5-chapter-06
https://github.com/MetaMask/web3-provider-engine
https://github.com/Neufund/ledger-wallet-provider
https://github.com/liquality/chainabstractionlayer
https://github.com/blockmason/web3-provider-ledger
https://0x.org/docs/tools/subproviders
Introduction
I've worked on building the PoC App with the COMIT SDK for a few sprints. Based on that, I've identified a list of three missing features that an app developer will need to build on COMIT. All three features have already been implemented on the app, since they were required for it to work.
This issue is meant to spark a conversation of whether we want to provide these features to other app developers, by adding it to the COMIT SDK.
Related SDK issue: comit-network/comit-js-sdk#94
The current SDK provides functions like deploy
, fund
, and redeem
but as an app developer I have no idea when to call each of the functions. Specifically: when is a swap ready for step X? I've had to dig through the internal swap workflow, call swap.fetchDetails()
to parse the ledger statuses, and figure out the steps on my own.
I've implemented two state machines (for the Taker app and the Maker service.) The state machine has this interface:
const s = new TakerStateMachine(swap)
await s.next();
Internally, it parses the swap properties to 'understand' what to do next. More details here: comit-network/comit-js-sdk#94 (comment)
We can port this to the SDK, so that users can just call next
on a Swap
:
await swap.next();
How the API will look like is open for discussion.
Note: The current state machine only implements the 'happy path', but to be production ready the state machines will need to handle branches such as the refund and expiry flow.
Both the Taker and Maker needs to execute the next action after the counterparty has executed theirs. The app needs to find this out by repeatedly polling fetchDetails()
for the latest swap state.
Since there's no out-of-the-box polling functionality provided by the SDK, I've implemented my own for both the Maker service and the Taker app. It's a simple polling mechanism. Basically:
for (let swap of swaps) {
await swap.next();
}
Note: There are two polling mechanisms, one for the backend and one for the frontend. The backend uses Node.js async/await, while the frontend approach uses React hooks to be more idiomatic React code.
For the SDK, we could explore a subscription-based API instead, for example:
swap.on('ready', (data) => {
// ... do something on the app
swap.next();
})
I think this API is more flexible and easier to work with.
Feedback most welcome.
Based on feedback, the app needed to use swaps as stateful objects and use a singleton global store for this state. This required the app to undergo a rearchitecture. The SDK doesn't provide an out-of-the box way to build a frontend in this style.
React Context and Hooks are key building blocks for modern React apps. Think of it as the idiomatic way to inject and consume dependencies such as modules or services in React.
I've started encapsulating the recommended architecture as reusable React hooks. Behind the scenes, these hooks manage state from a global store, so developers don't have to reinstantiate or rehydrate modules every time. With hooks, your clients and wallets are made available anywhere in the component tree as a singleton:
export default function HomePage(props: Props) {
const {
wallet: bitcoinWallet
} = useBitcoinWallet();
const {
wallet: ethereumWallet
} = useEthereumWallet();
const { cnd } = useCnd();
// you can call `cnd.getSwaps()` here
// ... other code
}
We can package these React-specific helper code to a @comit/comit-react
package to further accelerate COMIT App development. These hooks allow React developers to build COMIT apps at a higher level of abstraction with prebuilt components that follow our recommended practices.
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.