Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow cargo generate version 0.22 #445

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion templates/cis2-nft/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"
Victor-N-Suadicani marked this conversation as resolved.
Show resolved Hide resolved

[placeholders]
description = { type="string", prompt="Description for the project?" }
Expand Down
2 changes: 1 addition & 1 deletion templates/credential-registry/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"

[hooks]
pre = ["pre-script.rhai"] # a script for setting default values for the variables when `template_type = default`
Expand Down
2 changes: 1 addition & 1 deletion templates/default/cargo-generate.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[template]
cargo_generate_version = ">= 0.17.0, < 0.22.0"
cargo_generate_version = ">= 0.17.0, < 0.23.0"
2 changes: 1 addition & 1 deletion templates/default/deploy-scripts/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn main() -> Result<(), Error> {
// here.

// You can easily import a type from the smart contract like so:
use default::CustomInputParameter; // Example
use {{crate_name}}::CustomInputParameter; // Example

let param = OwnedParameter::from_serial(&CustomInputParameter { num: 42 })?; // Example

Expand Down
19 changes: 13 additions & 6 deletions templates/default/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,21 @@ fn initialize() -> (Chain, ContractInitSuccess) {
// Deploy the module.
let deployment = chain.module_deploy_v1(SIGNER, ALICE, module).expect("Deploy valid module");

let parameter = CustomInputParameter { num: 0 };

// Initialize the contract.
let init = chain
.contract_init(SIGNER, ALICE, Energy::from(10_000), InitContractPayload {
amount: Amount::zero(),
mod_ref: deployment.module_reference,
init_name: OwnedContractName::new_unchecked("init_{{crate_name}}".to_string()),
param: OwnedParameter::empty(),
})
.contract_init(
SIGNER,
ALICE,
Energy::from(10_000),
InitContractPayload {
amount: Amount::zero(),
mod_ref: deployment.module_reference,
init_name: OwnedContractName::new_unchecked("init_{{crate_name}}".to_string()),
param: OwnedParameter::from_serial(&parameter).expect("Parameter is valid."),
},
)
.expect("Initializing contract");

(chain, init)
Expand Down
Loading