@@ -27,7 +27,7 @@ export DOCKER_USER=$(id -u):$(id -g)
2727# Mandatory: run the container as the current user (should be 1000:1000), not as root.
2828# Suggestion: use a stateless container; remove it after use (--rm).
2929# Suggestion: map the current directory to "/data" in the container.
30- export RUN="docker run --user=${DOCKER_USER} --rm -it --volume $(pwd):/data"
30+ export RUN="docker run --network=host -- user=${DOCKER_USER} --rm -it --volume $(pwd):/data"
3131```
3232
3333Run the container and do a quick inspection:
@@ -36,56 +36,57 @@ Run the container and do a quick inspection:
3636${RUN} ${IMAGE} whoami
3737${RUN} ${IMAGE} mxpy --version
3838${RUN} ${IMAGE} mxpy deps check rust
39+ ${RUN} ${IMAGE} sc-meta --version
3940```
4041
4142Clone ` mx-contracts-rs ` locally, then build a few contracts within the container:
4243
4344```
4445git clone https://github.com/multiversx/mx-contracts-rs.git --single-branch --depth=1
4546
46- ${RUN} ${IMAGE} mxpy contract build /data/mx-contracts-rs/contracts/adder
47+ ${RUN} ${IMAGE} mxpy contract build --path /data/mx-contracts-rs/contracts/adder
4748stat ./mx-contracts-rs/contracts/adder/output/adder.wasm
4849
49- ${RUN} ${IMAGE} mxpy contract build /data/mx-contracts-rs/contracts/ping-pong-egld
50+ ${RUN} ${IMAGE} mxpy contract build --path /data/mx-contracts-rs/contracts/ping-pong-egld
5051stat ./mx-contracts-rs/contracts/ping-pong-egld/output/ping-pong-egld.wasm
5152```
5253
53- Deploy a previously-built smart contract on Testnet :
54+ Deploy a previously-built smart contract on Devnet :
5455
5556```
5657${RUN} ${IMAGE} mxpy contract deploy \
5758 --bytecode /data/mx-contracts-rs/contracts/adder/output/adder.wasm \
5859 --arguments 0 \
59- --pem /home/developer/multiversx-sdk/testwallets/latest/users/frank .pem \
60+ --pem /home/developer/multiversx-sdk/testwallets/latest/users/alice .pem \
6061 --recall-nonce \
6162 --gas-limit 5000000 \
62- --chain T \
63- --proxy https://testnet -gateway.multiversx.com \
63+ --chain D \
64+ --proxy https://devnet2 -gateway.multiversx.com \
6465 --send
6566```
6667
6768Call a function of a previously-deployed smart contract:
6869
6970```
7071${RUN} ${IMAGE} mxpy contract call \
71- erd1qqqqqqqqqqqqqpgq5v3ra8mxjkv6g2pues9tdkkzwmtm9fdht7asp8wtnr \
72+ erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \
7273 --function "add" \
7374 --arguments 42 \
74- --pem /home/developer/multiversx-sdk/testwallets/latest/users/frank .pem \
75+ --pem /home/developer/multiversx-sdk/testwallets/latest/users/alice .pem \
7576 --recall-nonce \
7677 --gas-limit 5000000 \
77- --chain T \
78- --proxy https://testnet -gateway.multiversx.com \
78+ --chain D \
79+ --proxy https://devnet2 -gateway.multiversx.com \
7980 --send
8081```
8182
8283Query a smart contract:
8384
8485```
8586${RUN} ${IMAGE} mxpy contract query \
86- erd1qqqqqqqqqqqqqpgq5v3ra8mxjkv6g2pues9tdkkzwmtm9fdht7asp8wtnr \
87+ erd1qqqqqqqqqqqqqpgqfzydqmdw7m2vazsp6u5p95yxz76t2p9rd8ss0zp9ts \
8788 --function "getSum" \
88- --proxy https://testnet -gateway.multiversx.com
89+ --proxy https://devnet2 -gateway.multiversx.com
8990```
9091
9192Setup a localnet (make sure to set the ` --workdir ` , as well), then inspect the generated files (on the mapped volume):
@@ -126,7 +127,7 @@ Resources:
126127Build the Docker images for local testing:
127128
128129```
129- docker build ./resources/smart-contracts-rust -t multiversx/devcontainer-smart-contracts-rust:latest -f ./resources/smart-contracts-rust/Dockerfile
130+ docker build --network=host ./resources/smart-contracts-rust -t multiversx/devcontainer-smart-contracts-rust:latest -f ./resources/smart-contracts-rust/Dockerfile
130131```
131132
132133### Test the templates
@@ -137,14 +138,14 @@ cp -R "src/smart-contracts-rust/.devcontainer" "/tmp/test-workspace" && \
137138code "/tmp/test-workspace/"
138139```
139140
140- Then, in VSCode, launch the command ` Dev Containers: Rebuild and Reopen in Container ` , wait, then inspect the environment (e.g. check version of ` mxpy ` , ` rust ` , build the sample smart contracts, verify output of rust-analyzer) .
141+ Then, in VSCode, launch the command ` Dev Containers: Rebuild and Reopen in Container ` , wait, then inspect the environment. For example, check version of ` mxpy ` , ` rust ` , ` sc-meta ` , build the sample smart contracts, verify output of ` rust-analyzer ` .
141142
142143### Publish images
143144
144145Locally:
145146
146147```
147- docker build ./resources/smart-contracts-rust -t multiversx/devcontainer-smart-contracts-rust:latest -f ./resources/smart-contracts-rust/Dockerfile
148+ docker build --network=host ./resources/smart-contracts-rust -t multiversx/devcontainer-smart-contracts-rust:latest -f ./resources/smart-contracts-rust/Dockerfile
148149docker push multiversx/devcontainer-smart-contracts-rust:latest
149150```
150151
0 commit comments