Skip to content

Commit

Permalink
Merge pull request #1019 from multiversx/contract-build-cleanup
Browse files Browse the repository at this point in the history
Cleanup: contract build, old tutorials etc.
  • Loading branch information
andreibancioiu authored Nov 25, 2024
2 parents a438a0a + 8021c0d commit f451199
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 162 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,5 @@ Make sure you migrate to the managed types **incrementally** and **thoroughly te
:::

:::tip
You can use the `mxpy contract report` command to verify whether your contract still requires dynamic allocation or not.
You can use the `sc-meta report` command to verify whether your contract still requires dynamic allocation or not.
:::
16 changes: 5 additions & 11 deletions docs/developers/meta/sc-build-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ title: Build Reference

## How to: Basic build

To build a contract, it is enough to navigate in your contract crate and run
To build a contract, navigate to the contract folder and run the following command:

```sh
sc-meta all build
```

:::info Note
The traditional way to trigger a build in console is to call `mxpy contract build --path <project>`, which works as well. However, mxpy currently just forwards commands to the [MultiversX Metaprogramming standalone tool](/developers/meta/sc-meta#introduction), so you might as well call it directly.
:::

---

[comment]: # (mx-exclude-context)

## Configuring the build
Expand Down Expand Up @@ -155,11 +149,11 @@ After building the contracts, there are three more operations left to perform, b

### g. Cleaning a project

Calling `cargo run clean` in the meta crate will run `cargo clean` in all wasm crates and delete the `output` folder.
In order to clean a project and remove all build artifacts, run the following command:

`mxpy contract clean` also just forwards to this.

Note that even the clean operation relies on the ABI, in order to reach all the wasm crates.
```sh
sc-meta all clean
```

[comment]: # (mx-context-auto)

Expand Down
4 changes: 2 additions & 2 deletions docs/developers/meta/sc-meta-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ This command is similar to `build-dbg`, in that it provides a shorthand for buil

### Calling `clean`

Calling `mxpy contract clean <project>` or `cargo run clean` in the meta crate will delete the `output` folder and clean outputs of the Rust crates.
Calling `sc-meta all clean` in the contract folder will remove all build artifacts, including the `output` folder.

[comment]: # (mx-context-auto)

Expand Down Expand Up @@ -419,4 +419,4 @@ Calling `cargo run cs` in the meta crate or `sc-meta cs` in the root crate will
Subcommands:
- `install` Pulls the latest chain simulator docker image available. This command needs Docker to be installed and running on the current machine.
- `start` Starts the chain simulator in verbose mode at `localhost:8085`.
- `stop` Stops the chain simulator.
- `stop` Stops the chain simulator.
1 change: 0 additions & 1 deletion docs/developers/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ Below is a list of tutorials for building on MultiversX:
| [Build a microservice for your dApp](/developers/tutorials/your-first-microservice) | Video + written tutorial on how to create your microservice. |
| [Crowdfunding Smart Contract](/developers/tutorials/crowdfunding-p1) | Crowdfunding tutorial (Part 1). |
| [Crowdfunding Smart Contract](/developers/tutorials/crowdfunding-p2) | Crowdfunding tutorial (Part 2). |
| [The Counter Smart Contract](/developers/tutorials/counter) | The Counter SC tutorial. |
| [Staking contract Tutorial](/developers/tutorials/staking-contract) | Step by step tutorial on how to create a Staking Smart Contract. |
| [Energy DAO Tutorial](/developers/tutorials/energy-dao) | In depth analysis of the Energy DAO SC template. |
| [DEX Walkthrough](/developers/tutorials/dex-walkthrough) | In depth walkthrough of all the main DEX contracts. |
Expand Down
134 changes: 0 additions & 134 deletions docs/developers/tutorials/counter.md

This file was deleted.

18 changes: 9 additions & 9 deletions docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v12.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ const tx4 = factory.createMultiESDTNFTTransfer({
import { Code } from "@multiversx/sdk-core";
import { promises } from "fs";

let buffer = await promises.readFile("../contracts/counter.wasm");
let buffer = await promises.readFile("../contracts/adder.wasm");
let code = Code.fromBuffer(buffer);
```

Expand All @@ -326,7 +326,7 @@ let code = Code.fromBuffer(buffer);
```js
import axios from "axios";

let response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/counter.wasm", {
let response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/adder.wasm", {
responseType: "arraybuffer",
transformResponse: [],
headers: {
Expand Down Expand Up @@ -421,7 +421,7 @@ console.log("Return code:", returnCode);
import { AbiRegistry, Address, SmartContract } from "@multiversx/sdk-core";
import { promises } from "fs";

let abiJson = await promises.readFile("../contracts/counter.abi.json", { encoding: "utf8" });
let abiJson = await promises.readFile("../contracts/adder.abi.json", { encoding: "utf8" });
let abiObj = JSON.parse(abiJson);
let abiRegistry = AbiRegistry.create(abiObj);
let existingContractAddress = Address.fromBech32("erd1qqqqqqqqqqqqqpgq5sup58y38q3pwyqklagxmuraetshrqwpd8ssh0ssph");
Expand All @@ -435,7 +435,7 @@ let existingContract = new SmartContract({ address: existingContractAddress, abi
```js
import axios from "axios";

const response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/counter.abi.json");
const response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/adder.abi.json");
abiRegistry = AbiRegistry.create(response.data);
existingContract = new SmartContract({ address: existingContractAddress, abi: abiRegistry });
```
Expand Down Expand Up @@ -742,13 +742,13 @@ console.log(untypedBundle.returnCode, untypedBundle.values.length);

```js
let endpointDefinition = AbiRegistry.create({
"name": "counter",
"name": "adder",
"endpoints": [{
"name": "increment",
"inputs": [],
"outputs": [{ "type": "i64" }]
"name": "add",
"inputs": [{ "type": "u64" }],
"outputs": [{ "type": "u64" }]
}]
}).getEndpoint("increment");
}).getEndpoint("add");

transactionOnNetwork = await networkProvider.getTransaction(txHash);
let typedBundle = resultsParser.parseOutcome(transactionOnNetwork, endpointDefinition);
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk-and-tools/sdk-js/sdk-js-cookbook-v13.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ let abi = AbiRegistry.create(abiObj);
```js
import axios from "axios";

const response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/counter.abi.json");
const response = await axios.get("https://github.com/multiversx/mx-sdk-js-core/raw/main/src/testdata/adder.abi.json");
abi = AbiRegistry.create(response.data);
```

Expand Down
4 changes: 2 additions & 2 deletions docs/sdk-and-tools/sdk-py/mxpy-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,7 +608,7 @@ Now let's deploy a smart contract using the Ledger:

```sh
mxpy contract deploy --proxy=https://devnet-gateway.multiversx.com --recall-nonce \
--bytecode=counter.wasm --gas-limit=5000000 \
--bytecode=adder.wasm --gas-limit=5000000 \
--ledger --ledger-address-index=42 \
--send
```
Expand All @@ -618,7 +618,7 @@ Then, perform a contract call:
```sh
mxpy contract call erd1qqqqqqqqqqqqqpgqwwef37kmegph97egvvrxh3nccx7xuygez8ns682zz0 \
--proxy=https://devnet-gateway.multiversx.com --recall-nonce \
--function increment --gas-limit 5000000 \
--function add --arguments 42 --gas-limit 5000000 \
--ledger --ledger-address-index=42 \
--send
```
Expand Down
1 change: 0 additions & 1 deletion sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ const sidebars = {
"developers/tutorials/your-first-microservice",
"developers/tutorials/crowdfunding-p1",
"developers/tutorials/crowdfunding-p2",
"developers/tutorials/counter",
"developers/tutorials/staking-contract",
"developers/tutorials/energy-dao",
"developers/tutorials/dex-walkthrough",
Expand Down

0 comments on commit f451199

Please sign in to comment.