NearApi Build StatusHex pmhex.pm downloads

Elixir library for DApps development on the NEAR blockchain platform

Currently in active development, so not recommended to use in production

Installation

If available in Hex, the package can be installed by adding near_api to your list of dependencies in mix.exs:

def deps do
  [
    {:near_api, "~> 0.1.3"}
  ]
end

Usage

We used Livebook for API documentation. To see NEAR API in action please clone this repository and run Livebook locally from your project folder with corresponding .livemd file loaded.

Access Keys

Retrieve information about an account's access keys.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/access-keys">NEAR API Docs: Access Keys</a>

Livebook

Accounts / Contracts

View details about accounts and contracts as well as perform contract calls.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/contracts">NEAR API Docs: Accounts / Contracts</a>

Block / Chunk (In Progress)

Query the network and get details about specific blocks or chunks.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/block-chunk">NEAR API Docs: Block / Chunk</a>

Gas (Backlog)

Get gas price for a specific block or hash.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/gas">NEAR API Docs: Gas</a>

Protocol (Backlog)

Retrieve current genesis and protocol configuration.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/protocol">NEAR API Docs: Protocol</a>

Network (Backlog)

Return status information for nodes and validators.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/network">NEAR API Docs: Network</a>

Transactions (Backlog)

Send transactions and query their status.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/transactions">NEAR API Docs: Transactions</a>

Sandbox (Backlog)

Patch state on a local sandbox node.

Docs: <a target="_blank" href="https://docs.near.org/docs/api/rpc/sandbox">NEAR API Docs: Sandbox</a>

Development

It is recommended to run local sandbox node for faster development and run automated tests. To install nearcore sandbox locally do the following from the project root:

cd bin && ./install_sandbox.sh

The sandbox will be installed into git-ignored directory test/sandbox. To run sandbox node, run from the project root directory:

cd bin && ./run_sandbox.sh

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/alexfilatov/near_api.

  1. Fork
  2. Create Pull request

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/near_api.