Skip to content

Commit

Permalink
update usages of cargo-near (#2392)
Browse files Browse the repository at this point in the history
* chore: update mentions of `cargo near deploy` cmd

* chore: update mentions of `cargo near build` cmd

---------

Co-authored-by: dj8yf0μl <[email protected]>
Co-authored-by: Guille <[email protected]>
  • Loading branch information
3 people authored Jan 4, 2025
1 parent 449a674 commit 5b784a4
Show file tree
Hide file tree
Showing 31 changed files with 42 additions and 51 deletions.
2 changes: 1 addition & 1 deletion docs/2.build/2.smart-contracts/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,6 @@ At the time of this writing, this example works with the following versions:
- node: `20.18.0`
- rustc: `1.81.0`
- near-cli-rs: `0.17.0`
- cargo-near: `0.10.1`
- cargo-near: `0.13.2`

:::
2 changes: 1 addition & 1 deletion docs/2.build/5.primitives/ft.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ On initialization you will define the token's metadata such as its name (e.g. Et
To initialize a FT contract you will need to deploy it and then call the `new` method defining the token's metadata.

```bash
cargo near deploy <account-id> with-init-call new json-args '{"owner_id": "<owner-account>", "total_supply": "1000000000000000", "metadata": { "spec": "ft-1.0.0", "name": "Example Token Name", "symbol": "EXLT", "decimals": 8 }}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm <account-id> with-init-call new json-args '{"owner_id": "<owner-account>", "total_supply": "1000000000000000", "metadata": { "spec": "ft-1.0.0", "name": "Example Token Name", "symbol": "EXLT", "decimals": 8 }}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

:::tip
Expand Down
4 changes: 2 additions & 2 deletions docs/3.tutorials/auction/0-intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ Ready to start? Let's jump to the [The Auction Contract](./1.1-basic.md) and beg
- near-cli: `0.12.0`
- rustc: `1.78.0`
- cargo: `1.80.1`
- cargo-near: `0.6.2`
- cargo-near: `0.13.2`
- rustc: `1.78.0`
- node: `21.6.1`

:::
:::
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ Let's deploy the contract (to the subaccount we created) and then check this aga
Ensure that in your command line application, you're in the directory that contains the `Cargo.toml` file, then run:

```bash
cargo near deploy crossword.friend.testnet without-init-call network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet without-init-call network-config testnet sign-with-keychain send
```

Congratulations, you've deployed the smart contract! Note that NEAR CLI will output a link to [NEAR Explorer](https://nearblocks.io/) where you can inspect details of the transaction.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Create fresh account if you wish, which is good practice:
Deploy the contract:

```bash
cargo near deploy crossword.friend.testnet without-init-call network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet without-init-call network-config testnet sign-with-keychain send
```

Call the "new" method:
Expand Down Expand Up @@ -225,7 +225,7 @@ Create fresh account if you wish, which is good practice:
Deploy the contract and call the initialization method:

```bash
cargo near deploy crossword.friend.testnet with-init-call new json-args '{"solution": "69c2feb084439956193f4c21936025f14a5a5a78979d67ae34762e18a7206a0f"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet with-init-call new json-args '{"solution": "69c2feb084439956193f4c21936025f14a5a5a78979d67ae34762e18a7206a0f"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

Now that we're using Batch Actions, no one can call this `new` method before us.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ Create fresh account if you wish, which is good practice:
Deploy the contract:

```bash
cargo near deploy crossword.friend.testnet with-init-call new json-args '{"solution": "69c2feb084439956193f4c21936025f14a5a5a78979d67ae34762e18a7206a0f"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet with-init-call new json-args '{"solution": "69c2feb084439956193f4c21936025f14a5a5a78979d67ae34762e18a7206a0f"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

Return to the project root and start the React app:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ Here's how to delete and recreate the subaccount using NEAR CLI:

Deploy, calling the "new" method with the parameter for owner_id:
```bash
cargo near deploy crossword.friend.testnet with-init-call new json-args '{"owner_id": "crossword.friend.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet with-init-call new json-args '{"owner_id": "crossword.friend.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

Now we're ready to construct our new crossword puzzle and add it via the `new_puzzle` method. Let's start with the clues for this new puzzle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ Create fresh account if you wish, which is good practice:
Deploy the contract:

```bash
cargo near deploy crossword.friend.testnet with-init-call new json-args '{"owner_id": "crossword.friend.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm crossword.friend.testnet with-init-call new json-args '{"owner_id": "crossword.friend.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

Add the crossword puzzle:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ cargo near build
</Tabs>

```bash
cargo near deploy $NEAR_ACCT with-init-call new json-args '{"owner_id": "'$NEAR_ACCT'", "creator_account": "testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $NEAR_ACCT with-init-call new json-args '{"owner_id": "'$NEAR_ACCT'", "creator_account": "testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

<Tabs groupId="cli-tabs">
Expand Down
4 changes: 1 addition & 3 deletions docs/3.tutorials/examples/advanced-xcc.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,9 +290,7 @@ In order to deploy the contract you will need to create a NEAR account.
Go into the directory containing the smart contract (`cd contract-advanced-ts` or `cd contract-advanced-rs`), build and deploy it:

```bash
cargo near build

cargo near deploy <accountId> with-init-call new json-args '{"hello_account":"hello.near-example.testnet","guestbook_account":"guestbook_account.near-example.testnet","counter_account":"counter_account.near-example.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm <accountId> with-init-call new json-args '{"hello_account":"hello.near-example.testnet","guestbook_account":"guestbook_account.near-example.testnet","counter_account":"counter_account.near-example.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

<hr class="subsection" />
Expand Down
4 changes: 1 addition & 3 deletions docs/3.tutorials/examples/count-near.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ In order to deploy the contract you will need to create a NEAR account.
Go into the directory containing the smart contract (`cd contract-ts` or `cd contract-rs`), build and deploy it:

```bash
cargo near build

cargo near deploy <accountId>
cargo near deploy build-non-reproducible-wasm <accountId>
```
:::tip
To interact with your contract from the [frontend](#frontend), simply replace the value of the `testnet` key in the `config.js` file.
Expand Down
4 changes: 1 addition & 3 deletions docs/3.tutorials/examples/donation.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,7 @@ In order to deploy the contract you will need to create a NEAR account.
Go into the directory containing the smart contract (`cd contract-ts` or `cd contract-rs`), build and deploy it:

```bash
cargo near build

cargo near deploy <accountId>
cargo near deploy build-non-reproducible-wasm <accountId>
```

:::tip
Expand Down
4 changes: 1 addition & 3 deletions docs/3.tutorials/examples/guest-book.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,7 @@ In order to deploy the contract you will need to create a NEAR account.
Go into the directory containing the smart contract (`cd contract-ts` or `cd contract-rs`), build and deploy it:

```bash
cargo near build

cargo near deploy <accountId>
cargo near deploy build-non-reproducible-wasm <accountId>
```

:::tip
Expand Down
4 changes: 1 addition & 3 deletions docs/3.tutorials/examples/xcc.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ In order to deploy the contract you will need to create a NEAR account.
Go into the directory containing the smart contract (`cd contract-advanced-ts` or `cd contract-advanced-rs`), build and deploy it:

```bash
cargo near build

cargo near deploy <accountId> with-init-call new json-args '{"hello_account":"hello.near-example.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm <accountId> with-init-call new json-args '{"hello_account":"hello.near-example.testnet"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

<hr class="subsection" />
Expand Down
2 changes: 1 addition & 1 deletion docs/3.tutorials/fts/1-skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,5 +181,5 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
:::
4 changes: 2 additions & 2 deletions docs/3.tutorials/fts/2-define-a-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ echo $FT_CONTRACT_ID
Verify that the correct account ID is printed in the terminal. If everything looks correct you can now deploy your contract. For simplicity, let's call the default metadata initialization function you wrote earlier so that you don't have to type the metadata manually in the CLI. In the root of your FT project run the following command to deploy your smart contract.

```bash
cargo near deploy $FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$FT_CONTRACT_ID'", "total_supply": "0"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$FT_CONTRACT_ID'", "total_supply": "0"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

At this point, the contract should have been deployed to your account and initialized.
Expand Down Expand Up @@ -186,6 +186,6 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
- near-cli-rs: `0.17.0`
:::
3 changes: 2 additions & 1 deletion docs/3.tutorials/fts/3-circulating-supply.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ cargo near build
It's time to deploy the contract, initialize it and mint the total supply. Let's create an initial supply of 1000 `gtNEAR`. Since it has 24 decimal places, you should put `1000` followed by 24 zeros in the total supply field.

```bash
cargo near deploy $EVENTS_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$EVENTS_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $EVENTS_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$EVENTS_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

You can check to see if everything went through properly by looking at the output in your CLI:
Expand Down Expand Up @@ -385,6 +385,7 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.13.2`
- cargo-near: `0.6.1`
- near-cli-rs: `0.17.0`
:::
4 changes: 2 additions & 2 deletions docs/3.tutorials/fts/4.storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ cargo near build
It's time to deploy the contract, initialize it and mint the total supply. Let's once again create an initial supply of 1000 `gtNEAR`.

```bash
cargo near deploy $STORAGE_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$STORAGE_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $STORAGE_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$STORAGE_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

If you now query for the storage paid by the owner, you should see that they're registered!
Expand Down Expand Up @@ -235,6 +235,6 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
- near-cli-rs: `0.17.0`
:::
4 changes: 2 additions & 2 deletions docs/3.tutorials/fts/5.transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ cargo near build
It's time to deploy the contract, initialize it and mint the total supply. Let's once again create an initial supply of 1000 `gtNEAR`.

```bash
cargo near deploy $TRANSFER_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$TRANSFER_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $TRANSFER_FT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$TRANSFER_FT_CONTRACT_ID'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

You can check if you own the FTs by running the following command:
Expand Down Expand Up @@ -380,6 +380,6 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
- near-cli-rs: `0.17.0`
:::
10 changes: 5 additions & 5 deletions docs/3.tutorials/fts/6-marketplace.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Let's start by building both the finished FT contract and the marketplace contra


```bash
cd market-contract && cargo near build && cd ..
cd market-contract && cargo near build non-reproducible-wasm && cd ..
```

This will install the dependencies for the marketplace contract as well as the FT contract. Note that there's also `ft-tutorial/out` directory with pre-build nft contract wasm file which you'll use to place the NFTs for sale.
Expand Down Expand Up @@ -174,15 +174,15 @@ Now that you *hopefully* have a good understanding of how the marketplace contra
The first thing you'll want to do is deploy a new FT, NFT, and marketplace contract.

```bash
cd market-contract && cargo near build && cd ..
cd market-contract && cargo near build non-reproducible-wasm && cd ..
```

To deploy the FT contract and export an environment variable, run the following command:

```bash
export FT_CONTRACT=<new-ft-account-id>
near create-account $FT_CONTRACT --useFaucet
cd 5.transfers/ && cargo near deploy $FT_CONTRACT with-init-call new_default_meta json-args '{"owner_id": "'$FT_CONTRACT'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send && cd ../
cd 5.transfers/ && cargo near deploy build-non-reproducible-wasm $FT_CONTRACT with-init-call new_default_meta json-args '{"owner_id": "'$FT_CONTRACT'", "total_supply": "1000000000000000000000000000"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send && cd ../
```

Next, you'll deploy the NFT and marketplace contracts.
Expand All @@ -196,7 +196,7 @@ near deploy $NFT_CONTRACT out/nft-contract.wasm
```bash
export MARKETPLACE_CONTRACT=<new-marketplace-account-id>
near create-account $MARKETPLACE_CONTRACT --useFaucet
cd market-contract/ && cargo near deploy $MARKETPLACE_CONTRACT with-init-call new json-args '{"owner_id": "'$MARKETPLACE_CONTRACT'", "ft_id": "'$FT_CONTRACT'"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send && cd ../
cd market-contract/ && cargo near deploy build-non-reproducible-wasm $MARKETPLACE_CONTRACT with-init-call new json-args '{"owner_id": "'$MARKETPLACE_CONTRACT'", "ft_id": "'$FT_CONTRACT'"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send && cd ../
```

Check and see if your environment variables are all correct by running the following command. Each output should be different.
Expand Down Expand Up @@ -613,6 +613,6 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.77.1`
- near-sdk-rs: `5.1.0` (with enabled `legacy` feature)
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
- near-cli: `4.0.13`
:::
2 changes: 1 addition & 1 deletion docs/3.tutorials/nfts/1-skeleton.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ At the time of this writing, this example works with the following versions:

- rustc: `1.76.0`
- near-sdk-rs: `5.1.0`
- cargo-near: `0.6.1`
- cargo-near: `0.13.2`
- NFT standard: [NEP171](https://nomicon.io/Standards/Tokens/NonFungibleToken/Core), version `1.0.0`

:::
4 changes: 2 additions & 2 deletions docs/3.tutorials/nfts/2-minting.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Verify that the correct account ID is printed in the terminal. If everything loo
In the root of your NFT project run the following command to deploy your smart contract and answer questions:

```bash
cargo near deploy $NFT_CONTRACT_ID
cargo near deploy build-non-reproducible-wasm $NFT_CONTRACT_ID

> Select the need for initialization: with-init-call - Add an initialize
> What is the name of the function? new_default_meta
Expand All @@ -267,7 +267,7 @@ cargo near deploy $NFT_CONTRACT_ID
You don't need to answer these questions every time. If you look at the results you will find the message `Here is the console command if you ever need to re-run it again`. The next line is the command which you may use instead of answering to interactive questions:

```bash
cargo near deploy $NFT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$NFT_CONTRACT_ID'"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $NFT_CONTRACT_ID with-init-call new_default_meta json-args '{"owner_id": "'$NFT_CONTRACT_ID'"}' prepaid-gas '100.0 Tgas' attached-deposit '0 NEAR' network-config testnet sign-with-keychain send
```

You've just deployed and initialized the contract with some default metadata and set your account ID as the owner. At this point, you're ready to call your first view function.
Expand Down
2 changes: 1 addition & 1 deletion docs/3.tutorials/nfts/2-upgrade.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Let's move over to the `enumeration.rs` file and implement that logic:
Now that you've implemented the necessary logic for `nft_tokens_for_owner`, it's time to build and re-deploy the contract to your account. Using the cargo-near, deploy the contract as you did in the previous tutorial:

```bash
cargo near deploy $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
```

Once the contract has been redeployed, let's test and see if the state migrated correctly by running a simple view function:
Expand Down
2 changes: 1 addition & 1 deletion docs/3.tutorials/nfts/3-enumeration.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Next, you can use the CLI to query these new methods and validate that they work
Now that you've implemented the necessary logic for `nft_tokens_for_owner`, it's time to build and re-deploy the contract to your account. Using the cargo-near, deploy the contract as you did in the previous tutorials:

```bash
cargo near deploy $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
```

---
Expand Down
2 changes: 1 addition & 1 deletion docs/3.tutorials/nfts/4-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ With that finished, you've now successfully added the necessary logic to allow u
Using cargo-near, deploy the contract as you did in the previous tutorials:

```bash
cargo near deploy $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
cargo near deploy build-non-reproducible-wasm $NFT_CONTRACT_ID without-init-call network-config testnet sign-with-keychain send
```

:::tip
Expand Down
Loading

0 comments on commit 5b784a4

Please sign in to comment.