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

[GatewayAPI] - Moving SuiJson to core and use it in the GatewayAPI #1652

Merged
merged 5 commits into from
May 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
fixup after rebase
  • Loading branch information
patrickkuo committed May 3, 2022
commit c3c186fa8f055db173886308350b61f068f231b0
5 changes: 3 additions & 2 deletions sui/src/rpc_gateway.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::rpc_gateway::responses::SuiTypeTag;
use crate::{
config::{GatewayConfig, PersistedConfig},
rpc_gateway::responses::{GetObjectInfoResponse, NamedObjectRef, ObjectResponse},
Expand All @@ -10,7 +11,7 @@ use async_trait::async_trait;
use ed25519_dalek::ed25519::signature::Signature;
use jsonrpsee::core::RpcResult;
use jsonrpsee_proc_macros::rpc;
use move_core_types::{identifier::Identifier, language_storage::TypeTag};
use move_core_types::identifier::Identifier;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use serde_with::{base64, serde_as};
Expand All @@ -27,7 +28,7 @@ use sui_types::{
crypto::SignableBytes,
json_schema,
json_schema::Base64,
messages::{CallArg, Transaction, TransactionData},
messages::{Transaction, TransactionData},
object::ObjectRead,
};
use tracing::debug;
Expand Down
14 changes: 8 additions & 6 deletions sui/src/unit_tests/cli_tests.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::cli_tests::sui_network::start_test_network;
use anyhow::anyhow;
use move_core_types::identifier::Identifier;
use serde_json::{json, Value};
use std::{
collections::BTreeSet, fmt::Write, fs::read_dir, ops::Add, path::PathBuf, str, time::Duration,
};

use anyhow::anyhow;
use move_core_types::identifier::Identifier;
use serde_json::{json, Value};
use tracing_test::traced_test;

use sui::{
config::{
AccountConfig, Config, GatewayConfig, GatewayType, GenesisConfig, NetworkConfig,
Expand All @@ -16,7 +18,6 @@ use sui::{
},
keystore::KeystoreType,
sui_commands::{SuiCommand, SuiNetwork, SUI_AUTHORITY_KEYS},
sui_json::SuiJsonValue,
wallet_commands::{WalletCommandResult, WalletCommands, WalletContext},
};
use sui_core::gateway_state::gateway_responses::SwitchResponse;
Expand All @@ -28,7 +29,8 @@ use sui_types::{
messages::TransactionEffects,
object::{Object, ObjectRead, GAS_VALUE_FOR_TESTING},
};
use tracing_test::traced_test;

use crate::cli_tests::sui_network::start_test_network;

const TEST_DATA_DIR: &str = "src/unit_tests/data/";
const AIRDROP_SOURCE_CONTRACT_ADDRESS: &str = "bc4ca0eda7647a8ab7c2061c2e118a18a936f13d";
Expand Down
4 changes: 1 addition & 3 deletions sui/src/unit_tests/rpc_server_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,17 @@ use sui::{
config::{PersistedConfig, WalletConfig, SUI_GATEWAY_CONFIG, SUI_WALLET_CONFIG},
keystore::{Keystore, SuiKeystore},
rpc_gateway::{
responses::ObjectResponse, RpcCallArg, RpcGatewayClient, RpcGatewayImpl, RpcGatewayServer,
responses::ObjectResponse, RpcGatewayClient, RpcGatewayImpl, RpcGatewayServer,
SignedTransaction, TransactionBytes,
},
sui_commands::SuiNetwork,
sui_json::{resolve_move_function_args, SuiJsonCallArg, SuiJsonValue},
};
use sui_core::gateway_state::gateway_responses::TransactionResponse;
use sui_core::sui_json::SuiJsonValue;
use sui_framework::build_move_package_to_bytes;
use sui_types::{
base_types::{ObjectID, SuiAddress},
json_schema::Base64,
object::ObjectRead,
SUI_FRAMEWORK_ADDRESS,
};

Expand Down
37 changes: 20 additions & 17 deletions sui/src/wallet_commands.rs
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::{
config::{Config, GatewayType, PersistedConfig, WalletConfig},
keystore::Keystore,
sui_json::{resolve_move_function_args, SuiJsonCallArg, SuiJsonValue},
};
use anyhow::anyhow;
use clap::*;
use colored::Colorize;
use core::fmt;
use move_core_types::{identifier::Identifier, language_storage::TypeTag, parser::parse_type_tag};
use serde::Serialize;
use serde_json::json;
use std::{
collections::{BTreeMap, BTreeSet},
fmt::{Debug, Display, Formatter, Write},
path::Path,
sync::{Arc, RwLock},
time::Instant,
};

use anyhow::anyhow;
use clap::*;
use colored::Colorize;
use move_core_types::{identifier::Identifier, language_storage::TypeTag, parser::parse_type_tag};
use serde::Serialize;
use serde_json::json;
use tracing::info;

use sui_core::gateway_state::{
gateway_responses::{MergeCoinResponse, PublishResponse, SplitCoinResponse, SwitchResponse},
GatewayClient,
};
use sui_core::sui_json::{resolve_move_function_args, SuiJsonCallArg, SuiJsonValue};
use sui_framework::build_move_package_to_bytes;
use sui_types::{
base_types::{decode_bytes_hex, ObjectID, ObjectRef, SuiAddress},
gas_coin::GasCoin,
messages::{CallArg, CertifiedTransaction, ExecutionStatus, Transaction, TransactionEffects},
messages::{CertifiedTransaction, ExecutionStatus, Transaction, TransactionEffects},
object::{Object, ObjectRead, ObjectRead::Exists},
SUI_FRAMEWORK_ADDRESS,
};
use tracing::info;

use crate::{
config::{Config, GatewayType, PersistedConfig, WalletConfig},
keystore::Keystore,
};

const EXAMPLE_NFT_NAME: &str = "Example NFT";
const EXAMPLE_NFT_DESCRIPTION: &str = "An NFT created by the wallet Command Line Tool";
Expand Down Expand Up @@ -107,10 +110,10 @@ pub enum WalletCommands {
function: Identifier,
/// Function name in module
#[clap(
long,
parse(try_from_str = parse_type_tag),
multiple_occurrences = false,
multiple_values = true
long,
parse(try_from_str = parse_type_tag),
multiple_occurrences = false,
multiple_values = true
)]
type_args: Vec<TypeTag>,
/// Simplified ordered args like in the function syntax
Expand Down