From 95aee91d25e3da6c6d3df38e2f2d25252ed6d08b Mon Sep 17 00:00:00 2001 From: Dragoljub Duric Date: Fri, 30 Aug 2024 15:37:40 +0000 Subject: [PATCH 1/4] . --- rust/basic_bitcoin/README.md | 4 +++- rust/basic_bitcoin/dfx.json | 11 ++--------- rust/basic_bitcoin/src/basic_bitcoin/build.sh | 6 ++++++ 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rust/basic_bitcoin/README.md b/rust/basic_bitcoin/README.md index 437a42715..edb6d2f2c 100644 --- a/rust/basic_bitcoin/README.md +++ b/rust/basic_bitcoin/README.md @@ -219,7 +219,9 @@ reflected in your current balance. You can also get a range of Bitcoin block headers by using the `get_block_headers` endpoint on your canister. -Make the call using the command line. Be sure to replace `10` with your desired start height: +In the Candid UI, write the desired start height and optionally end height, and click on "Call": + +Alternatively, make the call using the command line. Be sure to replace `10` with your desired start height: ```bash dfx canister --network=ic call basic_bitcoin get_block_headers "(10: nat32)" diff --git a/rust/basic_bitcoin/dfx.json b/rust/basic_bitcoin/dfx.json index 40ccfeb2e..9246f49ad 100644 --- a/rust/basic_bitcoin/dfx.json +++ b/rust/basic_bitcoin/dfx.json @@ -11,14 +11,7 @@ { "name": "candid:service" } - ], - "specified_id": "om77v-qqaaa-aaaap-ahmrq-cai", - "remote": { - "id": { - "ic": "om77v-qqaaa-aaaap-ahmrq-cai", - "playground": "om77v-qqaaa-aaaap-ahmrq-cai" - } - } + ] } }, "defaults": { @@ -34,4 +27,4 @@ "args": "" } } -} +} \ No newline at end of file diff --git a/rust/basic_bitcoin/src/basic_bitcoin/build.sh b/rust/basic_bitcoin/src/basic_bitcoin/build.sh index 4ecc823a6..d56371662 100755 --- a/rust/basic_bitcoin/src/basic_bitcoin/build.sh +++ b/rust/basic_bitcoin/src/basic_bitcoin/build.sh @@ -2,6 +2,7 @@ set -euo pipefail TARGET="wasm32-unknown-unknown" +CANISTER="basic_bitcoin" SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" pushd $SCRIPT_DIR @@ -16,5 +17,10 @@ else cargo build --target $TARGET --release fi +ic-wasm \ + "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public + popd From 4956a408ccbc8be6172e056e3f413b2ef6b5c273 Mon Sep 17 00:00:00 2001 From: Dragoljub Djuric Date: Fri, 30 Aug 2024 17:57:31 +0200 Subject: [PATCH 2/4] Update build.sh --- rust/basic_bitcoin/src/basic_bitcoin/build.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/rust/basic_bitcoin/src/basic_bitcoin/build.sh b/rust/basic_bitcoin/src/basic_bitcoin/build.sh index d56371662..ed5dfd629 100755 --- a/rust/basic_bitcoin/src/basic_bitcoin/build.sh +++ b/rust/basic_bitcoin/src/basic_bitcoin/build.sh @@ -17,10 +17,19 @@ else cargo build --target $TARGET --release fi -ic-wasm \ - "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ - -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ - metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public +cargo install ic-wasm --version 0.2.0 --root ./ +STATUS=$? + +if [[ "$STATUS" -eq "0" ]]; then + ./ic-wasm \ + "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public + true +else + echo Could not install ic-wasm + false +fi popd From e540d49d6a720dc7742cf00dcb40979f89fee850 Mon Sep 17 00:00:00 2001 From: Dragoljub Djuric Date: Fri, 30 Aug 2024 18:05:39 +0200 Subject: [PATCH 3/4] Update build.sh --- rust/basic_bitcoin/src/basic_bitcoin/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust/basic_bitcoin/src/basic_bitcoin/build.sh b/rust/basic_bitcoin/src/basic_bitcoin/build.sh index ed5dfd629..2a1e51660 100755 --- a/rust/basic_bitcoin/src/basic_bitcoin/build.sh +++ b/rust/basic_bitcoin/src/basic_bitcoin/build.sh @@ -21,7 +21,7 @@ cargo install ic-wasm --version 0.2.0 --root ./ STATUS=$? if [[ "$STATUS" -eq "0" ]]; then - ./ic-wasm \ + ./bin/ic-wasm \ "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public From e79533bcaf92a2b6659e09b8333e0ddab5a04ecd Mon Sep 17 00:00:00 2001 From: Dragoljub Djuric Date: Tue, 3 Sep 2024 12:12:25 +0200 Subject: [PATCH 4/4] Update build.sh --- rust/basic_bitcoin/src/basic_bitcoin/build.sh | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/rust/basic_bitcoin/src/basic_bitcoin/build.sh b/rust/basic_bitcoin/src/basic_bitcoin/build.sh index 2a1e51660..19dd5f885 100755 --- a/rust/basic_bitcoin/src/basic_bitcoin/build.sh +++ b/rust/basic_bitcoin/src/basic_bitcoin/build.sh @@ -18,18 +18,11 @@ else fi cargo install ic-wasm --version 0.2.0 --root ./ -STATUS=$? -if [[ "$STATUS" -eq "0" ]]; then - ./bin/ic-wasm \ - "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ - -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ - metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public - true -else - echo Could not install ic-wasm - false -fi +./bin/ic-wasm \ + "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + -o "$SCRIPT_DIR/../../target/$TARGET/release/$CANISTER.wasm" \ + metadata candid:service -f "$SCRIPT_DIR/basic_bitcoin.did" -v public popd