Skip to content

open-web-academy/GuestBook-JS

Repository files navigation

Guest Book 📖

Build Status

The Guest Book is a simple app that stores messages from users, allowing to pay for a premium message.

What This Example Shows

  1. How to receive $NEAR on a contract.
  2. How to store and retrieve information from the blockchain.
  3. How to use a Vector.
  4. How to interact with a contract from React JS.

Quickstart

Clone this repository locally or open it in gitpod. Then follow these steps:

1. Install Dependencies

npm install

2. Test the Contract

Deploy your contract in a sandbox and simulate interactions from users.

npm test

3. Deploy the Contract

Build the contract and deploy it in a testnet account

npm run build

near deploy account_name.testnet contract/build/contract.wasm

4. Get Messages

near view librovisitas.testnet get_messages '{"from_index":0, "limit":10}'

5. Add New Message

near call librovisitas.testnet add_message '{"text": "Primer mensaje"}' --accountId yairnava.testnet
near call owaguestbook.testnet add_message '{"text": "Primer mensaje premium"}' --amount 0.1 --accountId yairnava.testnet

6. Get Total Messages

near view guestbook1.testnet total_messages

Learn More

  1. Learn more about the contract through its README.
  2. Check our documentation.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published