Skip to content

Commit 4c6304c

Browse files
author
jared
committed
TS lbr-plutus golden tests
1 parent 343a1a9 commit 4c6304c

File tree

15 files changed

+2958
-0
lines changed

15 files changed

+2958
-0
lines changed

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
./testsuites/lbt-plutus/golden/build.nix
9494
./testsuites/lbt-plutus/lbt-plutus-haskell/build.nix
9595
./testsuites/lbt-plutus/lbt-plutus-purescript/build.nix
96+
./testsuites/lbt-plutus/lbt-plutus-typescript/build.nix
9697
./testsuites/lbt-plutus/lbt-plutus-plutarch/build.nix
9798
./testsuites/lbt-plutus/lbt-plutus-rust/build.nix
9899
./experimental/build.nix

runtimes/typescript/lbr-plutus/src/LambdaBuffers/V1/Instances.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,29 @@ declare module "../PlutusData.js" {
247247
PlutusData.IsPlutusData[Symbols.UpperBound] =
248248
PlutusLedgerApiV1.isPlutusDataUpperBound;
249249

250+
// Closure
251+
declare module "lbr-prelude" {
252+
export interface EqInstances {
253+
[Symbols.Closure]: Prelude.Eq<PlutusLedgerApiV1.Closure>;
254+
}
255+
256+
export interface JsonInstances {
257+
[Symbols.Closure]: Prelude.Json<PlutusLedgerApiV1.Closure>;
258+
}
259+
}
260+
261+
LbrPrelude.Eq[Symbols.Closure] = Prelude.eqBool;
262+
LbrPrelude.Json[Symbols.Closure] = Prelude.jsonBool;
263+
264+
declare module "../PlutusData.js" {
265+
export interface IsPlutusDataInstances {
266+
[Symbols.Closure]: PlutusLedgerApiPlutusData.IsPlutusData<
267+
PlutusLedgerApiV1.Closure
268+
>;
269+
}
270+
}
271+
PlutusData.IsPlutusData[Symbols.Closure] = PlutusLedgerApiV1.isPlutusDataBool;
272+
250273
// Redeemer
251274
declare module "lbr-prelude" {
252275
export interface EqInstances {

runtimes/typescript/lbr-plutus/src/LambdaBuffers/V1/Symbols.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export const Interval: unique symbol = Symbol("Interval");
1111
export const Extended: unique symbol = Symbol("Extended");
1212
export const LowerBound: unique symbol = Symbol("LowerBound");
1313
export const UpperBound: unique symbol = Symbol("UpperBound");
14+
export const Closure: unique symbol = Symbol("Closure");
1415
export const Redeemer: unique symbol = Symbol("Redeemer");
1516
export const Datum: unique symbol = Symbol("Datum");
1617
export const DatumHash: unique symbol = Symbol("DatumHash");
@@ -36,6 +37,7 @@ export type Interval<A> = PlutusLedgerApiV1.Interval<A>;
3637
export type Extended<A> = PlutusLedgerApiV1.Extended<A>;
3738
export type LowerBound<A> = PlutusLedgerApiV1.LowerBound<A>;
3839
export type UpperBound<A> = PlutusLedgerApiV1.UpperBound<A>;
40+
export type Closure = PlutusLedgerApiV1.Closure;
3941
export type Redeemer = PlutusLedgerApiV1.Redeemer;
4042
export type Datum = PlutusLedgerApiV1.Datum;
4143
export type DatumHash = PlutusLedgerApiV1.DatumHash;

testsuites/lbt-plutus/api/build.nix

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ _: {
2626
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
2727
};
2828

29+
lbf-plutus-golden-api-typescript = (config.lbf-nix.lbfPlutusTypescript {
30+
name = "lbf-plutus-golden-api";
31+
src = ./.;
32+
files = [ "Foo.lbf" "Foo/Bar.lbf" "Days.lbf" ];
33+
}).packages.lbf-plutus-golden-api-typescript-tgz
34+
;
35+
2936
};
3037
};
3138
}

testsuites/lbt-plutus/golden/build.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,14 @@ _:
2222
phases = "installPhase";
2323
installPhase = "ln -s $src $out";
2424
};
25+
26+
lbt-plutus-golden-typescript = pkgs.stdenv.mkDerivation {
27+
name = "lbt-plutus-golden-data";
28+
src = ./.;
29+
phases = "installPhase";
30+
installPhase = ''ln -s "$src" "$out"'';
31+
};
32+
2533
};
2634

2735
};
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.extra-dependencies
2+
data
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{ inputs, ... }:
2+
{
3+
perSystem = { config, system, ... }:
4+
let
5+
tsFlake =
6+
inputs.flake-lang.lib.${system}.typescriptFlake {
7+
name = "lbt-plutus";
8+
src = ./.;
9+
npmExtraDependencies = [
10+
config.packages.lbf-plutus-golden-api-typescript
11+
];
12+
13+
devShellTools = config.settings.shell.tools;
14+
devShellHook = config.settings.shell.hook;
15+
16+
data =
17+
[
18+
{
19+
name = "lbt-plutus-golden-data";
20+
path = config.packages.lbt-plutus-golden-typescript;
21+
}
22+
];
23+
};
24+
in
25+
{
26+
inherit (tsFlake) devShells checks;
27+
};
28+
}

testsuites/lbt-plutus/lbt-plutus-typescript/package-lock.json

Lines changed: 204 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "lbf-prelude-typescript",
3+
"version": "1.0.0",
4+
"description": "Test suite project for LambdaBuffers",
5+
"type": "module",
6+
"exports": {
7+
".": "./dist/index.mjs",
8+
"./package.json": "./package.json"
9+
},
10+
"scripts": {
11+
"build": "npx tsc -b src/",
12+
"test": "node --test"
13+
},
14+
"author": "Jared Pon",
15+
"license": "ISC",
16+
"files": [
17+
"./dist/**/*"
18+
],
19+
"devDependencies": {
20+
"@types/node": "^20.11.7",
21+
"typescript": "^5.3.3"
22+
},
23+
"dependencies": {
24+
"lbf-plutus": "file:.extra-dependencies/lbf-plutus-1.0.0.tgz",
25+
"lbf-plutus-golden-api": "file:.extra-dependencies/lbf-plutus-golden-api-1.0.0.tgz",
26+
"lbf-prelude": "file:.extra-dependencies/lbf-prelude-1.0.0.tgz",
27+
"lbr-plutus": "file:.extra-dependencies/lbr-plutus-1.0.0.tgz",
28+
"lbr-prelude": "file:.extra-dependencies/lbr-prelude-1.0.0.tgz",
29+
"plutus-ledger-api": "file:.extra-dependencies/plutus-ledger-api-1.0.0.tgz",
30+
"prelude": "file:.extra-dependencies/prelude-1.0.1.tgz"
31+
}
32+
}

0 commit comments

Comments
 (0)