1 of 7

Team

Kostya Mospan

Smart-Contracts Developer, Kharkiv, Ukraine

Ilya Kubariev

Full-Stack Blockchain Developer, Kharkiv, Ukraine

2 of 7

TypeGen

Like TypeChain in EVM, but TypeGen in NEAR;

1. Speeds-up the development of client-side code by x3;

2. Adds extra safety for front-end code, removing human factor;

3. Cleans up the front-end code, by abstracting developers from boilerplate

3 of 7

Problem

  1. Dynamic typing leading to less security on client-side
  2. Manual smart contract method selection by function name as a string, leading to Run-Time Errors
  3. Boilerplate code on Front-End, leading to Slow Front-End Development

Calling a method and passing parameters. Everything is non-typed, and method is selected by a string literal.

Example 1 (Hello-NEAR):

Example 2 (Hello-NEAR):

Viewing a method and passing parameters. Everything is non-typed, and method is selected by a string literal.

4 of 7

Solution

TypeGen tool that analyzes smart-contract’s code, generates ABI files and front-end types and functions;

BEFORE:

AFTER:

  1. Static typing - you will never call not existing method again (SAFETY);
  2. Boilerplate abstraction - native promises, safety checks and others (SPEED);
  3. Compatibility - under the hood it uses near-api-js so it's fully compatible (COMPATIBILITY);

5 of 7

Architecture

Near Contract

Client-side type definitions

Application Blockchain Interface

03

01

02

6 of 7

End Result

  1. We get a class-per-class API (Per Smart Contract class, there is a Client Class)
  2. We can call the functions in a typed way like below:

7 of 7

Thanks!