Skip to content

Commit

Permalink
modify transactions integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
tj327 committed Nov 23, 2023
1 parent 88bf72d commit fc014ab
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ addAccount testuser2
TESTUSER_ADDRESS=$(showAddress testuser2)

TXRESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
BLOCK_HASH=$(echo $TXRESULT | jsonQuickParse "txhash")
TXQUERYRESULT=$(sekaid query tx $TX_ID 2> /dev/null || exit 1)
TX_HASH=$(echo $TXRESULT | jsonQuickParse "txhash")
sleep 5
TXQUERYRESULT=$(sekaid query tx $TX_HASH --chain-id=$NETWORK_NAME --output=json --home=$SEKAID_HOME 2> /dev/null || exit 1)
BLOCK_HEIGHT=$(echo $TXQUERYRESULT | jsonQuickParse "height")
BLOCK_HASH=$(sekaid query block $BLOCK_HEIGHT --chain-id=$NETWORK_NAME --home=$SEKAID_HOME | jq '.block_id.hash' | tr -d '"')

INTERX_GATEWAY="127.0.0.1:11000"
RESULT_HASH_FROM_INTERX=$(curl --fail $INTERX_GATEWAY/api/blocks/$BLOCK_HEIGHT | jq '.block_id.hash' | tr -d '"' || exit 1)
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-local/Transactions/query-block-transactions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ TESTUSER_ADDRESS=$(showAddress testuser3)

TXRESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
TX_HASH=$(echo $TXRESULT | jsonQuickParse "txhash")
TXQUERYRESULT=$(sekaid query tx $TX_ID 2> /dev/null || exit 1)
sleep 5
TXQUERYRESULT=$(sekaid query tx $TX_HASH --chain-id=$NETWORK_NAME --output=json --home=$SEKAID_HOME 2> /dev/null || exit 1)
BLOCK_HEIGHT=$(echo $TXQUERYRESULT | jsonQuickParse "height")

INTERX_GATEWAY="127.0.0.1:11000"
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-local/Transactions/query-blocks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ TESTUSER_ADDRESS=$(showAddress testuser4)

TXRESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
TX_ID=$(echo $TXRESULT | jsonQuickParse "txhash")
TXQUERYRESULT=$(sekaid query tx $TX_ID 2> /dev/null || exit 1)
sleep 5
TXQUERYRESULT=$(sekaid query tx $TX_ID --chain-id=$NETWORK_NAME --output=json --home=$SEKAID_HOME 2> /dev/null || exit 1)
BLOCK_HEIGHT=$(echo $TXQUERYRESULT | jsonQuickParse "height")

INTERX_GATEWAY="127.0.0.1:11000"
Expand Down
3 changes: 2 additions & 1 deletion scripts/test-local/Transactions/query-transaction-result.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ addAccount testuser5
TESTUSER_ADDRESS=$(showAddress testuser5)

RESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
TX_HASH=$(echo $RESULT | jsonQuickParse "txhash" | tr -d '"')
TX_HASH=$(echo $RESULT | jsonQuickParse "txhash")
sleep 5

INTERX_GATEWAY="127.0.0.1:11000"
RESULT_FROM_INTERX=$(curl --fail $INTERX_GATEWAY/api/transactions/0x$TX_HASH || exit 1)
Expand Down
6 changes: 4 additions & 2 deletions scripts/test-local/Transactions/query-transactions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@ VALIDATOR_ADDRESS=$(showAddress validator)
addAccount testuser9
TESTUSER_ADDRESS=$(showAddress testuser9)
RESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
TX_HASH=0x$(echo $RESULT | jsonQuickParse "txhash" | tr -d '"')
TX_HASH=0x$(echo $RESULT | jsonQuickParse "txhash")

sleep 5

INTERX_GATEWAY="127.0.0.1:11000"
RESULT_FROM_INTERX=$(curl --fail $INTERX_GATEWAY/api/transactions?address=$TESTUSER_ADDRESS&type=send || exit 1)
RESULT_FROM_INTERX=$(curl --fail "$INTERX_GATEWAY/api/transactions?address=$TESTUSER_ADDRESS&type=send" || exit 1)

RESULT_TOTAL_COUNT=$(echo $RESULT_FROM_INTERX | jq '.total_count' | tr -d '"')
RESULT_TX_HASH=$(echo $RESULT_FROM_INTERX | jq '.transactions[0].hash' | tr -d '"')
Expand Down
5 changes: 3 additions & 2 deletions scripts/test-local/Transactions/transaction-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ addAccount testuser8
TESTUSER_ADDRESS=$(showAddress testuser8)

TXRESULT=$(sekaid tx bank send validator $TESTUSER_ADDRESS 5ukex --keyring-backend=test --chain-id=$NETWORK_NAME --fees 100ukex --broadcast-mode=async --output=json --yes --home=$SEKAID_HOME 2> /dev/null || exit 1)
TX_HASH=$(echo $TXRESULT | jsonQuickParse "txhash")
TXQUERYRESULT=$(sekaid query tx $TX_ID 2> /dev/null || exit 1)
TX_ID=$(echo $TXRESULT | jsonQuickParse "txhash")
sleep 5
TXQUERYRESULT=$(sekaid query tx $TX_ID --chain-id=$NETWORK_NAME --output=json --home=$SEKAID_HOME 2> /dev/null || exit 1)
BLOCK_HEIGHT=$(echo $TXQUERYRESULT | jsonQuickParse "height")
echo $TX_ID
echo $BLOCK_HEIGHT
Expand Down
29 changes: 29 additions & 0 deletions scripts/test-local/init-localnet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# To run test locally: make network-start && ./scripts/test-local/token-transfers.sh
set -e
set -x
. /etc/profile

INTERX_VERSION=$(./scripts/version.sh InterxVersion)
SEKAID_VERSION=$(./scripts/version.sh SekaiVersion)
DEFAULT_GRPC_PORT=9090
DEFAULT_RPC_PORT=26657
DEFAULT_INTERX_PORT=11000
PING_TARGET="127.0.0.1"
CFG_grpc="dns:///$PING_TARGET:$DEFAULT_GRPC_PORT"
CFG_rpc="http://$PING_TARGET:$DEFAULT_RPC_PORT"
INTERXD_HOME=$HOME/.interxd

interxd init --cache_dir="$INTERXD_HOME/cache" --home="$INTERXD_HOME" --grpc="$CFG_grpc" --rpc="$CFG_rpc" --port="$INTERNAL_API_PORT" \
--signing_mnemonic="$INTERXD_HOME/interx.mnemonic" \
--faucet_mnemonic="$INTERXD_HOME/faucet.mnemonic" \
--port="$DEFAULT_INTERX_PORT" \
--node_type="validator" \
--seed_node_id="" \
--sentry_node_id="" \
--validator_node_id="$(globGet validator_node_id)" \
--addrbook="$(globFile KIRA_ADDRBOOK)" \
--faucet_time_limit=30 \
--faucet_amounts="100000ukex,20000000test,300000000000000000samolean,1lol" \
--faucet_minimum_amounts="1000ukex,50000test,250000000000000samolean,1lol" \
--fee_amounts="ukex 1000ukex,test 500ukex,samolean 250ukex,lol 100ukex"

0 comments on commit fc014ab

Please sign in to comment.