Skip to content

Commit

Permalink
feat: grouping onchain utils to cocktail (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN authored Nov 6, 2024
1 parent 052bf49 commit a667ea1
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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_<type>`:
## Imports and function groups

All onchain utility functions can be imported from `cocktail` and are grouped with a naming convention of `vodka_<type>`.

```ak
use cocktail.{<the_util_fn>}
```

| Type | Naming Convention |
| ------------------------------------ | ----------------------------------------- |
Expand Down Expand Up @@ -100,15 +106,15 @@ 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`

```toml
[[dependencies]]
name = "sidan-lab/vodka"
version = "0.1.1-beta"
version = "0.1.4-beta"
source = "github"
```

Expand Down
4 changes: 2 additions & 2 deletions aiken.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
105 changes: 101 additions & 4 deletions lib/cocktail.ak
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions plutus.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit a667ea1

Please sign in to comment.