Blockchain In TypeScript

 
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.
 
TSARK is available on Github: https://github.com/ArkEcosystem/ark-ts
 
TypeScript Blockchain Examples
 
Get delegate list from Devnet network.
  1. import { Client, Network, NetworkType } from 'ark-ts';  
  2.   
  3. const devnet = Network.getDefault(NetworkType.Devnet);  
  4. const client = new Client(devnet);  
  5.   
  6. client.delegate.list().subscribe((list) => {  
  7. console.log(list);  
  8. });  
Get address from passphrase.
  1. import { PrivateKey } from 'ark-ts/core';  
  2.   
  3. // if no specify a second param, default is mainnet  
  4. const key = PrivateKey.fromSeed('my secret passphrase');  
  5. console.log(key.getPublicKey().getAddress()); // AaWU6X3pGdtSCK3s9weo9tjth64F3hixgT