diff --git a/.travis.yml b/.travis.yml index c8b8eec..b4e96b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,7 +21,7 @@ before_script: - ganache-cli --port 18545 > ganache-cli.log & - git clone https://github.com/oceanprotocol/barge - cd barge - - bash -x start_ocean.sh --latest --no-brizo --no-pleuston --local-nile-node 2>&1 > start_ocean.log & + - bash -x start_ocean.sh --latest --no-brizo --no-pleuston --local-spree-node 2>&1 > start_ocean.log & - cd .. script: @@ -29,6 +29,7 @@ script: - npm run report-coverage - npm run build - npm run doc + - ./scripts/wait_for_migration_and_extract_keeper_artifacts.sh - npm run integration after_script: diff --git a/scripts/wait_for_migration_and_extract_keeper_artifacts.sh b/scripts/wait_for_migration_and_extract_keeper_artifacts.sh new file mode 100755 index 0000000..1360a16 --- /dev/null +++ b/scripts/wait_for_migration_and_extract_keeper_artifacts.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +RETRY_COUNT=0 +COMMAND_STATUS=1 + +mkdir -p artifacts + +until [ $COMMAND_STATUS -eq 0 ] || [ $RETRY_COUNT -eq 120 ]; do + keeper_contracts_docker_id=$(docker container ls | grep keeper-contracts | awk '{print $1}') + docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/ready ./artifacts/ + COMMAND_STATUS=$? + sleep 5 + let RETRY_COUNT=RETRY_COUNT+1 +done + +if [ $COMMAND_STATUS -ne 0 ]; then + echo "Waited for more than two minutes, but keeper contracts have not been migrated yet. Did you run an Ethereum RPC client and the migration script?" + exit 1 +fi + +docker cp ${keeper_contracts_docker_id}:/keeper-contracts/artifacts/. ./node_modules/@oceanprotocol/keeper-contracts/artifacts/ diff --git a/src/examples/config.ts b/src/examples/config.ts index b12a0af..fc5c1b0 100644 --- a/src/examples/config.ts +++ b/src/examples/config.ts @@ -4,14 +4,12 @@ import * as config from "./config/config.json" if (process.env.SEED_WORDS) { const seedphrase = process.env.SEED_WORDS - // There are 20 accounts availabe (19 + 1) - const accountIndex = Math.floor(Math.random() * 19) // @ts-ignore config.web3Provider = new HDWalletProvider( seedphrase, config.nodeUri, - accountIndex, + 0, 2, ) } diff --git a/src/examples/fire_lazers.sh b/src/examples/fire_lazers.sh index 3d05666..ce10a78 100755 --- a/src/examples/fire_lazers.sh +++ b/src/examples/fire_lazers.sh @@ -2,12 +2,15 @@ set -e -# this has to go first +# First of all to log the accounts +npm run run src/examples/GetAccounts.ts + +# Before rest of examples npm run run src/examples/RegisterServiceAgreementTemplates.ts +# Examples npm run run src/examples/BuyAsset.ts npm run run src/examples/ExecuteAgreement.ts -npm run run src/examples/GetAccounts.ts npm run run src/examples/GetBalance.ts # npm run run src/examples/GrantAccess.ts npm run run src/examples/RegisterAsset.ts