near-sdk-js
  • README
  • packages
  • api
    • functions
      • accountBalance
      • accountLockedBalance
      • altBn128G1Multiexp
      • altBn128G1Sum
      • altBn128PairingCheck
      • attachedDeposit
      • blockHeight
      • blockIndex
      • blockTimestamp
      • currentAccountId
      • ecrecover
      • epochHeight
      • input
      • inputRaw
      • keccak256
      • keccak512
      • log
      • logUtf16
      • logUtf8
      • panicUtf8
      • predecessorAccountId
      • prepaidGas
      • promiseAnd
      • promiseBatchActionAddKeyWithFullAccess
      • promiseBatchActionAddKeyWithFunctionCall
      • promiseBatchActionCreateAccount
      • promiseBatchActionDeleteAccount
      • promiseBatchActionDeleteKey
      • promiseBatchActionDeployContract
      • promiseBatchActionFunctionCall
      • promiseBatchActionFunctionCallRaw
      • promiseBatchActionFunctionCallWeight
      • promiseBatchActionFunctionCallWeightRaw
      • promiseBatchActionStake
      • promiseBatchActionTransfer
      • promiseBatchCreate
      • promiseBatchThen
      • promiseCreate
      • promiseCreateRaw
      • promiseResult
      • promiseResultRaw
      • promiseResultsCount
      • promiseReturn
      • promiseThen
      • promiseThenRaw
      • randomSeed
      • ripemd160
      • sha256
      • signerAccountId
      • signerAccountPk
      • storageByteCost
      • storageGetEvicted
      • storageGetEvictedRaw
      • storageHasKey
      • storageHasKeyRaw
      • storageRead
      • storageReadRaw
      • storageRemove
      • storageRemoveRaw
      • storageUsage
      • storageWrite
      • storageWriteRaw
      • usedGas
      • validatorStake
      • validatorTotalStake
      • valueReturn
      • valueReturnRaw
  • collections
    • lookup-map
      • classes
        • LookupMap
    • lookup-set
      • classes
        • LookupSet
    • subtype
      • classes
        • SubType
    • unordered-map
      • classes
        • UnorderedMap
    • unordered-set
      • classes
        • UnorderedSet
    • vector
      • classes
        • Vector
        • VectorIterator
  • index
    • functions
      • includeBytes
  • near-bindgen
    • functions
      • NearBindgen
      • call
      • initialize
      • middleware
      • migrate
      • view
  • promise
    • classes
      • AddAccessKey
      • AddFullAccessKey
      • CreateAccount
      • DeleteAccount
      • DeleteKey
      • DeployContract
      • FunctionCall
      • FunctionCallRaw
      • FunctionCallWeight
      • FunctionCallWeightRaw
      • NearPromise
      • PromiseAction
      • PromiseJoint
      • Stake
      • Transfer
    • type-aliases
      • PromiseOrValue
  • types
    • account_id
      • type-aliases
        • AccountId
    • collections
      • interfaces
        • GetOptions
    • gas
      • type-aliases
        • Gas
      • variables
        • ONE_TERA_GAS
    • primitives
      • type-aliases
        • Balance
        • BlockHeight
        • EpochHeight
        • GasWeight
        • Nonce
        • StorageUsage
      • variables
        • ONE_NEAR
        • ONE_YOCTO
    • public_key
      • classes
        • Base58Error
        • InvalidLengthError
        • ParsePublicKeyError
        • PublicKey
        • UnknownCurve
      • enumerations
        • CurveType
      • functions
        • curveTypeFromStr
    • vm_types
      • enumerations
        • PromiseError
        • PromiseResult
      • type-aliases
        • IteratorIndex
        • ReceiptIndex
  • utils
    • classes
      • TextDecoder
      • TextEncoder
    • functions
      • assert
      • bytes
      • concat
      • decode
      • decodeObj2class
      • deserialize
      • encode
      • getValueWithOptions
      • serialize
      • serializeValueWithOptions
      • str
      • validateAccountId
    • interfaces
      • Env
      • IntoStorageKey
    • type-aliases
      • Mutable
      • NearAmount
      • PromiseIndex
      • Register
    • variables
      • ERR_INCONSISTENT_STATE
      • ERR_INDEX_OUT_OF_BOUNDS
  • version
    • variables
      • LIB_VERSION
  • cli
    • abi
      • functions
        • runAbiCompilerPlugin
    • cli
      • functions
        • buildCom
        • checkTypescriptCom
        • createJsFileWithRollupCom
        • generateAbi
        • transpileJsAndBuildWasmCom
        • validateCom
    • post-install
    • utils
      • functions
        • download
        • executeCommand
        • validateContract
    • build-tools
      • include-bytes
        • functions
          • default
      • near-bindgen-exporter
        • functions
          • default
Powered by GitBook
On this page
  • NEAR JavaScript SDK
  • Documentation
  • Prerequisites
  • Quick Start
  • Contributing
  • License

README

Nextpackages

Last updated 6 months ago

near-sdk-js v2.0.0 •


NEAR JavaScript SDK

A JavaScript library for writing NEAR smart contracts.

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

Documentation

Prerequisites

  • node >=14 <16.6.0 || >16.6.0

  • pnpm >=7

Quick Start

npx create-near-app

This will scaffold a basic template for you 😎

Contributing

License

See more in the .

Check our

Find with common use cases

Lookup available features in

🏠 Learn more about NEAR on our

Breaking features diff from

Use to quickly get started writing smart contracts in JavaScript on NEAR.

If you are interested in contributing, please look at the .

🐞

💡

💪

This repository is distributed under the terms of both the and the (Version 2.0). See and for details.

Anatomy of a Contract
Learn how to use
Learn by example with AgorApp
Learn by example with NEAR Docs
detailed examples and tutorials
source code examples
API reference
Documentation website
SDK 2.0.0 to 1.0.0
create-near-app
contributing guidelines
Report issues you encounter
Provide suggestions or feedback
Show us what you've built!
MIT license
Apache License
LICENSE
LICENSE-APACHE
Docs