-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add-long-list-for-identity
- Loading branch information
Showing
29 changed files
with
531 additions
and
263 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -2,3 +2,4 @@ mod custom_types; | |
mod dotenv; | ||
mod hello_world; | ||
mod util; | ||
mod wrap; |
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,79 @@ | ||
use soroban_cli::CommandParser; | ||
use soroban_cli::{ | ||
commands::{ | ||
config::{self}, | ||
lab::token::wrap, | ||
}, | ||
utils::contract_id_hash_from_asset, | ||
}; | ||
use soroban_test::TestEnv; | ||
|
||
use super::util::network_passphrase; | ||
|
||
#[tokio::test] | ||
#[ignore] | ||
async fn burn() { | ||
let sandbox = &TestEnv::default(); | ||
let address = config::identity::address::Cmd::parse("--hd-path=0") | ||
.unwrap() | ||
.public_key() | ||
.unwrap(); | ||
let asset = format!("native:{address}"); | ||
wrap_cmd(&asset).run().await.unwrap(); | ||
let asset = soroban_cli::utils::parsing::parse_asset(&asset).unwrap(); | ||
let hash = contract_id_hash_from_asset(&asset, &network_passphrase().unwrap()).unwrap(); | ||
let id = stellar_strkey::Contract(hash.0).to_string(); | ||
assert_eq!( | ||
"CAMTHSPKXZJIRTUXQP5QWJIFH3XIDMKLFAWVQOFOXPTKAW5GKV37ZC4N", | ||
id | ||
); | ||
assert_eq!( | ||
"true", | ||
sandbox | ||
.invoke(&[ | ||
"--id", | ||
&id, | ||
"--", | ||
"authorized", | ||
"--id", | ||
&address.to_string() | ||
]) | ||
.await | ||
.unwrap() | ||
); | ||
assert_eq!( | ||
"\"9223372036854775807\"", | ||
sandbox | ||
.invoke(&["--id", &id, "--", "balance", "--id", &address.to_string()]) | ||
.await | ||
.unwrap(), | ||
); | ||
|
||
println!( | ||
"{}", | ||
sandbox | ||
.invoke(&[ | ||
"--id", | ||
&id, | ||
"--", | ||
"burn", | ||
"--id", | ||
&address.to_string(), | ||
"--amount=100" | ||
]) | ||
.await | ||
.unwrap() | ||
); | ||
|
||
assert_eq!( | ||
"\"9223372036854775707\"", | ||
sandbox | ||
.invoke(&["--id", &id, "--", "balance", "--id", &address.to_string()]) | ||
.await | ||
.unwrap(), | ||
); | ||
} | ||
|
||
fn wrap_cmd(asset: &str) -> wrap::Cmd { | ||
wrap::Cmd::parse_arg_vec(&[&format!("--asset={asset}")]).unwrap() | ||
} |
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
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
Oops, something went wrong.