essential-contributions / pint

Pint, the constraint-based programming language for declarative blockchains
Apache License 2.0
14 stars 0 forks source link

feat(pint-abi): Generate `ADDRESS` consts for contracts, predicates #787

Closed mitchmindtree closed 1 month ago

mitchmindtree commented 1 month ago

This adds support for generating ADDRESS constants for contracts and predicates by optionally providing the path to the compiled contract associated with the ABI.

The pint_abi::gen_from_file! macro API has been changed slightly. Previously, it was used like so:

pint_abi::gen_from_file!("path/to/abi.json");

Now, the invocation looks like:

pint_abi::gen_from_file! {
    abi: "path/to/abi.json",
    contract: "path/to/contract.json",
}

The contract field is optional. When provided, the contract at the specified path will be used to determine the contract and predicate ADDRESS consts and include them in their associated generated modules. If not provided, the old behaviour remains the same.