Skip to content

Commit d882d1b

Browse files
committed
localnet tests
1 parent 668bef5 commit d882d1b

File tree

2 files changed

+99
-2
lines changed

2 files changed

+99
-2
lines changed

examples/call/scripts/localnet.sh

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ set -e
44
set -x
55
set -o pipefail
66

7-
if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 25; fi
7+
if [ "$1" = "start" ]; then npx hardhat localnet & sleep 15; fi
88

99
echo -e "\n🚀 Compiling contracts..."
1010
npx hardhat compile --force --quiet
1111

1212
ZRC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ZRC-20 ETH on 5") | .address' localnet.json)
1313
ERC20_ETHEREUM=$(jq -r '.addresses[] | select(.type=="ERC-20 USDC" and .chain=="ethereum") | .address' localnet.json)
1414
ZRC20_BNB=$(jq -r '.addresses[] | select(.type=="ZRC-20 BNB on 97") | .address' localnet.json)
15+
ZRC20_SOL=$(jq -r '.addresses[] | select(.type=="ZRC-20 SOL on 901") | .address' localnet.json)
1516
GATEWAY_ETHEREUM=$(jq -r '.addresses[] | select(.type=="gatewayEVM" and .chain=="ethereum") | .address' localnet.json)
1617
GATEWAY_ZETACHAIN=$(jq -r '.addresses[] | select(.type=="gatewayZEVM" and .chain=="zetachain") | .address' localnet.json)
1718
SENDER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266
@@ -107,4 +108,100 @@ npx hardhat universal-withdraw-and-call \
107108

108109
npx hardhat localnet-check
109110

111+
# Testing toolkit methods
112+
113+
npx hardhat evm-deposit \
114+
--receiver "$CONTRACT_ZETACHAIN" \
115+
--gateway-evm "$GATEWAY_ETHEREUM" \
116+
--network localhost \
117+
--amount 1
118+
119+
npx hardhat localnet-check
120+
121+
npx hardhat evm-deposit \
122+
--receiver "$CONTRACT_ZETACHAIN" \
123+
--gateway-evm "$GATEWAY_ETHEREUM" \
124+
--network localhost \
125+
--erc20 "$ERC20_ETHEREUM" \
126+
--amount 1
127+
128+
npx hardhat localnet-check
129+
130+
npx hardhat evm-call \
131+
--receiver "$CONTRACT_ZETACHAIN" \
132+
--gateway-evm "$GATEWAY_ETHEREUM" \
133+
--network localhost \
134+
--types '["string"]' alice
135+
136+
npx hardhat localnet-check
137+
138+
npx hardhat evm-deposit-and-call \
139+
--receiver "$CONTRACT_ZETACHAIN" \
140+
--gateway-evm "$GATEWAY_ETHEREUM" \
141+
--network localhost \
142+
--amount 1 \
143+
--types '["string"]' alice
144+
145+
npx hardhat localnet-check
146+
147+
npx hardhat evm-deposit-and-call \
148+
--receiver "$CONTRACT_ZETACHAIN" \
149+
--gateway-evm "$GATEWAY_ETHEREUM" \
150+
--network localhost \
151+
--amount 1 \
152+
--erc20 "$ERC20_ETHEREUM" \
153+
--types '["string"]' alice
154+
155+
npx hardhat localnet-check
156+
157+
npx hardhat zetachain-withdraw \
158+
--receiver "$CONTRACT_ETHEREUM" \
159+
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
160+
--zrc20 "$ZRC20_ETHEREUM" \
161+
--network localhost \
162+
--amount 1
163+
164+
npx hardhat localnet-check
165+
166+
npx hardhat zetachain-withdraw \
167+
--receiver "DrexsvCMH9WWjgnjVbx1iFf3YZcKadupFmxnZLfSyotd" \
168+
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
169+
--zrc20 "$ZRC20_SOL" \
170+
--network localhost \
171+
--amount 1
172+
173+
npx hardhat localnet-check
174+
175+
npx hardhat zetachain-call \
176+
--receiver "$CONTRACT_ETHEREUM" \
177+
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
178+
--zrc20 "$ZRC20_ETHEREUM" \
179+
--function "hello(string)" \
180+
--network localhost \
181+
--types '["string"]' alice
182+
183+
npx hardhat localnet-check
184+
185+
npx hardhat zetachain-withdraw-and-call \
186+
--receiver "$CONTRACT_ETHEREUM" \
187+
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
188+
--zrc20 "$ZRC20_ETHEREUM" \
189+
--function "hello(string)" \
190+
--amount 1 \
191+
--network localhost \
192+
--call-options-is-arbitrary-call \
193+
--types '["string"]' hello
194+
195+
npx hardhat localnet-check
196+
197+
npx hardhat zetachain-withdraw-and-call \
198+
--receiver "$CONTRACT_ETHEREUM" \
199+
--gateway-zeta-chain "$GATEWAY_ZETACHAIN" \
200+
--zrc20 "$ZRC20_ETHEREUM" \
201+
--amount 1 \
202+
--network localhost \
203+
--types '["string"]' hello
204+
205+
npx hardhat localnet-check
206+
110207
if [ "$1" = "start" ]; then npx hardhat localnet-stop; fi

examples/swap/scripts/localnet.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -e
44
set -x
55
set -o pipefail
66

7-
if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 20; fi
7+
if [ "$1" = "start" ]; then npx hardhat localnet --exit-on-error & sleep 10; fi
88

99
echo -e "\n🚀 Compiling contracts..."
1010
npx hardhat compile --force --quiet

0 commit comments

Comments
 (0)