Skip to content

Commit

Permalink
fix: hardcode project name
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillermo Alejandro Gallardo Diez authored and Guillermo Alejandro Gallardo Diez committed Jan 4, 2025
1 parent 66cbb95 commit 5022f33
Showing 1 changed file with 42 additions and 38 deletions.
80 changes: 42 additions & 38 deletions docs/2.build/2.smart-contracts/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ _Creating a project using `create-near-app`_
This will generate a project with the following structure:

```bash
hello-near
├── sandbox-test # sandbox testing
│ └── main.ava.js
├── src # contract's code
Expand All @@ -104,12 +105,18 @@ This will generate a project with the following structure:
└── tsconfig.json
```

:::tip

We recommend you to name your project `hello-near` for this tutorial, but feel free to use any name you prefer

:::

</TabItem>

<TabItem value="rust" label="🦀 Rust">

```bash
cargo near new <project_name>
cargo near new hello-near
```

![img](@site/static/docs/hello-near-rs.gif)
Expand All @@ -118,6 +125,7 @@ _Creating a project using `cargo near new`_
This will generate a project with the following structure:

```bash
hello-near
├── src # contract's code
│ └── lib.rs
├── tests # sandbox testing
Expand All @@ -127,6 +135,12 @@ This will generate a project with the following structure:
└── rust-toolchain.toml
```

:::tip

`hello-near` is the name we chose for this project so the tutorial is simpler to follow, but for future projects feel free to use any name you prefer

:::

</TabItem>

</Tabs>
Expand Down Expand Up @@ -289,7 +303,7 @@ When you are ready to create a build of the contract run a one-line command depe

:::info

If you encounter issues with Docker you can use the `non-reproducible-wasm` option to skip creating a reproducible build
For this tutorial we will use the `non-reproducible-wasm` option when building the contract, but please know that you can create a reproducible build if you have `Docker` installed

:::

Expand All @@ -303,54 +317,45 @@ When you are ready to create a build of the contract run a one-line command depe

Having our account created, we can now deploy the contract:


<Tabs groupId="cli-tabs">
<TabItem value="js" label="🌐 JavaScript">
<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">

<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">

```bash
near deploy <created-account> build/hello_near.wasm
```
```bash
near deploy <created-account> ./build/hello_near.wasm
```

</TabItem>
</TabItem>
<TabItem value="full" label="Full">

<TabItem value="full" label="Full">

```bash
near contract deploy <created-account> use-file ./target/near/hello.wasm without-init-call network-config testnet sign-with-keychain send
```

</TabItem>

</Tabs>
```bash
near contract deploy <created-account> use-file ./build/hello_near.wasm without-init-call network-config testnet sign-with-keychain send
```

</TabItem>
</Tabs>
</TabItem>

<TabItem value="rust" label="🦀 Rust">

<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">
<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">

```bash
near deploy <created-account> ./target/near/<generated-file>.wasm
```
```bash
near deploy <created-account> ./target/near/hello_near.wasm
```

</TabItem>
</TabItem>

<TabItem value="full" label="Full">
<TabItem value="full" label="Full">

```bash
near contract deploy <created-account> use-file ./target/near/<generated-file>.wasm without-init-call network-config testnet sign-with-keychain send
```
```bash
near contract deploy <created-account> use-file ./target/near/hello_near.wasm without-init-call network-config testnet sign-with-keychain send
```

</TabItem>
</Tabs>
</TabItem>

</Tabs>

</TabItem>

</Tabs>

**Congrats**! Your contract now lives in the NEAR testnet network.
Expand All @@ -364,8 +369,7 @@ To interact with your deployed smart contract, you can call its functions throug
<hr class="subsection" />

#### Get Greeting

The `get_greeting` function only reads from the contract's state, and can thus be called for **free**.
Let's start by fetching the greeting stored in the contract. The `get_greeting` function only reads from the contract's state, and can thus be called for **free**.

<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">
Expand All @@ -389,7 +393,7 @@ The `get_greeting` function only reads from the contract's state, and can thus b

#### Set Greeting

The `set_greeting` method writes on the contract's [storage](./anatomy/storage.md), and thus requires a user to sign a transaction in order to be executed.
We can now change the greeting stored in the contract. The `set_greeting` method writes on the contract's [storage](./anatomy/storage.md), and thus requires a user to sign a transaction in order to be executed.

<Tabs groupId="cli-tabs">
<TabItem value="short" label="Short">
Expand Down

0 comments on commit 5022f33

Please sign in to comment.