Skip to content

Commit

Permalink
fix deploy commands for js examples
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 5b784a4 commit 726d884
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 17 deletions.
22 changes: 19 additions & 3 deletions docs/3.tutorials/examples/advanced-xcc.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,25 @@ 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 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
```
<Tabs groupId="code-tabs">

<TabItem value="js" label="🌐 JavaScript">

```bash
npm run build
near deploy <accountId> ./build/cross_contract.wasm --initFunction new --initArgs '{"hello_account":"hello.near-example.testnet","guestbook_account":"guestbook_account.near-example.testnet","counter_account":"counter_account.near-example.testnet"}'
```

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

```bash
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
```

</TabItem>

</Tabs>

<hr class="subsection" />

Expand Down
26 changes: 22 additions & 4 deletions docs/3.tutorials/examples/count-near.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The contract presents 4 methods: `get_num`, `increment`, `decrement`, and `reset
<Language value="js" language="ts">
<Github fname="contract.ts"
url="https://github.com/near-examples/counters/blob/main/contract-ts/src/contract.ts"
start="3" end="29" />
start="3" end="33" />
</Language>
<Language value="rust" language="rust">
<Github fname="lib.rs"
Expand Down Expand Up @@ -182,13 +182,31 @@ 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 deploy build-non-reproducible-wasm <accountId>
```
<Tabs groupId="code-tabs">

<TabItem value="js" label="🌐 JavaScript">

```bash
npm run build
near deploy <accountId> ./build/counter.wasm
```

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

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

</TabItem>

</Tabs>

:::tip
To interact with your contract from the [frontend](#frontend), simply replace the value of the `testnet` key in the `config.js` file.
:::


<hr class="subsection" />

### CLI: Interacting with the Contract
Expand Down
22 changes: 19 additions & 3 deletions docs/3.tutorials/examples/donation.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,25 @@ 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 deploy build-non-reproducible-wasm <accountId>
```
<Tabs groupId="code-tabs">

<TabItem value="js" label="🌐 JavaScript">

```bash
npm run build
near deploy <accountId> ./build/donation.wasm
```

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

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

</TabItem>

</Tabs>

:::tip
To interact with your contract from the [frontend](#frontend), simply replace the variable `CONTRACT_NAME` in the `index.js` file.
Expand Down
24 changes: 20 additions & 4 deletions docs/3.tutorials/examples/guest-book.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You have two options to start the Guest book Example.
2. Clone the repository locally and use it from your computer.

| Codespaces | Clone locally |
| --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
|-----------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------|
| [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/near-examples/guest-book-examples) | 🌐 `https://github.com/near-examples/guest-book-examples` |

---
Expand Down Expand Up @@ -183,9 +183,25 @@ 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 deploy build-non-reproducible-wasm <accountId>
```
<Tabs groupId="code-tabs">

<TabItem value="js" label="🌐 JavaScript">

```bash
npm run build
near deploy <accountId> ./build/guest_book.wasm
```

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

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

</TabItem>

</Tabs>

:::tip
To interact with your contract from the [frontend](#frontend), simply replace the variable `CONTRACT_NAME` in the `index.js` file.
Expand Down
23 changes: 20 additions & 3 deletions docs/3.tutorials/examples/xcc.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,26 @@ 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 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
```
<Tabs groupId="code-tabs">

<TabItem value="js" label="🌐 JavaScript">

```bash
npm run build
near deploy <accountId> ./build/cross_contract.wasm --initFunction new --initArgs '{"hello_account":"hello.near-example.testnet"}'
```

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

```bash
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

```

</TabItem>

</Tabs>

<hr class="subsection" />

Expand Down

0 comments on commit 726d884

Please sign in to comment.