diff --git a/README.md b/README.md index 07cda6d8..1a5879d8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,13 @@ # NEAR JavaScript SDK
+ + + - - - - @@ -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/near-sdk-js@2.0.0-diff-1.0.0.md) +## 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).