Crate whisky

Crate whisky 

Source
Expand description

§whisky

whisky is built with the same pattern as MeshJS’s lower level APIs where Rust Cardano developer can import directly for use.

§Install

In your Rust project, run the below

cargo add whisky

or add the dependency in Cargo.toml

[dependencies]
whisky = "^<the-latest-version>"

§Feature Flags

By default, all features are enabled. You can selectively enable features:

# Full (default) - all features
whisky = "1.0.18"

# Just common types (minimal)
whisky = { version = "1.0.18", default-features = false }

# Wallet only (includes csl + common)
whisky = { version = "1.0.18", default-features = false, features = ["wallet"] }

# Provider only (includes csl + common)
whisky = { version = "1.0.18", default-features = false, features = ["provider"] }

# CSL only (transaction building without wallet/provider)
whisky = { version = "1.0.18", default-features = false, features = ["csl"] }

§Getting Started

use whisky::*;

async fn my_first_whisky_tx(
    recipient_address: &str,
    my_address: &str,
    inputs: &[UTxO],
) -> String {
    let mut mesh = TxBuilder::new_core();
    mesh.tx_out(
        &recipient_address,
        &[Asset::new_from_str("lovelace", "1000000")],
    )
        .change_address(my_address)
        .select_utxos_from(inputs, 5000000)
        .complete(None)
        .await;
    mesh.tx_hex()
}

§APIs

All user facing APIs are documentation at the builder interface.

Re-exports§

pub use builder::*;
pub use parser::*;
pub use transaction::*;
pub use utils::*;

Modules§

algo
blockfrost
builder
constants
csl
data
derivation_indices
errors
interfaces
maestro
mnemonic
models
parser
root_key
services
transaction
tx_builder
tx_parser
tx_prototype
tx_tester
utils
wallet_constants

Macros§

impl_constr_fields
impl_constr_n
impl_constr_type
impl_plutus_data_tuple

Structs§

Account
AccountInfo
Action
Addresses
Anchor
AnchorPrototype
Artist
Asset
AudioAssetMetadata
AuxiliaryDataPrototype
BlockInfo
BlockfrostProvider
Blueprint
Main Blueprint structure containing preamble, validators, and definitions
BootstrapWitnessPrototype
Budget
CSLParser
CommitteeColdResign
CommitteeColdResignPrototype
CommitteeHotAuth
CommitteeHotAuthPrototype
CommitteeMemberPrototype
CommitteePrototype
ConstitutionPrototype
CoreCSL
DRepDeregistration
DRepDeregistrationPrototype
DRepRegistration
DRepRegistrationPrototype
DRepUpdate
DRepUpdatePrototype
DRepVotingThresholdsPrototype
DelegateStake
DeregisterStake
DeserializedAddress
EvalError
ExUnitPricesPrototype
ExUnitsPrototype
File
FungibleAssetMetadata
GenesisKeyDelegationPrototype
GovernanceActionIdPrototype
GovernanceProposalInfo
HardForkInitiationActionPrototype
ImageAssetMetadata
InlineDatumSource
InlineScriptSource
InlineSimpleScriptSource
JsonSlotConfig
MaestroProvider
Metadata
MintParameter
MnemonicWallet
MoveInstantaneousRewardPrototype
MoveInstantaneousRewardsCertPrototype
MultiHostName
MultiHostNamePrototype
NewConstitutionActionPrototype
NoConfidenceActionPrototype
NoncePrototype
Output
ParameterChangeActionPrototype
PlutusListPrototype
PlutusScriptWithdrawal
PoolMetadata
PoolMetadataPrototype
PoolParams
PoolParamsPrototype
PoolRegistrationPrototype
PoolRetirementPrototype
PoolVotingThresholdsPrototype
Protocol
ProtocolParamUpdatePrototype
ProtocolVersionPrototype
ProvidedDatumSource
ProvidedScriptSource
ProvidedSimpleScriptSource
PubKeyTxIn
PubKeyWithdrawal
Redeemer
RedeemerPrototype
RefTxIn
RegisterPool
RegisterStake
RetirePool
RootKeyWallet
RoyaltiesStandard
ScriptAllPrototype
ScriptAnyPrototype
ScriptCertificate
ScriptMint
ScriptNOfKPrototype
ScriptPubkeyPrototype
ScriptTxIn
ScriptTxInParameter
ScriptVote
SimpleScriptCertificate
SimpleScriptMint
SimpleScriptTxIn
SimpleScriptVote
SimpleScriptWithdrawal
SingleHostAddr
SingleHostAddrPrototype
SingleHostName
SingleHostNamePrototype
SmartAssetMetadata
StakeAndVoteDelegation
StakeAndVoteDelegationPrototype
StakeDelegationPrototype
StakeDeregistrationPrototype
StakeRegistrationAndDelegation
StakeRegistrationAndDelegationPrototype
StakeRegistrationPrototype
StakeToCoinPrototype
StakeVoteRegistrationAndDelegation
StakeVoteRegistrationAndDelegationPrototype
TimelockExpiryPrototype
TimelockStartPrototype
TransactionBodyPrototype
TransactionInfo
TransactionInputPrototype
TransactionOutputPrototype
TransactionPrototype
TransactionUnspentOutputPrototype
TransactionWitnessSetPrototype
TreasuryWithdrawalsActionPrototype
TxBuilderBody
TxInParameter
TxTester
UTxO
UnitIntervalPrototype
UpdateCommitteeActionPrototype
UpdatePrototype
UtxoInput
UtxoOutput
ValidityRange
ValuePrototype
VideoAssetMetadata
VkeywitnessPrototype
VoteDelegation
VoteDelegationPrototype
VotePrototype
VoteRegistrationAndDelegation
VoteRegistrationAndDelegationPrototype
VoteType
VoterVotesPrototype
VotingProcedure
VotingProcedurePrototype
VotingProposalPrototype
WError
Wallet
Represents a Cardano wallet.
WhiskyCSL

