Skip to content

Commit f7fc5d2

Browse files
github-actions[bot]jklein24matthappensjoelweinbergerJasonCWang
authored
Merge release/core-v0.6.1 into main (#237)
* Add the uma-configuration file to the demo VASP * adding sending / receiving vasp methods for demo * change path for requesting invoice * adding basic receiver vasp methods * remove duplicate code for create invoices * change to fetching well known configuration from sending vasp * revert to previous endpoint * adding sender vasp demo endpoints * nits and such * moving parameter to json body * Update SendingVasp.kt * ms -> s * Add explicit timeouts to the Requester * Create SECURITY.md * Regenerating SDKs following introspection of schemas. * Bump ci runners to macos-13. (#214) * Expose idempotency keys for operations which allow them. (#212) * Add the outgoing_payment_for_idempotency_key query. (#213) * Merge release/lightspark-sdk-v0.19.0 into develop (#215) This PR was automatically created by the release branch cut workflow.\nSDK=lightspark-sdk\nVERSION=0.19.0 Co-authored-by: runner <runner@Mac-1739391984425.local> * Remove an extra param for outgoing_payment_for_idempotency_key (#219) This was accidental copy-pasta. * Bump lightspark-sdk to version 0.19.1 * Fix non uma lnurl path (#224) * Bump sdk version, use standard errors in UMA demo vasp (#226) * Added paymentHash and preimageNonce params to createInvoice, createLnurlInvoice, and createUmaInvoice and their respective mutations from all 3 clients. * Added releasePaymentPreimage functions to all 3 kotlin clients * Update Gradle version * Fix misnamed buckets ldev.web-dev -> lsdev.web-dev * Rename to lightspark-dev-web.web-dev * Switch to CENTRAL_PORTAL for maven publishing (#235) * Bump core to version 0.6.1 --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Jeremy Klein <jklein24@gmail.com> Co-authored-by: Matt Davis <mrdavis@lightspark.com> Co-authored-by: Matt Davis <matthappens@gmail.com> Co-authored-by: Joel Weinberger <jww@lightspark.com> Co-authored-by: Jason Wang <jason@lightspark.com> Co-authored-by: Jason Wang <jasoncwangai@gmail.com> Co-authored-by: runner <runner@Mac-1739391984425.local> Co-authored-by: runner <runner@Mac-1739478597077.local> Co-authored-by: Shreya Vissamsetti <shreya@lightspark.com> Co-authored-by: Aaryaman Bhute <aaryaman@lightspark.com> Co-authored-by: Aaryaman Bhute <35084309+AaryamanBhute@users.noreply.github.com> Co-authored-by: Alex Weil <alexweil@lightspark.com> Co-authored-by: Alex Weil <alexjweil@users.noreply.github.com> Co-authored-by: runner <runner@Mac-1750470216285.local>
1 parent e58fef3 commit f7fc5d2

File tree

21 files changed

+460
-352
lines changed

21 files changed

+460
-352
lines changed

androidwalletdemo/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
22
import java.io.FileInputStream
33
import java.util.*
44

5-
@Suppress("DSL_SCOPE_VIOLATION")
65
plugins {
76
id(libs.plugins.androidApplication.get().pluginId)
87
kotlin("android")
@@ -20,7 +19,7 @@ try {
2019

2120
val isCI: Boolean = System.getenv("CI") == "true"
2221
val jwtServerUrl: String = if (isCI) "" else
23-
gradleLocalProperties(rootDir).getProperty("jwtServerUrl")
22+
gradleLocalProperties(rootDir, providers).getProperty("jwtServerUrl")
2423
?: throw Error("You must set the jwtServerUrl property in a local.properties file")
2524

2625
android {

build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ subprojects {
8383

8484
plugins.withId("com.vanniktech.maven.publish.base") {
8585
configure<MavenPublishBaseExtension> {
86-
publishToMavenCentral(SonatypeHost.S01, automaticRelease = true)
86+
publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL, automaticRelease = true)
8787
signAllPublications()
8888
pom {
8989
name.set(project.name)
@@ -147,6 +147,7 @@ subprojects {
147147

148148
if (project.name !in DEMO_APPS) {
149149
apply(plugin = "org.jetbrains.kotlin.multiplatform")
150+
apply(plugin = "com.android.library")
150151
configure<KotlinMultiplatformExtension> {
151152
jvmToolchain(11)
152153
androidTarget {

core/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
22
import com.mgd.core.gradle.S3Upload
33

4-
@Suppress("DSL_SCOPE_VIOLATION")
54
plugins {
65
kotlin("multiplatform")
76
alias(libs.plugins.kotlinSerialization)
@@ -127,14 +126,14 @@ tasks.register<Copy>("generateSdkDocs") {
127126
}
128127

129128
s3 {
130-
bucket = "lsdev.web-dev"
129+
bucket = "lightspark-dev-web"
131130
region = "us-west-2"
132131
}
133132

134133
tasks.register<S3Upload>("uploadDocsToS3") {
135134
group = "documentation"
136135
dependsOn("generateSdkDocs")
137-
bucket = "ldev.web-dev"
136+
bucket = "lightspark-dev-web"
138137
keyPrefix = "docs/kotlin"
139138
sourceDir = "docs/html"
140139
}

core/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GROUP=com.lightspark
22
POM_ARTIFACT_ID=lightspark-core
33
# Don't bump this manually. Run `scripts/versions.main.kt <new_version>` to bump the version instead.
4-
VERSION_NAME=0.6.0
4+
VERSION_NAME=0.6.1
55

66
POM_DESCRIPTION=The Lightspark shared utilities library for Kotlin and Java.
77
POM_INCEPTION_YEAR=2023

crypto/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
22
import de.undercouch.gradle.tasks.download.Download
33

4-
@Suppress("DSL_SCOPE_VIOLATION")
54
plugins {
65
kotlin("multiplatform")
76
id(libs.plugins.androidLibrary.get().pluginId)

gradle/libs.versions.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
# Core SDK deps (or common):
33
acinqSecp256k1 = "0.10.1"
4-
androidGradlePlugin = "8.1.2"
4+
androidGradlePlugin = "8.10.0"
55
appAuth = "0.11.1"
66
buildKonfig = "0.13.3"
77
dataStore = "1.0.0"
@@ -12,17 +12,17 @@ gradleS3 = "1.2.1"
1212
jna = "5.13.0"
1313
kase64 = "1.0.6"
1414
kotest = "5.5.4"
15-
kotlin = "1.9.0"
15+
kotlin = "1.9.20"
1616
kotlinCompilerExtension = "1.4.0"
1717
kotlinCoroutines = "1.7.2"
1818
kotlinxDateTime = "0.4.0"
1919
kotlinSerializationJson = "1.4.1"
2020
ktlint = "11.3.1"
2121
ktor = "2.3.7"
22-
lightsparkCore = "0.6.0"
22+
lightsparkCore = "0.6.1"
2323
lightsparkCrypto = "0.6.0"
24-
uma = "1.3.0"
25-
mavenPublish = "0.25.2"
24+
uma = "1.5.0"
25+
mavenPublish = "0.32.0"
2626
mockitoCore = "5.5.0"
2727
taskTree = "2.1.1"
2828

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Thu Feb 02 10:27:20 PST 2023
22
distributionBase=GRADLE_USER_HOME
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
44
distributionPath=wrapper/dists
55
zipStorePath=wrapper/dists
66
zipStoreBase=GRADLE_USER_HOME

lightspark-sdk/build.gradle.kts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import com.codingfeline.buildkonfig.compiler.FieldSpec.Type.STRING
22
import com.mgd.core.gradle.S3Upload
33

4-
@Suppress("DSL_SCOPE_VIOLATION")
54
plugins {
65
kotlin("multiplatform")
76
alias(libs.plugins.kotlinSerialization)
@@ -137,14 +136,14 @@ tasks.register<Copy>("generateSdkDocs") {
137136
}
138137

139138
s3 {
140-
bucket = "lsdev.web-dev"
139+
bucket = "lightspark-dev-web"
141140
region = "us-west-2"
142141
}
143142

144143
tasks.register<S3Upload>("uploadDocsToS3") {
145144
group = "documentation"
146145
dependsOn("generateSdkDocs")
147-
bucket = "ldev.web-dev"
146+
bucket = "lightspark-dev-web"
148147
keyPrefix = "docs/kotlin"
149148
sourceDir = "docs/html"
150149
}

lightspark-sdk/src/commonJvmAndroidMain/kotlin/com/lightspark/sdk/LightsparkFuturesClient.kt

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import com.lightspark.sdk.model.InvoiceType
2121
import com.lightspark.sdk.model.OutgoingPayment
2222
import com.lightspark.sdk.model.PaymentDirection
2323
import com.lightspark.sdk.model.RegionCode
24+
import com.lightspark.sdk.model.ReleasePaymentPreimageOutput
2425
import com.lightspark.sdk.model.RiskRating
2526
import com.lightspark.sdk.model.TransactionStatus
2627
import com.lightspark.sdk.model.UmaInvitation
@@ -116,6 +117,23 @@ class LightsparkFuturesClient(config: ClientConfig) {
116117
): CompletableFuture<WalletDashboard?> =
117118
coroutineScope.future { coroutinesClient.getSingleNodeDashboard(nodeId, numTransactions, bitcoinNetwork) }
118119

120+
/**
121+
* Marks a payment preimage as released. To be used when the recipient has received the payment.
122+
*
123+
* @param invoiceId The invoice the preimage belongs to.
124+
* @param paymentPreimage The preimage to release.
125+
*/
126+
fun releasePaymentPreimage(
127+
invoiceId: String,
128+
paymentPreimage: String
129+
): CompletableFuture<ReleasePaymentPreimageOutput?> =
130+
coroutineScope.future {
131+
coroutinesClient.releasePaymentPreimage(
132+
invoiceId,
133+
paymentPreimage
134+
)
135+
}
136+
119137
/**
120138
* Creates a lightning invoice for the given node.
121139
*
@@ -126,6 +144,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
126144
* @param memo Optional memo to include in the invoice.
127145
* @param type The type of invoice to create. Defaults to [InvoiceType.STANDARD].
128146
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
147+
* @param paymentHash Optional payment hash to include in the invoice.
148+
* @param preimageNonce Optional preimage nonce to include in the invoice.
129149
*/
130150
@JvmOverloads
131151
fun createInvoice(
@@ -134,8 +154,20 @@ class LightsparkFuturesClient(config: ClientConfig) {
134154
memo: String? = null,
135155
type: InvoiceType = InvoiceType.STANDARD,
136156
expirySecs: Int? = null,
157+
paymentHash: String? = null,
158+
preimageNonce: String? = null,
137159
): CompletableFuture<Invoice> =
138-
coroutineScope.future { coroutinesClient.createInvoice(nodeId, amountMsats, memo, type, expirySecs) }
160+
coroutineScope.future {
161+
coroutinesClient.createInvoice(
162+
nodeId,
163+
amountMsats,
164+
memo,
165+
type,
166+
expirySecs,
167+
paymentHash,
168+
preimageNonce,
169+
)
170+
}
139171

140172
/**
141173
* Creates a Lightning invoice for the given node. This should only be used for generating invoices for LNURLs, with
@@ -146,20 +178,26 @@ class LightsparkFuturesClient(config: ClientConfig) {
146178
* @param metadata The LNURL metadata payload field from the initial payreq response. This will be hashed and
147179
* present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice.
148180
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
181+
* @param paymentHash Optional payment hash to include in the invoice.
182+
* @param preimageNonce Optional preimage nonce to include in the invoice.
149183
*/
150184
@JvmOverloads
151185
fun createLnurlInvoice(
152186
nodeId: String,
153187
amountMsats: Long,
154188
metadata: String,
155189
expirySecs: Int? = null,
190+
paymentHash: String? = null,
191+
preimageNonce: String? = null,
156192
): CompletableFuture<Invoice> =
157193
coroutineScope.future {
158194
coroutinesClient.createLnurlInvoice(
159195
nodeId,
160196
amountMsats,
161197
metadata,
162198
expirySecs,
199+
paymentHash,
200+
preimageNonce,
163201
)
164202
}
165203

@@ -175,6 +213,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
175213
* @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
176214
* @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
177215
* monthly-rotated seed and used for anonymized analysis.
216+
* @param paymentHash Optional payment hash to include in the invoice.
217+
* @param preimageNonce Optional preimage nonce to include in the invoice.
178218
*/
179219
@JvmOverloads
180220
@Throws(IllegalArgumentException::class)
@@ -185,6 +225,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
185225
expirySecs: Int? = null,
186226
signingPrivateKey: ByteArray? = null,
187227
receiverIdentifier: String? = null,
228+
paymentHash: String? = null,
229+
preimageNonce: String? = null,
188230
): CompletableFuture<Invoice> =
189231
coroutineScope.future {
190232
coroutinesClient.createUmaInvoice(
@@ -194,6 +236,8 @@ class LightsparkFuturesClient(config: ClientConfig) {
194236
expirySecs,
195237
signingPrivateKey,
196238
receiverIdentifier,
239+
paymentHash,
240+
preimageNonce,
197241
)
198242
}
199243

lightspark-sdk/src/commonMain/kotlin/com/lightspark/sdk/LightsparkCoroutinesClient.kt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,30 @@ class LightsparkCoroutinesClient private constructor(
172172
)
173173
}
174174

175+
/**
176+
* Marks a payment preimage as released. To be used when the recipient has received the payment.
177+
*
178+
* @param invoiceId The invoice the preimage belongs to.
179+
* @param paymentPreimage The preimage to release.
180+
*/
181+
suspend fun releasePaymentPreimage(invoiceId: String, paymentPreimage: String): ReleasePaymentPreimageOutput {
182+
requireValidAuth()
183+
184+
return executeQuery(
185+
Query(
186+
ReleasePaymentPreimageMutation,
187+
{
188+
add("invoice_id", invoiceId)
189+
add("payment_preimage", paymentPreimage)
190+
},
191+
) {
192+
val releasePaymentPreimageJson =
193+
requireNotNull(it["release_payment_preimage"]) { "Invalid response for payment preimage release" }
194+
serializerFormat.decodeFromJsonElement<ReleasePaymentPreimageOutput>(releasePaymentPreimageJson)
195+
},
196+
)
197+
}
198+
175199
/**
176200
* Creates a lightning invoice for the given node.
177201
*
@@ -182,13 +206,17 @@ class LightsparkCoroutinesClient private constructor(
182206
* @param memo Optional memo to include in the invoice.
183207
* @param type The type of invoice to create. Defaults to [InvoiceType.STANDARD].
184208
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
209+
* @param paymentHash Optional payment hash to include in the invoice.
210+
* @param preimageNonce Optional preimage nonce to include in the invoice.
185211
*/
186212
suspend fun createInvoice(
187213
nodeId: String,
188214
amountMsats: Long,
189215
memo: String? = null,
190216
type: InvoiceType = InvoiceType.STANDARD,
191217
expirySecs: Int? = null,
218+
paymentHash: String? = null,
219+
preimageNonce: String? = null,
192220
): Invoice {
193221
requireValidAuth()
194222
return executeQuery(
@@ -200,6 +228,8 @@ class LightsparkCoroutinesClient private constructor(
200228
memo?.let { add("memo", memo) }
201229
add("type", serializerFormat.encodeToJsonElement(type))
202230
expirySecs?.let { add("expirySecs", expirySecs) }
231+
paymentHash?.let { add("paymentHash", paymentHash) }
232+
preimageNonce?.let { add("preimageNonce", preimageNonce) }
203233
},
204234
) {
205235
val invoiceJson =
@@ -220,12 +250,16 @@ class LightsparkCoroutinesClient private constructor(
220250
* @param metadata The LNURL metadata payload field from the initial payreq response. This will be hashed and
221251
* present in the h-tag (SHA256 purpose of payment) of the resulting Bolt 11 invoice.
222252
* @param expirySecs The number of seconds until the invoice expires. Defaults to 1 day.
253+
* @param paymentHash Optional payment hash to include in the invoice.
254+
* @param preimageNonce Optional preimage nonce to include in the invoice.
223255
*/
224256
suspend fun createLnurlInvoice(
225257
nodeId: String,
226258
amountMsats: Long,
227259
metadata: String,
228260
expirySecs: Int? = null,
261+
paymentHash: String? = null,
262+
preimageNonce: String? = null,
229263
): Invoice {
230264
requireValidAuth()
231265

@@ -241,6 +275,8 @@ class LightsparkCoroutinesClient private constructor(
241275
add("amountMsats", amountMsats)
242276
add("metadataHash", metadataHash)
243277
expirySecs?.let { add("expirySecs", expirySecs) }
278+
paymentHash?.let { add("paymentHash", paymentHash) }
279+
preimageNonce?.let { add("preimageNonce", preimageNonce) }
244280
},
245281
) {
246282
val invoiceJson =
@@ -264,6 +300,8 @@ class LightsparkCoroutinesClient private constructor(
264300
* @param signingPrivateKey The receiver's signing private key. Used to hash the receiver identifier.
265301
* @param receiverIdentifier Optional identifier of the receiver. If provided, this will be hashed using a
266302
* monthly-rotated seed and used for anonymized analysis.
303+
* @param paymentHash Optional payment hash to include in the invoice.
304+
* @param preimageNonce Optional preimage nonce to include in the invoice.
267305
*/
268306
@Throws(IllegalArgumentException::class)
269307
suspend fun createUmaInvoice(
@@ -273,6 +311,8 @@ class LightsparkCoroutinesClient private constructor(
273311
expirySecs: Int? = null,
274312
signingPrivateKey: ByteArray? = null,
275313
receiverIdentifier: String? = null,
314+
paymentHash: String? = null,
315+
preimageNonce: String? = null,
276316
): Invoice {
277317
requireValidAuth()
278318

@@ -296,6 +336,8 @@ class LightsparkCoroutinesClient private constructor(
296336
add("metadataHash", metadataHash)
297337
expirySecs?.let { add("expirySecs", expirySecs) }
298338
receiverHash?.let { add("receiverHash", receiverHash) }
339+
paymentHash?.let { add("paymentHash", paymentHash) }
340+
preimageNonce?.let { add("preimageNonce", preimageNonce) }
299341
},
300342
) {
301343
val invoiceJson =

0 commit comments

Comments
 (0)