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

refactor: made solana methods to support event as an input #59

Merged
merged 13 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from 11 commits
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
789 changes: 397 additions & 392 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bridge-cli/src/defaults.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub const ARB_BRIDGE_TOKEN_FACTORY_ADDRESS_TESTNET: &str =
"0xd565f7CcE0FA1bB8DBe73FCDA281390d545f6200";

pub const SOLANA_RPC_TESTNET: &str = "https://api.devnet.solana.com";
pub const SOLANA_BRIDGE_ADDRESS_TESTNET: &str = "";
pub const SOLANA_BRIDGE_ADDRESS_TESTNET: &str = "Gy1XPwYZURfBzHiGAxnw3SYC33SfqsEpGSS5zeBge28p";
pub const SOLANA_WORMHOLE_ADDRESS_TESTNET: &str = "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5";

pub const FAST_BRIDGE_ACCOUNT_ID_TESTNET: &str = "fastbridge.testnet";
Expand Down
28 changes: 19 additions & 9 deletions bridge-cli/src/omni_connector_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use omni_connector::{
BindTokenArgs, DeployTokenArgs, FinTransferArgs, InitTransferArgs, LogMetadataArgs,
OmniConnector, OmniConnectorBuilder,
};
use omni_types::{ChainKind, Fee};
use omni_types::{ChainKind, Fee, TransferId};
use solana_bridge_client::SolanaBridgeClientBuilder;
use solana_client::nonblocking::rpc_client::RpcClient;
use solana_sdk::signature::Keypair;
Expand Down Expand Up @@ -43,7 +43,11 @@ pub enum OmniConnectorSubCommand {
},
NearSignTransfer {
#[clap(short, long)]
nonce: u64,
origin_chain_id: u8,
#[clap(short, long)]
origin_nonce: u64,
#[clap(short, long)]
fee_recipient: Option<String>,
#[clap(short, long)]
fee: u128,
#[clap(long)]
Expand Down Expand Up @@ -216,15 +220,20 @@ pub async fn match_subcommand(cmd: OmniConnectorSubCommand, network: Network) {
.unwrap();
}
OmniConnectorSubCommand::NearSignTransfer {
nonce,
origin_chain_id,
origin_nonce,
fee_recipient,
fee,
native_fee,
config_cli,
} => {
omni_connector(network, config_cli)
.near_sign_transfer(
nonce,
None,
TransferId {
origin_chain: ChainKind::try_from(origin_chain_id).unwrap(),
origin_nonce,
},
fee_recipient.map(|recipient| AccountId::from_str(&recipient).unwrap()),
Some(Fee {
fee: fee.into(),
native_fee: native_fee.into(),
Expand Down Expand Up @@ -360,8 +369,8 @@ pub async fn match_subcommand(cmd: OmniConnectorSubCommand, network: Network) {
config_cli,
} => {
omni_connector(network, config_cli)
.deploy_token(DeployTokenArgs::SolanaDeployToken {
tx_hash: transaction_hash.parse().unwrap(),
.deploy_token(DeployTokenArgs::SolanaDeployTokenWithTxHash {
near_tx_hash: transaction_hash.parse().unwrap(),
sender_id: sender_id.map(|id| id.parse().unwrap()),
})
.await
Expand Down Expand Up @@ -399,8 +408,8 @@ pub async fn match_subcommand(cmd: OmniConnectorSubCommand, network: Network) {
config_cli,
} => {
omni_connector(network, config_cli)
.fin_transfer(FinTransferArgs::SolanaFinTransfer {
tx_hash: transaction_hash.parse().unwrap(),
.fin_transfer(FinTransferArgs::SolanaFinTransferWithTxHash {
near_tx_hash: transaction_hash.parse().unwrap(),
solana_token: solana_token.parse().unwrap(),
sender_id: sender_id.map(|id| id.parse().unwrap()),
})
Expand Down Expand Up @@ -490,6 +499,7 @@ fn omni_connector(network: Network, cli_config: CliConfig) -> OmniConnector {
.base_bridge_client(Some(base_bridge_client))
.arb_bridge_client(Some(arb_bridge_client))
.solana_bridge_client(Some(solana_bridge_client))
.wormhole_bridge_client(None)
.build()
.unwrap()
}
2 changes: 0 additions & 2 deletions bridge-sdk/bridge-clients/evm-bridge-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@ near-crypto.workspace = true
near-jsonrpc-client.workspace = true
near-primitives.workspace = true
near-token.workspace = true
near-contract-standards.workspace = true
omni-types.workspace = true
serde_json.workspace = true
tracing.workspace = true
eth-proof = { path = "../../eth-proof" }
near-rpc-client = { path = "../../near-rpc-client" }
bridge-connector-common = { path = "../../connectors/bridge-connector-common" }
near-bridge-client = { path = "../near-bridge-client" }

[lib]
path = "src/evm_bridge_client.rs"
1 change: 1 addition & 0 deletions bridge-sdk/bridge-clients/near-bridge-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ near-primitives.workspace = true
near-token.workspace = true
near-contract-standards.workspace = true
omni-types.workspace = true
serde.workspace = true
serde_json.workspace = true
tracing.workspace = true
near-rpc-client = { path = "../../near-rpc-client" }
Expand Down
Loading
Loading