-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: Added a simple contract to the README, and added a link to Agor…
…App courses (#407)
- Loading branch information
Showing
1 changed file
with
35 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
# NEAR JavaScript SDK | ||
|
||
<p> | ||
<a href="https://docs.near.org/tools/sdk" target="_blank"> | ||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-JS/TS-brightgreen.svg" /> | ||
</a> | ||
<a href="https://www.npmjs.com/package/near-sdk-js" target="_blank"> | ||
<img alt="Version" src="https://img.shields.io/npm/v/near-sdk-js.svg"> | ||
</a> | ||
<img src="https://img.shields.io/badge/node-%3E%3D14%20%3C16.6.0%20%7C%7C%20%3E16.6.0-blue.svg" /> | ||
<img src="https://img.shields.io/badge/pnpm-%3E%3D7-blue.svg" /> | ||
<a href="https://docs.near.org/sdk/js/introduction" target="_blank"> | ||
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" /> | ||
</a> | ||
<a href="https://github.com/near/near-sdk-js/blob/develop/LICENSE" target="_blank"> | ||
<img alt="License: LICENSE" src="https://img.shields.io/badge/License-MIT-yellow.svg" /> | ||
</a> | ||
|
@@ -19,28 +18,51 @@ | |
|
||
A JavaScript library for writing NEAR smart contracts. | ||
|
||
## Prerequisites | ||
|
||
- node >=14 <16.6.0 || >16.6.0 | ||
- pnpm >=7 | ||
```typescript | ||
import { NearBindgen, near, call, view } from 'near-sdk-js'; | ||
|
||
## Quick Start | ||
@NearBindgen({}) | ||
class HelloNear { | ||
greeting: string = 'Hello'; | ||
|
||
Use [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR. | ||
@view({}) // This method is read-only and can be called for free | ||
get_greeting(): string { | ||
return this.greeting; | ||
} | ||
|
||
npx create-near-app | ||
@call({}) // This method changes the state, for which it cost gas | ||
set_greeting({ greeting }: { greeting: string }): void { | ||
near.log(`Saving greeting ${greeting}`); | ||
this.greeting = greeting; | ||
} | ||
} | ||
``` | ||
|
||
This will scaffold a basic template for you 😎 | ||
See more in the [Anatomy of a Contract](https://docs.near.org/build/smart-contracts/anatomy/). | ||
|
||
## Documentation | ||
|
||
- [Learn how to use](https://docs.near.org/build/smart-contracts/quickstart) the library in your project | ||
- [Learn by example with AgorApp](https://agorapp.dev/catalog/all?difficulty=&chains=near) | ||
- [Learn by example with NEAR Docs](https://docs.near.org/build/smart-contracts/quickstart) | ||
- Check our [detailed examples and tutorials](https://docs.near.org/tutorials/welcome) | ||
- Find [source code examples](https://github.com/near/near-sdk-js/tree/develop/examples) with common use cases | ||
- Lookup available features in [API reference](https://near.github.io/near-sdk-js/) | ||
- 🏠 Learn more about NEAR on our [Documentation website](https://docs.near.org/) | ||
- Breaking features diff from [SDK 2.0.0 to 1.0.0](https://github.com/near/near-sdk-js/tree/develop/[email protected]) | ||
|
||
## Prerequisites | ||
|
||
- node >=14 <16.6.0 || >16.6.0 | ||
- pnpm >=7 | ||
|
||
## Quick Start | ||
|
||
Use [`create-near-app`](https://github.com/near/create-near-app) to quickly get started writing smart contracts in JavaScript on NEAR. | ||
|
||
npx create-near-app | ||
|
||
This will scaffold a basic template for you 😎 | ||
|
||
## Contributing | ||
|
||
If you are interested in contributing, please look at the [contributing guidelines](https://github.com/near/near-sdk-js/tree/develop/CONTRIBUTING.md). | ||
|