Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix deploy commands for js examples #2408

Merged
merged 1 commit into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading