Skip to content

Commit

Permalink
Updated ArkType (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
SynthLuvr authored Sep 12, 2024
1 parent 0cad993 commit ea04031
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/aiken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Install Aiken
run: |
curl -sSfL https://install.aiken-lang.org | bash
~/.aiken/bin/aikup
~/.aiken/bin/aikup install v1.0.29-alpha
sudo ln -s ~/.aiken/bin/aiken /usr/local/bin/aiken
- name: Run tests
Expand Down
1 change: 1 addition & 0 deletions aiken.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name = "sundae/mint-chocolate-chip"
compiler = "v1.0.29-alpha"
version = "0.0.0"
license = "Apache-2.0"
description = "Aiken contracts for project 'sundae/mint-chocolate-chip'"
Expand Down
30 changes: 15 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"@lucid-evolution/lucid": "^0.3.11",
"arktype": "^2.0.0-dev.26",
"arktype": "^2.0.0-rc.6",
"cardano-ts": "^0.2.0",
"commander": "^12.1.0",
"es-toolkit": "^1.16.0",
Expand Down
12 changes: 10 additions & 2 deletions src/inputs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
import { fromText } from "@lucid-evolution/lucid";
import { type, Type } from "arktype";
import { type } from "arktype";

const validate = <T, U>(validator: Type<T, U>, data: unknown) => {
type AnyType = {
(data: unknown): unknown;
infer: unknown;
};

const validate = <T extends AnyType>(
validator: T,
data: unknown
): T["infer"] => {
const result = validator(data);
if (result instanceof type.errors) return logThenExit(result.summary);
return result;
Expand Down

0 comments on commit ea04031

Please sign in to comment.