Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PLT-7185 - Dependency optimisation #17

Merged
merged 4 commits into from
Aug 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ tsconfig.tsbuildinfo
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# created by the rollup
stats.html
# created by nix
result
source
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,27 @@
"devDependencies": {
"@blockfrost/blockfrost-js": "5.2.0",
"@blockfrost/openapi": "0.1.54",
"lucid-cardano": "0.9.4",
"dotenv": "^16.0.3",
"@relmify/jest-fp-ts": "^2.0.2",
"@rollup/plugin-commonjs": "^25.0.3",
"@rollup/plugin-node-resolve": "^15.1.0",
"@rollup/plugin-wasm": "^6.1.3",
"@types/axios-curlirize": "^1.3.2",
"@types/deep-equal": "1.0.1",
"@types/jest": "^26.0.24",
"@types/json-bigint": "^1.0.1",
"@types/node": "^18.14.2",
"dotenv": "^16.0.3",
"eslint": "^7.32.0",
"http-server": "^14.1.1",
"jest": "^29.4",
"jest-serial-runner": "^1.2.1",
"lucid-cardano": "0.9.4",
"npm-run-all": "^4.1.5",
"prettier": "^2.3.2",
"rollup": "^3.27.2",
"rollup-plugin-copy": "^3.4.0",
"rollup-plugin-output-size": "^1.2.2",
"rollup-plugin-visualizer": "^5.9.2",
"shx": "^0.3.3",
"ts-jest": "^29.0.5",
"ts-node": "^10.9.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/contract/assert.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Contract } from "./index.js";
import { Observation } from "./common/observations.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/contract/close.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

export const close = 'close'
export type Close = t.TypeOf<typeof Close>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import * as t from "io-ts"
import * as t from "io-ts/lib/index.js"

export type AddressBech32 = string
export const AddressBech32 = t.string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";
import { ChoiceId, Value } from "./value.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Party } from "./party.js";
import { Token } from "../token.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { AccountId } from "./account.js";
import { Party } from "./party.js";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";
import { TokenName } from "../token.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";
import { Party } from "../common/payee/party.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

import { Assert } from "./assert.js";
import { Close } from "./close.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/contract/if.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Contract } from "./index.js";
import { Observation } from "./common/observations.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/contract/let.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Contract } from "./index.js";
import { ValueId, Value } from "./common/value.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/contract/pay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts"
import * as t from "io-ts/lib/index.js"
import { AccountId } from "./common/payee/account.js";
import { Contract } from "./index.js";
import { Payee } from "./common/payee/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { ChoiceId } from "../../common/value.js";

export type Bound
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { AccountId } from "../../common/payee/account.js";
import { Party } from "../../common/payee/party.js";
import { Token } from "../../common/token.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

import { Choice } from "./choice.js";
import { Deposit } from "./deposit.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Observation } from "../../common/observations.js";

export type Notify = { notify_if: Observation }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Action } from "./action/index.js";
import { Contract } from "../index.js";
import { pipe } from "fp-ts/lib/function.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { ChoiceId } from "../../common/value.js";

export type ChosenNum = t.TypeOf<typeof ChosenNum>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { AccountId } from "../../common/payee/account.js";
import { Party } from "../../common/payee/party.js";
import { Token } from "../../common/token.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";


export const inputNotify = 'input_notify'
Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/environment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { ISO8601, datetoIso8601 } from "@marlowe/legacy-adapter/time";

export const mkEnvironment : (validityStart:Date) => (validityEnd:Date) => Environment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Bound } from "../../contract/when/action/choice.js";
import { ChoiceId } from "../../contract/common/value.js";
import { IsMerkleizedContinuation } from "../common/IsMerkleizedContinuation.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { AccountId } from "../../contract/common/payee/account.js";
import { Party } from "../../contract/common/payee/party.js";
import { Token } from "../../contract/common/token.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { IsMerkleizedContinuation } from "../common/IsMerkleizedContinuation.js";
import { CaseIndex } from "../common/caseIndex.js";
import { InputNotify } from "../../contract/when/input/notify.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { CanDeposit } from "./canDeposit.js";
import { CanChoose } from "./canChoose.js";
import { CanNotify } from "./canNotify.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

export type IsMerkleizedContinuation = boolean
export const IsMerkleizedContinuation = t.boolean
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

export type CaseIndex = bigint
export const CaseIndex = t.bigint
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/next/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { ApplicableInputs } from "./applicables/index.js";
export { toInput } from "./applicables/canDeposit.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/language/core/v1/src/semantics/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

import { Accounts } from "./contract/common/payee/account.js";
import { ChoiceId, ValueId } from "./contract/common/value.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-adapter/src/time.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { pipe } from "fp-ts/lib/function.js";
import { format, formatISO } from "date-fns";

Expand Down
4 changes: 1 addition & 3 deletions packages/legacy-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
"newtype-ts":"0.3.5",
"date-fns": "2.29.3",
"axios": "^1.3.3",
"axios-curlirize": "^2.0.0",
"@47ng/codec":"1.1.0",
"json-bigint": "^1.0.0",
"io-ts-bigint":"2.0.1",
"jsonbigint-io-ts-reporters":"2.0.1",
"@emurgo/cardano-serialization-lib-asmjs":"11.4.0"
"@emurgo/cardano-serialization-lib-browser":"11.4.0"
}
}
13 changes: 8 additions & 5 deletions packages/legacy-runtime/src/common/address.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";
import {C, fromHex } from "lucid-cardano";

