diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c2d57f9..766b296 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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) diff --git a/.github/workflows/promote_image.yml b/.github/workflows/promote_image.yml new file mode 100644 index 0000000..d26deaa --- /dev/null +++ b/.github/workflows/promote_image.yml @@ -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 diff --git a/apps/docs/docs/pages/about.mdx b/apps/docs/docs/pages/about.mdx index 4e2700a..41d85cb 100644 --- a/apps/docs/docs/pages/about.mdx +++ b/apps/docs/docs/pages/about.mdx @@ -1,5 +1,9 @@ +import { Callout } from 'vocs/components' + # About MinaJS [Learn about MinaJS and Klesia.] +As of September 2024, MinaJS is in early development. Don't use for production just yet. + 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. diff --git a/apps/docs/docs/pages/getting-started.mdx b/apps/docs/docs/pages/getting-started.mdx index c10b45d..3292181 100644 --- a/apps/docs/docs/pages/getting-started.mdx +++ b/apps/docs/docs/pages/getting-started.mdx @@ -27,4 +27,4 @@ $ npm install @mina-js/klesia-sdk - [MinaJS Connect](/connect) - [MinaJS Accounts](/accounts) -- [Klesia SDK](/klesia-sdk) +- [Klesia SDK](/klesia/sdk) diff --git a/apps/docs/docs/pages/klesia-sdk/index.mdx b/apps/docs/docs/pages/klesia-sdk/index.mdx deleted file mode 100644 index f9bf1ab..0000000 --- a/apps/docs/docs/pages/klesia-sdk/index.mdx +++ /dev/null @@ -1 +0,0 @@ -#TODO diff --git a/apps/docs/docs/pages/klesia/index.mdx b/apps/docs/docs/pages/klesia/index.mdx new file mode 100644 index 0000000..86654b4 --- /dev/null +++ b/apps/docs/docs/pages/klesia/index.mdx @@ -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. diff --git a/apps/docs/docs/pages/klesia/rpc.mdx b/apps/docs/docs/pages/klesia/rpc.mdx new file mode 100644 index 0000000..1af99db --- /dev/null +++ b/apps/docs/docs/pages/klesia/rpc.mdx @@ -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. diff --git a/apps/docs/docs/pages/klesia/sdk.mdx b/apps/docs/docs/pages/klesia/sdk.mdx new file mode 100644 index 0000000..89f383d --- /dev/null +++ b/apps/docs/docs/pages/klesia/sdk.mdx @@ -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. diff --git a/apps/docs/vocs.config.ts b/apps/docs/vocs.config.ts index 12013bc..6989286 100644 --- a/apps/docs/vocs.config.ts +++ b/apps/docs/vocs.config.ts @@ -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", diff --git a/apps/klesia/nixpacks.toml b/apps/klesia/nixpacks.toml new file mode 100644 index 0000000..86398af --- /dev/null +++ b/apps/klesia/nixpacks.toml @@ -0,0 +1,2 @@ +[start] +cmd = "cd apps/klesia && npm run start" diff --git a/bun.lockb b/bun.lockb index f0e2435..3f85b1d 100755 Binary files a/bun.lockb and b/bun.lockb differ