From b26266a4b15b8ea2aeb639503a6bd63cc2167595 Mon Sep 17 00:00:00 2001 From: solidsnakedev Date: Tue, 12 Mar 2024 07:58:23 -0400 Subject: [PATCH] feat: detach core types from lucid-evolution --- packages/core-types/package.json | 26 +++++ .../src/types => core-types/src}/global.ts | 0 .../types/mod.ts => core-types/src/index.ts} | 0 .../src/types => core-types/src}/types.ts | 0 packages/core-types/tsconfig.json | 110 ++++++++++++++++++ packages/lucid-evolution/package.json | 1 + packages/lucid-evolution/src/lucid/lucid.ts | 4 +- packages/lucid-evolution/src/lucid/message.ts | 2 +- packages/lucid-evolution/src/lucid/tx.ts | 4 +- .../lucid-evolution/src/lucid/tx_complete.ts | 2 +- .../lucid-evolution/src/lucid/tx_signed.ts | 2 +- .../lucid-evolution/src/misc/sign_data.ts | 5 +- packages/lucid-evolution/src/misc/wallet.ts | 5 +- packages/lucid-evolution/src/mod.ts | 1 - packages/lucid-evolution/src/plutus/data.ts | 2 +- packages/lucid-evolution/src/plutus/time.ts | 7 +- .../src/provider/blockfrost.ts | 2 +- .../lucid-evolution/src/provider/emulator.ts | 2 +- .../lucid-evolution/src/provider/kupmios.ts | 2 +- .../lucid-evolution/src/provider/maestro.ts | 2 +- .../lucid-evolution/src/tx-builder/Attach.ts | 4 +- .../lucid-evolution/src/tx-builder/Collect.ts | 3 +- .../src/tx-builder/Complete.ts | 3 +- .../src/tx-builder/Interval.ts | 2 +- .../lucid-evolution/src/tx-builder/Mint.ts | 3 +- .../lucid-evolution/src/tx-builder/Native.ts | 2 +- .../lucid-evolution/src/tx-builder/Pay.ts | 3 +- .../lucid-evolution/src/tx-builder/Read.ts | 3 +- .../lucid-evolution/src/tx-builder/types.ts | 3 +- .../lucid-evolution/src/tx-builder/utils.ts | 3 +- .../lucid-evolution/src/utils/cost_model.ts | 3 +- packages/lucid-evolution/src/utils/utils.ts | 4 +- pnpm-lock.yaml | 18 +++ 33 files changed, 198 insertions(+), 35 deletions(-) create mode 100644 packages/core-types/package.json rename packages/{lucid-evolution/src/types => core-types/src}/global.ts (100%) rename packages/{lucid-evolution/src/types/mod.ts => core-types/src/index.ts} (100%) rename packages/{lucid-evolution/src/types => core-types/src}/types.ts (100%) create mode 100644 packages/core-types/tsconfig.json diff --git a/packages/core-types/package.json b/packages/core-types/package.json new file mode 100644 index 00000000..6d0b0ee3 --- /dev/null +++ b/packages/core-types/package.json @@ -0,0 +1,26 @@ +{ + "name": "@anastasia-labs/core-types", + "version": "0.0.1", + "description": "", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "type": "module", + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "scripts": { + "build": "tsup-node src/index.ts --format esm,cjs --dts --clean" + }, + "keywords": [], + "author": "", + "license": "MIT", + "devDependencies": { + "@dcspark/cardano-multiplatform-lib-nodejs": "^5.1.0", + "@types/node": "^20.11.24", + "tsup": "^8.0.2", + "typescript": "^5.3.3" + } +} diff --git a/packages/lucid-evolution/src/types/global.ts b/packages/core-types/src/global.ts similarity index 100% rename from packages/lucid-evolution/src/types/global.ts rename to packages/core-types/src/global.ts diff --git a/packages/lucid-evolution/src/types/mod.ts b/packages/core-types/src/index.ts similarity index 100% rename from packages/lucid-evolution/src/types/mod.ts rename to packages/core-types/src/index.ts diff --git a/packages/lucid-evolution/src/types/types.ts b/packages/core-types/src/types.ts similarity index 100% rename from packages/lucid-evolution/src/types/types.ts rename to packages/core-types/src/types.ts diff --git a/packages/core-types/tsconfig.json b/packages/core-types/tsconfig.json new file mode 100644 index 00000000..333ddf19 --- /dev/null +++ b/packages/core-types/tsconfig.json @@ -0,0 +1,110 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + + /* Language and Environment */ + "target": "esnext", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + + /* Modules */ + "module": "nodenext", /* Specify what module code is generated. */ + "rootDir": "src", /* Specify the root folder within your source files. */ + "moduleResolution": "nodenext", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */ + // "types": [], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */ + // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */ + // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */ + // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */ + "resolveJsonModule": true, /* Enable importing .json files. */ + // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + + /* JavaScript Support */ + // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + "outDir": "dist", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": ["./src/**/*"] +} diff --git a/packages/lucid-evolution/package.json b/packages/lucid-evolution/package.json index 698bed1e..e448ab7a 100644 --- a/packages/lucid-evolution/package.json +++ b/packages/lucid-evolution/package.json @@ -19,6 +19,7 @@ "author": "", "license": "MIT", "devDependencies": { + "@anastasia-labs/core-types": "workspace:*", "@dcspark/cardano-multiplatform-lib-nodejs": "^5.1.0", "@effect/schema": "^0.62.9", "@emurgo/cardano-message-signing-nodejs": "^1.0.1", diff --git a/packages/lucid-evolution/src/lucid/lucid.ts b/packages/lucid-evolution/src/lucid/lucid.ts index f0770774..c77a7d9a 100644 --- a/packages/lucid-evolution/src/lucid/lucid.ts +++ b/packages/lucid-evolution/src/lucid/lucid.ts @@ -5,7 +5,7 @@ import { Constr, Data } from "../plutus/data.js"; import { SLOT_CONFIG_NETWORK } from "../plutus/time.js"; import { Emulator } from "../provider/emulator.js"; -import type { +import { Address, Credential, Delegation, @@ -26,7 +26,7 @@ import type { UTxO, Wallet, WalletApi, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { coreToUtxo, createCostModels, diff --git a/packages/lucid-evolution/src/lucid/message.ts b/packages/lucid-evolution/src/lucid/message.ts index b5bb9f5f..b3572121 100644 --- a/packages/lucid-evolution/src/lucid/message.ts +++ b/packages/lucid-evolution/src/lucid/message.ts @@ -5,7 +5,7 @@ import type { PrivateKey, RewardAddress, SignedMessage, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { signData } from "../misc/sign_data.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; diff --git a/packages/lucid-evolution/src/lucid/tx.ts b/packages/lucid-evolution/src/lucid/tx.ts index d5282d94..907dfb35 100644 --- a/packages/lucid-evolution/src/lucid/tx.ts +++ b/packages/lucid-evolution/src/lucid/tx.ts @@ -1,6 +1,6 @@ import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { Data } from "../mod.js"; -import type { +import { Address, Assets, CertificateValidator, @@ -20,7 +20,7 @@ import type { UnixTime, UTxO, WithdrawalValidator, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { assetsToValue, fromHex, diff --git a/packages/lucid-evolution/src/lucid/tx_complete.ts b/packages/lucid-evolution/src/lucid/tx_complete.ts index 6be5cf66..dfd2d4f0 100644 --- a/packages/lucid-evolution/src/lucid/tx_complete.ts +++ b/packages/lucid-evolution/src/lucid/tx_complete.ts @@ -4,7 +4,7 @@ import { Transaction, TransactionWitnesses, TxHash, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { Lucid } from "./lucid.js"; import { TxSigned } from "./tx_signed.js"; import { toCMLTransactionHash } from "../tx-builder/utils.js"; diff --git a/packages/lucid-evolution/src/lucid/tx_signed.ts b/packages/lucid-evolution/src/lucid/tx_signed.ts index c283acf9..591753e9 100644 --- a/packages/lucid-evolution/src/lucid/tx_signed.ts +++ b/packages/lucid-evolution/src/lucid/tx_signed.ts @@ -1,5 +1,5 @@ import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; -import type { Transaction, TxHash } from "../types/mod.js"; +import type { Transaction, TxHash } from "@anastasia-labs/core-types"; import { Lucid } from "./lucid.js"; import { toCMLTransactionHash } from "../tx-builder/utils.js"; diff --git a/packages/lucid-evolution/src/misc/sign_data.ts b/packages/lucid-evolution/src/misc/sign_data.ts index d3aeb50e..639b01dc 100644 --- a/packages/lucid-evolution/src/misc/sign_data.ts +++ b/packages/lucid-evolution/src/misc/sign_data.ts @@ -1,11 +1,10 @@ +import { fromHex, toHex } from "../mod.js"; import { - fromHex, KeyHash, Payload, PrivateKey, SignedMessage, - toHex, -} from "../mod.js"; +} from "@anastasia-labs/core-types"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import * as M from "@emurgo/cardano-message-signing-nodejs"; diff --git a/packages/lucid-evolution/src/misc/wallet.ts b/packages/lucid-evolution/src/misc/wallet.ts index a0c008c3..cfd8b2ca 100644 --- a/packages/lucid-evolution/src/misc/wallet.ts +++ b/packages/lucid-evolution/src/misc/wallet.ts @@ -1,13 +1,12 @@ +import { fromHex, getAddressDetails } from "../mod.js"; import { Address, - fromHex, - getAddressDetails, KeyHash, Network, PrivateKey, RewardAddress, UTxO, -} from "../mod.js"; +} from "@anastasia-labs/core-types"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { mnemonicToEntropy } from "./bip39.js"; diff --git a/packages/lucid-evolution/src/mod.ts b/packages/lucid-evolution/src/mod.ts index efdcc8be..6adcddb7 100644 --- a/packages/lucid-evolution/src/mod.ts +++ b/packages/lucid-evolution/src/mod.ts @@ -1,6 +1,5 @@ export * from "./lucid/mod.js"; export * from "./provider/mod.js"; -export * from "./types/mod.js"; export * from "./utils/mod.js"; export * from "./plutus/mod.js"; export * from "./tx-builder/mod.js"; diff --git a/packages/lucid-evolution/src/plutus/data.ts b/packages/lucid-evolution/src/plutus/data.ts index f5f086d2..048cf5d9 100644 --- a/packages/lucid-evolution/src/plutus/data.ts +++ b/packages/lucid-evolution/src/plutus/data.ts @@ -8,7 +8,7 @@ import { Type, } from "@sinclair/typebox"; export * from "@sinclair/typebox"; -import type { Datum, Exact, Json, Redeemer } from "../types/mod.js"; +import { Datum, Exact, Json, Redeemer } from "@anastasia-labs/core-types"; import { fromHex, fromText, toHex } from "../utils/utils.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; diff --git a/packages/lucid-evolution/src/plutus/time.ts b/packages/lucid-evolution/src/plutus/time.ts index bce591bb..074d8848 100644 --- a/packages/lucid-evolution/src/plutus/time.ts +++ b/packages/lucid-evolution/src/plutus/time.ts @@ -1,4 +1,9 @@ -import { Network, Slot, SlotConfig, UnixTime } from "../types/mod.js"; +import { + Network, + Slot, + SlotConfig, + UnixTime, +} from "@anastasia-labs/core-types"; export const SLOT_CONFIG_NETWORK: Record = { Mainnet: { zeroTime: 1596059091000, zeroSlot: 4492800, slotLength: 1000 }, // Starting at Shelley era diff --git a/packages/lucid-evolution/src/provider/blockfrost.ts b/packages/lucid-evolution/src/provider/blockfrost.ts index 2a6fb241..f218eb1d 100644 --- a/packages/lucid-evolution/src/provider/blockfrost.ts +++ b/packages/lucid-evolution/src/provider/blockfrost.ts @@ -14,7 +14,7 @@ import { TxHash, Unit, UTxO, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import packageJson from "../../package.json"; export class Blockfrost implements Provider { diff --git a/packages/lucid-evolution/src/provider/emulator.ts b/packages/lucid-evolution/src/provider/emulator.ts index 4a2a96f1..d1486175 100644 --- a/packages/lucid-evolution/src/provider/emulator.ts +++ b/packages/lucid-evolution/src/provider/emulator.ts @@ -19,7 +19,7 @@ import { Unit, UnixTime, UTxO, -} from "../types/types.js"; +} from "@anastasia-labs/core-types"; import { PROTOCOL_PARAMETERS_DEFAULT } from "../utils/mod.js"; import { coreToUtxo, diff --git a/packages/lucid-evolution/src/provider/kupmios.ts b/packages/lucid-evolution/src/provider/kupmios.ts index 2d1bd1bc..653e3777 100644 --- a/packages/lucid-evolution/src/provider/kupmios.ts +++ b/packages/lucid-evolution/src/provider/kupmios.ts @@ -13,7 +13,7 @@ import { TxHash, Unit, UTxO, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { fromHex, fromUnit, toHex } from "../utils/mod.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; diff --git a/packages/lucid-evolution/src/provider/maestro.ts b/packages/lucid-evolution/src/provider/maestro.ts index 0064163f..3b8ce4f5 100644 --- a/packages/lucid-evolution/src/provider/maestro.ts +++ b/packages/lucid-evolution/src/provider/maestro.ts @@ -16,7 +16,7 @@ import { TxHash, Unit, UTxO, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import packageJson from "../../package.json"; export type MaestroSupportedNetworks = "Mainnet" | "Preprod" | "Preview"; diff --git a/packages/lucid-evolution/src/tx-builder/Attach.ts b/packages/lucid-evolution/src/tx-builder/Attach.ts index 7dcb30fc..ff827499 100644 --- a/packages/lucid-evolution/src/tx-builder/Attach.ts +++ b/packages/lucid-evolution/src/tx-builder/Attach.ts @@ -1,10 +1,10 @@ +import { applyDoubleCborEncoding } from "../mod.js"; import { CertificateValidator, MintingPolicy, SpendingValidator, WithdrawalValidator, - applyDoubleCborEncoding, -} from "../mod.js"; +} from "@anastasia-labs/core-types"; import { makeTx } from "./MakeTx.js"; import { Config } from "./types.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; diff --git a/packages/lucid-evolution/src/tx-builder/Collect.ts b/packages/lucid-evolution/src/tx-builder/Collect.ts index f0a99abc..37af2fb1 100644 --- a/packages/lucid-evolution/src/tx-builder/Collect.ts +++ b/packages/lucid-evolution/src/tx-builder/Collect.ts @@ -1,5 +1,6 @@ import { Effect } from "effect"; -import { Data, Redeemer, ScriptType, UTxO, utxoToCore } from "../mod.js"; +import { Data, utxoToCore } from "../mod.js"; +import { Redeemer, ScriptType, UTxO } from "@anastasia-labs/core-types"; import { Config } from "./types.js"; import { DatumOfError } from "./Errors.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; diff --git a/packages/lucid-evolution/src/tx-builder/Complete.ts b/packages/lucid-evolution/src/tx-builder/Complete.ts index 8dcb35c7..8a86a7ab 100644 --- a/packages/lucid-evolution/src/tx-builder/Complete.ts +++ b/packages/lucid-evolution/src/tx-builder/Complete.ts @@ -1,5 +1,6 @@ import { Effect } from "effect"; -import { Address, OutputData, TxComplete } from "../mod.js"; +import { TxComplete } from "../mod.js"; +import { Address, OutputData } from "@anastasia-labs/core-types"; import { Config } from "./types.js"; import { GetUTxosCoreError, diff --git a/packages/lucid-evolution/src/tx-builder/Interval.ts b/packages/lucid-evolution/src/tx-builder/Interval.ts index a674bbc3..5e6d44d5 100644 --- a/packages/lucid-evolution/src/tx-builder/Interval.ts +++ b/packages/lucid-evolution/src/tx-builder/Interval.ts @@ -1,5 +1,5 @@ import { Effect } from "effect"; -import { UnixTime } from "../mod.js"; +import { UnixTime } from "@anastasia-labs/core-types"; import { Config } from "./types.js"; import { makeTx } from "./MakeTx.js"; diff --git a/packages/lucid-evolution/src/tx-builder/Mint.ts b/packages/lucid-evolution/src/tx-builder/Mint.ts index 63add673..153d68bc 100644 --- a/packages/lucid-evolution/src/tx-builder/Mint.ts +++ b/packages/lucid-evolution/src/tx-builder/Mint.ts @@ -1,5 +1,6 @@ import { Effect } from "effect"; -import { Assets, Redeemer, toText } from "../mod.js"; +import { toText } from "../mod.js"; +import { Assets, Redeemer } from "@anastasia-labs/core-types"; import { Config } from "./types.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { toPartial, toV1, toV2 } from "./utils.js"; diff --git a/packages/lucid-evolution/src/tx-builder/Native.ts b/packages/lucid-evolution/src/tx-builder/Native.ts index 203bdb80..710c9157 100644 --- a/packages/lucid-evolution/src/tx-builder/Native.ts +++ b/packages/lucid-evolution/src/tx-builder/Native.ts @@ -1,6 +1,6 @@ import * as S from "@effect/schema/Schema"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; -import { Script } from "../mod.js"; +import { Script } from "@anastasia-labs/core-types"; export type NativeScriptType = | { diff --git a/packages/lucid-evolution/src/tx-builder/Pay.ts b/packages/lucid-evolution/src/tx-builder/Pay.ts index ade4d2fc..ea0d7fab 100644 --- a/packages/lucid-evolution/src/tx-builder/Pay.ts +++ b/packages/lucid-evolution/src/tx-builder/Pay.ts @@ -1,5 +1,6 @@ import { Effect, pipe } from "effect"; -import { Address, Assets, Script, assetsToValue, toScriptRef } from "../mod.js"; +import { assetsToValue, toScriptRef } from "../mod.js"; +import { Address, Assets, Script } from "@anastasia-labs/core-types"; import { Config, OutputDatum } from "./types.js"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { addressFromWithNetworkCheck, toDatumOption } from "./utils.js"; diff --git a/packages/lucid-evolution/src/tx-builder/Read.ts b/packages/lucid-evolution/src/tx-builder/Read.ts index 8ba9a52a..2ba83599 100644 --- a/packages/lucid-evolution/src/tx-builder/Read.ts +++ b/packages/lucid-evolution/src/tx-builder/Read.ts @@ -1,5 +1,6 @@ import { Effect } from "effect"; -import { Data, UTxO, utxoToCore } from "../mod.js"; +import { Data, utxoToCore } from "../mod.js"; +import { UTxO } from "@anastasia-labs/core-types"; import { Config } from "./types.js"; import { makeTx } from "./MakeTx.js"; import { DatumOfError } from "./Errors.js"; diff --git a/packages/lucid-evolution/src/tx-builder/types.ts b/packages/lucid-evolution/src/tx-builder/types.ts index 4f87b9f1..85ecedeb 100644 --- a/packages/lucid-evolution/src/tx-builder/types.ts +++ b/packages/lucid-evolution/src/tx-builder/types.ts @@ -1,5 +1,6 @@ import { Effect } from "effect"; -import { Lucid, ScriptType, UTxO } from "../mod.js"; +import { Lucid } from "../mod.js"; +import { ScriptType, UTxO } from "@anastasia-labs/core-types"; import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { RunTimeError, TransactionErrors } from "./Errors.js"; diff --git a/packages/lucid-evolution/src/tx-builder/utils.ts b/packages/lucid-evolution/src/tx-builder/utils.ts index ae98c23f..6083a0f4 100644 --- a/packages/lucid-evolution/src/tx-builder/utils.ts +++ b/packages/lucid-evolution/src/tx-builder/utils.ts @@ -2,7 +2,8 @@ import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; import { C } from "lucid-cardano"; import { CBORHex, OutputDatum } from "./types.js"; import { Effect } from "effect"; -import { Address, Lucid, RewardAddress, fromHex, networkToId } from "../mod.js"; +import { Lucid, fromHex, networkToId } from "../mod.js"; +import { Address, RewardAddress } from "@anastasia-labs/core-types"; import { TxRunTimeError, NetworkError } from "./Errors.js"; export const toDatumOption = (outputDatum: OutputDatum): CML.DatumOption => { diff --git a/packages/lucid-evolution/src/utils/cost_model.ts b/packages/lucid-evolution/src/utils/cost_model.ts index 084f1f7f..0300a903 100644 --- a/packages/lucid-evolution/src/utils/cost_model.ts +++ b/packages/lucid-evolution/src/utils/cost_model.ts @@ -1,6 +1,5 @@ import * as CML from "@dcspark/cardano-multiplatform-lib-nodejs"; -import type { CostModels } from "../mod.js"; -import type { ProtocolParameters } from "../types/types.js"; +import { CostModels, ProtocolParameters } from "@anastasia-labs/core-types"; export function createCostModels(costModels: CostModels): CML.CostModels { const costmdls = CML.CostModels.new(); diff --git a/packages/lucid-evolution/src/utils/utils.ts b/packages/lucid-evolution/src/utils/utils.ts index 518b811b..96b9c77c 100644 --- a/packages/lucid-evolution/src/utils/utils.ts +++ b/packages/lucid-evolution/src/utils/utils.ts @@ -7,7 +7,7 @@ import { slotToBeginUnixTime, unixTimeToEnclosingSlot, } from "../plutus/time.js"; -import type { +import { Address, AddressDetails, Assets, @@ -34,7 +34,7 @@ import type { UTxO, Validator, WithdrawalValidator, -} from "../types/mod.js"; +} from "@anastasia-labs/core-types"; import { Native, nativeJSFromJson } from "../tx-builder/Native.js"; export class Utils { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 48468b88..a8c10fbf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -70,6 +70,21 @@ importers: specifier: ^5.3.3 version: 5.3.3 + packages/core-types: + devDependencies: + '@dcspark/cardano-multiplatform-lib-nodejs': + specifier: ^5.1.0 + version: 5.1.0 + '@types/node': + specifier: ^20.11.24 + version: 20.11.24 + tsup: + specifier: ^8.0.2 + version: 8.0.2(typescript@5.3.3) + typescript: + specifier: ^5.3.3 + version: 5.3.3 + packages/eslint-config: devDependencies: '@typescript-eslint/eslint-plugin': @@ -96,6 +111,9 @@ importers: packages/lucid-evolution: devDependencies: + '@anastasia-labs/core-types': + specifier: workspace:* + version: link:../core-types '@dcspark/cardano-multiplatform-lib-nodejs': specifier: ^5.1.0 version: 5.1.0