Enums§

AddressType
AssetMetadata
BuilderDataType
Certificate
CertificatePrototype
CertificateType
CredTypePrototype
Credential
DRep
DRepPrototype
DataOptionPrototype
Datum
DatumSource
EvalResult
GovernanceActionPrototype
LanguageKindPrototype
LanguageVersion
MIREnumPrototype
MIRPotPrototype
MetadatumPrototype
MintItem
NativeScriptPrototype
Network
NetworkId
NetworkIdPrototype
NonFungibleAssetMetadata
OutputScriptSource
PlutusData
PlutusDataVariant
RedeemerTag
RedeemerTagPrototype
Relay
RelayPrototype
ScriptSource
SimpleScriptSource
SimpleScriptTxInParameter
TxIn
Vote
VoteKind
VoteKindPrototype
Voter
VoterPrototype
WalletType
Withdrawal

Constants§

FUNGIBLE_ASSET_KEYS
METADATA_STANDARD_KEYS
ROYALTIES_STANDARD_KEYS

Traits§

Evaluator
Fetcher
PlutusDataCbor
Extension trait that adds CBOR serialization/deserialization capabilities to any type implementing PlutusDataJson.
Submitter
TxBuildable
TxParsable

Functions§

apply_double_cbor_encoding
apply_params_to_plutus_script
apply_params_to_script
build_csl_cost_models
build_tx_builder
bytes_to_hex
calculate_tx_hash
decrypt_with_cipher
deserialize_address
encrypt_with_cipher
evaluate_tx_scripts
get_cost_mdls
get_cost_models_from_network
get_mainnet_cost_models
get_min_utxo_value
get_native_script_hash
get_preprod_cost_models
get_preview_cost_models
get_script_hash
hex_to_bytes
hex_to_string
map_error_to_eval_error
map_eval_result
map_redeemer_tag
map_redeemer_to_action
proto_to_anchor
Convert AnchorPrototype to CSL Anchor
proto_to_assets
Convert AssetsPrototype to CSL Assets
proto_to_auxiliary_data
Convert AuxiliaryDataPrototype to CSL AuxiliaryData
proto_to_bignum
Convert a string to BigNum (for Prototype types)
proto_to_certificate
Convert CertificatePrototype to CSL Certificate
proto_to_certificates
Convert Vec to CSL Certificates
proto_to_credential
Convert CredTypePrototype to CSL Credential
proto_to_csl_transaction
Convert TransactionPrototype to CSL Transaction
proto_to_data_option
Convert DataOptionPrototype to CSL data representation Returns (Option, Option) for output usage
proto_to_drep
Convert DRepPrototype to CSL DRep
proto_to_ex_units
Convert ExUnitsPrototype to CSL ExUnits
proto_to_governance_action
Convert GovernanceActionPrototype to CSL GovernanceAction
proto_to_governance_action_id
Convert GovernanceActionIdPrototype to CSL GovernanceActionId
proto_to_int
Convert a string to Int (can be negative)
proto_to_ipv4
Convert Ipv4Prototype to CSL Ipv4
proto_to_ipv6
Convert Ipv6Prototype to CSL Ipv6
proto_to_language
Convert LanguageKindPrototype to CSL Language
proto_to_mint
Convert MintPrototype to CSL Mint MintPrototype is MultiAssetPrototype matching CSL’s Mint structure Note: Mint uses Int (can be negative for burning) while MultiAsset uses BigNum
proto_to_multiasset
Convert MultiAssetPrototype to CSL MultiAsset
proto_to_native_script
Convert NativeScriptPrototype to CSL NativeScript
proto_to_network_id
Convert NetworkIdPrototype to CSL NetworkId
proto_to_plutus_data
Convert PlutusData to CSL PlutusData (recursive)
proto_to_plutus_data_from_variant
Convert PlutusDataVariant to CSL PlutusData This handles both CBOR hex and manual construction
proto_to_protocol_version
Convert ProtocolVersionPrototype to CSL ProtocolVersion
proto_to_redeemer_tag
Convert RedeemerTagPrototype to CSL RedeemerTag
proto_to_script_ref
Convert ScriptRefPrototype (hex string) to CSL ScriptRef Handles both regular format and “82” prefixed format that needs CBOR tag 24 wrapping
proto_to_transaction_body
Convert TransactionBodyPrototype to CSL TransactionBody
proto_to_transaction_bytes
Convert TransactionPrototype to CBOR bytes
proto_to_transaction_hex
Convert TransactionPrototype to hex string
proto_to_transaction_input
Convert TransactionInputPrototype to CSL TransactionInput
proto_to_transaction_inputs
Convert Vec to CSL TransactionInputs
proto_to_transaction_output
Convert TransactionOutputPrototype to CSL TransactionOutput
proto_to_transaction_outputs
Convert Vec to CSL TransactionOutputs
proto_to_transaction_witness_set
Convert TransactionWitnessSetPrototype to CSL TransactionWitnessSet
proto_to_unit_interval
Convert UnitIntervalPrototype to CSL UnitInterval
proto_to_value
Convert ValuePrototype to CSL Value
proto_to_vote_kind
Convert VoteKindPrototype to CSL VoteKind
proto_to_voter
Convert VoterPrototype to CSL Voter
proto_to_voter_votes
Convert VoterVotesPrototype to CSL VotingProcedures (one voter’s votes)
proto_to_voting_procedure
Convert VotingProcedurePrototype to CSL VotingProcedure
proto_to_voting_procedures
Convert Vec to CSL VotingProcedures
proto_to_voting_proposal
Convert VotingProposalPrototype to CSL VotingProposal
proto_to_voting_proposals
Convert Vec to CSL VotingProposals
script_hash_to_stake_address
script_to_address
select_utxos
serialize_address_obj
sign_transaction
string_to_hex
to_bignum
to_csl_anchor
to_csl_cert
to_csl_drep
to_csl_redeemer
to_csl_script_source
to_csl_simple_script_source
to_csl_vote_kind
to_csl_voter
to_pallas_datum
to_pallas_multi_asset_value
to_pallas_script_ref
to_pallas_utxos
to_pallas_value
to_value
validate_tx