import { pipe } from "fp-ts/lib/function.js";
import * as CSL from '@emurgo/cardano-serialization-lib-browser'
import { hex } from '@47ng/codec'

export type AddressBech32 = Newtype<{ readonly AddressBech32: unique symbol }, string>
export const AddressBech32 = fromNewtype<AddressBech32>(t.string)
export const unAddressBech32 = iso<AddressBech32>().unwrap
export const addressBech32 = iso<AddressBech32>().wrap

export const deserializeAddress : (hex:string) => AddressBech32 =
(hex) => pipe(C.Address.from_bytes(fromHex(hex),).to_bech32(undefined)
,addressBech32)
export const deserializeAddress : (addressHex:string) => AddressBech32 =
(addressHex) =>
pipe(CSL.Address.from_bytes(hex.decode(addressHex),).to_bech32()
,addressBech32)
6 changes: 2 additions & 4 deletions packages/legacy-runtime/src/common/block.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@


import * as t from "io-ts";
import { identity } from 'fp-ts/lib/function.js'
import { failure, success, Type } from 'io-ts'
import {PositiveBigInt} from 'io-ts-bigint'
import * as t from "io-ts/lib/index.js";
import { failure, success, Type } from 'io-ts/lib/index.js'


export function isBigIntOrNumber(u: unknown): u is (bigint | number) {
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/metadata/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";


export type MetadatumLabel = t.TypeOf<typeof MetadatumLabel>
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/metadata/tag.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Metadata } from "./index.js";


Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/policyId.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/textEnvelope.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import reporter from 'jsonbigint-io-ts-reporters'
import { Newtype } from "newtype-ts";
import { fromNewtype,option, optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

// see : https://input-output-hk.github.io/cardano-node/cardano-api/lib/Cardano-Api-SerialiseTextEnvelope.html

Expand Down
11 changes: 6 additions & 5 deletions packages/legacy-runtime/src/common/tx/collateral.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { pipe } from "fp-ts/lib/function.js";
import { C, fromHex } from "lucid-cardano";
import * as CSL from '@emurgo/cardano-serialization-lib-browser'
import { TxOutRef, txOutRef } from "./outRef.js";
import { hex } from '@47ng/codec'

export const deserializeCollateral : (hex:string) => TxOutRef =
(hex) => pipe(C.TransactionUnspentOutput.from_bytes(Buffer.from(hex, 'hex'))
, utxo => txOutRef (utxo.input().transaction_id().to_hex() + '#' + utxo.input().index().to_str())
)
export const deserializeCollateral : (collateral:string) => TxOutRef
= (collateral) =>
pipe( CSL.TransactionUnspentOutput.from_bytes(hex.decode(collateral))
, utxo => txOutRef (utxo.input().transaction_id().to_hex() + '#' + utxo.input().index().toString()))

2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/tx/id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

export type TxId = t.TypeOf<typeof TxId>
export const TxId = t.string // to refine
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/tx/outRef.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/common/version.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

export type MarloweVersion = t.TypeOf<typeof MarloweVersion>;
export const MarloweVersion = t.literal('v1')
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/contract/details.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Contract } from "@marlowe/language-core-v1";
import { MarloweState } from "@marlowe/language-core-v1/state";
import { ContractId } from "./id.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { AxiosInstance, ParamEncoder, ParamsSerializerOptions } from 'axios';

import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import * as TE from 'fp-ts/lib/TaskEither.js'
import { pipe } from 'fp-ts/lib/function.js';
import * as E from 'fp-ts/lib/Either.js'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { pipe } from 'fp-ts/lib/function.js';
import * as HTTP from '../../common/http.js';
import { HexTransactionWitnessSet, transactionWitnessSetTextEnvelope } from '../../common/textEnvelope.js';
import { ContractDetails } from '../details.js';
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import {formatValidationErrors} from 'jsonbigint-io-ts-reporters'
import { DecodingError } from '../../common/codec.js';
import { ContractId, unContractId } from '../id.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/contract/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { MarloweVersion } from "../common/version.js";
import { TxStatus } from "./transaction/status.js";
import { ContractId } from "./id.js";
import { optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

import { PolicyId } from "../common/policyId.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/contract/id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { iso, Newtype } from "newtype-ts";
import { fromNewtype } from "io-ts-types";
import { split } from "fp-ts/lib/string.js";
Expand Down
2 changes: 1 addition & 1 deletion packages/legacy-runtime/src/contract/role.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts"
import * as t from "io-ts/lib/index.js"
import { optionFromNullable } from "io-ts-types";
import { PolicyId } from "@marlowe/language-core-v1";
import { AddressBech32 } from "../common/address.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { optionFromNullable } from "io-ts-types";
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";

import { ISO8601 } from "@marlowe/legacy-adapter/time";
import { BuiltinByteString, Input } from "@marlowe/language-core-v1";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as t from "io-ts";
import * as t from "io-ts/lib/index.js";
import { Newtype, iso } from 'newtype-ts'
import * as E from 'fp-ts/lib/Either.js'
import * as A from 'fp-ts/lib/Array.js'
Expand Down
Loading
Loading