Skip to content
This repository was archived by the owner on Mar 23, 2021. It is now read-only.

Commit b7379ec

Browse files
bors[bot]luckysori
andauthored
Merge #258
258: No need to know about CCA. r=mergify[bot] a=luckysori Note: please review with care given what the original issue described. I went a bit fast. Fixes #114. Except for needing to download `create-comit-app` more than once. An issue will be created to track the optimisation that would fix it. Co-authored-by: Lucas Soriano del Pino <l.soriano.del.pino@gmail.com>
2 parents c85df0c + 67d5217 commit b7379ec

File tree

19 files changed

+426
-47
lines changed

19 files changed

+426
-47
lines changed

.npm/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": " Set up a local development environment for COMIT apps with one command.",
55
"main": "cca.js",
66
"scripts": {
7-
"start": "node cca.js",
7+
"start": "node cca.js new",
88
"fix": "prettier --write '**/*.{ts,js,json,yml}'",
99
"test": "prettier --check '**/*.{ts,js,json,yml}'"
1010
},

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ If you have any question please [reach out to the team in our Gitter chat](https
1414

1515
## 2 - Create your first project!
1616

17-
1. `yarn create comit-app new <your-app-name>`,
18-
2. `yarn create comit-app start-env` to start blockchain and COMIT nodes,
17+
1. `yarn create comit-app <your-app-name>`,
18+
2. `cd <your-app-name>` and `yarn start-env` to start blockchain and COMIT nodes,
1919
3. Run the [separate-apps](https://github.com/comit-network/create-comit-app/tree/master/new_project/examples/separate_apps) example (in separate terminals for the taker and maker):
20-
1. Navigate to the separate-apps example app directory `cd <path-to-your-app>/examples/separate-apps`,
20+
1. Navigate to the separate-apps example app directory `cd ./examples/separate_apps`,
2121
2. `yarn install` to install dependencies,
22-
3. `yarn run maker` to run the maker app.
23-
4. `yarn run taker` to run the taker app.
22+
3. `yarn run maker` to run the maker app,
23+
4. `yarn run taker` to run the taker app,
2424
5. Follow the steps be hitting `Return` to complete the swap.
2525

2626
You can find additional examples in the [examples](https://github.com/comit-network/create-comit-app/tree/master/new_project/examples) directory that is created as part of step 1.

new_project/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This project was bootstrapped with [Create Comit App](https://github.com/comit-n
44

55
In the project directory, you can run:
66

7-
### `yarn create comit-app start-env`
7+
### `yarn start-env`
88

99
Sets up the development environment, starting blockchain nodes and COMIT nodes.
1010

new_project/examples/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Example projects for building on top of COMIT
22

3-
This folder contains examples on how to use the `comit-js-sdk` to implement applications on top of COMIT.
3+
This folder contains examples on how to use the `comit-sdk` to implement applications on top of COMIT.
44

55
## Prerequisites
66

77
Make sure that you have Docker installed before proceeding.
88

99
## How to run an example
1010

11-
1. Run `create-comit-app start-env`: This will setup a local environment that can be used across all examples.
12-
2. Checkout the README of the particular example on how to execute it.
11+
Follow the instructions outlined in the README of the particular example.
Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Example for swapping Bitcoin for Ether
1+
# Example for swapping Bitcoin for Ether
22

33
An example project that shows how to swap Bitcoin for Ether with COMIT.
44

55
## How to run this example
66

7-
1. Make sure you have an environment setup through `create-comit-app`
8-
2. Run `yarn install` to install the necessary dependencies
9-
3. Run `yarn start` to start the swap
10-
4. Hit `CTRL-C` once the swap is done.
7+
Ensure that the environment is up in a separate terminal.
8+
9+
1. Run `yarn install` to install the necessary dependencies,
10+
2. Run `yarn swap` to start the swap,
11+
3. Hit `CTRL-C` once the swap is done.

new_project/examples/btc_eth/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
"main": "index.js",
66
"scripts": {
77
"check": "tsc && tslint -p . && prettier --check '**/*.{ts,json,yml}'",
8-
"start": "DOTENV_CONFIG_PATH=$HOME/.create-comit-app/env ts-node -r dotenv/config ./src/index.ts",
9-
"fix": "tslint -p . --fix && prettier --write '**/*.{ts,js,json,yml}'"
8+
"swap": "DOTENV_CONFIG_PATH=$HOME/.create-comit-app/env ts-node -r dotenv/config ./src/index.ts",
9+
"fix": "tslint -p . --fix && prettier --write '**/*.{ts,js,json,yml}'",
10+
"start-env": "create-comit-app start-env"
1011
},
1112
"keywords": [],
1213
"author": "",
1314
"license": "ISC",
1415
"devDependencies": {
1516
"@types/readline-sync": "^1.4.3",
17+
"create-comit-app": "^0.5.1",
1618
"jest": "^24.9.0",
1719
"prettier": "^1.19.1",
1820
"ts-node": "^8.5.4",

new_project/examples/btc_eth/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ function createSwap(maker: Actor, taker: Actor): SwapRequest {
123123
function checkEnvFile(path: string) {
124124
if (!fs.existsSync(path)) {
125125
console.log(
126-
"Could not find file %s. Did you run `yarn create comit-app start-env`?",
126+
"Could not find file %s. Did you run `yarn start-env`?",
127127
path
128128
);
129129
process.exit(1);

new_project/examples/btc_eth/yarn.lock

Lines changed: 101 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,14 @@ bitcoin-core@^2.2.0:
775775
semver "^5.1.0"
776776
standard-error "^1.1.0"
777777

778+
bl@^1.0.0:
779+
version "1.2.2"
780+
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.2.tgz#a160911717103c07410cef63ef51b397c025af9c"
781+
integrity sha512-e8tQYnZodmebYDWGH7KMRvtzKXaJHx3BbilrgZCfvyLUYdKpK1t5PSPmpkny/SgiTSCnjfLW7v5rlONXVFkQEA==
782+
dependencies:
783+
readable-stream "^2.3.5"
784+
safe-buffer "^5.1.1"
785+
778786
blgr@~0.1.7:
779787
version "0.1.7"
780788
resolved "https://registry.yarnpkg.com/blgr/-/blgr-0.1.7.tgz#69ed054282e5d3be7b6b19b03962a397227ab498"
@@ -934,6 +942,24 @@ btcp@~0.1.5:
934942
resolved "https://registry.yarnpkg.com/btcp/-/btcp-0.1.5.tgz#f76262415a0f6eaa592cdbb91c8b18386530ac28"
935943
integrity sha512-tkrtMDxeJorn5p0KxaLXELneT8AbfZMpOFeoKYZ5qCCMMSluNuwut7pGccLC5YOJqmuk0DR774vNVQLC9sNq/A==
936944

945+
buffer-alloc-unsafe@^1.1.0:
946+
version "1.1.0"
947+
resolved "https://registry.yarnpkg.com/buffer-alloc-unsafe/-/buffer-alloc-unsafe-1.1.0.tgz#bd7dc26ae2972d0eda253be061dba992349c19f0"
948+
integrity sha512-TEM2iMIEQdJ2yjPJoSIsldnleVaAk1oW3DBVUykyOLsEsFmEc9kn+SFFPz+gl54KQNxlDnAwCXosOS9Okx2xAg==
949+
950+
buffer-alloc@^1.2.0:
951+
version "1.2.0"
952+
resolved "https://registry.yarnpkg.com/buffer-alloc/-/buffer-alloc-1.2.0.tgz#890dd90d923a873e08e10e5fd51a57e5b7cce0ec"
953+
integrity sha512-CFsHQgjtW1UChdXgbyJGtnm+O/uLQeZdtbDo8mfUgYXCHSM1wgrVxXm6bSyrUuErEb+4sYVGCzASBRot7zyrow==
954+
dependencies:
955+
buffer-alloc-unsafe "^1.1.0"
956+
buffer-fill "^1.0.0"
957+
958+
buffer-fill@^1.0.0:
959+
version "1.0.0"
960+
resolved "https://registry.yarnpkg.com/buffer-fill/-/buffer-fill-1.0.0.tgz#f8f78b76789888ef39f205cd637f68e702122b2c"
961+
integrity sha1-+PeLdniYiO858gXNY39o5wISKyw=
962+
937963
buffer-from@^1.0.0:
938964
version "1.1.1"
939965
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef"
@@ -1039,6 +1065,11 @@ chalk@^2.0.0, chalk@^2.0.1, chalk@^2.3.0, chalk@^2.4.2:
10391065
escape-string-regexp "^1.0.5"
10401066
supports-color "^5.3.0"
10411067

1068+
chownr@^1.0.1:
1069+
version "1.1.3"
1070+
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.3.tgz#42d837d5239688d55f303003a508230fa6727142"
1071+
integrity sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==
1072+
10421073
chownr@^1.1.1:
10431074
version "1.1.2"
10441075
resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.2.tgz#a18f1e0b269c8a6a5d3c86eb298beb14c3dd7bf6"
@@ -1178,6 +1209,14 @@ core-util-is@1.0.2, core-util-is@~1.0.0:
11781209
resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7"
11791210
integrity sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=
11801211

1212+
create-comit-app@^0.5.1:
1213+
version "0.5.1"
1214+
resolved "https://registry.yarnpkg.com/create-comit-app/-/create-comit-app-0.5.1.tgz#08066d0f81967b0531a803d837250cad6371d565"
1215+
integrity sha512-ZKZzBTPS7OPRJOnDojJsXatpzZxvnmueVkVoncdwP7CK/Xe3JV1TyjWv0HlZ+aTw0/kL2DksUwPpZrnd9GI+hg==
1216+
dependencies:
1217+
axios "^0.19.0"
1218+
targz "^1.0.1"
1219+
11811220
cross-spawn@^6.0.0:
11821221
version "6.0.5"
11831222
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-6.0.5.tgz#4a5ec7c64dfae22c3a14124dbacdee846d80cbc4"
@@ -1394,6 +1433,13 @@ encodeurl@~1.0.2:
13941433
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59"
13951434
integrity sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=
13961435

1436+
end-of-stream@^1.0.0:
1437+
version "1.4.4"
1438+
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
1439+
integrity sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==
1440+
dependencies:
1441+
once "^1.4.0"
1442+
13971443
end-of-stream@^1.1.0:
13981444
version "1.4.1"
13991445
resolved "https://registry.yarnpkg.com/end-of-stream/-/end-of-stream-1.4.1.tgz#ed29634d19baba463b6ce6b80a37213eab71ec43"
@@ -1719,6 +1765,11 @@ fresh@0.5.2:
17191765
resolved "https://registry.yarnpkg.com/fresh/-/fresh-0.5.2.tgz#3d8cadd90d976569fa835ab1f8e4b23a105605a7"
17201766
integrity sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=
17211767

1768+
fs-constants@^1.0.0:
1769+
version "1.0.0"
1770+
resolved "https://registry.yarnpkg.com/fs-constants/-/fs-constants-1.0.0.tgz#6be0de9be998ce16af8afc24497b9ee9b7ccd9ad"
1771+
integrity sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==
1772+
17221773
fs-minipass@^1.2.5:
17231774
version "1.2.7"
17241775
resolved "https://registry.yarnpkg.com/fs-minipass/-/fs-minipass-1.2.7.tgz#ccff8570841e7fe4265693da88936c55aed7f7c7"
@@ -3427,6 +3478,14 @@ psl@^1.1.24, psl@^1.1.28:
34273478
resolved "https://registry.yarnpkg.com/psl/-/psl-1.4.0.tgz#5dd26156cdb69fa1fdb8ab1991667d3f80ced7c2"
34283479
integrity sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==
34293480

3481+
pump@^1.0.0:
3482+
version "1.0.3"
3483+
resolved "https://registry.yarnpkg.com/pump/-/pump-1.0.3.tgz#5dfe8311c33bbf6fc18261f9f34702c47c08a954"
3484+
integrity sha512-8k0JupWme55+9tCVE+FS5ULT3K6AbgqrGa58lTT49RpyfwwcGedHqaC5LlQNdEAumn/wFsu6aPwkuPMioy8kqw==
3485+
dependencies:
3486+
end-of-stream "^1.1.0"
3487+
once "^1.3.1"
3488+
34303489
pump@^3.0.0:
34313490
version "3.0.0"
34323491
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
@@ -3502,7 +3561,7 @@ read-pkg@^3.0.0:
35023561
normalize-package-data "^2.3.2"
35033562
path-type "^3.0.0"
35043563

3505-
readable-stream@^2.0.6:
3564+
readable-stream@^2.0.6, readable-stream@^2.3.0, readable-stream@^2.3.5:
35063565
version "2.3.6"
35073566
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf"
35083567
integrity sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==
@@ -3655,7 +3714,7 @@ safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1:
36553714
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d"
36563715
integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==
36573716

3658-
safe-buffer@^5.0.1, safe-buffer@^5.1.2:
3717+
safe-buffer@^5.0.1, safe-buffer@^5.1.1, safe-buffer@^5.1.2:
36593718
version "5.2.0"
36603719
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519"
36613720
integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg==
@@ -4063,6 +4122,29 @@ symbol-tree@^3.2.2:
40634122
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
40644123
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==
40654124

4125+
tar-fs@^1.8.1:
4126+
version "1.16.3"
4127+
resolved "https://registry.yarnpkg.com/tar-fs/-/tar-fs-1.16.3.tgz#966a628841da2c4010406a82167cbd5e0c72d509"
4128+
integrity sha512-NvCeXpYx7OsmOh8zIOP/ebG55zZmxLE0etfWRbWok+q2Qo8x/vOR/IJT1taADXPe+jsiu9axDb3X4B+iIgNlKw==
4129+
dependencies:
4130+
chownr "^1.0.1"
4131+
mkdirp "^0.5.1"
4132+
pump "^1.0.0"
4133+
tar-stream "^1.1.2"
4134+
4135+
tar-stream@^1.1.2:
4136+
version "1.6.2"
4137+
resolved "https://registry.yarnpkg.com/tar-stream/-/tar-stream-1.6.2.tgz#8ea55dab37972253d9a9af90fdcd559ae435c555"
4138+
integrity sha512-rzS0heiNf8Xn7/mpdSVVSMAWAoy9bfb1WOTYC78Z0UQKeKa/CWS8FOq0lKGNa8DWKAn9gxjCvMLYc5PGXYlK2A==
4139+
dependencies:
4140+
bl "^1.0.0"
4141+
buffer-alloc "^1.2.0"
4142+
end-of-stream "^1.0.0"
4143+
fs-constants "^1.0.0"
4144+
readable-stream "^2.3.0"
4145+
to-buffer "^1.1.1"
4146+
xtend "^4.0.0"
4147+
40664148
tar@^4:
40674149
version "4.4.11"
40684150
resolved "https://registry.yarnpkg.com/tar/-/tar-4.4.11.tgz#7ac09801445a3cf74445ed27499136b5240ffb73"
@@ -4076,6 +4158,13 @@ tar@^4:
40764158
safe-buffer "^5.1.2"
40774159
yallist "^3.0.3"
40784160

4161+
targz@^1.0.1:
4162+
version "1.0.1"
4163+
resolved "https://registry.yarnpkg.com/targz/-/targz-1.0.1.tgz#8f76a523694cdedfbb5d60a4076ff6eeecc5398f"
4164+
integrity sha1-j3alI2lM3t+7XWCkB2/27uzFOY8=
4165+
dependencies:
4166+
tar-fs "^1.8.1"
4167+
40794168
test-exclude@^5.2.3:
40804169
version "5.2.3"
40814170
resolved "https://registry.yarnpkg.com/test-exclude/-/test-exclude-5.2.3.tgz#c3d3e1e311eb7ee405e092dac10aefd09091eac0"
@@ -4096,6 +4185,11 @@ tmpl@1.0.x:
40964185
resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1"
40974186
integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE=
40984187

4188+
to-buffer@^1.1.1:
4189+
version "1.1.1"
4190+
resolved "https://registry.yarnpkg.com/to-buffer/-/to-buffer-1.1.1.tgz#493bd48f62d7c43fcded313a03dcadb2e1213a80"
4191+
integrity sha512-lx9B5iv7msuFYE3dytT+KE5tap+rNYw+K4jVkb9R/asAb+pbBSM17jtunHplhBe6RRJdZx3Pn2Jph24O32mOVg==
4192+
40994193
to-fast-properties@^2.0.0:
41004194
version "2.0.0"
41014195
resolved "https://registry.yarnpkg.com/to-fast-properties/-/to-fast-properties-2.0.0.tgz#dc5e698cbd079265bc73e0377681a4e4e83f616e"
@@ -4454,6 +4548,11 @@ xmlhttprequest@1.8.0:
44544548
resolved "https://registry.yarnpkg.com/xmlhttprequest/-/xmlhttprequest-1.8.0.tgz#67fe075c5c24fef39f9d65f5f7b7fe75171968fc"
44554549
integrity sha1-Z/4HXFwk/vOfnWX197f+dRcZaPw=
44564550

4551+
xtend@^4.0.0:
4552+
version "4.0.2"
4553+
resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54"
4554+
integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==
4555+
44574556
y18n@^4.0.0:
44584557
version "4.0.0"
44594558
resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b"

new_project/examples/erc20_btc/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ Both maker and taker are processed in the same terminal.
66

77
## How to run this example
88

9-
1. Make sure you have an environment setup through `create-comit-app`,
10-
2. Run `yarn install` to install the necessary dependencies,
11-
3. Run `yarn start` to start the swap,
12-
4. Press `Enter` when asked to continue,
13-
5. Profit!
9+
Ensure that the environment is up in a separate terminal.
10+
11+
1. Run `yarn install` to install the necessary dependencies,
12+
2. Run `yarn swap` to start the swap,
13+
3. Press `Enter` when asked to continue,
14+
4. Profit!

new_project/examples/erc20_btc/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,16 @@
55
"main": "index.js",
66
"scripts": {
77
"check": "tsc && tslint -p . && prettier --check '**/*.{ts,json,yml}'",
8-
"start": "DOTENV_CONFIG_PATH=$HOME/.create-comit-app/env ts-node -r dotenv/config ./src/index.ts",
9-
"fix": "tslint -p . --fix && prettier --write '**/*.{ts,js,json,yml}'"
8+
"swap": "DOTENV_CONFIG_PATH=$HOME/.create-comit-app/env ts-node -r dotenv/config ./src/index.ts",
9+
"fix": "tslint -p . --fix && prettier --write '**/*.{ts,js,json,yml}'",
10+
"start-env": "create-comit-app start-env"
1011
},
1112
"keywords": [],
1213
"author": "",
1314
"license": "ISC",
1415
"devDependencies": {
1516
"@types/readline-sync": "^1.4.3",
17+
"create-comit-app": "^0.5.1",
1618
"prettier": "^1.19.1",
1719
"ts-node": "^8.5.4",
1820
"tslint": "^5.20.1",

0 commit comments

Comments
 (0)