# README

**near-sdk-js v2.0.0** • [**Docs**](https://near-sdk-js.gitbook.io/near-sdk-js/packages)

***

## NEAR JavaScript SDK

[![Documentation](https://img.shields.io/badge/documentation-JS/TS-brightgreen.svg) ](https://docs.near.org/tools/sdk)[![Version](https://img.shields.io/npm/v/near-sdk-js.svg) ](https://www.npmjs.com/package/near-sdk-js)![](https://img.shields.io/badge/node-%3E%3D14%20%3C16.6.0%20||%20%3E16.6.0-blue.svg) [![License: LICENSE](https://img.shields.io/badge/License-MIT-yellow.svg) ](https://github.com/near/near-sdk-js/blob/develop/LICENSE)[![License: LICENSE](https://img.shields.io/badge/License-Apache-yellow.svg)](https://github.com/near/near-sdk-js/blob/develop/LICENSE-APACHE)

A JavaScript library for writing NEAR smart contracts.

```typescript
import { NearBindgen, near, call, view } from 'near-sdk-js';

@NearBindgen({})
class HelloNear {
  greeting: string = 'Hello';

  @view({}) // This method is read-only and can be called for free
  get_greeting(): string {
    return this.greeting;
  }

  @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;
  }
}
```

See more in the [Anatomy of a Contract](https://docs.near.org/build/smart-contracts/anatomy/).

### Documentation

* [Learn how to use](https://github.com/near/create-near-app/tree/master/templates/contracts/ts)
* [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).

* [Report issues you encounter](https://github.com/near/near-sdk-js/issues) 🐞
* [Provide suggestions or feedback](https://github.com/near/near-sdk-js/discussions) 💡
* [Show us what you've built!](https://github.com/near/near-sdk-js/discussions/categories/show-and-tell) 💪

### License

This repository is distributed under the terms of both the [MIT license](https://github.com/near/near-sdk-js/blob/develop/LICENSE) and the [Apache License](https://github.com/near/near-sdk-js/blob/develop/LICENSE-APACHE) (Version 2.0). See [LICENSE](https://github.com/near/near-sdk-js/tree/develop/LICENSE) and [LICENSE-APACHE](https://github.com/near/near-sdk-js/tree/develop/LICENSE-APACHE) for details.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://near-sdk-js.gitbook.io/near-sdk-js/readme.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
