Blockchain In TypeScript
TypeScript developed by Microsoft is an open source next generation programming library based on JavaScript and C#. TypeScript is is a superset of JavaScript which mainly offers optional static typing, classes, and interfaces.
ARK Blockchain provides a wrapper for TypeScript developers to build blockchain solutions in TypeScript on top of Ark Blockchain.
The API wrapper is TSARK. TSARK compiles into ES5 so you can work with both, ECMAScript or TypeScript.
TypeScript Blockchain Examples
Get delegate list from Devnet network.
- import { Client, Network, NetworkType } from 'ark-ts';
-
- const devnet = Network.getDefault(NetworkType.Devnet);
- const client = new Client(devnet);
-
- client.delegate.list().subscribe((list) => {
- console.log(list);
- });
Get address from passphrase.
- import { PrivateKey } from 'ark-ts/core';
-
-
- const key = PrivateKey.fromSeed('my secret passphrase');
- console.log(key.getPublicKey().getAddress());