Aiken Vodka - Library for Aiken Development

Licence Continuous Integration Twitter/X


Vodka is a library build for Aiken development. It offers

  1. Cocktail - Validating utils in writing on-chain code in aiken
  2. Mocktail - Unit test utils for easy building mock value for unit test

Version

Vodka is now upgraded to support latest PlutusV3 with latest version, if you want to use the old version compatible for legacy aiken version, please refer to below’s table

VodkaAiken Compileraiken-lang/stdlib
0.1.1-beta^v1.1.0v2
0.0.1-betav1.0.29-alphav1.9.0

Vodka is pure and simple

For your transaction.

let Transaction { inputs, outputs, extra_signatories, .. } = context.transaction

Locating inputs & outputs:

when (inputs_at(inputs, target_address), outputs_at(outputs, target_address)) is {
  ([only_input], [only_output]) -> ...
  _ -> False
}

Checking signature with:

key_signed(extra_signatories, key_hash_required)

All onchain utility functions are grouped with a naming convention of vodka_<type>:

TypeNaming Convention
Addressvodka_address.{<the_util_fn>}
Valuevodka_value.{<the_util_fn>}
transaction.extra_signatoriesvodka_extra_signatories.{<the_util_fn>}
transaction.inputsvodka_inputs.{<the_util_fn>}
transaction.mintsvodka_mints.{<the_util_fn>}
transaction.outputsvodka_outputs.{<the_util_fn>}
transaction.redeemersvodka_redeemers.{<the_util_fn>}
transaction.validity_rangevodka_validity_range.{<the_util_fn>}
ByteArray and Int conversion & utilsvodka_converter.{<the_util_fn>}

Taste it before vodka cocktail, mocktail can be mixed, blended and Mesh

Building unit testing in vodka, easily indicating how you should build in whisky and Mesh.

You can taste if your transaction can pass your aiken contract validation:

# Mock transaction
let mock_tx: Transaction = mocktail_tx()
    ...
    |> required_signer_hash(is_key_provided, mock_pub_key_hex(1))
    |> complete()

Then move it to blend a whisky:

let mut tx = MeshTxBuilder::new_core()
tx.spending_plutus_script_v2()
  ...
  .required_signer_hash(key_hash)
  .complete(None)

Or Mesh:

const txBuilder = new MeshTxBuilder();
await txBuilder
  ...
  .requiredSignerHash(keyHash)
  .complete();

Start mixing

Simply run

aiken add sidan-lab/vodka --version 0.1.1-beta

or putting the below in you aiken.toml

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

Documentation

Please refer to the hosted documentation.

Alt

Search Document