Skip to content

Commit

Permalink
Merge pull request #971 from dfinity/alex/mops-in-motoko-basic-bitcoin
Browse files Browse the repository at this point in the history
use mops in motoko `basic_bitcoin`
  • Loading branch information
altkdf authored Sep 9, 2024
2 parents 9a0e33e + ec1c7f4 commit d1dfe92
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/motoko-basic-bitcoin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ _MACOSX
.vscode/
target/
*.old.did
.idea
.idea
.mops
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 9 additions & 1 deletion motoko/basic_bitcoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,15 @@ 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
```

### 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
Expand Down
2 changes: 1 addition & 1 deletion motoko/basic_bitcoin/dfx.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"log_level": "info"
},
"build": {
"packtool": "",
"packtool": "mops sources",
"args": ""
}
},
Expand Down
5 changes: 5 additions & 0 deletions motoko/basic_bitcoin/mops.toml
Original file line number Diff line number Diff line change
@@ -0,0 +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"
1 change: 0 additions & 1 deletion motoko/basic_bitcoin/motoko-bitcoin
Submodule motoko-bitcoin deleted from 10cf7f
18 changes: 9 additions & 9 deletions motoko/basic_bitcoin/src/basic_bitcoin/src/BitcoinWallet.mo
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion motoko/basic_bitcoin/src/basic_bitcoin/src/Types.mo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Curves "../../../motoko-bitcoin/src/ec/Curves";
import Curves "mo:bitcoin/ec/Curves";

module Types {
public type SendRequest = {
Expand Down

0 comments on commit d1dfe92

Please sign in to comment.