Skip to content

Commit

Permalink
[wallet] - rename transfer to transfer-coin (MystenLabs#1762)
Browse files Browse the repository at this point in the history
* rename transfer to transfer-coin

* address PR comment

* improve transfer non coin error message

* improve transfer non coin error message
  • Loading branch information
patrickkuo authored May 4, 2022
1 parent 69a7e8f commit 580f8ff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion sui/src/bin/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ async fn handle_command(
.collect::<Vec<_>>();
cache.insert(CacheKey::new("object", "--id"), objects.clone());
cache.insert(CacheKey::flag("--gas"), objects.clone());
cache.insert(CacheKey::flag("--object-id"), objects);
cache.insert(CacheKey::flag("--coin-object-id"), objects);
}
_ => {}
}
Expand Down
6 changes: 3 additions & 3 deletions sui/src/unit_tests/cli_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ async fn test_gas_command() -> Result<(), anyhow::Error> {
// Send an object
WalletCommands::Transfer {
to: recipient,
object_id: object_to_send,
coin_object_id: object_to_send,
gas: Some(object_id),
gas_budget: 50000,
}
Expand Down Expand Up @@ -905,7 +905,7 @@ async fn test_native_transfer() -> Result<(), anyhow::Error> {
let resp = WalletCommands::Transfer {
gas: Some(gas_obj_id),
to: recipient,
object_id: obj_id,
coin_object_id: obj_id,
gas_budget: 50000,
}
.execute(&mut context)
Expand Down Expand Up @@ -999,7 +999,7 @@ async fn test_native_transfer() -> Result<(), anyhow::Error> {
let resp = WalletCommands::Transfer {
gas: None,
to: recipient,
object_id: obj_id,
coin_object_id: obj_id,
gas_budget: 50000,
}
.execute(&mut context)
Expand Down
10 changes: 5 additions & 5 deletions sui/src/wallet_commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,16 @@ pub enum WalletCommands {
gas_budget: u64,
},

/// Transfer an object
#[clap(name = "transfer")]
/// Transfer coin object
#[clap(name = "transfer-coin")]
Transfer {
/// Recipient address
#[clap(long, parse(try_from_str = decode_bytes_hex))]
to: SuiAddress,

/// Object to transfer, in 20 bytes Hex string
/// Coin to transfer, in 20 bytes Hex string
#[clap(long)]
object_id: ObjectID,
coin_object_id: ObjectID,

/// ID of the gas object for gas payment, in 20 bytes Hex string
/// If not provided, a gas object with at least gas_budget value will be selected
Expand Down Expand Up @@ -304,7 +304,7 @@ impl WalletCommands {

WalletCommands::Transfer {
to,
object_id,
coin_object_id: object_id,
gas,
gas_budget,
} => {
Expand Down
4 changes: 2 additions & 2 deletions sui_types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum SuiError {
LockErrors { errors: Vec<SuiError> },
#[error("Attempt to transfer an object that's not owned.")]
TransferUnownedError,
#[error("Attempt to transfer an object that's not a coin.")]
#[error("Attempt to transfer an object that's not a coin. Object transfer must be done using a distinct Move function call.")]
TransferNonCoinError,
#[error("A move package is expected, instead a move object is passed: {object_id}")]
MoveObjectAsPackage { object_id: ObjectID },
Expand All @@ -62,7 +62,7 @@ pub enum SuiError {
UnsupportedSharedObjectError,
#[error("Object used as shared is not shared.")]
NotSharedObjectError,
#[error("An object that's owned by another object cannot be deleted or wrapped. It must be transerred to an account address first before deletion")]
#[error("An object that's owned by another object cannot be deleted or wrapped. It must be transferred to an account address first before deletion")]
DeleteObjectOwnedObject,
#[error("The shared locks for this transaction have not yet been set.")]
SharedObjectLockNotSetObject,
Expand Down

0 comments on commit 580f8ff

Please sign in to comment.