Skip to content

Commit

Permalink
fix streaming of incoming invoice non sphinx
Browse files Browse the repository at this point in the history
  • Loading branch information
Evanfeenstra committed Mar 7, 2024
1 parent 3eddd66 commit e314640
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
2 changes: 1 addition & 1 deletion sphinx-ffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ sphinx-signer = { path = "../signer", default-features = false, features = [
"no-native",
] }
sphinx-glyph = { path = "../glyph", default-features = false }
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "40cd317d0ceffafd87b00eb1931e5ea57b6939ec", features = [
sphinx = { git = "https://github.com/stakwork/sphinx", rev = "f28601a3835bcb135700c78216db2e2842c31e9b", features = [
"msg",
"bindings",
] }
Expand Down
4 changes: 4 additions & 0 deletions sphinx-ffi/src/auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ pub struct RunReturn {
pub initial_tribe: Option<String>,
pub lsp_host: Option<String>,
pub invoice: Option<String>,
pub route: Option<String>,
pub node: Option<String>,
}

pub fn set_network(net: String) -> Result<RunReturn> {
Expand Down Expand Up @@ -428,6 +430,8 @@ impl From<bindings::RunReturn> for RunReturn {
initial_tribe: rr.initial_tribe,
lsp_host: rr.lsp_host,
invoice: rr.invoice,
route: rr.route,
node: rr.node,
}
}
}
20 changes: 18 additions & 2 deletions sphinx-ffi/src/sphinxrs.swift
Original file line number Diff line number Diff line change
Expand Up @@ -597,10 +597,12 @@ public struct RunReturn {
public var `initialTribe`: String?
public var `lspHost`: String?
public var `invoice`: String?
public var `route`: String?
public var `node`: String?

// Default memberwise initializers are never public by default, so we
// declare one manually.
public init(`msgs`: [Msg], `topics`: [String], `payloads`: [Data], `stateMp`: Data?, `stateToDelete`: [String], `newBalance`: UInt64?, `myContactInfo`: String?, `sentStatus`: String?, `settledStatus`: String?, `error`: String?, `newTribe`: String?, `tribeMembers`: String?, `newInvite`: String?, `inviterContactInfo`: String?, `inviterAlias`: String?, `initialTribe`: String?, `lspHost`: String?, `invoice`: String?) {
public init(`msgs`: [Msg], `topics`: [String], `payloads`: [Data], `stateMp`: Data?, `stateToDelete`: [String], `newBalance`: UInt64?, `myContactInfo`: String?, `sentStatus`: String?, `settledStatus`: String?, `error`: String?, `newTribe`: String?, `tribeMembers`: String?, `newInvite`: String?, `inviterContactInfo`: String?, `inviterAlias`: String?, `initialTribe`: String?, `lspHost`: String?, `invoice`: String?, `route`: String?, `node`: String?) {
self.`msgs` = `msgs`
self.`topics` = `topics`
self.`payloads` = `payloads`
Expand All @@ -619,6 +621,8 @@ public struct RunReturn {
self.`initialTribe` = `initialTribe`
self.`lspHost` = `lspHost`
self.`invoice` = `invoice`
self.`route` = `route`
self.`node` = `node`
}
}

Expand Down Expand Up @@ -679,6 +683,12 @@ extension RunReturn: Equatable, Hashable {
if lhs.`invoice` != rhs.`invoice` {
return false
}
if lhs.`route` != rhs.`route` {
return false
}
if lhs.`node` != rhs.`node` {
return false
}
return true
}

Expand All @@ -701,6 +711,8 @@ extension RunReturn: Equatable, Hashable {
hasher.combine(`initialTribe`)
hasher.combine(`lspHost`)
hasher.combine(`invoice`)
hasher.combine(`route`)
hasher.combine(`node`)
}
}

Expand All @@ -725,7 +737,9 @@ public struct FfiConverterTypeRunReturn: FfiConverterRustBuffer {
`inviterAlias`: FfiConverterOptionString.read(from: &buf),
`initialTribe`: FfiConverterOptionString.read(from: &buf),
`lspHost`: FfiConverterOptionString.read(from: &buf),
`invoice`: FfiConverterOptionString.read(from: &buf)
`invoice`: FfiConverterOptionString.read(from: &buf),
`route`: FfiConverterOptionString.read(from: &buf),
`node`: FfiConverterOptionString.read(from: &buf)
)
}

Expand All @@ -748,6 +762,8 @@ public struct FfiConverterTypeRunReturn: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.`initialTribe`, into: &buf)
FfiConverterOptionString.write(value.`lspHost`, into: &buf)
FfiConverterOptionString.write(value.`invoice`, into: &buf)
FfiConverterOptionString.write(value.`route`, into: &buf)
FfiConverterOptionString.write(value.`node`, into: &buf)
}
}

Expand Down
2 changes: 2 additions & 0 deletions sphinx-ffi/src/sphinxrs.udl
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ dictionary RunReturn {
string? initial_tribe;
string? lsp_host;
string? invoice;
string? route;
string? node;
};

namespace sphinxrs {
Expand Down
12 changes: 10 additions & 2 deletions sphinx-ffi/src/uniffi/sphinxrs/sphinxrs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -1009,7 +1009,9 @@ data class RunReturn (
var `inviterAlias`: String?,
var `initialTribe`: String?,
var `lspHost`: String?,
var `invoice`: String?
var `invoice`: String?,
var `route`: String?,
var `node`: String?
) {

}
Expand All @@ -1035,6 +1037,8 @@ public object FfiConverterTypeRunReturn: FfiConverterRustBuffer<RunReturn> {
FfiConverterOptionalString.read(buf),
FfiConverterOptionalString.read(buf),
FfiConverterOptionalString.read(buf),
FfiConverterOptionalString.read(buf),
FfiConverterOptionalString.read(buf),
)
}

Expand All @@ -1056,7 +1060,9 @@ public object FfiConverterTypeRunReturn: FfiConverterRustBuffer<RunReturn> {
FfiConverterOptionalString.allocationSize(value.`inviterAlias`) +
FfiConverterOptionalString.allocationSize(value.`initialTribe`) +
FfiConverterOptionalString.allocationSize(value.`lspHost`) +
FfiConverterOptionalString.allocationSize(value.`invoice`)
FfiConverterOptionalString.allocationSize(value.`invoice`) +
FfiConverterOptionalString.allocationSize(value.`route`) +
FfiConverterOptionalString.allocationSize(value.`node`)
)

override fun write(value: RunReturn, buf: ByteBuffer) {
Expand All @@ -1078,6 +1084,8 @@ public object FfiConverterTypeRunReturn: FfiConverterRustBuffer<RunReturn> {
FfiConverterOptionalString.write(value.`initialTribe`, buf)
FfiConverterOptionalString.write(value.`lspHost`, buf)
FfiConverterOptionalString.write(value.`invoice`, buf)
FfiConverterOptionalString.write(value.`route`, buf)
FfiConverterOptionalString.write(value.`node`, buf)
}
}

Expand Down

0 comments on commit e314640

Please sign in to comment.