February prototype status
Time for a post on the state of the prototype!
First note is that syntax is not final. This is all Rust meant to compile to WASM similar to what the result of the Starstream language compiled to WASM would be. This makes prototyping easy and hopefully helps illustrate the semantics more concretely. The prototype runs the WASM within a scheduler written in Node.js, but it's compatible with browsers and WASM zkVMs. ABI glue is left out of the post.
The coordination script is where Starstream's design shines. The design naturally permits UTXO call chaining, including conditionals. Let's mint NFTs up to a specific supply amount then stop:
pub fn star_nft_mint_up_to(
// This parameter's type is a handle to a UTXO object.
// The scheduler routes calls to the correct sleeping UTXO code instance.
nft_contract: example_contract::StarNftMint,
desired_supply: u64,
owner: PublicKey,
) {
while nft_contract.get_supply() < desired_supply {
// In this example, we create many UTXOs with one NFT each. We could
// just as easily create one UTXO containing all NFTs minted by this
// call.
example_contract::PayToPublicKeyHash::new(owner)
.attach(nft_contract.prepare_to_mint());
}
}