Skip to content

Commit

Permalink
chore: more consistent params
Browse files Browse the repository at this point in the history
  • Loading branch information
j4m1ef0rd committed Oct 22, 2024
1 parent df8771a commit 7374cc2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
16 changes: 8 additions & 8 deletions api/bin/chainflip-broker-api/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ pub trait Rpc {
destination_asset: Asset,
destination_address: AddressString,
broker_commission: BasisPoints,
retry_duration: u32,
min_output_amount: NumberOrHex,
dca_parameters: Option<DcaParameters>,
retry_duration: u32,
boost_fee: Option<BasisPoints>,
affiliate_fees: Option<Affiliates<AccountId32>>,
dca_parameters: Option<DcaParameters>,
) -> RpcResult<SwapPayload>;
}

Expand Down Expand Up @@ -116,7 +116,7 @@ impl RpcServer for RpcServerImpl {
broker_commission,
channel_metadata,
boost_fee,
affiliate_fees.unwrap_or_default(),
affiliate_fees,
refund_parameters,
dca_parameters,
)
Expand All @@ -143,11 +143,11 @@ impl RpcServer for RpcServerImpl {
destination_asset: Asset,
destination_address: AddressString,
broker_commission: BasisPoints,
retry_duration: u32,
min_output_amount: NumberOrHex,
dca_parameters: Option<DcaParameters>,
retry_duration: u32,
boost_fee: Option<BasisPoints>,
affiliate_fees: Option<Affiliates<AccountId32>>,
dca_parameters: Option<DcaParameters>,
) -> RpcResult<SwapPayload> {
Ok(self
.api
Expand All @@ -156,12 +156,12 @@ impl RpcServer for RpcServerImpl {
source_asset,
destination_asset,
destination_address,
retry_duration,
broker_commission,
try_parse_number_or_hex(min_output_amount).map_err(to_rpc_error)?,
retry_duration,
boost_fee,
dca_parameters,
broker_commission,
affiliate_fees,
dca_parameters,
)
.await
.map_err(to_rpc_error)?)
Expand Down
24 changes: 12 additions & 12 deletions api/lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ pub trait BrokerApi: SignedExtrinsicApi + StorageApi + Sized + Send + Sync + 'st
broker_commission: BasisPoints,
channel_metadata: Option<CcmChannelMetadata>,
boost_fee: Option<BasisPoints>,
affiliate_fees: Affiliates<AccountId32>,
affiliate_fees: Option<Affiliates<AccountId32>>,
refund_parameters: Option<RefundParameters>,
dca_parameters: Option<DcaParameters>,
) -> Result<SwapDepositAddress> {
Expand All @@ -418,7 +418,7 @@ pub trait BrokerApi: SignedExtrinsicApi + StorageApi + Sized + Send + Sync + 'st
broker_commission,
channel_metadata,
boost_fee: boost_fee.unwrap_or_default(),
affiliate_fees,
affiliate_fees: affiliate_fees.unwrap_or_default(),
refund_parameters: refund_parameters
.map(|rpc_params| {
Ok::<_, anyhow::Error>(ChannelRefundParametersGeneric {
Expand Down Expand Up @@ -526,15 +526,15 @@ pub trait BrokerApi: SignedExtrinsicApi + StorageApi + Sized + Send + Sync + 'st

async fn request_swap_parameter_encoding(
&self,
input_asset: Asset,
output_asset: Asset,
output_address: AddressString,
retry_duration: BlockNumber,
source_asset: Asset,
destination_asset: Asset,
destination_address: AddressString,
broker_commission: BasisPoints,
min_output_amount: AssetAmount,
retry_duration: BlockNumber,
boost_fee: Option<BasisPoints>,
dca_parameters: Option<DcaParameters>,
broker_commission: BasisPoints,
affiliate_fees: Option<Affiliates<AccountId32>>,
dca_parameters: Option<DcaParameters>,
) -> Result<SwapPayload> {
// Check if safe mode is active
let block_hash = self.base_rpc_api().latest_finalized_block_hash().await?;
Expand Down Expand Up @@ -566,12 +566,12 @@ pub trait BrokerApi: SignedExtrinsicApi + StorageApi + Sized + Send + Sync + 'st
}

// Encode swap
match ForeignChain::from(input_asset) {
match ForeignChain::from(source_asset) {
ForeignChain::Bitcoin => {
let params = UtxoEncodedData {
output_asset,
output_address: output_address
.try_parse_to_encoded_address(output_asset.into())?,
output_asset: destination_asset,
output_address: destination_address
.try_parse_to_encoded_address(destination_asset.into())?,
parameters: SharedCfParameters {
retry_duration: retry_duration.try_into()?,
min_output_amount,
Expand Down

0 comments on commit 7374cc2

Please sign in to comment.