inkdevhub / drink

De-chained Ready-to-play ink! playground
Apache License 2.0
69 stars 15 forks source link

Enable loading contract bundles #68

Closed piotrMocz closed 1 year ago

piotrMocz commented 1 year ago

As simple as the title suggests. Instead of loading the .wasm blob and the .json metadata separately, you can now load the whole .contract file using one of:

ContractFile::load("some/path/to/your.contract")
local_contract_file!()

And pass them to the methods that work with bundles, which would be one of:

So, all in all, what you do in your tests is:

use drink::{
    local_contract_file,
    session::{ContractFile, Session}};

let contract = ContractFile::load("path/to/your.contract");
Session::<MinimalRuntime>::new()?.deploy_contract_and(contract, "new", NO_ARGS, vec![], None) /* ... */

// or:

Session::<MinimalRuntime>::new()?.deploy_contract_and(local_contract_file!(), "new", NO_ARGS, vec![], None) /* ... */