Skip to content
Merged
44 changes: 44 additions & 0 deletions docs/get-started/plu-ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
id: plu-ts
title: Get Started with `plu-ts`
sidebar_label: plu-ts
description: Get Started with `plu-ts`
---

`plu-ts` is a Typescript-embedded smart contract programming language and a transaction creation library.

## Installation

### Add `plu-ts` as dependecy

To install `plu-ts` you can use `npm` (or the node package manager of your coiche) and run the following in you root project.

```sh
npm install @harmoniclabs/plu-ts
```

### Get `plu-ts` from source

First clone the git repository

```sh
git clone https://github.com/HarmonicLabs/plu-ts.git
```

then run `npm install` to set up everything
```sh
npm install
```

and finally build the project using
```sh
npm run build
```

the output can be found in the `dist` directory under the project root.

## Hello World

You now have all you need to start your adventure with Typescript smart contracts. Have a look at the [hello world example contract](https://pluts.harmoniclabs.tech/docs/examples/Hello%20World).

Visit the `plu-ts` website and explore [other examples](https://pluts.harmoniclabs.tech/docs/category/examples).
1 change: 1 addition & 0 deletions docs/smart-contracts/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ In another world, you'd like to build programs, possibly even replace a major co
- [Marlowe](marlowe) - a domain-specific language, it covers the world of financial contracts.
- [opshin](opshin) - a programming language for generic Smart Contracts based on Python.
- [Plutus](plutus) - a platform to write full applications that interact with the Cardano blockchain.
- [plu-ts](plu-ts) - Typescript-embedded smart contract programming language and a transaction creation library.

63 changes: 63 additions & 0 deletions docs/smart-contracts/plu-ts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
id: plu-ts
title: plu-ts
sidebar_label: plu-ts
description: plu-ts
image: ../img/plu_ts-logo.svg
---

## Introduction

[`plu-ts`](https://github.com/HarmonicLabs/plu-ts) is a Typescript-embedded programming language and library for developing smart contracts on the Cardano blockchain. It is designed for smart contract efficiency while staying as close as possible to the Typescript syntax.

The tool is composed by the eDSL that allows you to create smart contracts and compile them; and an off-chain library that introuduces all the types required to interact with the Cardano ledger and create transactions.

## Getting started

Visit the [Get started with plu-ts](/docs/get-started/plu-ts) to install plu-ts unsing `npm` and setup your project.

You can find the documentatition for `plu-ts` at [pluts.harmoniclabs.tech](https://pluts.harmoniclabs.tech/docs/intro).

If you need help feel free to open issues at the [`plu-ts` git repository](https://github.com/HarmonicLabs/plu-ts).


### Example contract

some example projects can be found [in the `plu-ts` documentation](https://pluts.harmoniclabs.tech/docs/category/examples);

here we report the `Hello plu-ts` contract; to see how it works you can follow [the example project](https://pluts.harmoniclabs.tech/docs/examples/Hello%20World#run-the-template).

```ts
import { bool, compile, makeValidator, PaymentCredentials, pBool, pfn, Script, ScriptType, PScriptContext, bs, PPubKeyHash } from "@harmoniclabs/plu-ts";

const contract = pfn([
PPubKeyHash.type,
bs,
PScriptContext.type
], bool)
(( owner, message, ctx ) => {

const isBeingPolite = message.eq("Hello plu-ts");

const signedByOwner = ctx.tx.signatories.some( owner.eqTerm );

return isBeingPolite.and( signedByOwner );
});

// all validators must be untyped once on-chain
export const untypedValidator = makeValidator( contract );

// here we get the raw bytes of the contract
export const compiledContract = compile( untypedValidator );

// the `script` object can be used offchain
export const script = new Script(
ScriptType.PlutusV2,
compiledContract
);
```

## Links
- [`plu-ts` documentation](https://pluts.harmoniclabs.tech/docs/intro)
- [`plu-ts` Github Repository](https://github.com/HarmonicLabs/plu-ts).

24 changes: 24 additions & 0 deletions src/data/builder-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,30 @@ export const Showcases = [
getstarted: null,
tags: ["javascript", "plutus"],
},
{
title: "plu-ts",
description: "Typescript-embedded smart contract programming language and transaction creation library",
preview: require("./builder-tools/plu-ts.svg"),
website: "https://pluts.harmoniclabs.tech/docs/intro",
getstarted: "/docs/get-started/plu-ts",
tags: ["plutus", "javascript", "typescript", "serialization"],
},
{
title: "cardanocli-pluts",
description: "Wrapper of the cardano-cli tool based on the plu-ts offchain types",
preview: require("./builder-tools/plu-ts.svg"),
website: "https://github.com/HarmonicLabs/cardanocli-pluts",
getstarted: null,
tags: ["javascript", "typescript", "serialization"],
},
{
title: "koios-pluts",
description: "Wrapper of the koios tool based on the plu-ts offchain types",
preview: require("./builder-tools/plu-ts.svg"),
website: "https://github.com/HarmonicLabs/koios-pluts",
getstarted: null,
tags: ["javascript", "typescript", "serialization", "koios"],
},
{
title: "Aiken",
description: "A modern smart contract platform for Cardano.",
Expand Down
43 changes: 43 additions & 0 deletions src/data/builder-tools/plu-ts.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading