From a667ea1625108c00fb7d8b3cc94d01226e861cb6 Mon Sep 17 00:00:00 2001 From: Hinson <90688504+HinsonSIDAN@users.noreply.github.com> Date: Thu, 7 Nov 2024 01:07:05 +0800 Subject: [PATCH] feat: grouping onchain utils to cocktail (#14) --- .github/workflows/build_docs.yml | 2 +- .github/workflows/release.yml | 2 +- README.md | 14 +++-- aiken.toml | 4 +- lib/cocktail.ak | 105 +++++++++++++++++++++++++++++-- plutus.json | 4 +- 6 files changed, 117 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index 9d31d87..8a220b6 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -36,7 +36,7 @@ jobs: - uses: aiken-lang/setup-aiken@v1 with: - version: v1.1.4 + version: v1.1.5 - run: aiken fmt --check - run: aiken check -D - run: aiken docs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e7b4e7c..4eed794 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v4 - uses: aiken-lang/setup-aiken@v1 with: - version: v1.1.4 + version: v1.1.5 - run: aiken fmt --check - run: aiken check -D - run: aiken docs diff --git a/README.md b/README.md index 7c7214f..0b747cb 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Vodka is now upgraded to support latest PlutusV3 with latest version, if you wan | Vodka | Aiken Compiler | `aiken-lang/stdlib` | | ---------- | -------------- | ------------------- | -| 0.1.1-beta | ^v1.1.0 | v2 | +| 0.1.4-beta | ^v1.1.5 | v2.1.0 | | 0.0.1-beta | v1.0.29-alpha | v1.9.0 | ## Vodka is pure and simple @@ -46,7 +46,13 @@ Checking signature with: key_signed(extra_signatories, key_hash_required) ``` -All onchain utility functions are grouped with a naming convention of `vodka_`: +## Imports and function groups + +All onchain utility functions can be imported from `cocktail` and are grouped with a naming convention of `vodka_`. + +```ak +use cocktail.{} +``` | Type | Naming Convention | | ------------------------------------ | ----------------------------------------- | @@ -100,7 +106,7 @@ await txBuilder Simply run ```sh -aiken add sidan-lab/vodka --version 0.1.1-beta +aiken add sidan-lab/vodka --version 0.1.4-beta ``` or putting the below in you `aiken.toml` @@ -108,7 +114,7 @@ or putting the below in you `aiken.toml` ```toml [[dependencies]] name = "sidan-lab/vodka" -version = "0.1.1-beta" +version = "0.1.4-beta" source = "github" ``` diff --git a/aiken.toml b/aiken.toml index 288772e..ed09cad 100644 --- a/aiken.toml +++ b/aiken.toml @@ -1,6 +1,6 @@ name = "sidan-lab/vodka" -version = "0.1.3-beta" -compiler = "v1.1.4" +version = "0.1.4-beta" +compiler = "v1.1.5" plutus = "v3" license = "Apache-2.0" description = "Aiken utils for project 'sidan-lab/vodka" diff --git a/lib/cocktail.ak b/lib/cocktail.ak index bcaf6c9..7e35e7c 100644 --- a/lib/cocktail.ak +++ b/lib/cocktail.ak @@ -14,7 +14,104 @@ //// - `validity_range` - [`use vodka_validity_range`](./vodka_validity_range.html) //// - `Redeemers` - [`use vodka_redeemers`](./vodka_redeemers.html) -/// Placeholder - for hosting docs above -pub type Cocktail { - Cocktail -} +use vodka_address +use vodka_converter +use vodka_extra_signatories +use vodka_inputs +use vodka_mints +use vodka_outputs +use vodka_redeemers +use vodka_validity_range +use vodka_value + +// Address + +pub const compare_script_address = vodka_address.compare_script_address + +pub const compare_address = vodka_address.compare_address + +pub const address_pub_key = vodka_address.address_pub_key + +pub const address_script_hash = vodka_address.address_script_hash + +// Converter + +pub const convert_int_to_bytes = vodka_converter.convert_int_to_bytes + +pub const get_number_digit = vodka_converter.get_number_digit + +// Extra Signatories + +pub const key_signed = vodka_extra_signatories.key_signed + +pub const one_of_keys_signed = vodka_extra_signatories.one_of_keys_signed + +pub const all_key_signed = vodka_extra_signatories.all_key_signed + +// Inputs + +pub const input_inline_datum = vodka_inputs.input_inline_datum + +pub const only_input_datum_with = vodka_inputs.only_input_datum_with + +pub const inputs_at = vodka_inputs.inputs_at + +pub const inputs_with = vodka_inputs.inputs_with + +pub const inputs_with_policy = vodka_inputs.inputs_with_policy + +pub const inputs_at_with = vodka_inputs.inputs_at_with + +pub const inputs_at_with_policy = vodka_inputs.inputs_at_with_policy + +pub const inputs_token_quantity = vodka_inputs.inputs_token_quantity + +// Mints + +pub const check_policy_only_burn = vodka_mints.check_policy_only_burn + +pub const only_minted_token = vodka_mints.only_minted_token + +pub const token_minted = vodka_mints.token_minted + +// Outputs + +pub const output_inline_datum = vodka_outputs.output_inline_datum + +pub const outputs_at = vodka_outputs.outputs_at + +pub const outputs_with = vodka_outputs.outputs_with + +pub const outputs_with_policy = vodka_outputs.outputs_with_policy + +pub const outputs_at_with = vodka_outputs.outputs_at_with + +pub const outputs_at_with_policy = vodka_outputs.outputs_at_with_policy + +// Redeemers + +pub const redeemer_from = vodka_redeemers.redeemer_from + +pub const withdrawal_redeemer = vodka_redeemers.withdrawal_redeemer + +pub const compare_output_reference = vodka_redeemers.compare_output_reference + +// Validity Range + +pub const valid_after = vodka_validity_range.valid_after + +pub const valid_before = vodka_validity_range.valid_before + +// Value + +pub const value_length = vodka_value.value_length + +pub const get_all_value_to = vodka_value.get_all_value_to + +pub const get_all_value_from = vodka_value.get_all_value_from + +pub const value_geq = vodka_value.value_geq + +pub const value_policy_info = vodka_value.value_policy_info + +pub const value_tokens = vodka_value.value_tokens diff --git a/plutus.json b/plutus.json index d33e665..e2b2e3e 100644 --- a/plutus.json +++ b/plutus.json @@ -2,11 +2,11 @@ "preamble": { "title": "sidan-lab/vodka", "description": "Aiken utils for project 'sidan-lab/vodka", - "version": "0.1.3-beta", + "version": "0.1.4-beta", "plutusVersion": "v3", "compiler": { "name": "Aiken", - "version": "v1.1.4+79d0e45" + "version": "v1.1.5+a7741ec" }, "license": "Apache-2.0" },