forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RPC API][Refactoring] - Move rpc apis to it's own package (MystenLab…
…s#2542) * move rpc apis to it's own package and decouple it from gateway, in preparation of creating a Sui rust SDK * minor fixes * fix fmt * rename sui-rpc and sui-rpc-api to sui-json-rpc and sui-json-rpc-api
- Loading branch information
1 parent
d96ea49
commit b027b24
Showing
39 changed files
with
394 additions
and
214 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
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
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
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,10 +1,29 @@ | ||
// Copyright (c) 2022, Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
pub mod api; | ||
pub mod bcs_api; | ||
use crate::config::GatewayConfig; | ||
use anyhow::anyhow; | ||
use std::path::Path; | ||
use std::sync::Arc; | ||
use sui_config::PersistedConfig; | ||
use sui_core::gateway_state::{GatewayClient, GatewayState}; | ||
|
||
pub mod config; | ||
pub mod json_rpc; | ||
pub mod read_api; | ||
pub mod rpc_gateway; | ||
pub mod rpc_gateway_client; | ||
|
||
pub fn create_client(config_path: &Path) -> Result<GatewayClient, anyhow::Error> { | ||
let config: GatewayConfig = PersistedConfig::read(config_path).map_err(|e| { | ||
anyhow!( | ||
"Failed to read config file at {:?}: {}. Have you run `sui genesis` first?", | ||
config_path, | ||
e | ||
) | ||
})?; | ||
let committee = config.make_committee(); | ||
let authority_clients = config.make_authority_clients(); | ||
Ok(Arc::new(GatewayState::new( | ||
config.db_folder_path, | ||
committee, | ||
authority_clients, | ||
)?)) | ||
} |
Oops, something went wrong.