Skip to content

Commit

Permalink
chore(repo): try dockerizing Klesia
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Sep 4, 2024
1 parent 97b4f7d commit 98ad280
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,22 @@ jobs:
needs: test
steps:
- uses: actions/checkout@v4
- name: Install Nixpacks
run: |
curl -LO https://github.com/railwayapp/nixpacks/releases/download/v1.27.1/nixpacks-v1.27.1-amd64.deb
sudo dpkg -i nixpacks-v1.27.1-amd64.deb
- uses: oven-sh/setup-bun@v2
- run: bun i --no-save
- run: bun run build
- run: bunx pkg-pr-new publish './packages/klesia-sdk'
- run: nixpacks build . --config apps/klesia/nixpacks.toml
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag image
run: docker tag $(docker images --format='{{.ID}}' | head -1) ghcr.io/palladians/klesia:$(git rev-parse --short HEAD)
- name: Push to GHCR
run: docker push ghcr.io/palladians/klesia:$(git rev-parse --short HEAD)
19 changes: 19 additions & 0 deletions .github/workflows/promote_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Promote Docker image to latest
on:
workflow_dispatch:
jobs:
dockerize_and_push:
name: Tag latest and push to GHCR
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Tag image
run: docker buildx imagetools create ghcr.io/palladians/klesia:$(git rev-parse --short HEAD) --tag ghcr.io/palladians/klesia:latest
4 changes: 4 additions & 0 deletions apps/docs/docs/pages/about.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { Callout } from 'vocs/components'

# About MinaJS [Learn about MinaJS and Klesia.]

<Callout type="warning">As of September 2024, MinaJS is in early development. Don't use for production just yet.</Callout>

MinaJS is a TypeScript interface for Mina Protocol. It provides a set of TypeScript types and utilities to interact with Mina Protocol. MinaJS is the missing piece for your smooth zkApp development on Mina.
It aims to remove the complexities, and allow developers to focus on building innovative zkApps on Mina.

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/docs/pages/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ $ npm install @mina-js/klesia-sdk

- [MinaJS Connect](/connect)
- [MinaJS Accounts](/accounts)
- [Klesia SDK](/klesia-sdk)
- [Klesia SDK](/klesia/sdk)
1 change: 0 additions & 1 deletion apps/docs/docs/pages/klesia-sdk/index.mdx

This file was deleted.

8 changes: 8 additions & 0 deletions apps/docs/docs/pages/klesia/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Klesia [Missed Alchemy and Infura? Here's Klesia.]

Klesia is a JSON-RPC wrapper over Mina Node's GraphQL API and TypeScript SDK to interact with it. It's similar to APIs like Alchemy and Infura. It's self hostable, so you can bring your own infrastructure.

## Tools and Libraries

- [Klesia JSON-RPC](/klesia/rpc) - JSON-RPC wrapper over Mina Node's GraphQL API.
- [Klesia TypeScript SDK](/klesia/sdk) - TypeScript SDK to interact with Klesia JSON-RPC API with type-safe interfaces and properties auto-completion.
73 changes: 73 additions & 0 deletions apps/docs/docs/pages/klesia/rpc.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Klesia JSON-RPC

Klesia is accessible via HTTP JSON-RPC. You can use any HTTP client to interact with it, but if you're building o1js zkApps, we recommend using the [Klesia SDK](/klesia/sdk).

## Endpoints

There are two Klesia instances available. One for Mina Mainnet and the other for Mina Devnet.

### Mina Mainnet

```
https://mainnet.klesia.palladians.xyz/api
```

### Mina Devnet

```
https://devnet.klesia.palladians.xyz/api
```

## RPC Methods

Below you can find the complete list of RPC methods available on Klesia.

---

### mina_getTransactionCount

Returns the number of transactions sent from an address. Usually you may want to use this number to determine the nonce for the next transaction.

#### Parameters

Array of strings:
- `publicKey` - Address to check for transaction count.

---

### mina_getBalance

Returns the balance of the account of given address.

#### Parameters

Array of strings:
- `publicKey` - Address to check for transaction count.

---

### mina_blockHash

Returns the hash of the most recent block.

---

### mina_chainId

Returns the currently configured chain ID.

---

### mina_sendTransaction

Broadcasts a signed transaction to the network.

#### Parameters

Array of strings:
- `input` - Signed transaction or zkApp input.
- `type` - Transaction type. Can be `payment`, `delegation`, or `zkapp`.

## Self-hosting

The application is open-source and available on GitHub. You can self-host it by following the instructions in the repository.
26 changes: 26 additions & 0 deletions apps/docs/docs/pages/klesia/sdk.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Klesia TypeScript SDK

Klesia has a TypeScript SDK to interact with the JSON-RPC API. The SDK provides type-safe interfaces and properties auto-completion.

## Installation

```bash
$ npm install @mina-js/klesia-sdk
```

## Usage

```typescript
import { createClient } from '@mina-js/klesia-sdk'

const client = createClient({ network: 'devnet' })

const { result } = await client.request({
method: 'mina_getTransactionCount',
params: ['B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS']
})
```

## Methods

Refer to the [RPC Methods](/klesia/rpc#rpc-methods) page for a complete list of methods available on Klesia.
15 changes: 14 additions & 1 deletion apps/docs/vocs.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,24 @@ export default defineConfig({
},
},
},
markdown: {
code: {
themes: {
light: "rose-pine-dawn",
dark: "rose-pine",
},
},
},
socials: [
{ icon: "github", link: "https://github.com/palladians/mina-js" },
{ icon: "discord", link: "https://get.pallad.co/discord" },
],
topNav: [{ text: "Pallad", link: "https://get.pallad.co/website" }],
topNav: [
{
text: "Pallad - Mina Protocol wallet",
link: "https://get.pallad.co/website",
},
],
sidebar: [
{
text: "About MinaJS",
Expand Down
2 changes: 2 additions & 0 deletions apps/klesia/nixpacks.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[start]
cmd = "cd apps/klesia && npm run start"
Binary file modified bun.lockb
Binary file not shown.

0 comments on commit 98ad280

Please sign in to comment.