Type Aliases§

AddressPrototype
AnchorDataHashPrototype
AssetNamePrototype
AssetNamesPrototype
AssetsPrototype
AuxiliaryDataHashPrototype
AuxiliaryDataSetPrototype
BigIntPrototype
BigNumPrototype
BlockHashPrototype
BootstrapWitnessesPrototype
CertificatesPrototype
CostModelPrototype
CostmdlsPrototype
CredentialPrototype
CredentialsPrototype
DNSRecordAorAAAAPrototype
DNSRecordSRVPrototype
DataHashPrototype
Ed25519KeyHashPrototype
Ed25519KeyHashesPrototype
Ed25519SignaturePrototype
GenesisDelegateHashPrototype
GenesisHashPrototype
GenesisHashesPrototype
GovernanceActionIdsPrototype
InfoActionPrototype
IntPrototype
Ipv4Prototype
Ipv6Prototype
KESVKeyPrototype
LanguagePrototype
LanguagesPrototype
MIRToStakeCredentialsPrototype
MintPrototype
MultiAssetPrototype
NativeScriptsPrototype
NonceHashPrototype
PlutusScriptPrototype
PlutusScriptsPrototype
PoolMetadataHashPrototype
ProposedProtocolParameterUpdatesPrototype
PublicKeyPrototype
RedeemersPrototype
RelaysPrototype
RewardAddressPrototype
RewardAddressesPrototype
ScriptDataHashPrototype
ScriptHashPrototype
ScriptHashesPrototype
ScriptRefPrototype
ScriptRef is stored as a CBOR hex string
TransactionBodiesPrototype
TransactionHashPrototype
TransactionInputsPrototype
TransactionOutputsPrototype
TransactionUnspentOutputsPrototype
TreasuryWithdrawalsPrototype
TxMetadataPrototype
URLPrototype
VkeyPrototype
VkeywitnessesPrototype
VotersPrototype
VotingProceduresPrototype
VotingProposalsPrototype
WithdrawalsPrototype

Derive Macros§

ConstrEnum
ConstrWrapper
ImplConstr