-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(klesia): decouple server from exports
- Loading branch information
Showing
7 changed files
with
64 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,58 @@ | ||
import { expect, it } from "bun:test"; | ||
import { describe, expect, it } from "bun:test"; | ||
import { testClient } from "hono/testing"; | ||
import { klesiaRpcRoute } from "./"; | ||
|
||
const client = testClient(klesiaRpcRoute); | ||
const request = testClient(klesiaRpcRoute).api.$post; | ||
|
||
it("returns result for mina_getTransactionCount", async () => { | ||
const response = await client.api.$post({ | ||
json: { | ||
method: "mina_getTransactionCount", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
describe("Mina Devnet RPC", () => { | ||
it("returns result for mina_getTransactionCount", async () => { | ||
const response = await request({ | ||
json: { | ||
method: "mina_getTransactionCount", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(BigInt(result)).toBeGreaterThan(0); | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(BigInt(result)).toBeGreaterThan(0); | ||
}); | ||
|
||
it("returns result for mina_getBalance", async () => { | ||
const response = await client.api.$post({ | ||
json: { | ||
method: "mina_getBalance", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
it("returns result for mina_getBalance", async () => { | ||
const response = await request({ | ||
json: { | ||
method: "mina_getBalance", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(BigInt(String(result))).toBeGreaterThan(0); | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(BigInt(String(result))).toBeGreaterThan(0); | ||
}); | ||
|
||
it("returns result for mina_blockHash", async () => { | ||
const response = await client.api.$post({ | ||
json: { method: "mina_blockHash" }, | ||
it("returns result for mina_blockHash", async () => { | ||
const response = await request({ | ||
json: { method: "mina_blockHash" }, | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(result.length).toBeGreaterThan(0); | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(result.length).toBeGreaterThan(0); | ||
}); | ||
|
||
it("returns result for mina_chainId", async () => { | ||
const response = await client.api.$post({ | ||
json: { method: "mina_chainId" }, | ||
it("returns result for mina_chainId", async () => { | ||
const response = await request({ | ||
json: { method: "mina_chainId" }, | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(result.length).toBeGreaterThan(0); | ||
}); | ||
const { result } = (await response.json()) as { result: string }; | ||
expect(result.length).toBeGreaterThan(0); | ||
}); | ||
|
||
it("returns result for mina_getAccount", async () => { | ||
const response = await client.api.$post({ | ||
json: { | ||
method: "mina_getAccount", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
it("returns result for mina_getAccount", async () => { | ||
const response = await request({ | ||
json: { | ||
method: "mina_getAccount", | ||
params: ["B62qkYa1o6Mj6uTTjDQCob7FYZspuhkm4RRQhgJg9j4koEBWiSrTQrS"], | ||
}, | ||
}); | ||
// biome-ignore lint/suspicious/noExplicitAny: TODO | ||
const { result } = (await response.json()) as any; | ||
expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0); | ||
expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0); | ||
}); | ||
// biome-ignore lint/suspicious/noExplicitAny: TODO | ||
const { result } = (await response.json()) as any; | ||
expect(BigInt(result.nonce)).toBeGreaterThanOrEqual(0); | ||
expect(BigInt(result.balance)).toBeGreaterThanOrEqual(0); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { serve } from "@hono/node-server"; | ||
import { z } from "@hono/zod-openapi"; | ||
import { api } from "./"; | ||
|
||
serve( | ||
{ fetch: api.fetch, port: z.coerce.number().parse(process.env.PORT ?? 3000) }, | ||
(info) => { | ||
console.log(`Listening on http://localhost:${info.port}`); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
import { defineConfig } from "tsup"; | ||
import sharedConfig from "../../packages/shared/tsup.config"; | ||
|
||
export default sharedConfig; | ||
export default defineConfig({ | ||
...sharedConfig, | ||
entry: ["src/index.ts", "src/server.ts"], | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters