From 12171b8265fcda1ac6606deabad0874ada3f5558 Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Thu, 22 Sep 2022 13:49:26 +1000 Subject: [PATCH 1/4] docs: update README workflow badges - replace CI with Post-integration - Add Nightly and Release --- README.md | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7eca667a912..e283be994c7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,9 @@

-[![CI][img_src_ci]][workflow_ci] +[![PostIntegration][img_src_post-integration]][workflow_post-integration] +[![Nightly][img_src_nightly]][workflow_nightly] +[![Release][img_src_release]][workflow_release]
@@ -116,6 +118,10 @@ yarn docs :book: Documentation

-[img_src_ci]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/continuous-integration.yaml/badge.svg -[workflow_ci]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/continuous-integration.yaml +[img_src_post-integration]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/post_integration.yml/badge.svg +[workflow_post-integration]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/post_integration.yml +[img_src_nightly]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/nightly.yaml/badge.svg +[workflow_nightly]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/nightly.yaml +[img_src_release]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/release.yaml/badge.svg +[workflow_release]: https://github.com/input-output-hk/cardano-js-sdk/actions/workflows/release.yaml [let us know!]: https://github.com/input-output-hk/cardano-graphql/discussions/new From f4d6632d61c5b63bc15a64ec3962425f9ad2d6eb Mon Sep 17 00:00:00 2001 From: Angel Castillo Date: Wed, 21 Sep 2022 16:40:12 +0800 Subject: [PATCH 2/4] refactor(input-selection)!: renamed cip2 package to input-selection --- README.md | 2 +- packages/cardano-services/test/tsconfig.json | 4 +- packages/cip2/CHANGELOG.md | 102 ------------------ packages/e2e/test/tsconfig.json | 4 +- packages/{cip2 => input-selection}/.gitignore | 0 packages/input-selection/CHANGELOG.md | 102 ++++++++++++++++++ packages/{cip2 => input-selection}/LICENSE | 0 packages/{cip2 => input-selection}/NOTICE | 0 packages/{cip2 => input-selection}/README.md | 6 +- .../{cip2 => input-selection}/jest.config.js | 0 .../{cip2 => input-selection}/package.json | 4 +- .../src/InputSelectionError.ts | 0 .../src/RoundRobinRandomImprove/change.ts | 0 .../src/RoundRobinRandomImprove/index.ts | 0 .../src/RoundRobinRandomImprove/roundRobin.ts | 0 .../src/RoundRobinRandomImprove/util.ts | 0 .../{cip2 => input-selection}/src/index.ts | 0 .../src/selectionConstraints.ts | 0 .../src/tsconfig.json | 0 .../{cip2 => input-selection}/src/types.ts | 0 .../test/RoundRobinRandomImprove.test.ts | 0 .../test/jest.setup.js | 0 .../test/selectionConstraints.test.ts | 0 .../test/tsconfig.json | 0 .../test/util/index.ts | 0 .../test/util/properties.ts | 0 .../test/util/selectionConstraints.ts | 0 .../test/util/tests.ts | 0 packages/wallet/package.json | 2 +- packages/wallet/src/SingleAddressWallet.ts | 2 +- .../Transaction/createTransactionInternals.ts | 2 +- packages/wallet/src/TxBuilder/types.ts | 2 +- packages/wallet/src/cip30.ts | 2 +- packages/wallet/src/services/WalletUtil.ts | 2 +- packages/wallet/src/tsconfig.json | 2 +- packages/wallet/src/types.ts | 2 +- .../createTransactionInternals.test.ts | 4 +- packages/wallet/test/tsconfig.json | 4 +- yarn-project.nix | 4 +- yarn.lock | 42 ++++---- 40 files changed, 147 insertions(+), 147 deletions(-) delete mode 100644 packages/cip2/CHANGELOG.md rename packages/{cip2 => input-selection}/.gitignore (100%) create mode 100644 packages/input-selection/CHANGELOG.md rename packages/{cip2 => input-selection}/LICENSE (100%) rename packages/{cip2 => input-selection}/NOTICE (100%) rename packages/{cip2 => input-selection}/README.md (90%) rename packages/{cip2 => input-selection}/jest.config.js (100%) rename packages/{cip2 => input-selection}/package.json (94%) rename packages/{cip2 => input-selection}/src/InputSelectionError.ts (100%) rename packages/{cip2 => input-selection}/src/RoundRobinRandomImprove/change.ts (100%) rename packages/{cip2 => input-selection}/src/RoundRobinRandomImprove/index.ts (100%) rename packages/{cip2 => input-selection}/src/RoundRobinRandomImprove/roundRobin.ts (100%) rename packages/{cip2 => input-selection}/src/RoundRobinRandomImprove/util.ts (100%) rename packages/{cip2 => input-selection}/src/index.ts (100%) rename packages/{cip2 => input-selection}/src/selectionConstraints.ts (100%) rename packages/{cip2 => input-selection}/src/tsconfig.json (100%) rename packages/{cip2 => input-selection}/src/types.ts (100%) rename packages/{cip2 => input-selection}/test/RoundRobinRandomImprove.test.ts (100%) rename packages/{cip2 => input-selection}/test/jest.setup.js (100%) rename packages/{cip2 => input-selection}/test/selectionConstraints.test.ts (100%) rename packages/{cip2 => input-selection}/test/tsconfig.json (100%) rename packages/{cip2 => input-selection}/test/util/index.ts (100%) rename packages/{cip2 => input-selection}/test/util/properties.ts (100%) rename packages/{cip2 => input-selection}/test/util/selectionConstraints.ts (100%) rename packages/{cip2 => input-selection}/test/util/tests.ts (100%) diff --git a/README.md b/README.md index 7eca667a912..409e25a98a0 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ A suite of TypeScript packages suitable for both Node.js and browser-based development. - [@cardano-sdk/core](./packages/core) -- [@cardano-sdk/cip2](./packages/cip2) +- [@cardano-sdk/input-selection](./packages/input-selection) - [@cardano-sdk/cip30](./packages/cip30) - [@cardano-sdk/governance](./packages/governance) - [@cardano-sdk/key-management](./packages/key-management) diff --git a/packages/cardano-services/test/tsconfig.json b/packages/cardano-services/test/tsconfig.json index 2cf58786c71..907bf31aaeb 100644 --- a/packages/cardano-services/test/tsconfig.json +++ b/packages/cardano-services/test/tsconfig.json @@ -5,7 +5,7 @@ }, "include": [ "./**/*.ts", - "../../cip2/test/util", + "../../input-selection/test/util", "../../core/test/CardanoNode", "../../ogmios/test/mocks" ], @@ -29,7 +29,7 @@ "path": "../../ogmios/src" }, { - "path": "../../cip2/src" + "path": "../../input-selection/src" } ] } diff --git a/packages/cip2/CHANGELOG.md b/packages/cip2/CHANGELOG.md deleted file mode 100644 index 475c234d232..00000000000 --- a/packages/cip2/CHANGELOG.md +++ /dev/null @@ -1,102 +0,0 @@ -# Change Log - -All notable changes to this project will be documented in this file. -See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - -## [0.5.0](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/cip2@0.4.0...@cardano-sdk/cip2@0.5.0) (2022-08-30) - - -### ⚠ BREAKING CHANGES - -* rename InputSelectionParameters implicitCoin->implicitValue.coin -* rm TxAlonzo.implicitCoin -* update min utxo computation to be Babbage-compatible - -### Features - -* **cip2:** add implicit tokens support (mint/burn) for input selection ([3361855](https://github.com/input-output-hk/cardano-js-sdk/commit/3361855a2fbf20afc8ead11565ac6759548ab13f)) - - -### Bug Fixes - -* update min utxo computation to be Babbage-compatible ([51ca1d5](https://github.com/input-output-hk/cardano-js-sdk/commit/51ca1d5716b62b47d211475aba1be4a6d5782397)) - - -### Code Refactoring - -* rename InputSelectionParameters implicitCoin->implicitValue.coin ([3242a0d](https://github.com/input-output-hk/cardano-js-sdk/commit/3242a0dc63da0e59c4f8536d16758ea19f58a2c0)) -* rm TxAlonzo.implicitCoin ([167d205](https://github.com/input-output-hk/cardano-js-sdk/commit/167d205dd15c857b229f968ab53a6e52e5504d3f)) - - - -## [0.4.0](https://github.com/input-output-hk/cardano-js-sdk/compare/0.3.0...@cardano-sdk/cip2@0.4.0) (2022-07-25) - - -### ⚠ BREAKING CHANGES - -* update min utxo computation to be Babbage-compatible - -### Bug Fixes - -* update min utxo computation to be Babbage-compatible ([51ca1d5](https://github.com/input-output-hk/cardano-js-sdk/commit/51ca1d5716b62b47d211475aba1be4a6d5782397)) - -## 0.3.0 (2022-06-24) - - -### ⚠ BREAKING CHANGES - -* **cip2:** update interfaces to use core package types instead of CSL - -### Features - -* **cip2:** add support for custom random fn ([934c855](https://github.com/input-output-hk/cardano-js-sdk/commit/934c85520ca666bc62cc51afa6fbf17dda7bbfb5)) - - -### Bug Fixes - -* **cip2:** adjust fee by hardcoded value (+10k) ([7410ae0](https://github.com/input-output-hk/cardano-js-sdk/commit/7410ae053ea2b4c78d82659a89bdcfd895a4e808)) -* **cip2:** computeSelectionLimit constraint logic error ([b329971](https://github.com/input-output-hk/cardano-js-sdk/commit/b3299713ae40a6e5e06a312b4b28f6c20a6a3ef8)) -* **cip2:** omit 0 qty assets from change bundles ([d3a12cf](https://github.com/input-output-hk/cardano-js-sdk/commit/d3a12cfb577bcae04f793e96f23ce84ee87a7bcb)) -* **cip2:** property tests generate quantities > 0 ([3988ca0](https://github.com/input-output-hk/cardano-js-sdk/commit/3988ca002d45ca8a060d54fb67b244702157ca7e)) -* **cip2:** recompute min fee after selecting extra utxo due to min value ([bfb7db5](https://github.com/input-output-hk/cardano-js-sdk/commit/bfb7db55b76d154e036e788edae376b1589510ee)) -* **cip2:** remove hardcoded value in minimum cost selection constraint ([ad6d133](https://github.com/input-output-hk/cardano-js-sdk/commit/ad6d133a0ba1f865bf2ae1ca3f46b8e6f918502b)) -* resolve issues preventing to make a delegation tx ([7429f46](https://github.com/input-output-hk/cardano-js-sdk/commit/7429f466763342b08b6bed44f23d3bf24dbf92f2)) -* rm imports from @cardano-sdk/*/src/* ([3fdead3](https://github.com/input-output-hk/cardano-js-sdk/commit/3fdead3ae381a3efb98299b9881c6a964461b7db)) - - -### Code Refactoring - -* **cip2:** update interfaces to use core package types instead of CSL ([5c66d32](https://github.com/input-output-hk/cardano-js-sdk/commit/5c66d32fdc58100a2b0807a0470342d54a3989ed)) - -### 0.1.5 (2021-10-27) - - -### Features - -* **cip2:** add support for implicit coin ([47f6bd2](https://github.com/input-output-hk/cardano-js-sdk/commit/47f6bd2ee714ff9b6b9d8d311f2b3526f88a1a2b)) - -### 0.1.3 (2021-10-05) - -### 0.1.2 (2021-09-30) - - -### Bug Fixes - -* add missing dependencies ([2d3bfbc](https://github.com/input-output-hk/cardano-js-sdk/commit/2d3bfbc3f8d5fdce3be64835c57304b540e05811)) - -### 0.1.1 (2021-09-30) - - -### Features - -* **cip2:** implement defaultSelectionConstraints ([f93e3f1](https://github.com/input-output-hk/cardano-js-sdk/commit/f93e3f1fd860a477f81975ad415d38c3c93c65d9)) -* **cip2:** initial implementation of RoundRobinRandomImprove ([17080e2](https://github.com/input-output-hk/cardano-js-sdk/commit/17080e2ee37ed5b3f51affef8dc834ae3943219f)) - - -### Bug Fixes - -* **cip2:** add fee to selection skeleton ([36e93bc](https://github.com/input-output-hk/cardano-js-sdk/commit/36e93bccb8f5426022631f409b85aa2fe4ea7470)) -* **cip2:** change token bundle size constraint arg to CSL.MultiAsset ([4bde8e8](https://github.com/input-output-hk/cardano-js-sdk/commit/4bde8e8fde11908d4295f3f53918faed255f1ba0)) -* **cip2:** compute selection limit constraint with actual fee instead of max u64 ([eee4f5e](https://github.com/input-output-hk/cardano-js-sdk/commit/eee4f5e035a20fb61b151d294213978fd8f39302)) -* **cip2:** ensure there are no empty change bundles, add some test info to README ([8f3f20b](https://github.com/input-output-hk/cardano-js-sdk/commit/8f3f20ba8de812895844fad0d09eb63104114a83)) -* **cip2:** exclude fee from change bundles ([16d7c26](https://github.com/input-output-hk/cardano-js-sdk/commit/16d7c267df0b9f70d1e2ba1afd03e531282686fd)) diff --git a/packages/e2e/test/tsconfig.json b/packages/e2e/test/tsconfig.json index 3782cda81f0..0b77c0b844b 100644 --- a/packages/e2e/test/tsconfig.json +++ b/packages/e2e/test/tsconfig.json @@ -8,7 +8,7 @@ "./**/*.ts", "../../ogmios/test", "../../wallet/test", - "../../cip2/test/util" + "../../input-selection/test/util" ], "references": [ { @@ -36,7 +36,7 @@ "path": "../../wallet/src" }, { - "path": "../../cip2/src" + "path": "../../input-selection/src" } ] } diff --git a/packages/cip2/.gitignore b/packages/input-selection/.gitignore similarity index 100% rename from packages/cip2/.gitignore rename to packages/input-selection/.gitignore diff --git a/packages/input-selection/CHANGELOG.md b/packages/input-selection/CHANGELOG.md new file mode 100644 index 00000000000..31aa28151a2 --- /dev/null +++ b/packages/input-selection/CHANGELOG.md @@ -0,0 +1,102 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +## [0.5.0](https://github.com/input-output-hk/cardano-js-sdk/compare/@cardano-sdk/input-selection@0.4.0...@cardano-sdk/input-selection@0.5.0) (2022-08-30) + + +### ⚠ BREAKING CHANGES + +* rename InputSelectionParameters implicitCoin->implicitValue.coin +* rm TxAlonzo.implicitCoin +* update min utxo computation to be Babbage-compatible + +### Features + +* **input-selection:** add implicit tokens support (mint/burn) for input selection ([3361855](https://github.com/input-output-hk/cardano-js-sdk/commit/3361855a2fbf20afc8ead11565ac6759548ab13f)) + + +### Bug Fixes + +* update min utxo computation to be Babbage-compatible ([51ca1d5](https://github.com/input-output-hk/cardano-js-sdk/commit/51ca1d5716b62b47d211475aba1be4a6d5782397)) + + +### Code Refactoring + +* rename InputSelectionParameters implicitCoin->implicitValue.coin ([3242a0d](https://github.com/input-output-hk/cardano-js-sdk/commit/3242a0dc63da0e59c4f8536d16758ea19f58a2c0)) +* rm TxAlonzo.implicitCoin ([167d205](https://github.com/input-output-hk/cardano-js-sdk/commit/167d205dd15c857b229f968ab53a6e52e5504d3f)) + + + +## [0.4.0](https://github.com/input-output-hk/cardano-js-sdk/compare/0.3.0...@cardano-sdk/input-selection@0.4.0) (2022-07-25) + + +### ⚠ BREAKING CHANGES + +* update min utxo computation to be Babbage-compatible + +### Bug Fixes + +* update min utxo computation to be Babbage-compatible ([51ca1d5](https://github.com/input-output-hk/cardano-js-sdk/commit/51ca1d5716b62b47d211475aba1be4a6d5782397)) + +## 0.3.0 (2022-06-24) + + +### ⚠ BREAKING CHANGES + +* **input-selection:** update interfaces to use core package types instead of CSL + +### Features + +* **input-selection:** add support for custom random fn ([934c855](https://github.com/input-output-hk/cardano-js-sdk/commit/934c85520ca666bc62cc51afa6fbf17dda7bbfb5)) + + +### Bug Fixes + +* **input-selection:** adjust fee by hardcoded value (+10k) ([7410ae0](https://github.com/input-output-hk/cardano-js-sdk/commit/7410ae053ea2b4c78d82659a89bdcfd895a4e808)) +* **input-selection:** computeSelectionLimit constraint logic error ([b329971](https://github.com/input-output-hk/cardano-js-sdk/commit/b3299713ae40a6e5e06a312b4b28f6c20a6a3ef8)) +* **input-selection:** omit 0 qty assets from change bundles ([d3a12cf](https://github.com/input-output-hk/cardano-js-sdk/commit/d3a12cfb577bcae04f793e96f23ce84ee87a7bcb)) +* **input-selection:** property tests generate quantities > 0 ([3988ca0](https://github.com/input-output-hk/cardano-js-sdk/commit/3988ca002d45ca8a060d54fb67b244702157ca7e)) +* **input-selection:** recompute min fee after selecting extra utxo due to min value ([bfb7db5](https://github.com/input-output-hk/cardano-js-sdk/commit/bfb7db55b76d154e036e788edae376b1589510ee)) +* **input-selection:** remove hardcoded value in minimum cost selection constraint ([ad6d133](https://github.com/input-output-hk/cardano-js-sdk/commit/ad6d133a0ba1f865bf2ae1ca3f46b8e6f918502b)) +* resolve issues preventing to make a delegation tx ([7429f46](https://github.com/input-output-hk/cardano-js-sdk/commit/7429f466763342b08b6bed44f23d3bf24dbf92f2)) +* rm imports from @cardano-sdk/*/src/* ([3fdead3](https://github.com/input-output-hk/cardano-js-sdk/commit/3fdead3ae381a3efb98299b9881c6a964461b7db)) + + +### Code Refactoring + +* **input-selection:** update interfaces to use core package types instead of CSL ([5c66d32](https://github.com/input-output-hk/cardano-js-sdk/commit/5c66d32fdc58100a2b0807a0470342d54a3989ed)) + +### 0.1.5 (2021-10-27) + + +### Features + +* **input-selection:** add support for implicit coin ([47f6bd2](https://github.com/input-output-hk/cardano-js-sdk/commit/47f6bd2ee714ff9b6b9d8d311f2b3526f88a1a2b)) + +### 0.1.3 (2021-10-05) + +### 0.1.2 (2021-09-30) + + +### Bug Fixes + +* add missing dependencies ([2d3bfbc](https://github.com/input-output-hk/cardano-js-sdk/commit/2d3bfbc3f8d5fdce3be64835c57304b540e05811)) + +### 0.1.1 (2021-09-30) + + +### Features + +* **input-selection:** implement defaultSelectionConstraints ([f93e3f1](https://github.com/input-output-hk/cardano-js-sdk/commit/f93e3f1fd860a477f81975ad415d38c3c93c65d9)) +* **input-selection:** initial implementation of RoundRobinRandomImprove ([17080e2](https://github.com/input-output-hk/cardano-js-sdk/commit/17080e2ee37ed5b3f51affef8dc834ae3943219f)) + + +### Bug Fixes + +* **input-selection:** add fee to selection skeleton ([36e93bc](https://github.com/input-output-hk/cardano-js-sdk/commit/36e93bccb8f5426022631f409b85aa2fe4ea7470)) +* **input-selection:** change token bundle size constraint arg to CSL.MultiAsset ([4bde8e8](https://github.com/input-output-hk/cardano-js-sdk/commit/4bde8e8fde11908d4295f3f53918faed255f1ba0)) +* **input-selection:** compute selection limit constraint with actual fee instead of max u64 ([eee4f5e](https://github.com/input-output-hk/cardano-js-sdk/commit/eee4f5e035a20fb61b151d294213978fd8f39302)) +* **input-selection:** ensure there are no empty change bundles, add some test info to README ([8f3f20b](https://github.com/input-output-hk/cardano-js-sdk/commit/8f3f20ba8de812895844fad0d09eb63104114a83)) +* **input-selection:** exclude fee from change bundles ([16d7c26](https://github.com/input-output-hk/cardano-js-sdk/commit/16d7c267df0b9f70d1e2ba1afd03e531282686fd)) diff --git a/packages/cip2/LICENSE b/packages/input-selection/LICENSE similarity index 100% rename from packages/cip2/LICENSE rename to packages/input-selection/LICENSE diff --git a/packages/cip2/NOTICE b/packages/input-selection/NOTICE similarity index 100% rename from packages/cip2/NOTICE rename to packages/input-selection/NOTICE diff --git a/packages/cip2/README.md b/packages/input-selection/README.md similarity index 90% rename from packages/cip2/README.md rename to packages/input-selection/README.md index 423661d2ea5..492b2ccbf6b 100644 --- a/packages/cip2/README.md +++ b/packages/input-selection/README.md @@ -1,13 +1,13 @@ -# Cardano JS SDK | CIP2 | Input Selection +# Cardano JS SDK | Input Selection | CIP-0002 This package implements concepts from the draft specification being developed in [CIP-0002]. -Currently there is only 1 input selection algorithm: RoundRobinRandomImprove, which is a [Random-Improve] adaptation that handles asset selection. +Currently, there is only 1 input selection algorithm: RoundRobinRandomImprove, which is an [Random-Improve] adaptation that handles asset selection. ## Usage Example ```typescript -import { roundRobinRandomImprove, defaultSelectionConstraints, InputSelector, SelectionResult, SelectionSkeleton } from '@cardano-sdk/cip2'; +import { roundRobinRandomImprove, defaultSelectionConstraints, InputSelector, SelectionResult, SelectionSkeleton } from '@cardano-sdk/input-selection'; import { loadCardanoSerializationLib, CSL, CardanoSerializationLib, ProtocolParametersRequiredByWallet } from '@cardano-sdk/core'; const demo = async (protocolParameters: ProtocolParametersRequiredByWallet): Promise => { diff --git a/packages/cip2/jest.config.js b/packages/input-selection/jest.config.js similarity index 100% rename from packages/cip2/jest.config.js rename to packages/input-selection/jest.config.js diff --git a/packages/cip2/package.json b/packages/input-selection/package.json similarity index 94% rename from packages/cip2/package.json rename to packages/input-selection/package.json index 49aff71f842..0f630ed3901 100644 --- a/packages/cip2/package.json +++ b/packages/input-selection/package.json @@ -1,7 +1,7 @@ { - "name": "@cardano-sdk/cip2", + "name": "@cardano-sdk/input-selection", "version": "0.5.0", - "description": "TypeScript definitions for CIP2 (Coin Selection Algorithms for Cardano)", + "description": "TypeScript definitions for input-selection (Coin Selection Algorithms for Cardano)", "engines": { "node": "^14" }, diff --git a/packages/cip2/src/InputSelectionError.ts b/packages/input-selection/src/InputSelectionError.ts similarity index 100% rename from packages/cip2/src/InputSelectionError.ts rename to packages/input-selection/src/InputSelectionError.ts diff --git a/packages/cip2/src/RoundRobinRandomImprove/change.ts b/packages/input-selection/src/RoundRobinRandomImprove/change.ts similarity index 100% rename from packages/cip2/src/RoundRobinRandomImprove/change.ts rename to packages/input-selection/src/RoundRobinRandomImprove/change.ts diff --git a/packages/cip2/src/RoundRobinRandomImprove/index.ts b/packages/input-selection/src/RoundRobinRandomImprove/index.ts similarity index 100% rename from packages/cip2/src/RoundRobinRandomImprove/index.ts rename to packages/input-selection/src/RoundRobinRandomImprove/index.ts diff --git a/packages/cip2/src/RoundRobinRandomImprove/roundRobin.ts b/packages/input-selection/src/RoundRobinRandomImprove/roundRobin.ts similarity index 100% rename from packages/cip2/src/RoundRobinRandomImprove/roundRobin.ts rename to packages/input-selection/src/RoundRobinRandomImprove/roundRobin.ts diff --git a/packages/cip2/src/RoundRobinRandomImprove/util.ts b/packages/input-selection/src/RoundRobinRandomImprove/util.ts similarity index 100% rename from packages/cip2/src/RoundRobinRandomImprove/util.ts rename to packages/input-selection/src/RoundRobinRandomImprove/util.ts diff --git a/packages/cip2/src/index.ts b/packages/input-selection/src/index.ts similarity index 100% rename from packages/cip2/src/index.ts rename to packages/input-selection/src/index.ts diff --git a/packages/cip2/src/selectionConstraints.ts b/packages/input-selection/src/selectionConstraints.ts similarity index 100% rename from packages/cip2/src/selectionConstraints.ts rename to packages/input-selection/src/selectionConstraints.ts diff --git a/packages/cip2/src/tsconfig.json b/packages/input-selection/src/tsconfig.json similarity index 100% rename from packages/cip2/src/tsconfig.json rename to packages/input-selection/src/tsconfig.json diff --git a/packages/cip2/src/types.ts b/packages/input-selection/src/types.ts similarity index 100% rename from packages/cip2/src/types.ts rename to packages/input-selection/src/types.ts diff --git a/packages/cip2/test/RoundRobinRandomImprove.test.ts b/packages/input-selection/test/RoundRobinRandomImprove.test.ts similarity index 100% rename from packages/cip2/test/RoundRobinRandomImprove.test.ts rename to packages/input-selection/test/RoundRobinRandomImprove.test.ts diff --git a/packages/cip2/test/jest.setup.js b/packages/input-selection/test/jest.setup.js similarity index 100% rename from packages/cip2/test/jest.setup.js rename to packages/input-selection/test/jest.setup.js diff --git a/packages/cip2/test/selectionConstraints.test.ts b/packages/input-selection/test/selectionConstraints.test.ts similarity index 100% rename from packages/cip2/test/selectionConstraints.test.ts rename to packages/input-selection/test/selectionConstraints.test.ts diff --git a/packages/cip2/test/tsconfig.json b/packages/input-selection/test/tsconfig.json similarity index 100% rename from packages/cip2/test/tsconfig.json rename to packages/input-selection/test/tsconfig.json diff --git a/packages/cip2/test/util/index.ts b/packages/input-selection/test/util/index.ts similarity index 100% rename from packages/cip2/test/util/index.ts rename to packages/input-selection/test/util/index.ts diff --git a/packages/cip2/test/util/properties.ts b/packages/input-selection/test/util/properties.ts similarity index 100% rename from packages/cip2/test/util/properties.ts rename to packages/input-selection/test/util/properties.ts diff --git a/packages/cip2/test/util/selectionConstraints.ts b/packages/input-selection/test/util/selectionConstraints.ts similarity index 100% rename from packages/cip2/test/util/selectionConstraints.ts rename to packages/input-selection/test/util/selectionConstraints.ts diff --git a/packages/cip2/test/util/tests.ts b/packages/input-selection/test/util/tests.ts similarity index 100% rename from packages/cip2/test/util/tests.ts rename to packages/input-selection/test/util/tests.ts diff --git a/packages/wallet/package.json b/packages/wallet/package.json index 1cd82be0563..c67e0190907 100644 --- a/packages/wallet/package.json +++ b/packages/wallet/package.json @@ -72,9 +72,9 @@ "webextension-polyfill": "^0.9.0" }, "dependencies": { - "@cardano-sdk/cip2": "^0.5.0", "@cardano-sdk/cip30": "^0.5.0", "@cardano-sdk/core": "^0.5.0", + "@cardano-sdk/input-selection": "^0.5.0", "@cardano-sdk/key-management": "^0.1.0", "@cardano-sdk/util": "^0.5.0", "@cardano-sdk/util-rxjs": "^0.4.1", diff --git a/packages/wallet/src/SingleAddressWallet.ts b/packages/wallet/src/SingleAddressWallet.ts index f0641ca658a..b2327b74287 100644 --- a/packages/wallet/src/SingleAddressWallet.ts +++ b/packages/wallet/src/SingleAddressWallet.ts @@ -84,7 +84,7 @@ import { tap } from 'rxjs'; import { Cip30DataSignature } from '@cardano-sdk/cip30'; -import { InputSelector, defaultSelectionConstraints, roundRobinRandomImprove } from '@cardano-sdk/cip2'; +import { InputSelector, defaultSelectionConstraints, roundRobinRandomImprove } from '@cardano-sdk/input-selection'; import { Logger } from 'ts-log'; import { RetryBackoffConfig } from 'backoff-rxjs'; import { Shutdown, bufferToHexString, contextLogger, deepEquals } from '@cardano-sdk/util'; diff --git a/packages/wallet/src/Transaction/createTransactionInternals.ts b/packages/wallet/src/Transaction/createTransactionInternals.ts index e1445fc4494..a76f8f257c5 100644 --- a/packages/wallet/src/Transaction/createTransactionInternals.ts +++ b/packages/wallet/src/Transaction/createTransactionInternals.ts @@ -1,5 +1,5 @@ import { CSL, Cardano, coreToCsl, util } from '@cardano-sdk/core'; -import { SelectionResult } from '@cardano-sdk/cip2'; +import { SelectionResult } from '@cardano-sdk/input-selection'; export type CreateTxInternalsProps = { changeAddress: Cardano.Address; diff --git a/packages/wallet/src/TxBuilder/types.ts b/packages/wallet/src/TxBuilder/types.ts index b723642d0e3..7449220ec7f 100644 --- a/packages/wallet/src/TxBuilder/types.ts +++ b/packages/wallet/src/TxBuilder/types.ts @@ -1,7 +1,7 @@ import { Cardano } from '@cardano-sdk/core'; import { CustomError } from 'ts-custom-error'; -import { InputSelectionError } from '@cardano-sdk/cip2'; +import { InputSelectionError } from '@cardano-sdk/input-selection'; import { OutputValidation } from '../types'; import { SignTransactionOptions, TransactionSigner } from '@cardano-sdk/key-management'; diff --git a/packages/wallet/src/cip30.ts b/packages/wallet/src/cip30.ts index 0fd7bebf5f8..002682ee412 100644 --- a/packages/wallet/src/cip30.ts +++ b/packages/wallet/src/cip30.ts @@ -14,7 +14,7 @@ import { WalletApi } from '@cardano-sdk/cip30'; import { CSL, Cardano, coreToCsl, cslToCore } from '@cardano-sdk/core'; -import { InputSelectionError } from '@cardano-sdk/cip2'; +import { InputSelectionError } from '@cardano-sdk/input-selection'; import { Logger } from 'ts-log'; import { ObservableWallet } from './types'; import { errors } from '@cardano-sdk/key-management'; diff --git a/packages/wallet/src/services/WalletUtil.ts b/packages/wallet/src/services/WalletUtil.ts index e9aad0897e9..0656ffa5c6a 100644 --- a/packages/wallet/src/services/WalletUtil.ts +++ b/packages/wallet/src/services/WalletUtil.ts @@ -2,7 +2,7 @@ import { BigIntMath } from '@cardano-sdk/util'; import { Cardano, ProtocolParametersRequiredByWallet } from '@cardano-sdk/core'; import { Observable, firstValueFrom } from 'rxjs'; import { OutputValidation } from '../types'; -import { computeMinimumCoinQuantity, tokenBundleSizeExceedsLimit } from '@cardano-sdk/cip2'; +import { computeMinimumCoinQuantity, tokenBundleSizeExceedsLimit } from '@cardano-sdk/input-selection'; import { txInEquals } from './util'; export type ProtocolParametersRequiredByOutputValidator = Pick< diff --git a/packages/wallet/src/tsconfig.json b/packages/wallet/src/tsconfig.json index 0b9f9ebbef1..e11fad567f9 100644 --- a/packages/wallet/src/tsconfig.json +++ b/packages/wallet/src/tsconfig.json @@ -5,7 +5,7 @@ }, "references": [ { - "path": "../../cip2/src" + "path": "../../input-selection/src" }, { "path": "../../cip30/src" diff --git a/packages/wallet/src/types.ts b/packages/wallet/src/types.ts index 01d46c4a5b0..2938388c006 100644 --- a/packages/wallet/src/types.ts +++ b/packages/wallet/src/types.ts @@ -10,7 +10,7 @@ import { BalanceTracker, DelegationTracker, TransactionalObservables, Transactio import { Cip30DataSignature } from '@cardano-sdk/cip30'; import { GroupedAddress, SignTransactionOptions, TransactionSigner, cip8 } from '@cardano-sdk/key-management'; import { Observable } from 'rxjs'; -import { SelectionSkeleton } from '@cardano-sdk/cip2'; +import { SelectionSkeleton } from '@cardano-sdk/input-selection'; import { Shutdown } from '@cardano-sdk/util'; export type InitializeTxProps = { diff --git a/packages/wallet/test/Transaction/createTransactionInternals.test.ts b/packages/wallet/test/Transaction/createTransactionInternals.test.ts index c9bb1c8a6f0..f716a502a68 100644 --- a/packages/wallet/test/Transaction/createTransactionInternals.test.ts +++ b/packages/wallet/test/Transaction/createTransactionInternals.test.ts @@ -1,8 +1,8 @@ import { AssetId } from '@cardano-sdk/util-dev'; import { Cardano, NetworkInfoProvider } from '@cardano-sdk/core'; import { CreateTxInternalsProps, createTransactionInternals } from '../../src/Transaction'; -import { SelectionConstraints } from '../../../cip2/test/util'; -import { SelectionSkeleton, roundRobinRandomImprove } from '@cardano-sdk/cip2'; +import { SelectionConstraints } from '../../../input-selection/test/util'; +import { SelectionSkeleton, roundRobinRandomImprove } from '@cardano-sdk/input-selection'; import { mockNetworkInfoProvider, utxo } from '../mocks'; const address = Cardano.Address( diff --git a/packages/wallet/test/tsconfig.json b/packages/wallet/test/tsconfig.json index b520f17a9b0..715ca288955 100644 --- a/packages/wallet/test/tsconfig.json +++ b/packages/wallet/test/tsconfig.json @@ -5,7 +5,7 @@ }, "include": [ "./**/*.ts", - "../../cip2/test/util", + "../../input-selection/test/util", "../../key-management/test/mocks" ], "references": [ @@ -25,7 +25,7 @@ "path": "../../util-dev/src" }, { - "path": "../../cip2/src" + "path": "../../input-selection/src" }, { "path": "../../core/src" diff --git a/yarn-project.nix b/yarn-project.nix index e7c8ce3ea4b..db4e4f3317d 100644 --- a/yarn-project.nix +++ b/yarn-project.nix @@ -133,8 +133,8 @@ cacheEntries = { "ws@npm:8.5.0" = { filename = "ws-npm-8.5.0-8e99728c84-76f2f90e40.zip"; sha512 = "76f2f90e40344bf18fd544194e7067812fb1372b2a37865678d8f12afe4b478ff2ebc0c7c0aff82cd5e6b66fc43d889eec0f1865c2365d8f7a66d92da7744a77"; }; "serialize-error@npm:8.1.0" = { filename = "serialize-error-npm-8.1.0-a3c5bcc96c-2eef236d50.zip"; sha512 = "2eef236d50edd2d7926e602c14fb500dc3a125ee52e9f08f67033181b8e0be5d1122498bdf7c23c80683cddcad083a27974e9e7111ce23165f4d3bcdd6d65102"; }; "tslib@npm:2.3.1" = { filename = "tslib-npm-2.3.1-0e21e18015-de17a98d46.zip"; sha512 = "de17a98d4614481f7fcb5cd53ffc1aaf8654313be0291e1bfaee4b4bb31a20494b7d218ff2e15017883e8ea9626599b3b0e0229c18383ba9dce89da2adf15cb9"; }; -"fast-check@npm:2.24.0" = { filename = "fast-check-npm-2.24.0-9261e2c681-8f1e590768.zip"; sha512 = "8f1e590768379c2831bfc70e38c3eb545f82c706eaa316664226bd46956a1e52b644d665d9b31ebeca1e86477b054232f1159841b41c065ec8e4c24295da1c05"; }; "blake2b@npm:2.1.4" = { filename = "blake2b-npm-2.1.4-3a13da4cf0-cd598c96d4.zip"; sha512 = "cd598c96d459017714b7f9cb8892ef2b0a94f362e26e6baa46b7b8b189af0006ce25ab1713e3ec1484eb18ce7ebe1eb24e07d01e42ab1147067de2419c7f6158"; }; +"fast-check@npm:2.24.0" = { filename = "fast-check-npm-2.24.0-9261e2c681-8f1e590768.zip"; sha512 = "8f1e590768379c2831bfc70e38c3eb545f82c706eaa316664226bd46956a1e52b644d665d9b31ebeca1e86477b054232f1159841b41c065ec8e4c24295da1c05"; }; "get-port-please@npm:2.5.0" = { filename = "get-port-please-npm-2.5.0-ed085fd2be-c54ffe32f3.zip"; sha512 = "c54ffe32f3f04e3ca1978abe032b2a14ba9f128c96c014f0c13bfa77331b6fcff674684a112e496223d716ed81602035454e1badc8ef121026c983ae9908a07c"; }; "envalid@npm:7.3.1" = { filename = "envalid-npm-7.3.1-e16a72697a-dea10ada13.zip"; sha512 = "dea10ada13e007f684318474a7dd1b528bbe4ed8ca702918e276d26505bd3807f1e93c4045b7acadd1a4639f207ae4c5375ca0afdff973efab9ea7ead655240f"; }; "json-bigint@npm:1.0.0" = { filename = "json-bigint-npm-1.0.0-8e35bcb143-c67bb93ccb.zip"; sha512 = "c67bb93ccb3c291e60eb4b62931403e378906aab113ec1c2a8dd0f9a7f065ad6fd9713d627b732abefae2e244ac9ce1721c7a3142b2979532f12b258634ce6f6"; }; @@ -154,8 +154,8 @@ cacheEntries = { "npm-run-all@npm:4.1.5" = { filename = "npm-run-all-npm-4.1.5-3281f1c563-373b72c6a3.zip"; sha512 = "373b72c6a36564da13c1642c1fd9bb4dcc756bce7a3648f883772f02661095319820834ff813762d2fee403e9b40c1cd27c8685807c107440f10eb19c006d4a0"; }; "shelljs@npm:0.8.5" = { filename = "shelljs-npm-0.8.5-44be43f84a-7babc46f73.zip"; sha512 = "7babc46f732a98f4c054ec1f048b55b9149b98aa2da32f6cf9844c434b43c6251efebd6eec120937bd0999e13811ebd45efe17410edb3ca938f82f9381302748"; }; "blockfrost-js-ratelimited@npm:2.0.4" = { filename = "blockfrost-js-ratelimited-npm-2.0.4-e86eca2261-3ca5e14db3.zip"; sha512 = "3ca5e14db30abe7ef708970d04f37be407b53de5f41877a19b2252052afdcd8b39638036583a511bda3869d9b0504d33f4aeaa963d181590e962cef2f76c59c2"; }; -"pure-rand@npm:5.0.1" = { filename = "pure-rand-npm-5.0.1-ac773e158e-2b05a6d801.zip"; sha512 = "2b05a6d80163308583a013fab8d7f7f2958a6f77895680c99d8c3ea1f3e49ac273716a59cb1777cfc370540df53e6dc017e46c70a869da81fe490b2e6703d77d"; }; "nanoassert@npm:2.0.0" = { filename = "nanoassert-npm-2.0.0-06b51d4a59-b1d366f952.zip"; sha512 = "b1d366f9524405f3337192d32dda6ac0b02374e4d0550c9aad33480caf2eb3c84c06f18f41f4c5404c14f6fc1ae6b84692b4375166dcb9f2d04a2ea9b9bccba0"; }; +"pure-rand@npm:5.0.1" = { filename = "pure-rand-npm-5.0.1-ac773e158e-2b05a6d801.zip"; sha512 = "2b05a6d80163308583a013fab8d7f7f2958a6f77895680c99d8c3ea1f3e49ac273716a59cb1777cfc370540df53e6dc017e46c70a869da81fe490b2e6703d77d"; }; "fs-memo@npm:1.2.0" = { filename = "fs-memo-npm-1.2.0-274ddc7a4d-474c21adf4.zip"; sha512 = "474c21adf4510c60dc7e2a3c3ad1c08466c8bd276fcf9a8b5357fc03f48cb46a728a0e20c6146f6109db9f871015c8d5970cbbd1e4bdc8f0901e56a5318f8688"; }; "bignumber.js@npm:9.0.2" = { filename = "bignumber.js-npm-9.0.2-583f690302-8637b71d0a.zip"; sha512 = "8637b71d0a99104b20413c47578953970006fec6b4df796b9dcfd9835ea9c402ea0e727eba9a5ca9f9a393c1d88b6168c5bbe0887598b708d4f8b4870ad62e1f"; }; "import-local@npm:3.1.0" = { filename = "import-local-npm-3.1.0-8960af5e51-bfcdb63b5e.zip"; sha512 = "bfcdb63b5e3c0e245e347f3107564035b128a414c4da1172a20dc67db2504e05ede4ac2eee1252359f78b0bfd7b19ef180aec427c2fce6493ae782d73a04cddd"; }; diff --git a/yarn.lock b/yarn.lock index 96700421ce2..6dadc88b732 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1792,26 +1792,6 @@ __metadata: languageName: unknown linkType: soft -"@cardano-sdk/cip2@^0.5.0, @cardano-sdk/cip2@workspace:packages/cip2": - version: 0.0.0-use.local - resolution: "@cardano-sdk/cip2@workspace:packages/cip2" - dependencies: - "@cardano-sdk/core": ^0.5.0 - "@cardano-sdk/util": ^0.5.0 - "@cardano-sdk/util-dev": ^0.4.1 - "@types/lodash": ^4.14.182 - eslint: ^7.32.0 - fast-check: ^2.17.0 - jest: ^28.1.3 - lodash: ^4.17.21 - npm-run-all: ^4.1.5 - shx: ^0.3.3 - ts-custom-error: ^3.2.0 - ts-jest: ^28.0.7 - typescript: ^4.7.4 - languageName: unknown - linkType: soft - "@cardano-sdk/cip30@^0.5.0, @cardano-sdk/cip30@workspace:packages/cip30": version: 0.0.0-use.local resolution: "@cardano-sdk/cip30@workspace:packages/cip30" @@ -1982,6 +1962,26 @@ __metadata: languageName: unknown linkType: soft +"@cardano-sdk/input-selection@^0.5.0, @cardano-sdk/input-selection@workspace:packages/input-selection": + version: 0.0.0-use.local + resolution: "@cardano-sdk/input-selection@workspace:packages/input-selection" + dependencies: + "@cardano-sdk/core": ^0.5.0 + "@cardano-sdk/util": ^0.5.0 + "@cardano-sdk/util-dev": ^0.4.1 + "@types/lodash": ^4.14.182 + eslint: ^7.32.0 + fast-check: ^2.17.0 + jest: ^28.1.3 + lodash: ^4.17.21 + npm-run-all: ^4.1.5 + shx: ^0.3.3 + ts-custom-error: ^3.2.0 + ts-jest: ^28.0.7 + typescript: ^4.7.4 + languageName: unknown + linkType: soft + "@cardano-sdk/key-management@^0.1.0, @cardano-sdk/key-management@workspace:packages/key-management": version: 0.0.0-use.local resolution: "@cardano-sdk/key-management@workspace:packages/key-management" @@ -2090,9 +2090,9 @@ __metadata: resolution: "@cardano-sdk/wallet@workspace:packages/wallet" dependencies: "@cardano-ogmios/client": 5.5.2 - "@cardano-sdk/cip2": ^0.5.0 "@cardano-sdk/cip30": ^0.5.0 "@cardano-sdk/core": ^0.5.0 + "@cardano-sdk/input-selection": ^0.5.0 "@cardano-sdk/key-management": ^0.1.0 "@cardano-sdk/ogmios": ^0.5.0 "@cardano-sdk/util": ^0.5.0 From e617e7410e2081f90fb166194fa365aef7961565 Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Sat, 24 Sep 2022 02:11:45 +1000 Subject: [PATCH 3/4] ci: prevent nightly failing if no packages have changed - uses jq to make the logic more reasonable - gracefully handle the scenario of empty input by returning 0 instead of crashing - Adds missing emojis --- .github/workflows/nightly.yaml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index f586aa3523d..aa9901c51c3 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -21,7 +21,7 @@ jobs: ref: nightly submodules: true - - name: Merge in master + - name: ⏬ Merge in master run: | git config user.name github-actions git config user.email github-actions@github.com @@ -34,19 +34,20 @@ jobs: node-version: 14.17 registry-url: 'https://registry.npmjs.org' - - name: Install dependencies + - name: 💽 Install dependencies run: | yarn install --immutable --inline-builds --mode=skip-build git checkout yarn-project.nix - - name: Check if any packages changed + - name: 📝 Count changed packages + uses: sergeysova/jq-action@v2 id: precondition run: | - CHANGED=$(yarn run lerna changed --json | node -e "console.log(JSON.parse(require('fs').readFileSync(0).toString()).length)") + CHANGED=$(yarn run lerna changed --json | jq -ne 'input? // 0 | length') echo "$CHANGED packages changed" echo "::set-output name=changed::$(($CHANGED))" - - name: Publish + - name: 📤 Publish if: steps.precondition.outputs.changed > 0 run: | yarn build From f821bebec8c4bafc958e55d170a3ddd570307942 Mon Sep 17 00:00:00 2001 From: Rhys Bartels-Waller Date: Sun, 25 Sep 2022 00:02:20 +1000 Subject: [PATCH 4/4] ci: fix nightly jq step --- .github/workflows/nightly.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index aa9901c51c3..0810fc810c2 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -41,14 +41,12 @@ jobs: - name: 📝 Count changed packages uses: sergeysova/jq-action@v2 - id: precondition - run: | - CHANGED=$(yarn run lerna changed --json | jq -ne 'input? // 0 | length') - echo "$CHANGED packages changed" - echo "::set-output name=changed::$(($CHANGED))" + id: changed + with: + cmd: yarn run lerna changed --json | jq -ne 'input? // 0 | length' - name: 📤 Publish - if: steps.precondition.outputs.changed > 0 + if: steps.changed.outputs.value > 0 run: | yarn build yarn publish:nightly --loglevel silly