• Stars
    star
    280
  • Rank 147,492 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 6 years ago
  • Updated 6 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The official JavaScript SDK for Algorand.

js-algorand-sdk

CircleCI npm version

AlgoSDK is the official JavaScript library for communicating with the Algorand network. It's designed for modern browsers and Node.js.

Installation

Node.js

$ npm install algosdk

This package provides TypeScript types, but you will need TypeScript version 4.2 or higher to use them properly.

Browser

Include a minified browser bundle directly in your HTML like so:

<script
  src="https://unpkg.com/[email protected]/dist/browser/algosdk.min.js"
  integrity="sha384-vb9VngcgEwkDszQ4wPAsk/oiOfBcbEjNG+Icx9erSJMLZCDPNp0ncx22oBM+8Xji"
  crossorigin="anonymous"
></script>

or

<script
  src="https://cdn.jsdelivr.net/npm/[email protected]/dist/browser/algosdk.min.js"
  integrity="sha384-vb9VngcgEwkDszQ4wPAsk/oiOfBcbEjNG+Icx9erSJMLZCDPNp0ncx22oBM+8Xji"
  crossorigin="anonymous"
></script>

Information about hosting the package for yourself, finding the browser bundles of previous versions, and computing the SRI hash is available here.

Quick Start

const token = 'Your algod API token';
const server = 'http://127.0.0.1';
const port = 8080;
const client = new algosdk.Algodv2(token, server, port);

(async () => {
  console.log(await client.status().do());
})().catch((e) => {
  console.log(e);
});

Documentation

Documentation for this SDK is available here: https://algorand.github.io/js-algorand-sdk/. Additional resources are available on https://developer.algorand.org.

Examples

Running examples requires access to a running node. Follow the instructions in Algorand's developer resources to install a node on your computer.

As portions of the codebase are written in TypeScript, example files cannot be run directly using node. Please refer to the instructions described in the examples/README.md file for more information regarding running the examples.

SDK Development

Building

To build a new version of the library, run:

npm run build

Generating Documentation

To generate the documentation website, run:

npm run docs

The static website will be located in the docs/ directory.

Testing

We have two test suites: mocha tests in this repo, and the Algorand SDK test suite from https://github.com/algorand/algorand-sdk-testing.

Node.js

To run the mocha tests in Node.js, run:

npm test

To run the SDK test suite in Node.js, run:

make docker-test

Browsers

The test suites can also run in browsers. To do so, set the environment variable TEST_BROWSER to one of our supported browsers. Currently we support testing in chrome and firefox. When TEST_BROWSER is set, the mocha and SDK test suites will run in that browser.

For example, to run mocha tests in Chrome:

TEST_BROWSER=chrome npm test

And to run SDK tests in Firefox:

TEST_BROWSER=firefox make docker-test

Code Style

This project enforces a modified version of the Airbnb code style.

We've setup linters and formatters to help catch errors and improve the development experience:

  • Prettier – ensures that code is formatted in a readable way.
  • ESLint — checks code for antipatterns as well as formatting.

If using the Visual Studio Code editor with the recommended extensions, ESLint errors should be highlighted in red and the Prettier extension should format code on every save.

Precommit Hook

The linters and formatters listed above should run automatically on each commit to catch errors early and save CI running time.

License

js-algorand-sdk is licensed under an MIT license. See the LICENSE file for details.

More Repositories

1

go-algorand

Algorand's official implementation in Go.
Go
1,328
star
2

pyteal

Algorand Smart Contracts in Python
Python
280
star
3

py-algorand-sdk

Algorand Python SDK
Python
256
star
4

sandbox

Algorand node sandbox
Shell
235
star
5

go-algorand-sdk

Algorand Golang SDK
Go
184
star
6

indexer

searchable history and current state
Go
115
star
7

smart-contracts

Example stateful and stateless smart contracts.
JavaScript
69
star
8

java-algorand-sdk

Algorand SDK for Java7+ to interact with the Algorand network
Java
66
star
9

auction-demo

An example smart contract NFT auction on Algorand
Python
57
star
10

bls_sigs_ref

Algorand's reference implementation of bls signature scheme
Python
47
star
11

pointproofs

Rust
46
star
12

go-algorand-doc

Documentation for Algorand's Go implementation
Shell
39
star
13

conduit

Algorand's data pipeline framework.
Go
35
star
14

pyteal-utils

Python
29
star
15

node-ui

Terminal UI for remote Algorand node management.
Go
27
star
16

ledger-app-algorand

C
23
star
17

algorand-sdk-testing

Testing framework for Algorand SDKs
Gherkin
20
star
18

pairing-plus

This is a fork of pairing library with additional efficiency functionality improvement.
Rust
20
star
19

falcon

C
20
star
20

graviton

🧑‍🔬 verify your TEAL program by experiment and observation
Jupyter Notebook
18
star
21

pixel

Algorand's implementation of pixel consensus signature
Rust
18
star
22

vrf

Some tools for debugging/testing the VRF
C
13
star
23

tealviewer

JavaScript
11
star
24

reach-auction

Getting Started With Reach
JavaScript
11
star
25

mule

General automation framework
Python
11
star
26

msgp

Go
10
star
27

light-client-poc

Go
9
star
28

code-samples

Code samples tied to tutorials and solutions.
JavaScript
8
star
29

go-sumhash

Go
8
star
30

generator

OpenAPI parser/generator.
Java
7
star
31

symteal

Symteal is an automated verification framework for Algorand
Racket
6
star
32

go-stateproof-verification

Go
6
star
33

avm-abi

ARC-4 ABI Reference Implementation
Go
6
star
34

pointproofs-paramgen

Rust
5
star
35

pixel_param

A rust implementation for parameter generations of Pixel signature scheme
Rust
5
star
36

avm-debugger

Debug Adapter Protocol Debugger for the Algorand Virtual Machine
JavaScript
5
star
37

messagepack-debugger

Visually compare MessagePack objects to assist with debugging.
Kotlin
4
star
38

DerivhackExamples

Examples for the 2019 Derivhack Hackathon
Java
4
star
39

app-service

Java
4
star
40

graphtrace

System for tracing timing and propagation of messages across a mesh network
Go
4
star
41

wallet_addresses

Algorand Inc.'s Wallet Addresses: https://github.com/algorand/wallet_addresses
3
star
42

stateful-teal-auction-demo

A demo of an auction on stateful TEAL.
Shell
3
star
43

conduit-plugin-template

Get started with Algorand streaming APIs with Conduit plugin templates project.
Go
3
star
44

tealsign-demo

Shell
2
star
45

conduit-cockroachdb

Experimental CockroachDB exporter for Conduit.
Go
2
star
46

aardvark-prototype

Aardvark evaluation artifact
Go
2
star
47

tealfuzz

Go
2
star
48

sortition

C++
1
star
49

ledgerfuzz

C
1
star
50

Derivhack-Demo

1
star
51

walletconnect-automation

Automation for deploying walletconnect to eks
Shell
1
star
52

py-exebot

Bot for executing code off-chain.
1
star