Skip to content

Commit

Permalink
Rename to claim_reverse_swap
Browse files Browse the repository at this point in the history
  • Loading branch information
dangeross committed Jul 3, 2024
1 parent 0234597 commit fb13b8f
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion libs/sdk-bindings/src/breez_sdk.udl
Original file line number Diff line number Diff line change
Expand Up @@ -942,7 +942,7 @@ interface BlockingBreezServices {
sequence<ReverseSwapInfo> in_progress_reverse_swaps();

[Throws=SdkError]
void process_reverse_swap(string lockup_address);
void claim_reverse_swap(string lockup_address);

[Throws=SdkError]
MaxReverseSwapAmountResponse max_reverse_swap_amount();
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-bindings/src/uniffi_binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,8 @@ impl BlockingBreezServices {
rt().block_on(self.breez_services.in_progress_reverse_swaps())
}

pub fn process_reverse_swap(&self, lockup_address: String) -> SdkResult<()> {
rt().block_on(self.breez_services.process_reverse_swap(lockup_address))
pub fn claim_reverse_swap(&self, lockup_address: String) -> SdkResult<()> {
rt().block_on(self.breez_services.claim_reverse_swap(lockup_address))
}

pub fn max_reverse_swap_amount(&self) -> SdkResult<MaxReverseSwapAmountResponse> {
Expand Down
6 changes: 3 additions & 3 deletions libs/sdk-core/src/binding.rs
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,12 @@ pub fn in_progress_reverse_swaps() -> Result<Vec<ReverseSwapInfo>> {
.map_err(anyhow::Error::new::<SdkError>)
}

/// See [BreezServices::process_reverse_swap]
pub fn process_reverse_swap(lockup_address: String) -> Result<()> {
/// See [BreezServices::claim_reverse_swap]
pub fn claim_reverse_swap(lockup_address: String) -> Result<()> {
block_on(async {
get_breez_services()
.await?
.process_reverse_swap(lockup_address)
.claim_reverse_swap(lockup_address)
.await
})
.map_err(anyhow::Error::new::<SdkError>)
Expand Down
8 changes: 4 additions & 4 deletions libs/sdk-core/src/breez_services.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,16 +796,16 @@ impl BreezServices {
Ok(())
}

/// Processes an individual reverse swap.
/// Claims an individual reverse swap.
///
/// To be used only in the context of mobile notifications, where the notification triggers
/// an individual reverse swap to be processed.
/// an individual reverse swap to be claimed.
///
/// This is taken care of automatically in the context of typical SDK usage.
pub async fn process_reverse_swap(&self, lockup_address: String) -> SdkResult<()> {
pub async fn claim_reverse_swap(&self, lockup_address: String) -> SdkResult<()> {
Ok(self
.btc_send_swapper
.process_reverse_swap(lockup_address)
.claim_reverse_swap(lockup_address)
.await?)
}

Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-core/src/bridge_generated.io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,8 @@ pub extern "C" fn wire_in_progress_reverse_swaps(port_: i64) {
}

#[no_mangle]
pub extern "C" fn wire_process_reverse_swap(port_: i64, lockup_address: *mut wire_uint_8_list) {
wire_process_reverse_swap_impl(port_, lockup_address)
pub extern "C" fn wire_claim_reverse_swap(port_: i64, lockup_address: *mut wire_uint_8_list) {
wire_claim_reverse_swap_impl(port_, lockup_address)
}

#[no_mangle]
Expand Down
6 changes: 3 additions & 3 deletions libs/sdk-core/src/bridge_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,19 +785,19 @@ fn wire_in_progress_reverse_swaps_impl(port_: MessagePort) {
move || move |task_callback| in_progress_reverse_swaps(),
)
}
fn wire_process_reverse_swap_impl(
fn wire_claim_reverse_swap_impl(
port_: MessagePort,
lockup_address: impl Wire2Api<String> + UnwindSafe,
) {
FLUTTER_RUST_BRIDGE_HANDLER.wrap::<_, _, _, (), _>(
WrapInfo {
debug_name: "process_reverse_swap",
debug_name: "claim_reverse_swap",
port: Some(port_),
mode: FfiCallMode::Normal,
},
move || {
let api_lockup_address = lockup_address.wire2api();
move |task_callback| process_reverse_swap(api_lockup_address)
move |task_callback| claim_reverse_swap(api_lockup_address)
},
)
}
Expand Down
8 changes: 4 additions & 4 deletions libs/sdk-core/src/swap_out/reverseswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -622,10 +622,10 @@ impl BTCSendSwap {
async fn process_monitored_reverse_swaps(&self) -> Result<()> {
let monitored = self.list_monitored().await?;
debug!("Found {} monitored reverse swaps", monitored.len());
self.process_reverse_swaps(monitored).await
self.claim_reverse_swaps(monitored).await
}

async fn process_reverse_swaps(&self, reverse_swaps: Vec<FullReverseSwapInfo>) -> Result<()> {
async fn claim_reverse_swaps(&self, reverse_swaps: Vec<FullReverseSwapInfo>) -> Result<()> {
for rsi in reverse_swaps {
debug!("Processing reverse swap {rsi:?}");

Expand Down Expand Up @@ -682,7 +682,7 @@ impl BTCSendSwap {
Ok(())
}

pub async fn process_reverse_swap(&self, lockup_address: String) -> ReverseSwapResult<()> {
pub async fn claim_reverse_swap(&self, lockup_address: String) -> ReverseSwapResult<()> {
let rsis: Vec<FullReverseSwapInfo> = self
.list_monitored()
.await?
Expand All @@ -700,7 +700,7 @@ impl BTCSendSwap {
"Reverse swap address {} was not found",
lockup_address
))),
false => Ok(self.process_reverse_swaps(rsis).await?),
false => Ok(self.claim_reverse_swaps(rsis).await?),
}
}

Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-flutter/ios/Classes/bridge_generated.h
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ void wire_in_progress_swap(int64_t port_);

void wire_in_progress_reverse_swaps(int64_t port_);

void wire_process_reverse_swap(int64_t port_, struct wire_uint_8_list *lockup_address);
void wire_claim_reverse_swap(int64_t port_, struct wire_uint_8_list *lockup_address);

void wire_open_channel_fee(int64_t port_, struct wire_OpenChannelFeeRequest *req);

Expand Down Expand Up @@ -558,7 +558,7 @@ static int64_t dummy_method_to_enforce_bundling(void) {
dummy_var ^= ((int64_t) (void*) wire_redeem_swap);
dummy_var ^= ((int64_t) (void*) wire_in_progress_swap);
dummy_var ^= ((int64_t) (void*) wire_in_progress_reverse_swaps);
dummy_var ^= ((int64_t) (void*) wire_process_reverse_swap);
dummy_var ^= ((int64_t) (void*) wire_claim_reverse_swap);
dummy_var ^= ((int64_t) (void*) wire_open_channel_fee);
dummy_var ^= ((int64_t) (void*) wire_fetch_reverse_swap_fees);
dummy_var ^= ((int64_t) (void*) wire_onchain_payment_limits);
Expand Down
8 changes: 4 additions & 4 deletions libs/sdk-flutter/lib/breez_sdk.dart
Original file line number Diff line number Diff line change
Expand Up @@ -427,16 +427,16 @@ class BreezSDK {
)
Future<List<ReverseSwapInfo>> inProgressReverseSwaps() async => _lnToolkit.inProgressReverseSwaps();

/// Processes an individual reverse swap.
/// Claims an individual reverse swap.
///
/// To be used only in the context of mobile notifications, where the notification triggers
/// an individual reverse swap to be processed.
/// an individual reverse swap to be claimed.
///
/// This is taken care of automatically in the context of typical SDK usage.
Future<void> processReverseSwap({
Future<void> claimReverseSwap({
required String lockupAddress,
}) async {
return await _lnToolkit.processReverseSwap(lockupAddress: lockupAddress);
return await _lnToolkit.claimReverseSwap(lockupAddress: lockupAddress);
}

/* Swap Fee API's */
Expand Down
28 changes: 14 additions & 14 deletions libs/sdk-flutter/lib/bridge_generated.dart
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ abstract class BreezSdkCore {

FlutterRustBridgeTaskConstMeta get kInProgressReverseSwapsConstMeta;

/// See [BreezServices::process_reverse_swap]
Future<void> processReverseSwap({required String lockupAddress, dynamic hint});
/// See [BreezServices::claim_reverse_swap]
Future<void> claimReverseSwap({required String lockupAddress, dynamic hint});

FlutterRustBridgeTaskConstMeta get kProcessReverseSwapConstMeta;
FlutterRustBridgeTaskConstMeta get kClaimReverseSwapConstMeta;

/// See [BreezServices::open_channel_fee]
Future<OpenChannelFeeResponse> openChannelFee({required OpenChannelFeeRequest req, dynamic hint});
Expand Down Expand Up @@ -2876,20 +2876,20 @@ class BreezSdkCoreImpl implements BreezSdkCore {
argNames: [],
);

Future<void> processReverseSwap({required String lockupAddress, dynamic hint}) {
Future<void> claimReverseSwap({required String lockupAddress, dynamic hint}) {
var arg0 = _platform.api2wire_String(lockupAddress);
return _platform.executeNormal(FlutterRustBridgeTask(
callFfi: (port_) => _platform.inner.wire_process_reverse_swap(port_, arg0),
callFfi: (port_) => _platform.inner.wire_claim_reverse_swap(port_, arg0),
parseSuccessData: _wire2api_unit,
parseErrorData: _wire2api_FrbAnyhowException,
constMeta: kProcessReverseSwapConstMeta,
constMeta: kClaimReverseSwapConstMeta,
argValues: [lockupAddress],
hint: hint,
));
}

FlutterRustBridgeTaskConstMeta get kProcessReverseSwapConstMeta => const FlutterRustBridgeTaskConstMeta(
debugName: "process_reverse_swap",
FlutterRustBridgeTaskConstMeta get kClaimReverseSwapConstMeta => const FlutterRustBridgeTaskConstMeta(
debugName: "claim_reverse_swap",
argNames: ["lockupAddress"],
);

Expand Down Expand Up @@ -5856,21 +5856,21 @@ class BreezSdkCoreWire implements FlutterRustBridgeWireBase {
late final _wire_in_progress_reverse_swaps =
_wire_in_progress_reverse_swapsPtr.asFunction<void Function(int)>();

void wire_process_reverse_swap(
void wire_claim_reverse_swap(
int port_,
ffi.Pointer<wire_uint_8_list> lockup_address,
) {
return _wire_process_reverse_swap(
return _wire_claim_reverse_swap(
port_,
lockup_address,
);
}

late final _wire_process_reverse_swapPtr =
late final _wire_claim_reverse_swapPtr =
_lookup<ffi.NativeFunction<ffi.Void Function(ffi.Int64, ffi.Pointer<wire_uint_8_list>)>>(
'wire_process_reverse_swap');
late final _wire_process_reverse_swap =
_wire_process_reverse_swapPtr.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();
'wire_claim_reverse_swap');
late final _wire_claim_reverse_swap =
_wire_claim_reverse_swapPtr.asFunction<void Function(int, ffi.Pointer<wire_uint_8_list>)>();

void wire_open_channel_fee(
int port_,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,13 +825,13 @@ class BreezSDKModule(
}

@ReactMethod
fun processReverseSwap(
fun claimReverseSwap(
lockupAddress: String,
promise: Promise,
) {
executor.execute {
try {
getBreezServices().processReverseSwap(lockupAddress)
getBreezServices().claimReverseSwap(lockupAddress)
promise.resolve(readableMapOf("status" to "ok"))
} catch (e: Exception) {
promise.reject(e.javaClass.simpleName.replace("Exception", "Error"), e.message, e)
Expand Down
2 changes: 1 addition & 1 deletion libs/sdk-react-native/ios/RNBreezSDK.m
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ @interface RCT_EXTERN_MODULE(RNBreezSDK, RCTEventEmitter)
)

RCT_EXTERN_METHOD(
processReverseSwap: (NSString*)lockupAddress
claimReverseSwap: (NSString*)lockupAddress
resolve: (RCTPromiseResolveBlock)resolve
reject: (RCTPromiseRejectBlock)reject
)
Expand Down
6 changes: 3 additions & 3 deletions libs/sdk-react-native/ios/RNBreezSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -617,10 +617,10 @@ class RNBreezSDK: RCTEventEmitter {
}
}

@objc(processReverseSwap:resolve:reject:)
func processReverseSwap(_ lockupAddress: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
@objc(claimReverseSwap:resolve:reject:)
func claimReverseSwap(_ lockupAddress: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) {
do {
try getBreezServices().processReverseSwap(lockupAddress: lockupAddress)
try getBreezServices().claimReverseSwap(lockupAddress: lockupAddress)
resolve(["status": "ok"])
} catch let err {
rejectErr(err: err, reject: reject)
Expand Down
4 changes: 2 additions & 2 deletions libs/sdk-react-native/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,8 @@ export const inProgressReverseSwaps = async (): Promise<ReverseSwapInfo[]> => {
return response
}

export const processReverseSwap = async (lockupAddress: string): Promise<void> => {
await BreezSDK.processReverseSwap(lockupAddress)
export const claimReverseSwap = async (lockupAddress: string): Promise<void> => {
await BreezSDK.claimReverseSwap(lockupAddress)
}

export const maxReverseSwapAmount = async (): Promise<MaxReverseSwapAmountResponse> => {
Expand Down

0 comments on commit fb13b8f

Please sign in to comment.