From 58c8cd1017e7b138e5ba722242edd7b127facaec Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 12:56:39 +0200 Subject: [PATCH 01/11] remove submodule --- .gitmodules | 3 --- motoko/basic_bitcoin/motoko-bitcoin | 1 - 2 files changed, 4 deletions(-) delete mode 160000 motoko/basic_bitcoin/motoko-bitcoin diff --git a/.gitmodules b/.gitmodules index 8d4eca0b9..8af0142c1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,9 +8,6 @@ [submodule "rust/defi/DIP20"] path = rust/defi/src/DIP20 url = https://github.com/Psychedelic/DIP20.git -[submodule "motoko/basic_bitcoin/motoko-bitcoin"] - path = motoko/basic_bitcoin/motoko-bitcoin - url = https://github.com/tgalal/motoko-bitcoin [submodule "svelte/svelte-starter/internet-identity"] path = svelte/svelte-starter/internet-identity url = https://github.com/dfinity/internet-identity.git diff --git a/motoko/basic_bitcoin/motoko-bitcoin b/motoko/basic_bitcoin/motoko-bitcoin deleted file mode 160000 index 10cf7f2ef..000000000 --- a/motoko/basic_bitcoin/motoko-bitcoin +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 10cf7f2efbba9bb4d077013db1b990143f193844 From d14eb004595cd076937eb0686baafc5858b3cc20 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:14:04 +0200 Subject: [PATCH 02/11] fix imports --- .../src/basic_bitcoin/src/BitcoinWallet.mo | 18 +++++++++--------- .../src/basic_bitcoin/src/Types.mo | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinWallet.mo b/motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinWallet.mo index 3b37f2a23..9a0510c5d 100644 --- a/motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinWallet.mo +++ b/motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinWallet.mo @@ -16,15 +16,15 @@ import Nat64 "mo:base/Nat64"; import Iter "mo:base/Iter"; import Blob "mo:base/Blob"; -import EcdsaTypes "../../../motoko-bitcoin/src/ecdsa/Types"; -import P2pkh "../../../motoko-bitcoin/src/bitcoin/P2pkh"; -import Bitcoin "../../../motoko-bitcoin/src/bitcoin/Bitcoin"; -import Address "../../../motoko-bitcoin/src/bitcoin/Address"; -import Transaction "../../../motoko-bitcoin/src/bitcoin/Transaction"; -import Script "../../../motoko-bitcoin/src/bitcoin/Script"; -import Publickey "../../../motoko-bitcoin/src/ecdsa/Publickey"; -import Der "../../../motoko-bitcoin/src/ecdsa/Der"; -import Affine "../../../motoko-bitcoin/src/ec/Affine"; +import EcdsaTypes "mo:bitcoin/ecdsa/Types"; +import P2pkh "mo:bitcoin/bitcoin/P2pkh"; +import Bitcoin "mo:bitcoin/bitcoin/Bitcoin"; +import Address "mo:bitcoin/bitcoin/Address"; +import Transaction "mo:bitcoin/bitcoin/Transaction"; +import Script "mo:bitcoin/bitcoin/Script"; +import Publickey "mo:bitcoin/ecdsa/Publickey"; +import Der "mo:bitcoin/ecdsa/Der"; +import Affine "mo:bitcoin/ec/Affine"; import Types "Types"; import EcdsaApi "EcdsaApi"; diff --git a/motoko/basic_bitcoin/src/basic_bitcoin/src/Types.mo b/motoko/basic_bitcoin/src/basic_bitcoin/src/Types.mo index f4db5d6fd..45a88a669 100644 --- a/motoko/basic_bitcoin/src/basic_bitcoin/src/Types.mo +++ b/motoko/basic_bitcoin/src/basic_bitcoin/src/Types.mo @@ -1,4 +1,4 @@ -import Curves "../../../motoko-bitcoin/src/ec/Curves"; +import Curves "mo:bitcoin/ec/Curves"; module Types { public type SendRequest = { From 413b66d80da05660d38cd82f915e9ed8c3b42d9a Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:14:33 +0200 Subject: [PATCH 03/11] fix dfx config and gh worfklow --- .github/workflows/motoko-basic-bitcoin.yaml | 8 ++++++++ motoko/basic_bitcoin/dfx.json | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/motoko-basic-bitcoin.yaml b/.github/workflows/motoko-basic-bitcoin.yaml index f4ba8f4ac..4179bfc99 100644 --- a/.github/workflows/motoko-basic-bitcoin.yaml +++ b/.github/workflows/motoko-basic-bitcoin.yaml @@ -22,6 +22,10 @@ jobs: submodules: recursive - name: Provision Darwin run: bash .github/workflows/provision-darwin.sh + - name: Install mops + uses: ZenVoich/setup-mops@v1 + - name: install mops packages + run: mops install - name: Motoko Basic Bitcoin Darwin run: | dfx start --background @@ -36,6 +40,10 @@ jobs: submodules: recursive - name: Provision Linux run: bash .github/workflows/provision-linux.sh + - name: Install mops + uses: ZenVoich/setup-mops@v1 + - name: install mops packages + run: mops install - name: Motoko Basic Bitcoin Linux run: | dfx start --background diff --git a/motoko/basic_bitcoin/dfx.json b/motoko/basic_bitcoin/dfx.json index 9c96c75dc..18d674189 100644 --- a/motoko/basic_bitcoin/dfx.json +++ b/motoko/basic_bitcoin/dfx.json @@ -14,7 +14,7 @@ "log_level": "info" }, "build": { - "packtool": "", + "packtool": "mops sources", "args": "" } }, @@ -23,4 +23,4 @@ "bind": "127.0.0.1:4943" } } -} +} \ No newline at end of file From c8595518fa824fc32473f077d856ada0034d82e6 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:17:44 +0200 Subject: [PATCH 04/11] add forgotten mops.toml --- motoko/basic_bitcoin/mops.toml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 motoko/basic_bitcoin/mops.toml diff --git a/motoko/basic_bitcoin/mops.toml b/motoko/basic_bitcoin/mops.toml new file mode 100644 index 000000000..321825934 --- /dev/null +++ b/motoko/basic_bitcoin/mops.toml @@ -0,0 +1,4 @@ +[dependencies] +base = "0.11.2" +bitcoin = "https://github.com/dfinity/motoko-bitcoin#ad3709363bf980d2cab45cce0dea7eda5c97a7ff" +sha2 = "0.1.0" From f8ed52dc487676402ab88ad7f25d01d278ad16a3 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:17:59 +0200 Subject: [PATCH 05/11] add mops to gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0b68a52ab..c7344f88a 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ _MACOSX .vscode/ target/ *.old.did -.idea \ No newline at end of file +.idea +.mops From 0d3b4c2e9f8cbef1643edbe4205c05a7e9413333 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:25:43 +0200 Subject: [PATCH 06/11] add a comment --- motoko/basic_bitcoin/dfx.json | 2 +- motoko/basic_bitcoin/mops.toml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/motoko/basic_bitcoin/dfx.json b/motoko/basic_bitcoin/dfx.json index 18d674189..2efdabbd4 100644 --- a/motoko/basic_bitcoin/dfx.json +++ b/motoko/basic_bitcoin/dfx.json @@ -23,4 +23,4 @@ "bind": "127.0.0.1:4943" } } -} \ No newline at end of file +} diff --git a/motoko/basic_bitcoin/mops.toml b/motoko/basic_bitcoin/mops.toml index 321825934..ed316ec07 100644 --- a/motoko/basic_bitcoin/mops.toml +++ b/motoko/basic_bitcoin/mops.toml @@ -1,4 +1,5 @@ [dependencies] base = "0.11.2" bitcoin = "https://github.com/dfinity/motoko-bitcoin#ad3709363bf980d2cab45cce0dea7eda5c97a7ff" +// sha2 is a transitive dependency and should be removed when `bitcoin` is published on `mops` sha2 = "0.1.0" From fe27befb8250fbe54a6d0b5d946bea0956631c27 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:29:03 +0200 Subject: [PATCH 07/11] dfx handles mops commands on its own, this is only useful for mops tests which we currently don't have --- .github/workflows/motoko-basic-bitcoin.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/motoko-basic-bitcoin.yaml b/.github/workflows/motoko-basic-bitcoin.yaml index 4179bfc99..f4ba8f4ac 100644 --- a/.github/workflows/motoko-basic-bitcoin.yaml +++ b/.github/workflows/motoko-basic-bitcoin.yaml @@ -22,10 +22,6 @@ jobs: submodules: recursive - name: Provision Darwin run: bash .github/workflows/provision-darwin.sh - - name: Install mops - uses: ZenVoich/setup-mops@v1 - - name: install mops packages - run: mops install - name: Motoko Basic Bitcoin Darwin run: | dfx start --background @@ -40,10 +36,6 @@ jobs: submodules: recursive - name: Provision Linux run: bash .github/workflows/provision-linux.sh - - name: Install mops - uses: ZenVoich/setup-mops@v1 - - name: install mops packages - run: mops install - name: Motoko Basic Bitcoin Linux run: | dfx start --background From 067a96289f9e77eea577490598c54409a1d7cd3a Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:30:07 +0200 Subject: [PATCH 08/11] fix comment --- motoko/basic_bitcoin/mops.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/motoko/basic_bitcoin/mops.toml b/motoko/basic_bitcoin/mops.toml index ed316ec07..2ddbccecc 100644 --- a/motoko/basic_bitcoin/mops.toml +++ b/motoko/basic_bitcoin/mops.toml @@ -1,5 +1,5 @@ [dependencies] base = "0.11.2" bitcoin = "https://github.com/dfinity/motoko-bitcoin#ad3709363bf980d2cab45cce0dea7eda5c97a7ff" -// sha2 is a transitive dependency and should be removed when `bitcoin` is published on `mops` +# sha2 is a transitive dependency and should be removed when `bitcoin` is published on `mops` sha2 = "0.1.0" From 2b9bf4f4db68ac4a372b53494742e5e28490ae71 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:33:29 +0200 Subject: [PATCH 09/11] remove submodule initialization from README --- motoko/basic_bitcoin/README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/motoko/basic_bitcoin/README.md b/motoko/basic_bitcoin/README.md index 15c882760..d0357313a 100644 --- a/motoko/basic_bitcoin/README.md +++ b/motoko/basic_bitcoin/README.md @@ -29,7 +29,6 @@ To clone and build the smart contract in **Motoko**: ```bash git clone https://github.com/dfinity/examples cd examples/motoko/basic_bitcoin -git submodule update --init --recursive ``` ### Acquire cycles to deploy From 6e11a44ae4494c65cd0c33149d33c2532c3904e8 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:38:50 +0200 Subject: [PATCH 10/11] seems we still need to download mops s.t. dfx can run it --- .github/workflows/motoko-basic-bitcoin.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/motoko-basic-bitcoin.yaml b/.github/workflows/motoko-basic-bitcoin.yaml index f4ba8f4ac..662bcefbc 100644 --- a/.github/workflows/motoko-basic-bitcoin.yaml +++ b/.github/workflows/motoko-basic-bitcoin.yaml @@ -22,6 +22,8 @@ jobs: submodules: recursive - name: Provision Darwin run: bash .github/workflows/provision-darwin.sh + - name: Install mops + uses: ZenVoich/setup-mops@v1 - name: Motoko Basic Bitcoin Darwin run: | dfx start --background @@ -36,6 +38,8 @@ jobs: submodules: recursive - name: Provision Linux run: bash .github/workflows/provision-linux.sh + - name: Install mops + uses: ZenVoich/setup-mops@v1 - name: Motoko Basic Bitcoin Linux run: | dfx start --background From ec1c7f489aeaffb6b03cac89425c9b08c612cd63 Mon Sep 17 00:00:00 2001 From: Oleksandr Tkachenko Date: Sun, 8 Sep 2024 13:47:44 +0200 Subject: [PATCH 11/11] add mops to README --- motoko/basic_bitcoin/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/motoko/basic_bitcoin/README.md b/motoko/basic_bitcoin/README.md index d0357313a..54ffa2a11 100644 --- a/motoko/basic_bitcoin/README.md +++ b/motoko/basic_bitcoin/README.md @@ -31,6 +31,15 @@ git clone https://github.com/dfinity/examples cd examples/motoko/basic_bitcoin ``` +### Install MOPS + +[Install](https://docs.mops.one/quick-start#2-install-mops-cli) the MOPS package +manager, e.g., by running + +```bash +curl -fsSL cli.mops.one/install.sh | sh +``` + ### Acquire cycles to deploy Deploying to the Internet Computer requires [cycles](https://internetcomputer.org/docs/current/developer-docs/setup/cycles) (the equivalent of "gas" in other blockchains). You can get free cycles from the [cycles faucet](https://internetcomputer.org/docs/current/developer-docs/setup/cycles/cycles-faucet.md).