# SDKs generation

This section demonstrates the generation and use of SDKs through a simple example in the following programming languages:

We assume you are somewhat familiar with the development environment of your chosen language above (node and npm for Typescript, opam for OCaml, etc.).

Before going into more details, let's introduce the example: we will use a contract we deployed on Ghostnet to illustrate the use of the various SDKs generated by Factori. Its address is KT1Fjiwsmo49yM7jch6KG4ETLFkatF3Qj8of.

All you need to know about the smart contract is that it has two entrypoints:

• hello: it takes a string and puts it in the contract's storage, in addition to some other updates;
• ping: is a NOP, as it doesn't update the contract's storage.

For reference, the corresponding Camligo code is provided below. Note that you don't need to read or understand it to be able to play with the SDKs.

#![allow(unused)]
fn main() {
(* This the contract's storage type. It is made of:
- a [count] field of type nat;
- a [date] field of type timestamp;
- a [msg] field of type string. *)
type storage = {
count : nat;
date : timestamp;
msg: string;
}

(* The type action has two cases, from which two entrypoints
for the contract are derived:
- A [ping] entrypoint, that takes a unit parameter;
- A [hello] entrpypoint, that takes a string parameter. *)
type action = Ping | Hello of string

(* This is the main entry of the smart contract. *)
let main (param, storage : action * storage) =
let ops =  ([] : operation list) in
match param with
| Ping -> (* [ping] enptrypoint is a NOP. *)
ops, storage
| Hello msg ->
(*  [hello] entrypoint puts the message in the storage,
and updates the counter and the date. *)
ops, { count = storage.count + 1n; msg = msg; date = Tezos.get_now () }
}

The corresponding Michelson code is:

{ parameter (or (string %hello) (unit %ping)) ;
storage (pair (pair (nat %count) (timestamp %date)) (string %msg)) ;
code { UNPAIR ;
NIL operation ;
SWAP ;
IF_LEFT
{ NOW ; PUSH nat 1 ; DIG 4 ; CAR ; CAR ; ADD ; PAIR ; PAIR }
{ DROP ; SWAP } ;
SWAP ;
PAIR } }



For a more complete documentation, go to the features > SDK generation section.