Skip to content

Commit

Permalink
adapt to IOTA sandbox
Browse files Browse the repository at this point in the history
  • Loading branch information
eike-hass committed Feb 2, 2024
1 parent a929510 commit cd3d183
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 35 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: 'private-tangle-setup'
description: 'Setup a private tangle'
name: 'iota-sandbox-setup'
description: 'Setup IOTA Sandbox'
runs:
using: "composite"
steps:
- name: Setup private tangle
- name: Setup iota sandbox
shell: bash
run: |
# TODO: use next lines when a working hornet release is published
Expand All @@ -17,28 +17,27 @@ runs:
# tar -xf private_tangle.tar.gz
# TODO: remove next lines when a working hornet release is published
git clone https://github.com/iotaledger/hornet.git
cd hornet/private_tangle
git clone https://github.com/iotaledger/iota-sandbox
cd iota-sandbox/sandbox
# Set minPoWScore = 1 since the default (0) doesn't work with wasm_miner.rs in iota.rs currently.
jq '.minPoWScore = $val' --argjson val 1 protocol_parameters.json > tmp.json && mv tmp.json protocol_parameters.json
jq --color-output . protocol_parameters.json
# # Set minPoWScore = 1 since the default (0) doesn't work with wasm_miner.rs in iota.rs currently.
# jq '.minPoWScore = $val' --argjson val 1 protocol_parameters.json > tmp.json && mv tmp.json protocol_parameters.json
# jq --color-output . protocol_parameters.json
# Manipulate and print config
jq '.restAPI.pow.enabled = $newVal' --argjson newVal true config_private_tangle.json > tmp.$$.json && mv tmp.$$.json config_private_tangle.json
jq --color-output . config_private_tangle.json
# # Manipulate and print config
# jq '.restAPI.pow.enabled = $newVal' --argjson newVal true config_private_tangle.json > tmp.$$.json && mv tmp.$$.json config_private_tangle.json
# jq --color-output . config_private_tangle.json
# Start Tangle
sudo ./cleanup.sh
sudo ./bootstrap.sh
sudo ./run.sh -d
docker compose up -d
- name: Wait for tangle to start
shell: bash
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost:14265/health -- echo "Tangle is up"
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost/health -- echo "Tangle is up"
env:
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
- name: Wait for faucet to start
shell: bash
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost:8091/api/info -- echo "Faucet is up"
run: wget -qO- https://raw.githubusercontent.com/eficode/wait-for/$WAIT_FOR_VERSION/wait-for | sh -s -- -t 60 http://localhost/faucet/api/info -- echo "Faucet is up"
env:
WAIT_FOR_VERSION: 4df3f9262d84cab0039c07bf861045fbb3c20ab7 # v2.2.3
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: 'private-tangle-tear-down'
description: 'tear-down a private tangle'
name: 'iota-sandbox-tear-down'
description: 'tear-down a iota sandbox'
runs:
using: "composite"
steps:
- name: Tear down private tangle
- name: Tear down iota sandbox
shell: bash
run: |
# TODO: use next line when a working hornet release is published
#cd private_tangle
# TODO: remove next line when a working hornet release is published
cd hornet/private_tangle
cd iota-sandbox/sandbox
docker-compose down
cd ..
sudo rm -rf private_tangle
sudo rm -rf iota-sandbox
16 changes: 8 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ jobs:
- name: Build with all features
run: cargo build --workspace --tests --examples --all-features --release

- name: Start private tangle
- name: Start iota sandbox
if: matrix.os == 'ubuntu-latest'
uses: './.github/actions/private-tangle/setup'
uses: './.github/actions/iota-sandbox/setup'

- name: Run tests
run: cargo test --workspace --all-features --release
Expand All @@ -148,9 +148,9 @@ jobs:
npm ci
npm run test:readme:rust
- name: Tear down private tangle
- name: Tear down iota sandbox
if: matrix.os == 'ubuntu-latest' && always()
uses: './.github/actions/private-tangle/tear-down'
uses: './.github/actions/iota-sandbox/tear-down'

- name: Stop sccache
uses: './.github/actions/rust/sccache/stop-sccache'
Expand Down Expand Up @@ -194,13 +194,13 @@ jobs:
name: identity-wasm-bindings-build
path: bindings/wasm

- name: Start private tangle
uses: './.github/actions/private-tangle/setup'
- name: Start iota sandbox
uses: './.github/actions/iota-sandbox/setup'

- name: Run Wasm examples
run: npm run test:examples
working-directory: bindings/wasm

- name: Tear down private tangle
- name: Tear down iota sandbox
if: always()
uses: './.github/actions/private-tangle/tear-down'
uses: './.github/actions/iota-sandbox/tear-down'
2 changes: 1 addition & 1 deletion bindings/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const EXAMPLE_JWK = new Jwk({
});

// The endpoint of the IOTA node to use.
const API_ENDPOINT = "http://127.0.0.1:14265";
const API_ENDPOINT = "http://localhost";

/** Demonstrate how to create a DID Document. */
async function main() {
Expand Down
4 changes: 2 additions & 2 deletions bindings/wasm/examples/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import {
Utils,
} from "@iota/sdk-wasm/node";

export const API_ENDPOINT = "http://localhost:14265";
export const FAUCET_ENDPOINT = "http://localhost:8091/api/enqueue";
export const API_ENDPOINT = "http://localhost";
export const FAUCET_ENDPOINT = "http://localhost/faucet/api/enqueue";

/** Creates a DID Document and publishes it in a new Alias Output.
Expand Down
4 changes: 2 additions & 2 deletions examples/0_basic/0_create_did.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ use iota_sdk::types::block::output::AliasOutput;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// The API endpoint of an IOTA node, e.g. Hornet.
let api_endpoint: &str = "http://127.0.0.1:14265";
let api_endpoint: &str = "http://localhost";

// The faucet endpoint allows requesting funds for testing purposes.
let faucet_endpoint: &str = "http://127.0.0.1:8091/api/enqueue";
let faucet_endpoint: &str = "http://localhost/faucet/api/enqueue";

// Create a new client to interact with the IOTA ledger.
let client: Client = Client::builder()
Expand Down
4 changes: 2 additions & 2 deletions examples/utils/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ use iota_sdk::types::block::address::Hrp;
use rand::distributions::DistString;
use serde_json::Value;

pub static API_ENDPOINT: &str = "http://localhost:14265";
pub static FAUCET_ENDPOINT: &str = "http://localhost:8091/api/enqueue";
pub static API_ENDPOINT: &str = "http://localhost";
pub static FAUCET_ENDPOINT: &str = "http://localhost/faucet/api/enqueue";

pub type MemStorage = Storage<JwkMemStore, KeyIdMemstore>;

Expand Down

0 comments on commit cd3d183

Please sign in to comment.