-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add common derives to generated contract types (#759)
### What Add common derives to generated contract types. ### Why Some of them are required, and all of them are convenient to have on the data objects/types that are generated by contract imports. Close #758
- Loading branch information
1 parent
e84e3cd
commit 5f942ac
Showing
6 changed files
with
47 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use crate as soroban_sdk; | ||
use soroban_sdk::{contractimpl, symbol, BytesN, Env, Symbol}; | ||
|
||
mod errcontract { | ||
use crate as soroban_sdk; | ||
soroban_sdk::contractimport!( | ||
file = "../target/wasm32-unknown-unknown/release/test_errors.wasm" | ||
); | ||
} | ||
|
||
pub struct Contract; | ||
|
||
#[contractimpl] | ||
impl Contract { | ||
pub fn hello_with(env: Env, contract_id: BytesN<32>, flag: u32) -> Symbol { | ||
errcontract::Client::new(&env, &contract_id).hello(&flag) | ||
} | ||
} | ||
|
||
#[test] | ||
fn test_functional() { | ||
let e = Env::default(); | ||
|
||
let err_contract_id = e.register_contract_wasm(None, errcontract::WASM); | ||
|
||
let contract_id = e.register_contract(None, Contract); | ||
let client = ContractClient::new(&e, &contract_id); | ||
|
||
let z = client.hello_with(&err_contract_id, &0); | ||
assert!(z == symbol!("hello")); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "test_result" | ||
name = "test_errors" | ||
version = "0.2.0" | ||
authors = ["Stellar Development Foundation <[email protected]>"] | ||
license = "Apache-2.0" | ||
|